Bladeren bron

allow direct setting of geo bounding sphere

- support mesh, lines, text, spheres, points
Alexander Rose 5 jaren geleden
bovenliggende
commit
cd6d41a035

+ 7 - 3
src/mol-geo/geometry/lines/lines.ts

@@ -6,9 +6,7 @@
 
 import { ValueCell } from '../../../mol-util'
 import { Mat4 } from '../../../mol-math/linear-algebra'
-import { transformPositionArray,/* , transformDirectionArray, getNormalMatrix */
-GroupMapping,
-createGroupMapping} from '../../util';
+import { transformPositionArray, GroupMapping, createGroupMapping} from '../../util';
 import { GeometryUtils } from '../geometry';
 import { createColors } from '../color-data';
 import { createMarkers } from '../marker-data';
@@ -50,6 +48,8 @@ export interface Lines {
     readonly boundingSphere: Sphere3D
     /** Maps group ids to line indices */
     readonly groupMapping: GroupMapping
+
+    setBoundingSphere(boundingSphere: Sphere3D): void
 }
 
 export namespace Lines {
@@ -129,6 +129,10 @@ export namespace Lines {
                     currentGroup = lines.groupBuffer.ref.version
                 }
                 return groupMapping
+            },
+            setBoundingSphere(sphere: Sphere3D) {
+                Sphere3D.copy(boundingSphere, sphere)
+                currentHash = hashCode(lines)
             }
         }
         return lines

+ 6 - 0
src/mol-geo/geometry/mesh/mesh.ts

@@ -45,6 +45,8 @@ export interface Mesh {
     readonly boundingSphere: Sphere3D
     /** Maps group ids to vertex indices */
     readonly groupMapping: GroupMapping
+
+    setBoundingSphere(boundingSphere: Sphere3D): void
 }
 
 export namespace Mesh {
@@ -101,6 +103,10 @@ export namespace Mesh {
                     currentGroup = mesh.groupBuffer.ref.version
                 }
                 return groupMapping
+            },
+            setBoundingSphere(sphere: Sphere3D) {
+                Sphere3D.copy(boundingSphere, sphere)
+                currentHash = hashCode(mesh)
             }
         }
         return mesh

+ 7 - 3
src/mol-geo/geometry/points/points.ts

@@ -6,9 +6,7 @@
 
 import { ValueCell } from '../../../mol-util'
 import { Mat4 } from '../../../mol-math/linear-algebra'
-import { transformPositionArray,/* , transformDirectionArray, getNormalMatrix */
-GroupMapping,
-createGroupMapping} from '../../util';
+import { transformPositionArray, GroupMapping, createGroupMapping} from '../../util';
 import { GeometryUtils } from '../geometry';
 import { createColors } from '../color-data';
 import { createMarkers } from '../marker-data';
@@ -43,6 +41,8 @@ export interface Points {
     readonly boundingSphere: Sphere3D
     /** Maps group ids to point indices */
     readonly groupMapping: GroupMapping
+
+    setBoundingSphere(boundingSphere: Sphere3D): void
 }
 
 export namespace Points {
@@ -92,6 +92,10 @@ export namespace Points {
                     currentGroup = points.groupBuffer.ref.version
                 }
                 return groupMapping
+            },
+            setBoundingSphere(sphere: Sphere3D) {
+                Sphere3D.copy(boundingSphere, sphere)
+                currentHash = hashCode(points)
             }
         }
         return points

+ 6 - 0
src/mol-geo/geometry/spheres/spheres.ts

@@ -42,6 +42,8 @@ export interface Spheres {
     readonly boundingSphere: Sphere3D
     /** Maps group ids to sphere indices */
     readonly groupMapping: GroupMapping
+
+    setBoundingSphere(boundingSphere: Sphere3D): void
 }
 
 export namespace Spheres {
@@ -97,6 +99,10 @@ export namespace Spheres {
                     currentGroup = spheres.groupBuffer.ref.version
                 }
                 return groupMapping
+            },
+            setBoundingSphere(sphere: Sphere3D) {
+                Sphere3D.copy(boundingSphere, sphere)
+                currentHash = hashCode(spheres)
             }
         }
         return spheres

+ 6 - 0
src/mol-geo/geometry/text/text.ts

@@ -62,6 +62,8 @@ export interface Text {
     readonly boundingSphere: Sphere3D
     /** Maps group ids to text indices */
     readonly groupMapping: GroupMapping
+
+    setBoundingSphere(boundingSphere: Sphere3D): void
 }
 
 export namespace Text {
@@ -124,6 +126,10 @@ export namespace Text {
                     currentGroup = text.groupBuffer.ref.version
                 }
                 return groupMapping
+            },
+            setBoundingSphere(sphere: Sphere3D) {
+                Sphere3D.copy(boundingSphere, sphere)
+                currentHash = hashCode(text)
             }
         }
         return text