|
@@ -82,33 +82,11 @@ THREE.ShaderSkin = {
|
|
|
|
|
|
"uniform vec3 ambientLightColor;",
|
|
|
|
|
|
- "#if MAX_DIR_LIGHTS > 0",
|
|
|
-
|
|
|
- "uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];",
|
|
|
- "uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];",
|
|
|
-
|
|
|
- "#endif",
|
|
|
-
|
|
|
- "#if MAX_HEMI_LIGHTS > 0",
|
|
|
-
|
|
|
- "uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];",
|
|
|
- "uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];",
|
|
|
- "uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];",
|
|
|
-
|
|
|
- "#endif",
|
|
|
-
|
|
|
- "#if MAX_POINT_LIGHTS > 0",
|
|
|
-
|
|
|
- "uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];",
|
|
|
- "uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];",
|
|
|
- "uniform float pointLightDistance[ MAX_POINT_LIGHTS ];",
|
|
|
- "uniform float pointLightDecay[ MAX_POINT_LIGHTS ];",
|
|
|
-
|
|
|
- "#endif",
|
|
|
-
|
|
|
"varying vec3 vViewPosition;",
|
|
|
|
|
|
THREE.ShaderChunk[ "common" ],
|
|
|
+ THREE.ShaderChunk[ "bsdfs" ],
|
|
|
+ THREE.ShaderChunk[ "lights" ],
|
|
|
THREE.ShaderChunk[ "shadowmap_pars_fragment" ],
|
|
|
THREE.ShaderChunk[ "fog_pars_fragment" ],
|
|
|
THREE.ShaderChunk[ "bumpmap_pars_fragment" ],
|
|
@@ -197,9 +175,9 @@ THREE.ShaderSkin = {
|
|
|
|
|
|
"for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {",
|
|
|
|
|
|
- "vec3 lVector = pointLightPosition[ i ] + vViewPosition.xyz;",
|
|
|
+ "vec3 lVector = pointLights[ i ].position + vViewPosition.xyz;",
|
|
|
|
|
|
- "float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[i] );",
|
|
|
+ "float attenuation = calcLightAttenuation( length( lVector ), pointLights[ i ].distance, pointLights[ i ].decay );",
|
|
|
|
|
|
"lVector = normalize( lVector );",
|
|
|
|
|
@@ -209,8 +187,8 @@ THREE.ShaderSkin = {
|
|
|
|
|
|
"float pointSpecularWeight = KS_Skin_Specular( normal, lVector, viewerDirection, uRoughness, uSpecularBrightness );",
|
|
|
|
|
|
- "totalDiffuseLight += pointLightColor[ i ] * ( pointDiffuseWeight * attenuation );",
|
|
|
- "totalSpecularLight += pointLightColor[ i ] * specular * ( pointSpecularWeight * specularStrength * attenuation );",
|
|
|
+ "totalDiffuseLight += pointLight[ i ].color * ( pointDiffuseWeight * attenuation );",
|
|
|
+ "totalSpecularLight += pointLight[ i ].color * specular * ( pointSpecularWeight * specularStrength * attenuation );",
|
|
|
|
|
|
"}",
|
|
|
|
|
@@ -222,7 +200,7 @@ THREE.ShaderSkin = {
|
|
|
|
|
|
"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {",
|
|
|
|
|
|
- "vec3 dirVector = directionalLightDirection[ i ];",
|
|
|
+ "vec3 dirVector = directionalLight[ i ].direction;",
|
|
|
|
|
|
"float dirDiffuseWeightFull = max( dot( normal, dirVector ), 0.0 );",
|
|
|
"float dirDiffuseWeightHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );",
|
|
@@ -230,8 +208,8 @@ THREE.ShaderSkin = {
|
|
|
|
|
|
"float dirSpecularWeight = KS_Skin_Specular( normal, dirVector, viewerDirection, uRoughness, uSpecularBrightness );",
|
|
|
|
|
|
- "totalDiffuseLight += directionalLightColor[ i ] * dirDiffuseWeight;",
|
|
|
- "totalSpecularLight += directionalLightColor[ i ] * ( dirSpecularWeight * specularStrength );",
|
|
|
+ "totalDiffuseLight += directionalLight[ i ].color * dirDiffuseWeight;",
|
|
|
+ "totalSpecularLight += directionalLight[ i ].color * ( dirSpecularWeight * specularStrength );",
|
|
|
|
|
|
"}",
|
|
|
|