Removed padUint16ArrayForWebGPU since the bug has been fixed from Scirra.

This commit is contained in:
Davide Tantillo 2025-10-14 12:59:34 +02:00
parent eac735e5a9
commit 4b80ec9a81
2 changed files with 2 additions and 34 deletions

View File

@ -264,8 +264,7 @@ class DrawingInstance extends globalThis.ISDKWorldInstanceBase {
renderer.drawMesh( renderer.drawMesh(
vertices.subarray(0, numVertices * 3), vertices.subarray(0, numVertices * 3),
uvs.subarray(0, numVertices * 2), uvs.subarray(0, numVertices * 2),
// workaround for this bug: https://github.com/Scirra/Construct-bugs/issues/8746 indices.subarray(0, numIndices),
this.padUint16ArrayForWebGPU(indices.subarray(0, numIndices)),
c3colors.subarray(0, numVertices * 4), c3colors.subarray(0, numVertices * 4),
); );
@ -274,21 +273,6 @@ class DrawingInstance extends globalThis.ISDKWorldInstanceBase {
} }
padUint16ArrayForWebGPU (originalArray: Uint16Array) {
const currentLength = originalArray.length;
const alignedLength = Math.ceil(currentLength / 6) * 6;
if (alignedLength === currentLength) {
return originalArray;
}
const paddedArray = new Uint16Array(alignedLength);
paddedArray.set(originalArray);
return paddedArray;
}
_saveToJson () { _saveToJson () {
return { return {
// data to be saved for savegames // data to be saved for savegames

View File

@ -149,8 +149,7 @@ class MyDrawingInstance extends SDK.IWorldInstanceBase {
iRenderer.DrawMesh( iRenderer.DrawMesh(
vertices.subarray(0, numVertices * 3), vertices.subarray(0, numVertices * 3),
uvs.subarray(0, numVertices * 2), uvs.subarray(0, numVertices * 2),
// workaround for this bug: https://github.com/Scirra/Construct-bugs/issues/8746 indices.subarray(0, numIndices),
this.padUint16ArrayForWebGPU(indices.subarray(0, numIndices)),
c3colors, c3colors,
); );
@ -199,21 +198,6 @@ class MyDrawingInstance extends SDK.IWorldInstanceBase {
} }
} }
padUint16ArrayForWebGPU (originalArray: Uint16Array) {
const currentLength = originalArray.length;
const alignedLength = Math.ceil(currentLength / 6) * 6;
if (alignedLength === currentLength) {
return originalArray;
}
const paddedArray = new Uint16Array(alignedLength);
paddedArray.set(originalArray);
return paddedArray;
}
async OnPropertyChanged (id: string, value: EditorPropertyValueType) { async OnPropertyChanged (id: string, value: EditorPropertyValueType) {
console.log(`Prop change - Name: ${id} - Value: ${value}`); console.log(`Prop change - Name: ${id} - Value: ${value}`);