|
|
@ -11,6 +11,7 @@ attribute vec4 inBoneIndex; |
|
|
|
uniform mat4 m_BoneMatrices[NUM_BONES]; |
|
|
|
uniform mat4 m_BoneMatrices[NUM_BONES]; |
|
|
|
|
|
|
|
|
|
|
|
void Skinning_Compute(inout vec4 position){ |
|
|
|
void Skinning_Compute(inout vec4 position){ |
|
|
|
|
|
|
|
if (inBoneWeight.x != 0.0) { |
|
|
|
#if NUM_WEIGHTS_PER_VERT == 1 |
|
|
|
#if NUM_WEIGHTS_PER_VERT == 1 |
|
|
|
position = m_BoneMatrices[int(inBoneIndex.x)] * position; |
|
|
|
position = m_BoneMatrices[int(inBoneIndex.x)] * position; |
|
|
|
#else |
|
|
|
#else |
|
|
@ -21,9 +22,11 @@ void Skinning_Compute(inout vec4 position){ |
|
|
|
mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w; |
|
|
|
mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w; |
|
|
|
position = mat * position; |
|
|
|
position = mat * position; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Skinning_Compute(inout vec4 position, inout vec3 normal){ |
|
|
|
void Skinning_Compute(inout vec4 position, inout vec3 normal){ |
|
|
|
|
|
|
|
if (inBoneWeight.x != 0.0) { |
|
|
|
#if NUM_WEIGHTS_PER_VERT == 1 |
|
|
|
#if NUM_WEIGHTS_PER_VERT == 1 |
|
|
|
position = m_BoneMatrices[int(inBoneIndex.x)] * position; |
|
|
|
position = m_BoneMatrices[int(inBoneIndex.x)] * position; |
|
|
|
normal = (mat3(m_BoneMatrices[int(inBoneIndex.x)][0].xyz, |
|
|
|
normal = (mat3(m_BoneMatrices[int(inBoneIndex.x)][0].xyz, |
|
|
@ -40,9 +43,11 @@ void Skinning_Compute(inout vec4 position, inout vec3 normal){ |
|
|
|
mat3 rotMat = mat3(mat[0].xyz, mat[1].xyz, mat[2].xyz); |
|
|
|
mat3 rotMat = mat3(mat[0].xyz, mat[1].xyz, mat[2].xyz); |
|
|
|
normal = rotMat * normal; |
|
|
|
normal = rotMat * normal; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Skinning_Compute(inout vec4 position, inout vec3 tangent, inout vec3 normal){ |
|
|
|
void Skinning_Compute(inout vec4 position, inout vec3 tangent, inout vec3 normal){ |
|
|
|
|
|
|
|
if (inBoneWeight.x != 0.0) { |
|
|
|
#if NUM_WEIGHTS_PER_VERT == 1 |
|
|
|
#if NUM_WEIGHTS_PER_VERT == 1 |
|
|
|
position = m_BoneMatrices[int(inBoneIndex.x)] * position; |
|
|
|
position = m_BoneMatrices[int(inBoneIndex.x)] * position; |
|
|
|
tangent = m_BoneMatrices[int(inBoneIndex.x)] * tangent; |
|
|
|
tangent = m_BoneMatrices[int(inBoneIndex.x)] * tangent; |
|
|
@ -61,6 +66,7 @@ void Skinning_Compute(inout vec4 position, inout vec3 tangent, inout vec3 normal |
|
|
|
tangent = rotMat * tangent; |
|
|
|
tangent = rotMat * tangent; |
|
|
|
normal = rotMat * normal; |
|
|
|
normal = rotMat * normal; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
#endif |