diff --git a/cocos/renderer/ccShader_3D_PositionNormalTex.vert b/cocos/renderer/ccShader_3D_PositionNormalTex.vert index 3bc58b91a1..f412d9c8e9 100644 --- a/cocos/renderer/ccShader_3D_PositionNormalTex.vert +++ b/cocos/renderer/ccShader_3D_PositionNormalTex.vert @@ -100,28 +100,25 @@ void getPositionAndNormal(out vec4 position, out vec3 normal) matrixPalette1 += u_matrixPalette[matrixIndex] * blendWeight; matrixPalette2 += u_matrixPalette[matrixIndex + 1] * blendWeight; matrixPalette3 += u_matrixPalette[matrixIndex + 2] * blendWeight; + + blendWeight = a_blendWeight[2]; + if (blendWeight > 0.0) + { + matrixIndex = int(a_blendIndex[2]) * 3; + matrixPalette1 += u_matrixPalette[matrixIndex] * blendWeight; + matrixPalette2 += u_matrixPalette[matrixIndex + 1] * blendWeight; + matrixPalette3 += u_matrixPalette[matrixIndex + 2] * blendWeight; + + blendWeight = a_blendWeight[3]; + if (blendWeight > 0.0) + { + matrixIndex = int(a_blendIndex[3]) * 3; + matrixPalette1 += u_matrixPalette[matrixIndex] * blendWeight; + matrixPalette2 += u_matrixPalette[matrixIndex + 1] * blendWeight; + matrixPalette3 += u_matrixPalette[matrixIndex + 2] * blendWeight; + } + } } - - - blendWeight = a_blendWeight[2]; - if (blendWeight > 0.0) - { - matrixIndex = int(a_blendIndex[2]) * 3; - matrixPalette1 += u_matrixPalette[matrixIndex] * blendWeight; - matrixPalette2 += u_matrixPalette[matrixIndex + 1] * blendWeight; - matrixPalette3 += u_matrixPalette[matrixIndex + 2] * blendWeight; - } - - - blendWeight = a_blendWeight[3]; - if (blendWeight > 0.0) - { - matrixIndex = int(a_blendIndex[3]) * 3; - matrixPalette1 += u_matrixPalette[matrixIndex] * blendWeight; - matrixPalette2 += u_matrixPalette[matrixIndex + 1] * blendWeight; - matrixPalette3 += u_matrixPalette[matrixIndex + 2] * blendWeight; - } - vec4 p = vec4(a_position, 1.0); position.x = dot(p, matrixPalette1); diff --git a/cocos/renderer/ccShader_3D_PositionTex.vert b/cocos/renderer/ccShader_3D_PositionTex.vert index 92a359922b..387810bb54 100644 --- a/cocos/renderer/ccShader_3D_PositionTex.vert +++ b/cocos/renderer/ccShader_3D_PositionTex.vert @@ -46,28 +46,25 @@ vec4 getPosition() matrixPalette1 += u_matrixPalette[matrixIndex] * blendWeight; matrixPalette2 += u_matrixPalette[matrixIndex + 1] * blendWeight; matrixPalette3 += u_matrixPalette[matrixIndex + 2] * blendWeight; + + blendWeight = a_blendWeight[2]; + if (blendWeight > 0.0) + { + matrixIndex = int(a_blendIndex[2]) * 3; + matrixPalette1 += u_matrixPalette[matrixIndex] * blendWeight; + matrixPalette2 += u_matrixPalette[matrixIndex + 1] * blendWeight; + matrixPalette3 += u_matrixPalette[matrixIndex + 2] * blendWeight; + + blendWeight = a_blendWeight[3]; + if (blendWeight > 0.0) + { + matrixIndex = int(a_blendIndex[3]) * 3; + matrixPalette1 += u_matrixPalette[matrixIndex] * blendWeight; + matrixPalette2 += u_matrixPalette[matrixIndex + 1] * blendWeight; + matrixPalette3 += u_matrixPalette[matrixIndex + 2] * blendWeight; + } + } } - - - blendWeight = a_blendWeight[2]; - if (blendWeight > 0.0) - { - matrixIndex = int(a_blendIndex[2]) * 3; - matrixPalette1 += u_matrixPalette[matrixIndex] * blendWeight; - matrixPalette2 += u_matrixPalette[matrixIndex + 1] * blendWeight; - matrixPalette3 += u_matrixPalette[matrixIndex + 2] * blendWeight; - } - - - blendWeight = a_blendWeight[3]; - if (blendWeight > 0.0) - { - matrixIndex = int(a_blendIndex[3]) * 3; - matrixPalette1 += u_matrixPalette[matrixIndex] * blendWeight; - matrixPalette2 += u_matrixPalette[matrixIndex + 1] * blendWeight; - matrixPalette3 += u_matrixPalette[matrixIndex + 2] * blendWeight; - } - vec4 _skinnedPosition; vec4 postion = vec4(a_position, 1.0);