Skip to content

Commit

Permalink
Docs: Better explain bounding volumes. (#832)
Browse files Browse the repository at this point in the history
  • Loading branch information
Methuselah96 committed Feb 22, 2024
1 parent 42d8256 commit 9a449de
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
10 changes: 6 additions & 4 deletions types/three/src/core/BufferGeometry.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,16 @@ export class BufferGeometry<
setFromPoints(points: Vector3[] | Vector2[]): this;

/**
* Computes bounding box of the geometry, updating {@link boundingBox | .boundingBox} attribute.
* @remarks Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
* Computes the bounding box of the geometry, and updates the {@link .boundingBox} attribute. The bounding box is
* not computed by the engine; it must be computed by your app. You may need to recompute the bounding box if the
* geometry vertices are modified.
*/
computeBoundingBox(): void;

/**
* Computes bounding sphere of the geometry, updating {@link boundingSphere | .boundingSphere} attribute.
* @remarks bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
* Computes the bounding sphere of the geometry, and updates the {@link .boundingSphere} attribute. The engine
* automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling. You
* may need to recompute the bounding sphere if the geometry vertices are modified.
*/
computeBoundingSphere(): void;

Expand Down
10 changes: 6 additions & 4 deletions types/three/src/objects/InstancedMesh.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,16 @@ export class InstancedMesh<
morphTexture: DataTexture | null;

/**
* Computes bounding box of the all instances, updating {@link boundingBox | .boundingBox} attribute.
* @remarks Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
* Computes the bounding box of the instanced mesh, and updates the {@link .boundingBox} attribute. The bounding box
* is not computed by the engine; it must be computed by your app. You may need to recompute the bounding box if an
* instance is transformed via {@link .setMatrixAt()}.
*/
computeBoundingBox(): void;

/**
* Computes bounding sphere of the all instances, updating {@link boundingSphere | .boundingSphere} attribute.
* @remarks bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`.
* Computes the bounding sphere of the instanced mesh, and updates the {@link .boundingSphere} attribute. The engine
* automatically computes the bounding sphere when it is needed, e.g., for ray casting or view frustum culling. You
* may need to recompute the bounding sphere if an instance is transformed via [page:.setMatrixAt]().
*/
computeBoundingSphere(): void;

Expand Down
15 changes: 6 additions & 9 deletions types/three/src/objects/SkinnedMesh.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,16 @@ export class SkinnedMesh<
bind(skeleton: Skeleton, bindMatrix?: Matrix4): void;

/**
* Computes the bounding box, updating {@link boundingBox | .boundingBox} attribute.
* @remarks
* Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are `null`. If an
* instance of SkinnedMesh is animated, this method should be called per frame to compute a correct bounding box.
* Computes the bounding box of the skinned mesh, and updates the {@link .boundingBox} attribute. The bounding box
* is not computed by the engine; it must be computed by your app. If the skinned mesh is animated, the bounding box
* should be recomputed per frame.
*/
computeBoundingBox(): void;

/**
* Computes the bounding sphere, updating {@link boundingSphere | .boundingSphere} attribute.
* @remarks
* Bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are `null`. If
* an instance of SkinnedMesh is animated, this method should be called per frame to compute a correct bounding
* sphere.
* Computes the bounding sphere of the skinned mesh, and updates the {@link .boundingSphere} attribute. The bounding
* sphere is automatically computed by the engine when it is needed, e.g., for ray casting and view frustum culling.
* If the skinned mesh is animated, the bounding sphere should be recomputed per frame.
*/
computeBoundingSphere(): void;

Expand Down

0 comments on commit 9a449de

Please sign in to comment.