Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BatchedMesh: add support for resizing instance count, geometry size #1321

Merged
merged 1 commit into from
Nov 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions types/three/src/objects/BatchedMesh.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,22 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
*/
optimize(): this;

/**
* Resizes the available space in BatchedMesh's vertex and index buffer attributes to the provided sizes. If the
* provided arguments shrink the geometry buffers but there is not enough unused space at the end of the geometry
* attributes then an error is thrown.
* @param maxVertexCount the max number of vertices to be used by all unique geometries to resize to.
* @param maxIndexCount the max number of indices to be used by all unique geometries to resize to.
*/
setGeometrySize(maxVertexCount: number, maxIndexCount: number): void;

/**
* Resizes the necessary buffers to support the provided number of instances. If the provided arguments shrink the
* number of instances but there are not enough unused ids at the end of the list then an error is thrown.
* @param maxInstanceCount the max number of individual instances that can be added and rendered by the BatchedMesh.
*/
setInstanceCount(maxInstanceCount: number): void;

getBoundingBoxAt(geometryId: number, target: Box3): Box3 | null;
getBoundingSphereAt(geometryId: number, target: Sphere): Sphere | null;
}
Expand Down
Loading