浏览代码

forgotten file

Benjamin Guignabert 4 年之前
父节点
当前提交
0725bc87df
共有 1 个文件被更改,包括 37 次插入0 次删除
  1. 37 0
      src/Shaders/ShadersInclude/prePassVertex.fx

+ 37 - 0
src/Shaders/ShadersInclude/prePassVertex.fx

@@ -0,0 +1,37 @@
+#ifdef PREPASS_DEPTHNORMAL
+    vViewPos = (view * worldPos).rgb;
+#endif
+
+#if defined(PREPASS_VELOCITY) && defined(BONES_VELOCITY_ENABLED)
+    vCurrentPosition = viewProjection * worldPos;
+
+#if NUM_BONE_INFLUENCERS > 0
+    mat4 previousInfluence;
+    previousInfluence = mPreviousBones[int(matricesIndices[0])] * matricesWeights[0];
+    #if NUM_BONE_INFLUENCERS > 1
+        previousInfluence += mPreviousBones[int(matricesIndices[1])] * matricesWeights[1];
+    #endif  
+    #if NUM_BONE_INFLUENCERS > 2
+        previousInfluence += mPreviousBones[int(matricesIndices[2])] * matricesWeights[2];
+    #endif  
+    #if NUM_BONE_INFLUENCERS > 3
+        previousInfluence += mPreviousBones[int(matricesIndices[3])] * matricesWeights[3];
+    #endif
+    #if NUM_BONE_INFLUENCERS > 4
+        previousInfluence += mPreviousBones[int(matricesIndicesExtra[0])] * matricesWeightsExtra[0];
+    #endif  
+    #if NUM_BONE_INFLUENCERS > 5
+        previousInfluence += mPreviousBones[int(matricesIndicesExtra[1])] * matricesWeightsExtra[1];
+    #endif  
+    #if NUM_BONE_INFLUENCERS > 6
+        previousInfluence += mPreviousBones[int(matricesIndicesExtra[2])] * matricesWeightsExtra[2];
+    #endif  
+    #if NUM_BONE_INFLUENCERS > 7
+        previousInfluence += mPreviousBones[int(matricesIndicesExtra[3])] * matricesWeightsExtra[3];
+    #endif
+
+    vPreviousPosition = previousViewProjection * previousWorld * previousInfluence * vec4(positionUpdated, 1.0);
+#else
+    vPreviousPosition = previousViewProjection * previousWorld * vec4(positionUpdated, 1.0);
+#endif
+#endif