瀏覽代碼

Fixed numBadBoneIndices calculation in validateSkinning.

Reimund Järnfors 5 年之前
父節點
當前提交
02c707fa0f
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/Meshes/mesh.ts

+ 3 - 3
src/Meshes/mesh.ts

@@ -2094,10 +2094,10 @@ export class Mesh extends AbstractMesh implements IGetSetVerticesData {
         let numBones: number = this.skeleton.bones.length;
         let matricesIndices = (<FloatArray>this.getVerticesData(VertexBuffer.MatricesIndicesKind));
         let matricesIndicesExtra = (<FloatArray>this.getVerticesData(VertexBuffer.MatricesIndicesExtraKind));
-        let numBadBoneIndices: number = 0;
-        for (var a = 0; a < numWeights; a++) {
+		let numBadBoneIndices: number = 0;
+        for (var a = 0; a < numWeights; a += 4) {
             for (var b = 0; b < numInfluences; b++) {
-                let index = b < 4 ? matricesIndices[b] : matricesIndicesExtra[b - 4];
+                let index = b < 4 ? matricesIndices[a + b] : matricesIndicesExtra[a + b - 4];
                 if (index >= numBones || index < 0) { numBadBoneIndices++; }
             }
         }