|
@@ -16931,7 +16931,7 @@ THREE.ShaderChunk = {
|
|
|
" vec2 st0 = dFdx( vUv.st );",
|
|
|
" vec2 st1 = dFdy( vUv.st );",
|
|
|
|
|
|
- " vec3 S = normalize( q0 * st1.t - q1 * st0.t );",
|
|
|
+ " vec3 S = normalize( q0 * st1.t - q1 * st0.t );",
|
|
|
" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );",
|
|
|
" vec3 N = normalize( surf_norm );",
|
|
|
|
|
@@ -17337,7 +17337,7 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
"#if MAX_POINT_LIGHTS > 0",
|
|
|
|
|
|
- " vec3 pointDiffuse = vec3( 0.0 );",
|
|
|
+ " vec3 pointDiffuse = vec3( 0.0 );",
|
|
|
" vec3 pointSpecular = vec3( 0.0 );",
|
|
|
|
|
|
" for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {",
|
|
@@ -17368,7 +17368,7 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
" #endif",
|
|
|
|
|
|
- " pointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;",
|
|
|
+ " pointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;",
|
|
|
|
|
|
// specular
|
|
|
|
|
@@ -17376,9 +17376,7 @@ THREE.ShaderChunk = {
|
|
|
" float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );",
|
|
|
" float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );",
|
|
|
|
|
|
- // 2.0 => 2.0001 is hack to work around ANGLE bug
|
|
|
-
|
|
|
- " float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
|
|
|
+ " float specularNormalization = ( shininess + 2.0 ) / 8.0;",
|
|
|
|
|
|
" vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );",
|
|
|
" pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;",
|
|
@@ -17389,7 +17387,7 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
"#if MAX_SPOT_LIGHTS > 0",
|
|
|
|
|
|
- " vec3 spotDiffuse = vec3( 0.0 );",
|
|
|
+ " vec3 spotDiffuse = vec3( 0.0 );",
|
|
|
" vec3 spotSpecular = vec3( 0.0 );",
|
|
|
|
|
|
" for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {",
|
|
@@ -17434,9 +17432,7 @@ THREE.ShaderChunk = {
|
|
|
" float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );",
|
|
|
" float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );",
|
|
|
|
|
|
- // 2.0 => 2.0001 is hack to work around ANGLE bug
|
|
|
-
|
|
|
- " float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
|
|
|
+ " float specularNormalization = ( shininess + 2.0 ) / 8.0;",
|
|
|
|
|
|
" vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );",
|
|
|
" spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;",
|
|
@@ -17449,7 +17445,7 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
"#if MAX_DIR_LIGHTS > 0",
|
|
|
|
|
|
- " vec3 dirDiffuse = vec3( 0.0 );",
|
|
|
+ " vec3 dirDiffuse = vec3( 0.0 );",
|
|
|
" vec3 dirSpecular = vec3( 0.0 );" ,
|
|
|
|
|
|
" for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {",
|
|
@@ -17474,38 +17470,36 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
" #endif",
|
|
|
|
|
|
- " dirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;",
|
|
|
+ " dirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;",
|
|
|
|
|
|
- // specular
|
|
|
+ // specular
|
|
|
|
|
|
" vec3 dirHalfVector = normalize( dirVector + viewPosition );",
|
|
|
" float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );",
|
|
|
" float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );",
|
|
|
|
|
|
- /*
|
|
|
- // fresnel term from skin shader
|
|
|
+ /*
|
|
|
+ // fresnel term from skin shader
|
|
|
" const float F0 = 0.128;",
|
|
|
|
|
|
" float base = 1.0 - dot( viewPosition, dirHalfVector );",
|
|
|
" float exponential = pow( base, 5.0 );",
|
|
|
|
|
|
" float fresnel = exponential + F0 * ( 1.0 - exponential );",
|
|
|
- */
|
|
|
+ */
|
|
|
|
|
|
- /*
|
|
|
- // fresnel term from fresnel shader
|
|
|
+ /*
|
|
|
+ // fresnel term from fresnel shader
|
|
|
" const float mFresnelBias = 0.08;",
|
|
|
" const float mFresnelScale = 0.3;",
|
|
|
" const float mFresnelPower = 5.0;",
|
|
|
|
|
|
" float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );",
|
|
|
- */
|
|
|
-
|
|
|
- // 2.0 => 2.0001 is hack to work around ANGLE bug
|
|
|
+ */
|
|
|
|
|
|
- " float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
|
|
|
+ " float specularNormalization = ( shininess + 2.0 ) / 8.0;",
|
|
|
|
|
|
- //"dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;",
|
|
|
+ // " dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;",
|
|
|
|
|
|
" vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );",
|
|
|
" dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;",
|
|
@@ -17517,7 +17511,7 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
"#if MAX_HEMI_LIGHTS > 0",
|
|
|
|
|
|
- " vec3 hemiDiffuse = vec3( 0.0 );",
|
|
|
+ " vec3 hemiDiffuse = vec3( 0.0 );",
|
|
|
" vec3 hemiSpecular = vec3( 0.0 );" ,
|
|
|
|
|
|
" for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {",
|
|
@@ -17525,7 +17519,7 @@ THREE.ShaderChunk = {
|
|
|
" vec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );",
|
|
|
" vec3 lVector = normalize( lDirection.xyz );",
|
|
|
|
|
|
- // diffuse
|
|
|
+ // diffuse
|
|
|
|
|
|
" float dotProduct = dot( normal, lVector );",
|
|
|
" float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;",
|
|
@@ -17534,13 +17528,13 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
" hemiDiffuse += diffuse * hemiColor;",
|
|
|
|
|
|
- // specular (sky light)
|
|
|
+ // specular (sky light)
|
|
|
|
|
|
" vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );",
|
|
|
" float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;",
|
|
|
" float hemiSpecularWeightSky = specularStrength * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );",
|
|
|
|
|
|
- // specular (ground light)
|
|
|
+ // specular (ground light)
|
|
|
|
|
|
" vec3 lVectorGround = -lVector;",
|
|
|
|
|
@@ -17550,9 +17544,7 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
" float dotProductGround = dot( normal, lVectorGround );",
|
|
|
|
|
|
- // 2.0 => 2.0001 is hack to work around ANGLE bug
|
|
|
-
|
|
|
- " float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
|
|
|
+ " float specularNormalization = ( shininess + 2.0 ) / 8.0;",
|
|
|
|
|
|
" vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );",
|
|
|
" vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );",
|
|
@@ -17735,10 +17727,11 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
" #endif",
|
|
|
|
|
|
- " vec4 skinned = boneMatX * skinVertex * skinWeight.x;",
|
|
|
- " skinned += boneMatY * skinVertex * skinWeight.y;",
|
|
|
- " skinned += boneMatZ * skinVertex * skinWeight.z;",
|
|
|
- " skinned += boneMatW * skinVertex * skinWeight.w;",
|
|
|
+ " vec4 skinned = vec4( 0.0 )'",
|
|
|
+ " skinned += boneMatX * skinVertex * skinWeight.x;",
|
|
|
+ " skinned += boneMatY * skinVertex * skinWeight.y;",
|
|
|
+ " skinned += boneMatZ * skinVertex * skinWeight.z;",
|
|
|
+ " skinned += boneMatW * skinVertex * skinWeight.w;",
|
|
|
|
|
|
"#endif"
|
|
|
|
|
@@ -17821,10 +17814,10 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
" vec3 morphedNormal = vec3( 0.0 );",
|
|
|
|
|
|
- " morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];",
|
|
|
- " morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];",
|
|
|
- " morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];",
|
|
|
- " morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];",
|
|
|
+ " morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];",
|
|
|
+ " morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];",
|
|
|
+ " morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];",
|
|
|
+ " morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];",
|
|
|
|
|
|
" morphedNormal += normal;",
|
|
|
|
|
@@ -17836,10 +17829,11 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
"#ifdef USE_SKINNING",
|
|
|
|
|
|
- " mat4 skinMatrix = skinWeight.x * boneMatX;",
|
|
|
- " skinMatrix += skinWeight.y * boneMatY;",
|
|
|
- " skinMatrix += skinWeight.z * boneMatZ;",
|
|
|
- " skinMatrix += skinWeight.w * boneMatW;",
|
|
|
+ " mat4 skinMatrix = mat4( 0.0 );",
|
|
|
+ " skinMatrix += skinWeight.x * boneMatX;",
|
|
|
+ " skinMatrix += skinWeight.y * boneMatY;",
|
|
|
+ " skinMatrix += skinWeight.z * boneMatZ;",
|
|
|
+ " skinMatrix += skinWeight.w * boneMatW;",
|
|
|
|
|
|
" #ifdef USE_MORPHNORMALS",
|
|
|
|
|
@@ -17890,8 +17884,8 @@ THREE.ShaderChunk = {
|
|
|
// SHADOW MAP
|
|
|
|
|
|
// based on SpiderGL shadow map and Fabien Sanglard's GLSL shadow mapping examples
|
|
|
- // http://spidergl.org/example.php?id=6
|
|
|
- // http://fabiensanglard.net/shadowmapping
|
|
|
+ // http://spidergl.org/example.php?id=6
|
|
|
+ // http://fabiensanglard.net/shadowmapping
|
|
|
|
|
|
shadowmap_pars_fragment: [
|
|
|
|
|
@@ -17943,8 +17937,8 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
" vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;",
|
|
|
|
|
|
- // "if ( something && something )" breaks ATI OpenGL shader compiler
|
|
|
- // "if ( all( something, something ) )" using this instead
|
|
|
+ // "if ( something && something )" breaks ATI OpenGL shader compiler
|
|
|
+ // "if ( all( something, something ) )" using this instead
|
|
|
|
|
|
" bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );",
|
|
|
" bool inFrustum = all( inFrustumVec );",
|
|
@@ -17978,7 +17972,7 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
" float shadow = 0.0;",
|
|
|
|
|
|
- /*
|
|
|
+ /*
|
|
|
// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL
|
|
|
// must enroll loop manually
|
|
|
|
|
@@ -17999,7 +17993,7 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
" shadow /= 9.0;",
|
|
|
|
|
|
- */
|
|
|
+ */
|
|
|
|
|
|
" const float shadowDelta = 1.0 / 9.0;",
|
|
|
|
|
@@ -18101,13 +18095,13 @@ THREE.ShaderChunk = {
|
|
|
|
|
|
" if ( fDepth < shadowCoord.z )",
|
|
|
|
|
|
- // spot with multiple shadows is darker
|
|
|
+ // spot with multiple shadows is darker
|
|
|
|
|
|
" shadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );",
|
|
|
|
|
|
- // spot with multiple shadows has the same color as single shadow spot
|
|
|
+ // spot with multiple shadows has the same color as single shadow spot
|
|
|
|
|
|
- //"shadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );",
|
|
|
+ // " shadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );",
|
|
|
|
|
|
" #endif",
|
|
|
|
|
@@ -18253,6 +18247,7 @@ THREE.ShaderChunk = {
|
|
|
].join('\n'),
|
|
|
|
|
|
logdepthbuf_fragment: [
|
|
|
+
|
|
|
"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)",
|
|
|
|
|
|
" gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;",
|
|
@@ -18770,7 +18765,7 @@ THREE.ShaderLib = {
|
|
|
|
|
|
'particle_basic': {
|
|
|
|
|
|
- uniforms: THREE.UniformsUtils.merge( [
|
|
|
+ uniforms: THREE.UniformsUtils.merge( [
|
|
|
|
|
|
THREE.UniformsLib[ "particle" ],
|
|
|
THREE.UniformsLib[ "shadowmap" ]
|
|
@@ -18844,8 +18839,8 @@ THREE.ShaderLib = {
|
|
|
THREE.UniformsLib[ "fog" ],
|
|
|
|
|
|
{
|
|
|
- "scale": { type: "f", value: 1 },
|
|
|
- "dashSize": { type: "f", value: 1 },
|
|
|
+ "scale" : { type: "f", value: 1 },
|
|
|
+ "dashSize" : { type: "f", value: 1 },
|
|
|
"totalSize": { type: "f", value: 2 }
|
|
|
}
|
|
|
|
|
@@ -19029,18 +19024,18 @@ THREE.ShaderLib = {
|
|
|
|
|
|
{
|
|
|
|
|
|
- "enableAO" : { type: "i", value: 0 },
|
|
|
- "enableDiffuse" : { type: "i", value: 0 },
|
|
|
- "enableSpecular" : { type: "i", value: 0 },
|
|
|
- "enableReflection": { type: "i", value: 0 },
|
|
|
+ "enableAO" : { type: "i", value: 0 },
|
|
|
+ "enableDiffuse" : { type: "i", value: 0 },
|
|
|
+ "enableSpecular" : { type: "i", value: 0 },
|
|
|
+ "enableReflection" : { type: "i", value: 0 },
|
|
|
"enableDisplacement": { type: "i", value: 0 },
|
|
|
|
|
|
"tDisplacement": { type: "t", value: null }, // must go first as this is vertex texture
|
|
|
- "tDiffuse" : { type: "t", value: null },
|
|
|
- "tCube" : { type: "t", value: null },
|
|
|
- "tNormal" : { type: "t", value: null },
|
|
|
- "tSpecular" : { type: "t", value: null },
|
|
|
- "tAO" : { type: "t", value: null },
|
|
|
+ "tDiffuse" : { type: "t", value: null },
|
|
|
+ "tCube" : { type: "t", value: null },
|
|
|
+ "tNormal" : { type: "t", value: null },
|
|
|
+ "tSpecular" : { type: "t", value: null },
|
|
|
+ "tAO" : { type: "t", value: null },
|
|
|
|
|
|
"uNormalScale": { type: "v2", value: new THREE.Vector2( 1, 1 ) },
|
|
|
|
|
@@ -19060,7 +19055,7 @@ THREE.ShaderLib = {
|
|
|
"uOffset" : { type: "v2", value: new THREE.Vector2( 0, 0 ) },
|
|
|
"uRepeat" : { type: "v2", value: new THREE.Vector2( 1, 1 ) },
|
|
|
|
|
|
- "wrapRGB" : { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) }
|
|
|
+ "wrapRGB" : { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -19247,9 +19242,7 @@ THREE.ShaderLib = {
|
|
|
" float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );",
|
|
|
" float pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, shininess ), 0.0 );",
|
|
|
|
|
|
- // 2.0 => 2.0001 is hack to work around ANGLE bug
|
|
|
-
|
|
|
- " float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
|
|
|
+ " float specularNormalization = ( shininess + 2.0 ) / 8.0;",
|
|
|
|
|
|
" vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( pointVector, pointHalfVector ), 5.0 );",
|
|
|
" pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;",
|
|
@@ -19305,9 +19298,7 @@ THREE.ShaderLib = {
|
|
|
" float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );",
|
|
|
" float spotSpecularWeight = specularTex.r * max( pow( spotDotNormalHalf, shininess ), 0.0 );",
|
|
|
|
|
|
- // 2.0 => 2.0001 is hack to work around ANGLE bug
|
|
|
-
|
|
|
- " float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
|
|
|
+ " float specularNormalization = ( shininess + 2.0 ) / 8.0;",
|
|
|
|
|
|
" vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( spotVector, spotHalfVector ), 5.0 );",
|
|
|
" spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;",
|
|
@@ -19353,9 +19344,7 @@ THREE.ShaderLib = {
|
|
|
" float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );",
|
|
|
" float dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, shininess ), 0.0 );",
|
|
|
|
|
|
- // 2.0 => 2.0001 is hack to work around ANGLE bug
|
|
|
-
|
|
|
- " float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
|
|
|
+ " float specularNormalization = ( shininess + 2.0 ) / 8.0;",
|
|
|
|
|
|
" vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );",
|
|
|
" dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;",
|
|
@@ -19368,7 +19357,7 @@ THREE.ShaderLib = {
|
|
|
|
|
|
" #if MAX_HEMI_LIGHTS > 0",
|
|
|
|
|
|
- " vec3 hemiDiffuse = vec3( 0.0 );",
|
|
|
+ " vec3 hemiDiffuse = vec3( 0.0 );",
|
|
|
" vec3 hemiSpecular = vec3( 0.0 );" ,
|
|
|
|
|
|
" for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {",
|
|
@@ -19402,9 +19391,7 @@ THREE.ShaderLib = {
|
|
|
|
|
|
" float dotProductGround = dot( normal, lVectorGround );",
|
|
|
|
|
|
- // 2.0 => 2.0001 is hack to work around ANGLE bug
|
|
|
-
|
|
|
- " float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
|
|
|
+ " float specularNormalization = ( shininess + 2.0 ) / 8.0;",
|
|
|
|
|
|
" vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, hemiHalfVectorSky ), 5.0 );",
|
|
|
" vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 5.0 );",
|
|
@@ -19564,12 +19551,13 @@ THREE.ShaderLib = {
|
|
|
|
|
|
" vec4 skinVertex = vec4( position, 1.0 );",
|
|
|
|
|
|
- " vec4 skinned = boneMatX * skinVertex * skinWeight.x;",
|
|
|
- " skinned += boneMatY * skinVertex * skinWeight.y;",
|
|
|
- " skinned += boneMatZ * skinVertex * skinWeight.z;",
|
|
|
- " skinned += boneMatW * skinVertex * skinWeight.w;",
|
|
|
+ " vec4 skinned = vec4( 0.0 );",
|
|
|
+ " skinned += boneMatX * skinVertex * skinWeight.x;",
|
|
|
+ " skinned += boneMatY * skinVertex * skinWeight.y;",
|
|
|
+ " skinned += boneMatZ * skinVertex * skinWeight.z;",
|
|
|
+ " skinned += boneMatW * skinVertex * skinWeight.w;",
|
|
|
|
|
|
- " displacedPosition = skinned.xyz;",
|
|
|
+ " displacedPosition = skinned.xyz;",
|
|
|
|
|
|
" #else",
|
|
|
|
|
@@ -19585,12 +19573,13 @@ THREE.ShaderLib = {
|
|
|
|
|
|
" vec4 skinVertex = vec4( position, 1.0 );",
|
|
|
|
|
|
- " vec4 skinned = boneMatX * skinVertex * skinWeight.x;",
|
|
|
- " skinned += boneMatY * skinVertex * skinWeight.y;",
|
|
|
- " skinned += boneMatZ * skinVertex * skinWeight.z;",
|
|
|
- " skinned += boneMatW * skinVertex * skinWeight.w;",
|
|
|
+ " vec4 skinned = vec4( 0.0 );",
|
|
|
+ " skinned += boneMatX * skinVertex * skinWeight.x;",
|
|
|
+ " skinned += boneMatY * skinVertex * skinWeight.y;",
|
|
|
+ " skinned += boneMatZ * skinVertex * skinWeight.z;",
|
|
|
+ " skinned += boneMatW * skinVertex * skinWeight.w;",
|
|
|
|
|
|
- " displacedPosition = skinned.xyz;",
|
|
|
+ " displacedPosition = skinned.xyz;",
|
|
|
|
|
|
" #else",
|
|
|
|
|
@@ -19681,13 +19670,17 @@ THREE.ShaderLib = {
|
|
|
|
|
|
},
|
|
|
|
|
|
- // Depth encoding into RGBA texture
|
|
|
- // based on SpiderGL shadow map example
|
|
|
- // http://spidergl.org/example.php?id=6
|
|
|
- // originally from
|
|
|
- // http://www.gamedev.net/topic/442138-packing-a-float-into-a-a8r8g8b8-texture-shader/page__whichpage__1%25EF%25BF%25BD
|
|
|
- // see also here:
|
|
|
- // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
|
|
|
+ /* Depth encoding into RGBA texture
|
|
|
+ *
|
|
|
+ * based on SpiderGL shadow map example
|
|
|
+ * http://spidergl.org/example.php?id=6
|
|
|
+ *
|
|
|
+ * originally from
|
|
|
+ * http://www.gamedev.net/topic/442138-packing-a-float-into-a-a8r8g8b8-texture-shader/page__whichpage__1%25EF%25BF%25BD
|
|
|
+ *
|
|
|
+ * see also
|
|
|
+ * http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
|
|
|
+ */
|
|
|
|
|
|
'depthRGBA': {
|
|
|
|
|
@@ -19718,7 +19711,7 @@ THREE.ShaderLib = {
|
|
|
"vec4 pack_depth( const in float depth ) {",
|
|
|
|
|
|
" const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );",
|
|
|
- " const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );",
|
|
|
+ " const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );",
|
|
|
" vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );", // " vec4 res = fract( depth * bit_shift );",
|
|
|
" res -= res.xxyz * bit_mask;",
|
|
|
" return res;",
|