Ensure array size passed to draw mesh.

This commit is contained in:
Davide Tantillo 2025-11-19 17:57:35 +01:00
parent 3ef4c024f2
commit 4225edeede

View File

@ -167,8 +167,14 @@ class SpineC3Instance extends globalThis.ISDKWorldInstanceBase {
while (command) {
const { numVertices, positions, uvs, colors, indices, numIndices, blendMode } = command;
const vertices = this.tempVertices;
const c3colors = this.tempColors;
const vertices = this.tempVertices.length < numVertices * 3
? (this.tempVertices = new Float32Array(numVertices * 3))
: this.tempVertices;
const c3colors = this.tempColors.length < numVertices * 4
? (this.tempColors = new Float32Array(numVertices * 4))
: this.tempColors;
for (let i = 0; i < numVertices; i++) {
const srcIndex = i * 2;
const { x, y } = this.skeletonToC3WorldCoordinates(positions[srcIndex], positions[srcIndex + 1]);