Browse Source

Added shadow receiving for SkinnedMeshes.

alteredq 13 years ago
parent
commit
525ce679af
3 changed files with 11 additions and 3 deletions
  1. 0 0
      build/Three.js
  2. 0 0
      build/custom/ThreeWebGL.js
  3. 11 3
      src/renderers/WebGLShaders.js

File diff suppressed because it is too large
+ 0 - 0
build/Three.js


File diff suppressed because it is too large
+ 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"

Some files were not shown because too many files changed in this diff