Browse Source

Update types of nullable bounding boxes and spheres

Bounding boxes and spheres can be computed on geometry.
These bounding boxes are not computed by default and are instead set to null.
They only become non-null when they are explicitly being computed.

This change reflects that by changing the types of bounding boxes and spheres to be nullable. Otherwise typescript assumes that these values cannot be null.
Florian Stellbrink 5 years ago
parent
commit
09fc932b26
3 changed files with 6 additions and 6 deletions
  1. 2 2
      src/core/BufferGeometry.d.ts
  2. 2 2
      src/core/DirectGeometry.d.ts
  3. 2 2
      src/core/Geometry.d.ts

+ 2 - 2
src/core/BufferGeometry.d.ts

@@ -42,8 +42,8 @@ export class BufferGeometry extends EventDispatcher {
 	};
 	};
 	morphTargetsRelative: boolean;
 	morphTargetsRelative: boolean;
 	groups: { start: number; count: number; materialIndex?: number }[];
 	groups: { start: number; count: number; materialIndex?: number }[];
-	boundingBox: Box3;
-	boundingSphere: Sphere;
+	boundingBox: Box3 | null;
+	boundingSphere: Sphere | null;
 	drawRange: { start: number; count: number };
 	drawRange: { start: number; count: number };
 	userData: {[key: string]: any};
 	userData: {[key: string]: any};
 	readonly isBufferGeometry: true;
 	readonly isBufferGeometry: true;

+ 2 - 2
src/core/DirectGeometry.d.ts

@@ -27,8 +27,8 @@ export class DirectGeometry {
 	morphTargets: MorphTarget[];
 	morphTargets: MorphTarget[];
 	skinWeights: Vector4[];
 	skinWeights: Vector4[];
 	skinIndices: Vector4[];
 	skinIndices: Vector4[];
-	boundingBox: Box3;
-	boundingSphere: Sphere;
+	boundingBox: Box3 | null;
+	boundingSphere: Sphere | null;
 	verticesNeedUpdate: boolean;
 	verticesNeedUpdate: boolean;
 	normalsNeedUpdate: boolean;
 	normalsNeedUpdate: boolean;
 	colorsNeedUpdate: boolean;
 	colorsNeedUpdate: boolean;

+ 2 - 2
src/core/Geometry.d.ts

@@ -121,12 +121,12 @@ export class Geometry extends EventDispatcher {
 	/**
 	/**
 	 * Bounding box.
 	 * Bounding box.
 	 */
 	 */
-	boundingBox: Box3;
+	boundingBox: Box3 | null;
 
 
 	/**
 	/**
 	 * Bounding sphere.
 	 * Bounding sphere.
 	 */
 	 */
-	boundingSphere: Sphere;
+	boundingSphere: Sphere | null;
 
 
 	/**
 	/**
 	 * Set to true if the vertices array has been updated.
 	 * Set to true if the vertices array has been updated.