瀏覽代碼

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 年之前
父節點
當前提交
09fc932b26
共有 3 個文件被更改,包括 6 次插入6 次删除
  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;
 	groups: { start: number; count: number; materialIndex?: number }[];
-	boundingBox: Box3;
-	boundingSphere: Sphere;
+	boundingBox: Box3 | null;
+	boundingSphere: Sphere | null;
 	drawRange: { start: number; count: number };
 	userData: {[key: string]: any};
 	readonly isBufferGeometry: true;

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

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

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

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