From d36e40e269901b638560160efd22ee412252260d Mon Sep 17 00:00:00 2001 From: Popov72 Date: Fri, 30 Oct 2020 02:48:33 +0100 Subject: [PATCH] Fix crash when using skinning in cpu mode and displaying BoneWeights or SkeletonMap --- src/Debug/skeletonViewer.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Debug/skeletonViewer.ts b/src/Debug/skeletonViewer.ts index 29c54f288b6..9f6c343bd8d 100644 --- a/src/Debug/skeletonViewer.ts +++ b/src/Debug/skeletonViewer.ts @@ -60,6 +60,11 @@ export class SkeletonViewer { uniform mat4 worldViewProjection; #include + #if NUM_BONE_INFLUENCERS == 0 + attribute vec4 matricesIndices; + attribute vec4 matricesWeights; + #endif + #include varying vec3 vColor; @@ -121,7 +126,7 @@ export class SkeletonViewer { fragment: 'boneWeights:' + skeleton.name }, { - attributes: ['position', 'normal'], + attributes: ['position', 'normal', 'matricesIndices', 'matricesWeights'], uniforms: [ 'world', 'worldView', 'worldViewProjection', 'view', 'projection', 'viewProjection', 'colorBase', 'colorZero', 'colorQuarter', 'colorHalf', 'colorFull', 'targetBoneIndex' @@ -195,6 +200,10 @@ export class SkeletonViewer { uniform float colorMap[` + ((skeleton.bones.length) * 4) + `]; #include + #if NUM_BONE_INFLUENCERS == 0 + attribute vec4 matricesIndices; + attribute vec4 matricesWeights; + #endif #include varying vec3 vColor; @@ -242,7 +251,7 @@ export class SkeletonViewer { ` }, { - attributes: ['position', 'normal'], + attributes: ['position', 'normal', 'matricesIndices', 'matricesWeights'], uniforms: [ 'world', 'worldView', 'worldViewProjection', 'view', 'projection', 'viewProjection', 'colorMap'