mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-02 21:59:09 +08:00
[threejs] Fix batch capacity calculation, closes #2163
This commit is contained in:
parent
8a2e25ba05
commit
a5ea7a808d
@ -98,9 +98,9 @@ export class MeshBatcher extends THREE.Mesh {
|
|||||||
this.indicesLength = 0;
|
this.indicesLength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
canBatch (verticesLength: number, indicesLength: number) {
|
canBatch (numVertices: number, numIndices: number) {
|
||||||
if (this.indicesLength + indicesLength >= this.indices.byteLength / 2) return false;
|
if (this.indicesLength + numIndices >= this.indices.byteLength / 2) return false;
|
||||||
if (this.verticesLength + verticesLength >= this.vertices.byteLength / 2) return false;
|
if (this.verticesLength / MeshBatcher.VERTEX_SIZE + numVertices >= (this.vertices.byteLength / 4) / MeshBatcher.VERTEX_SIZE) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -249,7 +249,7 @@ export class SkeletonMesh extends THREE.Object3D {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start new batch if this one can't hold vertices/indices
|
// Start new batch if this one can't hold vertices/indices
|
||||||
if (!batch.canBatch(finalVerticesLength, finalIndicesLength)) {
|
if (!batch.canBatch(finalVerticesLength / SkeletonMesh.VERTEX_SIZE, finalIndicesLength)) {
|
||||||
batch.end();
|
batch.end();
|
||||||
batch = this.nextBatch();
|
batch = this.nextBatch();
|
||||||
batch.begin();
|
batch.begin();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user