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 getInstanceCount/setInstanceCount methods for instanced #906

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions types/three/src/objects/BatchedMesh.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,19 @@ declare class BatchedMesh extends Mesh<BufferGeometry, Material> {
*/
setGeometryAt(index: number, geometry: BufferGeometry): number;

/**
* Gets the instance count of the geometry at `index`. Returns `null` if instance counts are not configured.
* @param index The index of an instance. Values have to be in the range [0, count].
*/
getInstanceCountAt(index: number): number | null;

/**
* Sets an instance count of the geometry at `index`.
* @param index Which geometry index to configure an instance count for.
* @param instanceCount The number of instances to render of the given geometry index.
*/
setInstanceCountAt(index: number, instanceCount: number): number;

deleteGeometry(index: number): this;

getBoundingBoxAt(index: number, target: Box3): Box3 | null;
Expand Down
6 changes: 6 additions & 0 deletions types/three/src/renderers/webgl/WebGLBufferRenderer.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ export class WebGLBufferRenderer {
render: (start: any, count: number) => void;
renderInstances: (start: any, count: number, primcount: number) => void;
renderMultiDraw: (starts: Int32Array, counts: Int32Array, drawCount: number) => void;
renderMultiDrawInstances: (
starts: Int32Array,
counts: Int32Array,
drawCount: number,
primcount: Int32Array,
) => void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ export class WebGLIndexedBufferRenderer {
render: (start: any, count: number) => void;
renderInstances: (start: any, count: number, primcount: number) => void;
renderMultiDraw: (starts: Int32Array, counts: Int32Array, drawCount: number) => void;
renderMultiDrawInstances: (
starts: Int32Array,
counts: Int32Array,
drawCount: number,
primcount: Int32Array,
) => void;
}
Loading