소스 검색

Added shadow receiving for SkinnedMeshes.

alteredq 13 년 전
부모
커밋
525ce679af
3개의 변경된 파일11개의 추가작업 그리고 3개의 파일을 삭제
  1. 0 0
      build/Three.js
  2. 0 0
      build/custom/ThreeWebGL.js
  3. 11 3
      src/renderers/WebGLShaders.js

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
build/Three.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 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"

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.