Quellcode durchsuchen

fixed bone shader chunks

Daniel Salvadori vor 7 Jahren
Ursprung
Commit
b7cc1e54cd

+ 24 - 22
renderer/shaders/include/bones_vertex.glsl

@@ -1,28 +1,30 @@
-#if BONE_INFLUENCERS > 0
+#ifdef BONE_INFLUENCERS
+    #if BONE_INFLUENCERS > 0
 
-    mat4 influence = mBones[int(matricesIndices[0])] * matricesWeights[0];
-    #if BONE_INFLUENCERS > 1
-        influence += mBones[int(matricesIndices[1])] * matricesWeights[1];
-        #if BONE_INFLUENCERS > 2
-            influence += mBones[int(matricesIndices[2])] * matricesWeights[2];
-            #if BONE_INFLUENCERS > 3
-                influence += mBones[int(matricesIndices[3])] * matricesWeights[3];
-//                #if BONE_INFLUENCERS > 4
-//                    influence += mBones[int(matricesIndicesExtra[0])] * matricesWeightsExtra[0];
-//                    #if BONE_INFLUENCERS > 5
-//                        influence += mBones[int(matricesIndicesExtra[1])] * matricesWeightsExtra[1];
-//                        #if BONE_INFLUENCERS > 6
-//                            influence += mBones[int(matricesIndicesExtra[2])] * matricesWeightsExtra[2];
-//                            #if BONE_INFLUENCERS > 7
-//                                influence += mBones[int(matricesIndicesExtra[3])] * matricesWeightsExtra[3];
-//                            #endif
-//                        #endif
-//                    #endif
-//                #endif
+        mat4 influence = mBones[int(matricesIndices[0])] * matricesWeights[0];
+        #if BONE_INFLUENCERS > 1
+            influence += mBones[int(matricesIndices[1])] * matricesWeights[1];
+            #if BONE_INFLUENCERS > 2
+                influence += mBones[int(matricesIndices[2])] * matricesWeights[2];
+                #if BONE_INFLUENCERS > 3
+                    influence += mBones[int(matricesIndices[3])] * matricesWeights[3];
+    //                #if BONE_INFLUENCERS > 4
+    //                    influence += mBones[int(matricesIndicesExtra[0])] * matricesWeightsExtra[0];
+    //                    #if BONE_INFLUENCERS > 5
+    //                        influence += mBones[int(matricesIndicesExtra[1])] * matricesWeightsExtra[1];
+    //                        #if BONE_INFLUENCERS > 6
+    //                            influence += mBones[int(matricesIndicesExtra[2])] * matricesWeightsExtra[2];
+    //                            #if BONE_INFLUENCERS > 7
+    //                                influence += mBones[int(matricesIndicesExtra[3])] * matricesWeightsExtra[3];
+    //                            #endif
+    //                        #endif
+    //                    #endif
+    //                #endif
+                #endif
             #endif
         #endif
-    #endif
 
-    finalWorld = finalWorld * influence;
+        finalWorld = finalWorld * influence;
 
+    #endif
 #endif

+ 3 - 1
renderer/shaders/include/bones_vertex_declaration.glsl

@@ -1,4 +1,5 @@
-#if BONE_INFLUENCERS > 0
+#ifdef BONE_INFLUENCERS
+    #if BONE_INFLUENCERS > 0
 	uniform mat4 mBones[TOTAL_BONES];
     in vec4 matricesIndices;
     in vec4 matricesWeights;
@@ -6,4 +7,5 @@
 //        in vec4 matricesIndicesExtra;
 //        in vec4 matricesWeightsExtra;
 //    #endif
+    #endif
 #endif

+ 28 - 24
renderer/shaders/sources.go

@@ -17,37 +17,40 @@ layout(location = 5) in  vec4  VertexTexoffsets;
 
 `
 
-const include_bones_vertex_source = `#if BONE_INFLUENCERS > 0
-
-    mat4 influence = mBones[int(matricesIndices[0])] * matricesWeights[0];
-    #if BONE_INFLUENCERS > 1
-        influence += mBones[int(matricesIndices[1])] * matricesWeights[1];
-        #if BONE_INFLUENCERS > 2
-            influence += mBones[int(matricesIndices[2])] * matricesWeights[2];
-            #if BONE_INFLUENCERS > 3
-                influence += mBones[int(matricesIndices[3])] * matricesWeights[3];
-//                #if BONE_INFLUENCERS > 4
-//                    influence += mBones[int(matricesIndicesExtra[0])] * matricesWeightsExtra[0];
-//                    #if BONE_INFLUENCERS > 5
-//                        influence += mBones[int(matricesIndicesExtra[1])] * matricesWeightsExtra[1];
-//                        #if BONE_INFLUENCERS > 6
-//                            influence += mBones[int(matricesIndicesExtra[2])] * matricesWeightsExtra[2];
-//                            #if BONE_INFLUENCERS > 7
-//                                influence += mBones[int(matricesIndicesExtra[3])] * matricesWeightsExtra[3];
-//                            #endif
-//                        #endif
-//                    #endif
-//                #endif
+const include_bones_vertex_source = `#ifdef BONE_INFLUENCERS
+    #if BONE_INFLUENCERS > 0
+
+        mat4 influence = mBones[int(matricesIndices[0])] * matricesWeights[0];
+        #if BONE_INFLUENCERS > 1
+            influence += mBones[int(matricesIndices[1])] * matricesWeights[1];
+            #if BONE_INFLUENCERS > 2
+                influence += mBones[int(matricesIndices[2])] * matricesWeights[2];
+                #if BONE_INFLUENCERS > 3
+                    influence += mBones[int(matricesIndices[3])] * matricesWeights[3];
+    //                #if BONE_INFLUENCERS > 4
+    //                    influence += mBones[int(matricesIndicesExtra[0])] * matricesWeightsExtra[0];
+    //                    #if BONE_INFLUENCERS > 5
+    //                        influence += mBones[int(matricesIndicesExtra[1])] * matricesWeightsExtra[1];
+    //                        #if BONE_INFLUENCERS > 6
+    //                            influence += mBones[int(matricesIndicesExtra[2])] * matricesWeightsExtra[2];
+    //                            #if BONE_INFLUENCERS > 7
+    //                                influence += mBones[int(matricesIndicesExtra[3])] * matricesWeightsExtra[3];
+    //                            #endif
+    //                        #endif
+    //                    #endif
+    //                #endif
+                #endif
             #endif
         #endif
-    #endif
 
-    finalWorld = finalWorld * influence;
+        finalWorld = finalWorld * influence;
 
+    #endif
 #endif
 `
 
-const include_bones_vertex_declaration_source = `#if BONE_INFLUENCERS > 0
+const include_bones_vertex_declaration_source = `#ifdef BONE_INFLUENCERS
+    #if BONE_INFLUENCERS > 0
 	uniform mat4 mBones[TOTAL_BONES];
     in vec4 matricesIndices;
     in vec4 matricesWeights;
@@ -55,6 +58,7 @@ const include_bones_vertex_declaration_source = `#if BONE_INFLUENCERS > 0
 //        in vec4 matricesIndicesExtra;
 //        in vec4 matricesWeightsExtra;
 //    #endif
+    #endif
 #endif
 `