Selaa lähdekoodia

Added shadow receiving for SkinnedMeshes.

alteredq 13 vuotta sitten
vanhempi
commit
525ce679af
3 muutettua tiedostoa jossa 11 lisäystä ja 3 poistoa
  1. 0 0
      build/Three.js
  2. 0 0
      build/custom/ThreeWebGL.js
  3. 11 3
      src/renderers/WebGLShaders.js

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
build/Three.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
build/custom/ThreeWebGL.js


+ 11 - 3
src/renderers/WebGLShaders.js

@@ -967,10 +967,10 @@ THREE.ShaderChunk = {
 
 		"#ifdef USE_SKINNING",
 
-			"gl_Position  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;",
-			"gl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;",
+			"vec4 skinned  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;",
+			"skinned 	  += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;",
 
-			"gl_Position  = projectionMatrix * modelViewMatrix * gl_Position;",
+			"gl_Position  = projectionMatrix * modelViewMatrix * skinned;",
 
 		"#endif"
 
@@ -1294,12 +1294,20 @@ THREE.ShaderChunk = {
 
 					"vShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( morphed, 1.0 );",
 
+				"#else",
+
+				"#ifdef USE_SKINNING",
+
+					"vShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * skinned;",
+
 				"#else",
 
 					"vShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );",
 
 				"#endif",
 
+				"#endif",
+
 			"}",
 
 		"#endif"

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä