• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Main repository of MikuMikuStudio


Commit MetaInfo

Revisãoa3912f1cf39ec16fccf16d607407ad30f7e420ea (tree)
Hora2013-05-28 06:29:35
AutorshadowisLORD <shadowisLORD@75d0...>
CommitershadowisLORD

Mensagem de Log

  • Fixed bug where verts uninfluenced by bones would not work correctly in hardware skinning

git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@10633 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

Mudança Sumário

Diff

--- a/engine/src/core-data/Common/ShaderLib/Skinning.glsllib
+++ b/engine/src/core-data/Common/ShaderLib/Skinning.glsllib
@@ -11,56 +11,62 @@ attribute vec4 inBoneIndex;
1111 uniform mat4 m_BoneMatrices[NUM_BONES];
1212
1313 void Skinning_Compute(inout vec4 position){
14+ if (inBoneWeight.x != 0.0) {
1415 #if NUM_WEIGHTS_PER_VERT == 1
15- position = m_BoneMatrices[int(inBoneIndex.x)] * position;
16+ position = m_BoneMatrices[int(inBoneIndex.x)] * position;
1617 #else
17- mat4 mat = mat4(0.0);
18- mat += m_BoneMatrices[int(inBoneIndex.x)] * inBoneWeight.x;
19- mat += m_BoneMatrices[int(inBoneIndex.y)] * inBoneWeight.y;
20- mat += m_BoneMatrices[int(inBoneIndex.z)] * inBoneWeight.z;
21- mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w;
22- position = mat * position;
18+ mat4 mat = mat4(0.0);
19+ mat += m_BoneMatrices[int(inBoneIndex.x)] * inBoneWeight.x;
20+ mat += m_BoneMatrices[int(inBoneIndex.y)] * inBoneWeight.y;
21+ mat += m_BoneMatrices[int(inBoneIndex.z)] * inBoneWeight.z;
22+ mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w;
23+ position = mat * position;
2324 #endif
25+ }
2426 }
2527
2628 void Skinning_Compute(inout vec4 position, inout vec3 normal){
29+ if (inBoneWeight.x != 0.0) {
2730 #if NUM_WEIGHTS_PER_VERT == 1
28- position = m_BoneMatrices[int(inBoneIndex.x)] * position;
29- normal = (mat3(m_BoneMatrices[int(inBoneIndex.x)][0].xyz,
30- m_BoneMatrices[int(inBoneIndex.x)][1].xyz,
31- m_BoneMatrices[int(inBoneIndex.x)][2].xyz) * normal);
31+ position = m_BoneMatrices[int(inBoneIndex.x)] * position;
32+ normal = (mat3(m_BoneMatrices[int(inBoneIndex.x)][0].xyz,
33+ m_BoneMatrices[int(inBoneIndex.x)][1].xyz,
34+ m_BoneMatrices[int(inBoneIndex.x)][2].xyz) * normal);
3235 #else
33- mat4 mat = mat4(0.0);
34- mat += m_BoneMatrices[int(inBoneIndex.x)] * inBoneWeight.x;
35- mat += m_BoneMatrices[int(inBoneIndex.y)] * inBoneWeight.y;
36- mat += m_BoneMatrices[int(inBoneIndex.z)] * inBoneWeight.z;
37- mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w;
38- position = mat * position;
36+ mat4 mat = mat4(0.0);
37+ mat += m_BoneMatrices[int(inBoneIndex.x)] * inBoneWeight.x;
38+ mat += m_BoneMatrices[int(inBoneIndex.y)] * inBoneWeight.y;
39+ mat += m_BoneMatrices[int(inBoneIndex.z)] * inBoneWeight.z;
40+ mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w;
41+ position = mat * position;
3942
40- mat3 rotMat = mat3(mat[0].xyz, mat[1].xyz, mat[2].xyz);
41- normal = rotMat * normal;
43+ mat3 rotMat = mat3(mat[0].xyz, mat[1].xyz, mat[2].xyz);
44+ normal = rotMat * normal;
4245 #endif
46+ }
4347 }
4448
4549 void Skinning_Compute(inout vec4 position, inout vec3 tangent, inout vec3 normal){
50+ if (inBoneWeight.x != 0.0) {
4651 #if NUM_WEIGHTS_PER_VERT == 1
47- position = m_BoneMatrices[int(inBoneIndex.x)] * position;
48- tangent = m_BoneMatrices[int(inBoneIndex.x)] * tangent;
49- normal = (mat3(m_BoneMatrices[int(inBoneIndex.x)][0].xyz,
50- m_BoneMatrices[int(inBoneIndex.x)][1].xyz,
51- m_BoneMatrices[int(inBoneIndex.x)][2].xyz) * normal);
52+ position = m_BoneMatrices[int(inBoneIndex.x)] * position;
53+ tangent = m_BoneMatrices[int(inBoneIndex.x)] * tangent;
54+ normal = (mat3(m_BoneMatrices[int(inBoneIndex.x)][0].xyz,
55+ m_BoneMatrices[int(inBoneIndex.x)][1].xyz,
56+ m_BoneMatrices[int(inBoneIndex.x)][2].xyz) * normal);
5257 #else
53- mat4 mat = mat4(0.0);
54- mat += m_BoneMatrices[int(inBoneIndex.x)] * inBoneWeight.x;
55- mat += m_BoneMatrices[int(inBoneIndex.y)] * inBoneWeight.y;
56- mat += m_BoneMatrices[int(inBoneIndex.z)] * inBoneWeight.z;
57- mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w;
58- position = mat * position;
58+ mat4 mat = mat4(0.0);
59+ mat += m_BoneMatrices[int(inBoneIndex.x)] * inBoneWeight.x;
60+ mat += m_BoneMatrices[int(inBoneIndex.y)] * inBoneWeight.y;
61+ mat += m_BoneMatrices[int(inBoneIndex.z)] * inBoneWeight.z;
62+ mat += m_BoneMatrices[int(inBoneIndex.w)] * inBoneWeight.w;
63+ position = mat * position;
5964
60- mat3 rotMat = mat3(mat[0].xyz, mat[1].xyz, mat[2].xyz);
61- tangent = rotMat * tangent;
62- normal = rotMat * normal;
65+ mat3 rotMat = mat3(mat[0].xyz, mat[1].xyz, mat[2].xyz);
66+ tangent = rotMat * tangent;
67+ normal = rotMat * normal;
6368 #endif
69+ }
6470 }
6571
6672 #endif
\ No newline at end of file