uniform mat4 m_BoneMatrices[NUM_BONES];\r
\r
void Skinning_Compute(inout vec4 position){\r
+ if (inBoneWeight.x != 0.0) {\r
#if NUM_WEIGHTS_PER_VERT == 1\r
- position = m_BoneMatrices[int(inBoneIndex.x)] * position;\r
+ position = m_BoneMatrices[int(inBoneIndex.x)] * position;\r
#else\r
- mat4 mat = mat4(0.0);\r
- mat += m_BoneMatrices[int(inBoneIndex.x)] * inBoneWeight.x;\r
- mat += m_BoneMatrices[int(inBoneIndex.y)] * inBoneWeight.y;\r
- mat += m_BoneMatrices[int(inBoneIndex.z)] * inBoneWeight.z;\r
- mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w;\r
- position = mat * position;\r
+ mat4 mat = mat4(0.0);\r
+ mat += m_BoneMatrices[int(inBoneIndex.x)] * inBoneWeight.x;\r
+ mat += m_BoneMatrices[int(inBoneIndex.y)] * inBoneWeight.y;\r
+ mat += m_BoneMatrices[int(inBoneIndex.z)] * inBoneWeight.z;\r
+ mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w;\r
+ position = mat * position;\r
#endif\r
+ }\r
}\r
\r
void Skinning_Compute(inout vec4 position, inout vec3 normal){\r
+ if (inBoneWeight.x != 0.0) {\r
#if NUM_WEIGHTS_PER_VERT == 1\r
- position = m_BoneMatrices[int(inBoneIndex.x)] * position;\r
- normal = (mat3(m_BoneMatrices[int(inBoneIndex.x)][0].xyz,\r
- m_BoneMatrices[int(inBoneIndex.x)][1].xyz,\r
- m_BoneMatrices[int(inBoneIndex.x)][2].xyz) * normal);\r
+ position = m_BoneMatrices[int(inBoneIndex.x)] * position;\r
+ normal = (mat3(m_BoneMatrices[int(inBoneIndex.x)][0].xyz,\r
+ m_BoneMatrices[int(inBoneIndex.x)][1].xyz,\r
+ m_BoneMatrices[int(inBoneIndex.x)][2].xyz) * normal);\r
#else\r
- mat4 mat = mat4(0.0);\r
- mat += m_BoneMatrices[int(inBoneIndex.x)] * inBoneWeight.x;\r
- mat += m_BoneMatrices[int(inBoneIndex.y)] * inBoneWeight.y;\r
- mat += m_BoneMatrices[int(inBoneIndex.z)] * inBoneWeight.z;\r
- mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w;\r
- position = mat * position;\r
+ mat4 mat = mat4(0.0);\r
+ mat += m_BoneMatrices[int(inBoneIndex.x)] * inBoneWeight.x;\r
+ mat += m_BoneMatrices[int(inBoneIndex.y)] * inBoneWeight.y;\r
+ mat += m_BoneMatrices[int(inBoneIndex.z)] * inBoneWeight.z;\r
+ mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w;\r
+ position = mat * position;\r
\r
- mat3 rotMat = mat3(mat[0].xyz, mat[1].xyz, mat[2].xyz);\r
- normal = rotMat * normal;\r
+ mat3 rotMat = mat3(mat[0].xyz, mat[1].xyz, mat[2].xyz);\r
+ normal = rotMat * normal;\r
#endif\r
+ }\r
}\r
\r
void Skinning_Compute(inout vec4 position, inout vec3 tangent, inout vec3 normal){\r
+ if (inBoneWeight.x != 0.0) {\r
#if NUM_WEIGHTS_PER_VERT == 1\r
- position = m_BoneMatrices[int(inBoneIndex.x)] * position;\r
- tangent = m_BoneMatrices[int(inBoneIndex.x)] * tangent;\r
- normal = (mat3(m_BoneMatrices[int(inBoneIndex.x)][0].xyz,\r
- m_BoneMatrices[int(inBoneIndex.x)][1].xyz,\r
- m_BoneMatrices[int(inBoneIndex.x)][2].xyz) * normal);\r
+ position = m_BoneMatrices[int(inBoneIndex.x)] * position;\r
+ tangent = m_BoneMatrices[int(inBoneIndex.x)] * tangent;\r
+ normal = (mat3(m_BoneMatrices[int(inBoneIndex.x)][0].xyz,\r
+ m_BoneMatrices[int(inBoneIndex.x)][1].xyz,\r
+ m_BoneMatrices[int(inBoneIndex.x)][2].xyz) * normal);\r
#else\r
- mat4 mat = mat4(0.0);\r
- mat += m_BoneMatrices[int(inBoneIndex.x)] * inBoneWeight.x;\r
- mat += m_BoneMatrices[int(inBoneIndex.y)] * inBoneWeight.y;\r
- mat += m_BoneMatrices[int(inBoneIndex.z)] * inBoneWeight.z;\r
- mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w;\r
- position = mat * position;\r
+ mat4 mat = mat4(0.0);\r
+ mat += m_BoneMatrices[int(inBoneIndex.x)] * inBoneWeight.x;\r
+ mat += m_BoneMatrices[int(inBoneIndex.y)] * inBoneWeight.y;\r
+ mat += m_BoneMatrices[int(inBoneIndex.z)] * inBoneWeight.z;\r
+ mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w;\r
+ position = mat * position;\r
\r
- mat3 rotMat = mat3(mat[0].xyz, mat[1].xyz, mat[2].xyz);\r
- tangent = rotMat * tangent;\r
- normal = rotMat * normal;\r
+ mat3 rotMat = mat3(mat[0].xyz, mat[1].xyz, mat[2].xyz);\r
+ tangent = rotMat * tangent;\r
+ normal = rotMat * normal;\r
#endif\r
+ }\r
}\r
\r
#endif
\ No newline at end of file