Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
120c8952
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
120c8952
编写于
3月 04, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
1b0ac10c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
14 deletion
+15
-14
build/three.js
build/three.js
+5
-4
build/three.min.js
build/three.min.js
+10
-10
未找到文件。
build/three.js
浏览文件 @
120c8952
...
@@ -12898,8 +12898,9 @@ THREE.ObjectLoader.prototype = {
...
@@ -12898,8 +12898,9 @@ THREE.ObjectLoader.prototype = {
for ( var i = 0, l = json.length; i < l; i ++ ) {
for ( var i = 0, l = json.length; i < l; i ++ ) {
var image = json[ i ];
var image = json[ i ];
var path = /^(\/\/)|([a-z]+:(\/\/)?)/i.test( image.url ) ? image.url : scope.texturePath + image.url;
images[ image.uuid ] = loadImage(
scope.texturePath + image.url
);
images[ image.uuid ] = loadImage(
path
);
}
}
...
@@ -16583,7 +16584,7 @@ THREE.ShaderChunk[ 'lightmap_pars_vertex'] = "#ifdef USE_LIGHTMAP\n\n varying ve
...
@@ -16583,7 +16584,7 @@ THREE.ShaderChunk[ 'lightmap_pars_vertex'] = "#ifdef USE_LIGHTMAP\n\n varying ve
// File:src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl
// File:src/renderers/shaders/ShaderChunk/lights_phong_fragment.glsl
THREE.ShaderChunk[ 'lights_phong_fragment'] = "#ifndef FLAT_SHADED\n\n vec3 normal = normalize( vNormal );\n\n
#else\n\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\nvec3 viewPosition = normalize( vViewPosition );\n\n#ifdef DOUBLE_SIDED\n\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n#endif
\n\n#ifdef USE_NORMALMAP\n\n normal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n vec3 pointDiffuse = vec3( 0.0 );\n vec3 pointSpecular = vec3( 0.0 );\n\n for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float pointDiffuseWeightFull = max( dotProduct, 0.0 );\n float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float pointDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n pointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * attenuation;\n\n // specular\n\n vec3 pointHalfVector = normalize( lVector + viewPosition );\n float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n vec3 spotDiffuse = vec3( 0.0 );\n vec3 spotSpecular = vec3( 0.0 );\n\n for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float spotDiffuseWeightFull = max( dotProduct, 0.0 );\n float spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float spotDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n spotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\n\n // specular\n\n vec3 spotHalfVector = normalize( lVector + viewPosition );\n float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\n\n }\n\n }\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n vec3 dirDiffuse = vec3( 0.0 );\n vec3 dirSpecular = vec3( 0.0 );\n\n for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n // diffuse\n\n float dotProduct = dot( normal, dirVector );\n\n #ifdef WRAP_AROUND\n\n float dirDiffuseWeightFull = max( dotProduct, 0.0 );\n float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float dirDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n dirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n\n // specular\n\n vec3 dirHalfVector = normalize( dirVector + viewPosition );\n float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n /*\n // fresnel term from skin shader\n const float F0 = 0.128;\n\n float base = 1.0 - dot( viewPosition, dirHalfVector );\n float exponential = pow( base, 5.0 );\n\n float fresnel = exponential + F0 * ( 1.0 - exponential );\n */\n\n /*\n // fresnel term from fresnel shader\n const float mFresnelBias = 0.08;\n const float mFresnelScale = 0.3;\n const float mFresnelPower = 5.0;\n\n float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n */\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n // dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n vec3 hemiDiffuse = vec3( 0.0 );\n vec3 hemiSpecular = vec3( 0.0 );\n\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n hemiDiffuse += diffuse * hemiColor;\n\n // specular (sky light)\n\n vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n float hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n // specular (ground light)\n\n vec3 lVectorGround = -lVector;\n\n vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n float hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n float dotProductGround = dot( normal, lVectorGround );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n hemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n }\n\n#endif\n\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n\n#if MAX_DIR_LIGHTS > 0\n\n totalDiffuse += dirDiffuse;\n totalSpecular += dirSpecular;\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n totalDiffuse += hemiDiffuse;\n totalSpecular += hemiSpecular;\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n totalDiffuse += pointDiffuse;\n totalSpecular += pointSpecular;\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n totalDiffuse += spotDiffuse;\n totalSpecular += spotSpecular;\n\n#endif\n\n#ifdef METAL\n\n gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * diffuse + totalSpecular );\n\n#else\n\n gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * diffuse ) + totalSpecular;\n\n#endif\n";
THREE.ShaderChunk[ 'lights_phong_fragment'] = "#ifndef FLAT_SHADED\n\n vec3 normal = normalize( vNormal );\n\n
#ifdef DOUBLE_SIDED\n\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n\n #endif\n\n#else\n\n vec3 fdx = dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition );\n vec3 normal = normalize( cross( fdx, fdy ) );\n\n#endif\n\nvec3 viewPosition = normalize( vViewPosition );
\n\n#ifdef USE_NORMALMAP\n\n normal = perturbNormal2Arb( -vViewPosition, normal );\n\n#elif defined( USE_BUMPMAP )\n\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n vec3 pointDiffuse = vec3( 0.0 );\n vec3 pointSpecular = vec3( 0.0 );\n\n for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float pointDiffuseWeightFull = max( dotProduct, 0.0 );\n float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float pointDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n pointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * attenuation;\n\n // specular\n\n vec3 pointHalfVector = normalize( lVector + viewPosition );\n float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\n float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );\n pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;\n\n }\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n vec3 spotDiffuse = vec3( 0.0 );\n vec3 spotSpecular = vec3( 0.0 );\n\n for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {\n\n vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );\n vec3 lVector = lPosition.xyz + vViewPosition.xyz;\n\n float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );\n\n lVector = normalize( lVector );\n\n float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );\n\n if ( spotEffect > spotLightAngleCos[ i ] ) {\n\n spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n\n #ifdef WRAP_AROUND\n\n float spotDiffuseWeightFull = max( dotProduct, 0.0 );\n float spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float spotDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n spotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;\n\n // specular\n\n vec3 spotHalfVector = normalize( lVector + viewPosition );\n float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );\n float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );\n spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;\n\n }\n\n }\n\n#endif\n\n#if MAX_DIR_LIGHTS > 0\n\n vec3 dirDiffuse = vec3( 0.0 );\n vec3 dirSpecular = vec3( 0.0 );\n\n for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\n\n vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );\n\n // diffuse\n\n float dotProduct = dot( normal, dirVector );\n\n #ifdef WRAP_AROUND\n\n float dirDiffuseWeightFull = max( dotProduct, 0.0 );\n float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );\n\n vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n\n #else\n\n float dirDiffuseWeight = max( dotProduct, 0.0 );\n\n #endif\n\n dirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\n\n // specular\n\n vec3 dirHalfVector = normalize( dirVector + viewPosition );\n float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\n float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );\n\n /*\n // fresnel term from skin shader\n const float F0 = 0.128;\n\n float base = 1.0 - dot( viewPosition, dirHalfVector );\n float exponential = pow( base, 5.0 );\n\n float fresnel = exponential + F0 * ( 1.0 - exponential );\n */\n\n /*\n // fresnel term from fresnel shader\n const float mFresnelBias = 0.08;\n const float mFresnelScale = 0.3;\n const float mFresnelPower = 5.0;\n\n float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );\n */\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n // dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;\n\n vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );\n dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;\n\n\n }\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n vec3 hemiDiffuse = vec3( 0.0 );\n vec3 hemiSpecular = vec3( 0.0 );\n\n for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {\n\n vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );\n\n // diffuse\n\n float dotProduct = dot( normal, lVector );\n float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;\n\n vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );\n\n hemiDiffuse += diffuse * hemiColor;\n\n // specular (sky light)\n\n vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );\n float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;\n float hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );\n\n // specular (ground light)\n\n vec3 lVectorGround = -lVector;\n\n vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );\n float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;\n float hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );\n\n float dotProductGround = dot( normal, lVectorGround );\n\n float specularNormalization = ( shininess + 2.0 ) / 8.0;\n\n vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );\n vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );\n hemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );\n\n }\n\n#endif\n\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n\n#if MAX_DIR_LIGHTS > 0\n\n totalDiffuse += dirDiffuse;\n totalSpecular += dirSpecular;\n\n#endif\n\n#if MAX_HEMI_LIGHTS > 0\n\n totalDiffuse += hemiDiffuse;\n totalSpecular += hemiSpecular;\n\n#endif\n\n#if MAX_POINT_LIGHTS > 0\n\n totalDiffuse += pointDiffuse;\n totalSpecular += pointSpecular;\n\n#endif\n\n#if MAX_SPOT_LIGHTS > 0\n\n totalDiffuse += spotDiffuse;\n totalSpecular += spotSpecular;\n\n#endif\n\n#ifdef METAL\n\n gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * diffuse + totalSpecular );\n\n#else\n\n gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * diffuse ) + totalSpecular;\n\n#endif\n";
// File:src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl
// File:src/renderers/shaders/ShaderChunk/fog_pars_fragment.glsl
...
@@ -16603,7 +16604,7 @@ THREE.ShaderChunk[ 'logdepthbuf_fragment'] = "#if defined(USE_LOGDEPTHBUF) && de
...
@@ -16603,7 +16604,7 @@ THREE.ShaderChunk[ 'logdepthbuf_fragment'] = "#if defined(USE_LOGDEPTHBUF) && de
// File:src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl
// File:src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl
THREE.ShaderChunk[ 'normalmap_pars_fragment'] = "#ifdef USE_NORMALMAP\n\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n\n
// Per-Pixel Tangent Space Normal Mapping\n
// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n vec3 N = normalize( surf_norm );\n\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n\n }\n\n#endif\n";
THREE.ShaderChunk[ 'normalmap_pars_fragment'] = "#ifdef USE_NORMALMAP\n\n uniform sampler2D normalMap;\n uniform vec2 normalScale;\n\n
// Per-Pixel Tangent Space Normal Mapping\n
// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html\n\n vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {\n\n vec3 q0 = dFdx( eye_pos.xyz );\n vec3 q1 = dFdy( eye_pos.xyz );\n vec2 st0 = dFdx( vUv.st );\n vec2 st1 = dFdy( vUv.st );\n\n vec3 S = normalize( q0 * st1.t - q1 * st0.t );\n vec3 T = normalize( -q0 * st1.s + q1 * st0.s );\n vec3 N = normalize( surf_norm );\n\n vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n mapN.xy = normalScale * mapN.xy;\n mat3 tsn = mat3( S, T, N );\n return normalize( tsn * mapN );\n\n }\n\n#endif\n";
// File:src/renderers/shaders/ShaderChunk/lights_phong_pars_vertex.glsl
// File:src/renderers/shaders/ShaderChunk/lights_phong_pars_vertex.glsl
...
@@ -16691,7 +16692,7 @@ THREE.ShaderChunk[ 'fog_fragment'] = "#ifdef USE_FOG\n\n #ifdef USE_LOGDEPTHBUF_
...
@@ -16691,7 +16692,7 @@ THREE.ShaderChunk[ 'fog_fragment'] = "#ifdef USE_FOG\n\n #ifdef USE_LOGDEPTHBUF_
// File:src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl
// File:src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl
THREE.ShaderChunk[ 'bumpmap_pars_fragment'] = "#ifdef USE_BUMPMAP\n\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n\n
// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n // http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n vec2 dHdxy_fwd() {\n\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n return vec2( dBx, dBy );\n\n }\n\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n vec3 vSigmaX = dFdx( surf_pos );\n vec3 vSigmaY = dFdy( surf_pos );\n vec3 vN = surf_norm; // normalized\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n float fDet = dot( vSigmaX, R1 );\n\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n\n }\n\n#endif
";
THREE.ShaderChunk[ 'bumpmap_pars_fragment'] = "#ifdef USE_BUMPMAP\n\n uniform sampler2D bumpMap;\n uniform float bumpScale;\n\n
// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen\n // http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html\n\n // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n vec2 dHdxy_fwd() {\n\n vec2 dSTdx = dFdx( vUv );\n vec2 dSTdy = dFdy( vUv );\n\n float Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\n return vec2( dBx, dBy );\n\n }\n\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\n vec3 vSigmaX = dFdx( surf_pos );\n vec3 vSigmaY = dFdy( surf_pos );\n vec3 vN = surf_norm; // normalized\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n float fDet = dot( vSigmaX, R1 );\n\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n\n }\n\n#endif\n
";
// File:src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl
// File:src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl
...
...
build/three.min.js
浏览文件 @
120c8952
...
@@ -283,13 +283,13 @@ d=this.parseTextures(a.textures,d),d=this.parseMaterials(a.materials,d),e=this.p
...
@@ -283,13 +283,13 @@ d=this.parseTextures(a.textures,d),d=this.parseMaterials(a.materials,d),e=this.p
h
.
height
,
h
.
depth
,
h
.
widthSegments
,
h
.
heightSegments
,
h
.
depthSegments
);
break
;
case
"
CircleGeometry
"
:
g
=
new
THREE
.
CircleGeometry
(
h
.
radius
,
h
.
segments
);
break
;
case
"
CylinderGeometry
"
:
g
=
new
THREE
.
CylinderGeometry
(
h
.
radiusTop
,
h
.
radiusBottom
,
h
.
height
,
h
.
radialSegments
,
h
.
heightSegments
,
h
.
openEnded
);
break
;
case
"
SphereGeometry
"
:
g
=
new
THREE
.
SphereGeometry
(
h
.
radius
,
h
.
widthSegments
,
h
.
heightSegments
,
h
.
phiStart
,
h
.
phiLength
,
h
.
thetaStart
,
h
.
thetaLength
);
break
;
case
"
IcosahedronGeometry
"
:
g
=
new
THREE
.
IcosahedronGeometry
(
h
.
radius
,
h
.
height
,
h
.
depth
,
h
.
widthSegments
,
h
.
heightSegments
,
h
.
depthSegments
);
break
;
case
"
CircleGeometry
"
:
g
=
new
THREE
.
CircleGeometry
(
h
.
radius
,
h
.
segments
);
break
;
case
"
CylinderGeometry
"
:
g
=
new
THREE
.
CylinderGeometry
(
h
.
radiusTop
,
h
.
radiusBottom
,
h
.
height
,
h
.
radialSegments
,
h
.
heightSegments
,
h
.
openEnded
);
break
;
case
"
SphereGeometry
"
:
g
=
new
THREE
.
SphereGeometry
(
h
.
radius
,
h
.
widthSegments
,
h
.
heightSegments
,
h
.
phiStart
,
h
.
phiLength
,
h
.
thetaStart
,
h
.
thetaLength
);
break
;
case
"
IcosahedronGeometry
"
:
g
=
new
THREE
.
IcosahedronGeometry
(
h
.
radius
,
h
.
detail
);
break
;
case
"
TorusGeometry
"
:
g
=
new
THREE
.
TorusGeometry
(
h
.
radius
,
h
.
tube
,
h
.
radialSegments
,
h
.
tubularSegments
,
h
.
arc
);
break
;
case
"
TorusKnotGeometry
"
:
g
=
new
THREE
.
TorusKnotGeometry
(
h
.
radius
,
h
.
tube
,
h
.
radialSegments
,
h
.
tubularSegments
,
h
.
p
,
h
.
q
,
h
.
heightScale
);
break
;
case
"
BufferGeometry
"
:
g
=
d
.
parse
(
h
.
data
);
break
;
case
"
Geometry
"
:
g
=
c
.
parse
(
h
.
data
).
geometry
}
g
.
uuid
=
h
.
uuid
;
void
0
!==
h
.
name
&&
(
g
.
name
=
h
.
name
);
b
[
h
.
uuid
]
=
g
}
return
b
},
parseMaterials
:
function
(
a
,
b
){
var
c
=
{};
if
(
void
0
!==
a
)
for
(
var
d
=
function
(
a
){
void
0
===
h
.
detail
);
break
;
case
"
TorusGeometry
"
:
g
=
new
THREE
.
TorusGeometry
(
h
.
radius
,
h
.
tube
,
h
.
radialSegments
,
h
.
tubularSegments
,
h
.
arc
);
break
;
case
"
TorusKnotGeometry
"
:
g
=
new
THREE
.
TorusKnotGeometry
(
h
.
radius
,
h
.
tube
,
h
.
radialSegments
,
h
.
tubularSegments
,
h
.
p
,
h
.
q
,
h
.
heightScale
);
break
;
case
"
BufferGeometry
"
:
g
=
d
.
parse
(
h
.
data
);
break
;
case
"
Geometry
"
:
g
=
c
.
parse
(
h
.
data
).
geometry
}
g
.
uuid
=
h
.
uuid
;
void
0
!==
h
.
name
&&
(
g
.
name
=
h
.
name
);
b
[
h
.
uuid
]
=
g
}
return
b
},
parseMaterials
:
function
(
a
,
b
){
var
c
=
{};
if
(
void
0
!==
a
)
for
(
var
d
=
function
(
a
){
void
0
===
b
[
a
]
&&
THREE
.
warn
(
"
THREE.ObjectLoader: Undefined texture
"
,
a
);
return
b
[
a
]},
e
=
new
THREE
.
MaterialLoader
,
f
=
0
,
g
=
a
.
length
;
f
<
g
;
f
++
){
var
h
=
a
[
f
],
k
=
e
.
parse
(
h
);
k
.
uuid
=
h
.
uuid
;
void
0
!==
h
.
name
&&
(
k
.
name
=
h
.
name
);
void
0
!==
h
.
map
&&
(
k
.
map
=
d
(
h
.
map
));
void
0
!==
h
.
bumpMap
&&
(
k
.
bumpMap
=
d
(
h
.
bumpMap
),
h
.
bumpScale
&&
(
k
.
bumpScale
=
new
THREE
.
Vector2
(
h
.
bumpScale
,
h
.
bumpScale
)));
void
0
!==
h
.
alphaMap
&&
(
k
.
alphaMap
=
d
(
h
.
alphaMap
));
void
0
!==
h
.
envMap
&&
(
k
.
envMap
=
d
(
h
.
envMap
));
void
0
!==
h
.
normalMap
&&
(
k
.
normalMap
=
d
(
h
.
normalMap
),
h
.
normalScale
&&
(
k
.
normalScale
=
b
[
a
]
&&
THREE
.
warn
(
"
THREE.ObjectLoader: Undefined texture
"
,
a
);
return
b
[
a
]},
e
=
new
THREE
.
MaterialLoader
,
f
=
0
,
g
=
a
.
length
;
f
<
g
;
f
++
){
var
h
=
a
[
f
],
k
=
e
.
parse
(
h
);
k
.
uuid
=
h
.
uuid
;
void
0
!==
h
.
name
&&
(
k
.
name
=
h
.
name
);
void
0
!==
h
.
map
&&
(
k
.
map
=
d
(
h
.
map
));
void
0
!==
h
.
bumpMap
&&
(
k
.
bumpMap
=
d
(
h
.
bumpMap
),
h
.
bumpScale
&&
(
k
.
bumpScale
=
new
THREE
.
Vector2
(
h
.
bumpScale
,
h
.
bumpScale
)));
void
0
!==
h
.
alphaMap
&&
(
k
.
alphaMap
=
d
(
h
.
alphaMap
));
void
0
!==
h
.
envMap
&&
(
k
.
envMap
=
d
(
h
.
envMap
));
void
0
!==
h
.
normalMap
&&
(
k
.
normalMap
=
d
(
h
.
normalMap
),
h
.
normalScale
&&
(
k
.
normalScale
=
new
THREE
.
Vector2
(
h
.
normalScale
,
h
.
normalScale
)));
void
0
!==
h
.
lightMap
&&
(
k
.
lightMap
=
d
(
h
.
lightMap
));
void
0
!==
h
.
specularMap
&&
(
k
.
specularMap
=
d
(
h
.
specularMap
));
c
[
h
.
uuid
]
=
k
}
return
c
},
parseImages
:
function
(
a
,
b
){
var
c
=
this
,
d
=
{};
if
(
void
0
!==
a
&&
0
<
a
.
length
){
var
e
=
new
THREE
.
LoadingManager
(
b
),
f
=
new
THREE
.
ImageLoader
(
e
);
f
.
setCrossOrigin
(
this
.
crossOrigin
);
for
(
var
e
=
function
(
a
){
c
.
manager
.
itemStart
(
a
);
return
f
.
load
(
a
,
function
(){
c
.
manager
.
itemEnd
(
a
)})},
g
=
0
,
h
=
a
.
length
;
g
<
h
;
g
++
){
var
k
=
a
[
g
]
;
d
[
k
.
uuid
]
=
e
(
c
.
texturePath
+
k
.
url
)}}
return
d
},
new
THREE
.
Vector2
(
h
.
normalScale
,
h
.
normalScale
)));
void
0
!==
h
.
lightMap
&&
(
k
.
lightMap
=
d
(
h
.
lightMap
));
void
0
!==
h
.
specularMap
&&
(
k
.
specularMap
=
d
(
h
.
specularMap
));
c
[
h
.
uuid
]
=
k
}
return
c
},
parseImages
:
function
(
a
,
b
){
var
c
=
this
,
d
=
{};
if
(
void
0
!==
a
&&
0
<
a
.
length
){
var
e
=
new
THREE
.
LoadingManager
(
b
),
f
=
new
THREE
.
ImageLoader
(
e
);
f
.
setCrossOrigin
(
this
.
crossOrigin
);
for
(
var
e
=
function
(
a
){
c
.
manager
.
itemStart
(
a
);
return
f
.
load
(
a
,
function
(){
c
.
manager
.
itemEnd
(
a
)})},
g
=
0
,
h
=
a
.
length
;
g
<
h
;
g
++
){
var
k
=
a
[
g
]
,
l
=
/^
(\/\/)
|
([
a-z
]
+:
(\/\/)?)
/i
.
test
(
k
.
url
)?
parseTextures
:
function
(
a
,
b
){
var
c
=
{};
if
(
void
0
!==
a
)
for
(
var
d
=
0
,
e
=
a
.
length
;
d
<
e
;
d
++
){
var
f
=
a
[
d
];
void
0
===
f
.
image
&&
THREE
.
warn
(
'
THREE.ObjectLoader: No "image" speficied for
'
,
f
.
uuid
);
void
0
===
b
[
f
.
image
]
&&
THREE
.
warn
(
"
THREE.ObjectLoader: Undefined image
"
,
f
.
image
);
var
g
=
new
THREE
.
Texture
(
b
[
f
.
image
]);
g
.
needsUpdate
=!
0
;
g
.
uuid
=
f
.
uuid
;
void
0
!==
f
.
name
&&
(
g
.
name
=
f
.
name
);
void
0
!==
f
.
repeat
&&
(
g
.
repeat
=
new
THREE
.
Vector2
(
f
.
repeat
[
0
],
f
.
repeat
[
1
]));
void
0
!==
f
.
minFilter
&&
(
g
.
minFilter
=
THREE
[
f
.
minFilter
]);
void
0
!==
f
.
mag
Filter
&&
k
.
url
:
c
.
texturePath
+
k
.
url
;
d
[
k
.
uuid
]
=
e
(
l
)}}
return
d
},
parseTextures
:
function
(
a
,
b
){
var
c
=
{};
if
(
void
0
!==
a
)
for
(
var
d
=
0
,
e
=
a
.
length
;
d
<
e
;
d
++
){
var
f
=
a
[
d
];
void
0
===
f
.
image
&&
THREE
.
warn
(
'
THREE.ObjectLoader: No "image" speficied for
'
,
f
.
uuid
);
void
0
===
b
[
f
.
image
]
&&
THREE
.
warn
(
"
THREE.ObjectLoader: Undefined image
"
,
f
.
image
);
var
g
=
new
THREE
.
Texture
(
b
[
f
.
image
]);
g
.
needsUpdate
=!
0
;
g
.
uuid
=
f
.
uuid
;
void
0
!==
f
.
name
&&
(
g
.
name
=
f
.
name
);
void
0
!==
f
.
repeat
&&
(
g
.
repeat
=
new
THREE
.
Vector2
(
f
.
repeat
[
0
],
f
.
repeat
[
1
]));
void
0
!==
f
.
min
Filter
&&
(
g
.
m
agFilter
=
THREE
[
f
.
magFilter
]);
void
0
!==
f
.
anisotropy
&&
(
g
.
anisotropy
=
f
.
anisotropy
);
f
.
wrap
instanceof
Array
&&
(
g
.
wrapS
=
THREE
[
f
.
wrap
[
0
]],
g
.
wrapT
=
THREE
[
f
.
wrap
[
1
]]);
c
[
f
.
uuid
]
=
g
}
return
c
},
parseObject
:
function
(){
var
a
=
new
THREE
.
Matrix4
;
return
function
(
b
,
c
,
d
){
var
e
;
e
=
function
(
a
){
void
0
===
c
[
a
]
&&
THREE
.
warn
(
"
THREE.ObjectLoader: Undefined geometry
"
,
a
);
return
c
[
a
]};
var
f
=
function
(
a
){
void
0
===
d
[
a
]
&&
THREE
.
warn
(
"
THREE.ObjectLoader: Undefined material
"
,
a
);
return
d
[
a
]};
switch
(
b
.
type
){
case
"
Scene
"
:
e
=
new
THREE
.
Scene
;
(
g
.
m
inFilter
=
THREE
[
f
.
minFilter
]);
void
0
!==
f
.
magFilter
&&
(
g
.
magFilter
=
THREE
[
f
.
magFilter
]);
void
0
!==
f
.
anisotropy
&&
(
g
.
anisotropy
=
f
.
anisotropy
);
f
.
wrap
instanceof
Array
&&
(
g
.
wrapS
=
THREE
[
f
.
wrap
[
0
]],
g
.
wrapT
=
THREE
[
f
.
wrap
[
1
]]);
c
[
f
.
uuid
]
=
g
}
return
c
},
parseObject
:
function
(){
var
a
=
new
THREE
.
Matrix4
;
return
function
(
b
,
c
,
d
){
var
e
;
e
=
function
(
a
){
void
0
===
c
[
a
]
&&
THREE
.
warn
(
"
THREE.ObjectLoader: Undefined geometry
"
,
a
);
return
c
[
a
]};
var
f
=
function
(
a
){
void
0
===
d
[
a
]
&&
THREE
.
warn
(
"
THREE.ObjectLoader: Undefined material
"
,
a
);
return
d
[
a
]}
;
break
;
case
"
PerspectiveCamera
"
:
e
=
new
THREE
.
PerspectiveCamera
(
b
.
fov
,
b
.
aspect
,
b
.
near
,
b
.
far
);
break
;
case
"
OrthographicCamera
"
:
e
=
new
THREE
.
OrthographicCamera
(
b
.
left
,
b
.
right
,
b
.
top
,
b
.
bottom
,
b
.
near
,
b
.
far
);
break
;
case
"
AmbientLight
"
:
e
=
new
THREE
.
AmbientLight
(
b
.
color
);
break
;
case
"
DirectionalLight
"
:
e
=
new
THREE
.
DirectionalLight
(
b
.
color
,
b
.
intensity
);
break
;
case
"
PointLight
"
:
e
=
new
THREE
.
PointLight
(
b
.
color
,
b
.
intensity
,
b
.
distance
,
b
.
decay
);
break
;
case
"
SpotLight
"
:
e
=
new
THREE
.
SpotLight
(
b
.
color
,
b
.
intensity
,
b
.
distance
,
b
.
angle
,
switch
(
b
.
type
){
case
"
Scene
"
:
e
=
new
THREE
.
Scene
;
break
;
case
"
PerspectiveCamera
"
:
e
=
new
THREE
.
PerspectiveCamera
(
b
.
fov
,
b
.
aspect
,
b
.
near
,
b
.
far
);
break
;
case
"
OrthographicCamera
"
:
e
=
new
THREE
.
OrthographicCamera
(
b
.
left
,
b
.
right
,
b
.
top
,
b
.
bottom
,
b
.
near
,
b
.
far
);
break
;
case
"
AmbientLight
"
:
e
=
new
THREE
.
AmbientLight
(
b
.
color
);
break
;
case
"
DirectionalLight
"
:
e
=
new
THREE
.
DirectionalLight
(
b
.
color
,
b
.
intensity
);
break
;
case
"
PointLight
"
:
e
=
new
THREE
.
PointLight
(
b
.
color
,
b
.
intensity
,
b
.
distance
,
b
.
decay
);
break
;
case
"
SpotLight
"
:
e
=
new
THREE
.
SpotLight
(
b
.
color
,
b
.
exponent
,
b
.
decay
);
break
;
case
"
HemisphereLight
"
:
e
=
new
THREE
.
HemisphereLight
(
b
.
color
,
b
.
groundColor
,
b
.
intensity
);
break
;
case
"
Mesh
"
:
e
=
new
THREE
.
Mesh
(
e
(
b
.
geometry
),
f
(
b
.
material
));
break
;
case
"
Line
"
:
e
=
new
THREE
.
Line
(
e
(
b
.
geometry
),
f
(
b
.
material
));
break
;
case
"
PointCloud
"
:
e
=
new
THREE
.
PointCloud
(
e
(
b
.
geometry
),
f
(
b
.
material
));
break
;
case
"
Sprite
"
:
e
=
new
THREE
.
Sprite
(
f
(
b
.
material
));
break
;
case
"
Group
"
:
e
=
new
THREE
.
Group
;
break
;
default
:
e
=
new
THREE
.
Object3D
}
e
.
uuid
=
b
.
uuid
;
void
0
!==
b
.
name
&&
(
e
.
name
=
b
.
name
);
void
0
!==
b
.
matrix
?
b
.
intensity
,
b
.
distance
,
b
.
angle
,
b
.
exponent
,
b
.
decay
);
break
;
case
"
HemisphereLight
"
:
e
=
new
THREE
.
HemisphereLight
(
b
.
color
,
b
.
groundColor
,
b
.
intensity
);
break
;
case
"
Mesh
"
:
e
=
new
THREE
.
Mesh
(
e
(
b
.
geometry
),
f
(
b
.
material
));
break
;
case
"
Line
"
:
e
=
new
THREE
.
Line
(
e
(
b
.
geometry
),
f
(
b
.
material
));
break
;
case
"
PointCloud
"
:
e
=
new
THREE
.
PointCloud
(
e
(
b
.
geometry
),
f
(
b
.
material
));
break
;
case
"
Sprite
"
:
e
=
new
THREE
.
Sprite
(
f
(
b
.
material
));
break
;
case
"
Group
"
:
e
=
new
THREE
.
Group
;
break
;
default
:
e
=
new
THREE
.
Object3D
}
e
.
uuid
=
b
.
uuid
;
void
0
!==
b
.
name
&&
(
a
.
fromArray
(
b
.
matrix
),
a
.
decompose
(
e
.
position
,
e
.
quaternion
,
e
.
scale
)):(
void
0
!==
b
.
position
&&
e
.
position
.
fromArray
(
b
.
position
),
void
0
!==
b
.
rotation
&&
e
.
rotation
.
fromArray
(
b
.
rotation
),
void
0
!==
b
.
scale
&&
e
.
scale
.
fromArray
(
b
.
scale
));
void
0
!==
b
.
visible
&&
(
e
.
visible
=
b
.
visible
);
void
0
!==
b
.
userData
&&
(
e
.
userData
=
b
.
userData
);
if
(
void
0
!==
b
.
children
)
for
(
var
g
in
b
.
children
)
e
.
add
(
this
.
parseObject
(
b
.
children
[
g
],
c
,
d
));
return
e
}}()};
THREE
.
TextureLoader
=
function
(
a
){
this
.
manager
=
void
0
!==
a
?
a
:
THREE
.
DefaultLoadingManager
};
(
e
.
name
=
b
.
name
);
void
0
!==
b
.
matrix
?(
a
.
fromArray
(
b
.
matrix
),
a
.
decompose
(
e
.
position
,
e
.
quaternion
,
e
.
scale
)):(
void
0
!==
b
.
position
&&
e
.
position
.
fromArray
(
b
.
position
),
void
0
!==
b
.
rotation
&&
e
.
rotation
.
fromArray
(
b
.
rotation
),
void
0
!==
b
.
scale
&&
e
.
scale
.
fromArray
(
b
.
scale
));
void
0
!==
b
.
visible
&&
(
e
.
visible
=
b
.
visible
);
void
0
!==
b
.
userData
&&
(
e
.
userData
=
b
.
userData
);
if
(
void
0
!==
b
.
children
)
for
(
var
g
in
b
.
children
)
e
.
add
(
this
.
parseObject
(
b
.
children
[
g
],
c
,
d
));
return
e
}}()
};
THREE
.
TextureLoader
.
prototype
=
{
constructor
:
THREE
.
TextureLoader
,
load
:
function
(
a
,
b
,
c
,
d
){
var
e
=
new
THREE
.
ImageLoader
(
this
.
manager
);
e
.
setCrossOrigin
(
this
.
crossOrigin
);
e
.
load
(
a
,
function
(
a
){
a
=
new
THREE
.
Texture
(
a
);
a
.
needsUpdate
=!
0
;
void
0
!==
b
&&
b
(
a
)},
c
,
d
)},
setCrossOrigin
:
function
(
a
){
this
.
crossOrigin
=
a
}};
THREE
.
DataTextureLoader
=
THREE
.
BinaryTextureLoader
=
function
(){
this
.
_parser
=
null
};
THREE
.
TextureLoader
=
function
(
a
){
this
.
manager
=
void
0
!==
a
?
a
:
THREE
.
DefaultLoadingManager
};
THREE
.
TextureLoader
.
prototype
=
{
constructor
:
THREE
.
TextureLoader
,
load
:
function
(
a
,
b
,
c
,
d
){
var
e
=
new
THREE
.
ImageLoader
(
this
.
manager
);
e
.
setCrossOrigin
(
this
.
crossOrigin
);
e
.
load
(
a
,
function
(
a
){
a
=
new
THREE
.
Texture
(
a
);
a
.
needsUpdate
=!
0
;
void
0
!==
b
&&
b
(
a
)},
c
,
d
)},
setCrossOrigin
:
function
(
a
){
this
.
crossOrigin
=
a
}};
THREE
.
DataTextureLoader
=
THREE
.
BinaryTextureLoader
=
function
(){
this
.
_parser
=
null
};
THREE
.
BinaryTextureLoader
.
prototype
=
{
constructor
:
THREE
.
BinaryTextureLoader
,
load
:
function
(
a
,
b
,
c
,
d
){
var
e
=
this
,
f
=
new
THREE
.
DataTexture
,
g
=
new
THREE
.
XHRLoader
;
g
.
setResponseType
(
"
arraybuffer
"
);
g
.
load
(
a
,
function
(
a
){
if
(
a
=
e
.
_parser
(
a
))
void
0
!==
a
.
image
?
f
.
image
=
a
.
image
:
void
0
!==
a
.
data
&&
(
f
.
image
.
width
=
a
.
width
,
f
.
image
.
height
=
a
.
height
,
f
.
image
.
data
=
a
.
data
),
f
.
wrapS
=
void
0
!==
a
.
wrapS
?
a
.
wrapS
:
THREE
.
ClampToEdgeWrapping
,
f
.
wrapT
=
void
0
!==
a
.
wrapT
?
a
.
wrapT
:
THREE
.
ClampToEdgeWrapping
,
f
.
magFilter
=
void
0
!==
a
.
magFilter
?
a
.
magFilter
:
THREE
.
BinaryTextureLoader
.
prototype
=
{
constructor
:
THREE
.
BinaryTextureLoader
,
load
:
function
(
a
,
b
,
c
,
d
){
var
e
=
this
,
f
=
new
THREE
.
DataTexture
,
g
=
new
THREE
.
XHRLoader
;
g
.
setResponseType
(
"
arraybuffer
"
);
g
.
load
(
a
,
function
(
a
){
if
(
a
=
e
.
_parser
(
a
))
void
0
!==
a
.
image
?
f
.
image
=
a
.
image
:
void
0
!==
a
.
data
&&
(
f
.
image
.
width
=
a
.
width
,
f
.
image
.
height
=
a
.
height
,
f
.
image
.
data
=
a
.
data
),
f
.
wrapS
=
void
0
!==
a
.
wrapS
?
a
.
wrapS
:
THREE
.
ClampToEdgeWrapping
,
f
.
wrapT
=
void
0
!==
a
.
wrapT
?
a
.
wrapT
:
THREE
.
ClampToEdgeWrapping
,
f
.
magFilter
=
void
0
!==
a
.
magFilter
?
a
.
magFilter
:
THREE
.
LinearFilter
,
f
.
minFilter
=
void
0
!==
a
.
minFilter
?
a
.
minFilter
:
THREE
.
LinearMipMapLinearFilter
,
f
.
anisotropy
=
void
0
!==
a
.
anisotropy
?
a
.
anisotropy
:
1
,
void
0
!==
a
.
format
&&
(
f
.
format
=
a
.
format
),
void
0
!==
a
.
type
&&
(
f
.
type
=
a
.
type
),
void
0
!==
a
.
mipmaps
&&
(
f
.
mipmaps
=
a
.
mipmaps
),
1
===
a
.
mipmapCount
&&
(
f
.
minFilter
=
THREE
.
LinearFilter
),
f
.
needsUpdate
=!
0
,
b
&&
b
(
f
,
a
)},
c
,
d
);
return
f
}};
THREE
.
CompressedTextureLoader
=
function
(){
this
.
_parser
=
null
};
THREE
.
LinearFilter
,
f
.
minFilter
=
void
0
!==
a
.
minFilter
?
a
.
minFilter
:
THREE
.
LinearMipMapLinearFilter
,
f
.
anisotropy
=
void
0
!==
a
.
anisotropy
?
a
.
anisotropy
:
1
,
void
0
!==
a
.
format
&&
(
f
.
format
=
a
.
format
),
void
0
!==
a
.
type
&&
(
f
.
type
=
a
.
type
),
void
0
!==
a
.
mipmaps
&&
(
f
.
mipmaps
=
a
.
mipmaps
),
1
===
a
.
mipmapCount
&&
(
f
.
minFilter
=
THREE
.
LinearFilter
),
f
.
needsUpdate
=!
0
,
b
&&
b
(
f
,
a
)},
c
,
d
);
return
f
}};
THREE
.
CompressedTextureLoader
=
function
(){
this
.
_parser
=
null
};
THREE
.
CompressedTextureLoader
.
prototype
=
{
constructor
:
THREE
.
CompressedTextureLoader
,
load
:
function
(
a
,
b
,
c
){
var
d
=
this
,
e
=
[],
f
=
new
THREE
.
CompressedTexture
;
f
.
image
=
e
;
var
g
=
new
THREE
.
XHRLoader
;
g
.
setResponseType
(
"
arraybuffer
"
);
if
(
a
instanceof
Array
){
var
h
=
0
;
c
=
function
(
c
){
g
.
load
(
a
[
c
],
function
(
a
){
a
=
d
.
_parser
(
a
,
!
0
);
e
[
c
]
=
{
width
:
a
.
width
,
height
:
a
.
height
,
format
:
a
.
format
,
mipmaps
:
a
.
mipmaps
};
h
+=
1
;
6
===
h
&&
(
1
==
a
.
mipmapCount
&&
(
f
.
minFilter
=
THREE
.
LinearFilter
),
f
.
format
=
a
.
format
,
f
.
needsUpdate
=!
0
,
b
&&
b
(
f
))})};
for
(
var
k
=
0
,
l
=
THREE
.
CompressedTextureLoader
.
prototype
=
{
constructor
:
THREE
.
CompressedTextureLoader
,
load
:
function
(
a
,
b
,
c
){
var
d
=
this
,
e
=
[],
f
=
new
THREE
.
CompressedTexture
;
f
.
image
=
e
;
var
g
=
new
THREE
.
XHRLoader
;
g
.
setResponseType
(
"
arraybuffer
"
);
if
(
a
instanceof
Array
){
var
h
=
0
;
c
=
function
(
c
){
g
.
load
(
a
[
c
],
function
(
a
){
a
=
d
.
_parser
(
a
,
!
0
);
e
[
c
]
=
{
width
:
a
.
width
,
height
:
a
.
height
,
format
:
a
.
format
,
mipmaps
:
a
.
mipmaps
};
h
+=
1
;
6
===
h
&&
(
1
==
a
.
mipmapCount
&&
(
f
.
minFilter
=
THREE
.
LinearFilter
),
f
.
format
=
a
.
format
,
f
.
needsUpdate
=!
0
,
b
&&
b
(
f
))})};
for
(
var
k
=
0
,
l
=
...
@@ -387,10 +387,10 @@ THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),th
...
@@ -387,10 +387,10 @@ THREE.Fog.prototype.clone=function(){return new THREE.Fog(this.color.getHex(),th
THREE
.
ShaderChunk
.
alphatest_fragment
=
"
#ifdef ALPHATEST
\n\n\t
if ( gl_FragColor.a < ALPHATEST ) discard;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
lights_lambert_vertex
=
"
vLightFront = vec3( 0.0 );
\n\n
#ifdef DOUBLE_SIDED
\n\n\t
vLightBack = vec3( 0.0 );
\n\n
#endif
\n\n
transformedNormal = normalize( transformedNormal );
\n\n
#if MAX_DIR_LIGHTS > 0
\n\n
for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {
\n\n\t
vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );
\n\n\t
float dotProduct = dot( transformedNormal, dirVector );
\n\t
vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );
\n\n\t
#ifdef DOUBLE_SIDED
\n\n\t\t
vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );
\n\n\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t
vec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );
\n\n\t\t
#endif
\n\n\t
#endif
\n\n\t
#ifdef WRAP_AROUND
\n\n\t\t
vec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );
\n\t\t
directionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );
\n\n\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t
directionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );
\n\n\t\t
#endif
\n\n\t
#endif
\n\n\t
vLightFront += directionalLightColor[ i ] * directionalLightWeighting;
\n\n\t
#ifdef DOUBLE_SIDED
\n\n\t\t
vLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;
\n\n\t
#endif
\n\n
}
\n\n
#endif
\n\n
#if MAX_POINT_LIGHTS > 0
\n\n\t
for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {
\n\n\t\t
vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );
\n\t\t
vec3 lVector = lPosition.xyz - mvPosition.xyz;
\n\n\t\t
float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );
\n\n\t\t
lVector = normalize( lVector );
\n\t\t
float dotProduct = dot( transformedNormal, lVector );
\n\n\t\t
vec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );
\n\n\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t
vec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );
\n\n\t\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t\t
vec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );
\n\n\t\t\t
#endif
\n\n\t\t
#endif
\n\n\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t
vec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );
\n\t\t\t
pointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );
\n\n\t\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t\t
pointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );
\n\n\t\t\t
#endif
\n\n\t\t
#endif
\n\n\t\t
vLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;
\n\n\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t
vLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;
\n\n\t\t
#endif
\n\n\t
}
\n\n
#endif
\n\n
#if MAX_SPOT_LIGHTS > 0
\n\n\t
for( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {
\n\n\t\t
vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );
\n\t\t
vec3 lVector = lPosition.xyz - mvPosition.xyz;
\n\n\t\t
float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );
\n\n\t\t
if ( spotEffect > spotLightAngleCos[ i ] ) {
\n\n\t\t\t
spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );
\n\n\t\t\t
float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );
\n\n\t\t\t
lVector = normalize( lVector );
\n\n\t\t\t
float dotProduct = dot( transformedNormal, lVector );
\n\t\t\t
vec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );
\n\n\t\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t\t
vec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );
\n\n\t\t\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t\t\t
vec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );
\n\n\t\t\t\t
#endif
\n\n\t\t\t
#endif
\n\n\t\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t\t
vec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );
\n\t\t\t\t
spotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );
\n\n\t\t\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t\t\t
spotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );
\n\n\t\t\t\t
#endif
\n\n\t\t\t
#endif
\n\n\t\t\t
vLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;
\n\n\t\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t\t
vLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;
\n\n\t\t\t
#endif
\n\n\t\t
}
\n\n\t
}
\n\n
#endif
\n\n
#if MAX_HEMI_LIGHTS > 0
\n\n\t
for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {
\n\n\t\t
vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );
\n\n\t\t
float dotProduct = dot( transformedNormal, lVector );
\n\n\t\t
float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;
\n\t\t
float hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;
\n\n\t\t
vLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );
\n\n\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t
vLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );
\n\n\t\t
#endif
\n\n\t
}
\n\n
#endif
\n\n
vLightFront = vLightFront * diffuse + diffuse * ambientLightColor + emissive;
\n\n
#ifdef DOUBLE_SIDED
\n\n\t
vLightBack = vLightBack * diffuse + diffuse * ambientLightColor + emissive;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
alphatest_fragment
=
"
#ifdef ALPHATEST
\n\n\t
if ( gl_FragColor.a < ALPHATEST ) discard;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
lights_lambert_vertex
=
"
vLightFront = vec3( 0.0 );
\n\n
#ifdef DOUBLE_SIDED
\n\n\t
vLightBack = vec3( 0.0 );
\n\n
#endif
\n\n
transformedNormal = normalize( transformedNormal );
\n\n
#if MAX_DIR_LIGHTS > 0
\n\n
for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {
\n\n\t
vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );
\n\n\t
float dotProduct = dot( transformedNormal, dirVector );
\n\t
vec3 directionalLightWeighting = vec3( max( dotProduct, 0.0 ) );
\n\n\t
#ifdef DOUBLE_SIDED
\n\n\t\t
vec3 directionalLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );
\n\n\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t
vec3 directionalLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );
\n\n\t\t
#endif
\n\n\t
#endif
\n\n\t
#ifdef WRAP_AROUND
\n\n\t\t
vec3 directionalLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );
\n\t\t
directionalLightWeighting = mix( directionalLightWeighting, directionalLightWeightingHalf, wrapRGB );
\n\n\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t
directionalLightWeightingBack = mix( directionalLightWeightingBack, directionalLightWeightingHalfBack, wrapRGB );
\n\n\t\t
#endif
\n\n\t
#endif
\n\n\t
vLightFront += directionalLightColor[ i ] * directionalLightWeighting;
\n\n\t
#ifdef DOUBLE_SIDED
\n\n\t\t
vLightBack += directionalLightColor[ i ] * directionalLightWeightingBack;
\n\n\t
#endif
\n\n
}
\n\n
#endif
\n\n
#if MAX_POINT_LIGHTS > 0
\n\n\t
for( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {
\n\n\t\t
vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );
\n\t\t
vec3 lVector = lPosition.xyz - mvPosition.xyz;
\n\n\t\t
float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );
\n\n\t\t
lVector = normalize( lVector );
\n\t\t
float dotProduct = dot( transformedNormal, lVector );
\n\n\t\t
vec3 pointLightWeighting = vec3( max( dotProduct, 0.0 ) );
\n\n\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t
vec3 pointLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );
\n\n\t\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t\t
vec3 pointLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );
\n\n\t\t\t
#endif
\n\n\t\t
#endif
\n\n\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t
vec3 pointLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );
\n\t\t\t
pointLightWeighting = mix( pointLightWeighting, pointLightWeightingHalf, wrapRGB );
\n\n\t\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t\t
pointLightWeightingBack = mix( pointLightWeightingBack, pointLightWeightingHalfBack, wrapRGB );
\n\n\t\t\t
#endif
\n\n\t\t
#endif
\n\n\t\t
vLightFront += pointLightColor[ i ] * pointLightWeighting * attenuation;
\n\n\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t
vLightBack += pointLightColor[ i ] * pointLightWeightingBack * attenuation;
\n\n\t\t
#endif
\n\n\t
}
\n\n
#endif
\n\n
#if MAX_SPOT_LIGHTS > 0
\n\n\t
for( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {
\n\n\t\t
vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );
\n\t\t
vec3 lVector = lPosition.xyz - mvPosition.xyz;
\n\n\t\t
float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - worldPosition.xyz ) );
\n\n\t\t
if ( spotEffect > spotLightAngleCos[ i ] ) {
\n\n\t\t\t
spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );
\n\n\t\t\t
float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );
\n\n\t\t\t
lVector = normalize( lVector );
\n\n\t\t\t
float dotProduct = dot( transformedNormal, lVector );
\n\t\t\t
vec3 spotLightWeighting = vec3( max( dotProduct, 0.0 ) );
\n\n\t\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t\t
vec3 spotLightWeightingBack = vec3( max( -dotProduct, 0.0 ) );
\n\n\t\t\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t\t\t
vec3 spotLightWeightingHalfBack = vec3( max( -0.5 * dotProduct + 0.5, 0.0 ) );
\n\n\t\t\t\t
#endif
\n\n\t\t\t
#endif
\n\n\t\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t\t
vec3 spotLightWeightingHalf = vec3( max( 0.5 * dotProduct + 0.5, 0.0 ) );
\n\t\t\t\t
spotLightWeighting = mix( spotLightWeighting, spotLightWeightingHalf, wrapRGB );
\n\n\t\t\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t\t\t
spotLightWeightingBack = mix( spotLightWeightingBack, spotLightWeightingHalfBack, wrapRGB );
\n\n\t\t\t\t
#endif
\n\n\t\t\t
#endif
\n\n\t\t\t
vLightFront += spotLightColor[ i ] * spotLightWeighting * attenuation * spotEffect;
\n\n\t\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t\t
vLightBack += spotLightColor[ i ] * spotLightWeightingBack * attenuation * spotEffect;
\n\n\t\t\t
#endif
\n\n\t\t
}
\n\n\t
}
\n\n
#endif
\n\n
#if MAX_HEMI_LIGHTS > 0
\n\n\t
for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {
\n\n\t\t
vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );
\n\n\t\t
float dotProduct = dot( transformedNormal, lVector );
\n\n\t\t
float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;
\n\t\t
float hemiDiffuseWeightBack = -0.5 * dotProduct + 0.5;
\n\n\t\t
vLightFront += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );
\n\n\t\t
#ifdef DOUBLE_SIDED
\n\n\t\t\t
vLightBack += mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeightBack );
\n\n\t\t
#endif
\n\n\t
}
\n\n
#endif
\n\n
vLightFront = vLightFront * diffuse + diffuse * ambientLightColor + emissive;
\n\n
#ifdef DOUBLE_SIDED
\n\n\t
vLightBack = vLightBack * diffuse + diffuse * ambientLightColor + emissive;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
map_particle_pars_fragment
=
"
#ifdef USE_MAP
\n\n\t
uniform vec4 offsetRepeat;
\n\t
uniform sampler2D map;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
default_vertex
=
"
#ifdef USE_SKINNING
\n\n\t
vec4 mvPosition = modelViewMatrix * skinned;
\n\n
#elif defined( USE_MORPHTARGETS )
\n\n\t
vec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );
\n\n
#else
\n\n\t
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
\n\n
#endif
\n\n
gl_Position = projectionMatrix * mvPosition;
\n
"
;
THREE
.
ShaderChunk
.
map_particle_pars_fragment
=
"
#ifdef USE_MAP
\n\n\t
uniform vec4 offsetRepeat;
\n\t
uniform sampler2D map;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
default_vertex
=
"
#ifdef USE_SKINNING
\n\n\t
vec4 mvPosition = modelViewMatrix * skinned;
\n\n
#elif defined( USE_MORPHTARGETS )
\n\n\t
vec4 mvPosition = modelViewMatrix * vec4( morphed, 1.0 );
\n\n
#else
\n\n\t
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
\n\n
#endif
\n\n
gl_Position = projectionMatrix * mvPosition;
\n
"
;
THREE
.
ShaderChunk
.
map_pars_fragment
=
"
#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )
\n\n\t
varying vec2 vUv;
\n\n
#endif
\n\n
#ifdef USE_MAP
\n\n\t
uniform sampler2D map;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
skinnormal_vertex
=
"
#ifdef USE_SKINNING
\n\n\t
mat4 skinMatrix = mat4( 0.0 );
\n\t
skinMatrix += skinWeight.x * boneMatX;
\n\t
skinMatrix += skinWeight.y * boneMatY;
\n\t
skinMatrix += skinWeight.z * boneMatZ;
\n\t
skinMatrix += skinWeight.w * boneMatW;
\n\t
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
\n\n\t
#ifdef USE_MORPHNORMALS
\n\n\t
vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );
\n\n\t
#else
\n\n\t
vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );
\n\n\t
#endif
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
map_pars_fragment
=
"
#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )
\n\n\t
varying vec2 vUv;
\n\n
#endif
\n\n
#ifdef USE_MAP
\n\n\t
uniform sampler2D map;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
skinnormal_vertex
=
"
#ifdef USE_SKINNING
\n\n\t
mat4 skinMatrix = mat4( 0.0 );
\n\t
skinMatrix += skinWeight.x * boneMatX;
\n\t
skinMatrix += skinWeight.y * boneMatY;
\n\t
skinMatrix += skinWeight.z * boneMatZ;
\n\t
skinMatrix += skinWeight.w * boneMatW;
\n\t
skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
\n\n\t
#ifdef USE_MORPHNORMALS
\n\n\t
vec4 skinnedNormal = skinMatrix * vec4( morphedNormal, 0.0 );
\n\n\t
#else
\n\n\t
vec4 skinnedNormal = skinMatrix * vec4( normal, 0.0 );
\n\n\t
#endif
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
logdepthbuf_pars_vertex
=
"
#ifdef USE_LOGDEPTHBUF
\n\n\t
#ifdef USE_LOGDEPTHBUF_EXT
\n\n\t\t
varying float vFragDepth;
\n\n\t
#endif
\n\n\t
uniform float logDepthBufFC;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
lightmap_pars_vertex
=
"
#ifdef USE_LIGHTMAP
\n\n\t
varying vec2 vUv2;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
lights_phong_fragment
=
"
#ifndef FLAT_SHADED
\n\n\t
vec3 normal = normalize( vNormal );
\n\n
#else
\n\n\t
vec3 fdx = dFdx( vViewPosition );
\n\t
vec3 fdy = dFdy( vViewPosition );
\n\t
vec3 normal = normalize( cross( fdx, fdy ) );
\n\n
#endif
\n\n
vec3 viewPosition = normalize( vViewPosition );
\n\n
#ifdef DOUBLE_SIDED
\n\n\t
normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );
\n\n
#endif
\n\n
#ifdef USE_NORMALMAP
\n\n\t
normal = perturbNormal2Arb( -vViewPosition, normal );
\n\n
#elif defined( USE_BUMPMAP )
\n\n\t
normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );
\n\n
#endif
\n\n
#if MAX_POINT_LIGHTS > 0
\n\n\t
vec3 pointDiffuse = vec3( 0.0 );
\n\t
vec3 pointSpecular = vec3( 0.0 );
\n\n\t
for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {
\n\n\t\t
vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );
\n\t\t
vec3 lVector = lPosition.xyz + vViewPosition.xyz;
\n\n\t\t
float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );
\n\n\t\t
lVector = normalize( lVector );
\n\n\t\t\t\t
// diffuse
\n\n\t\t
float dotProduct = dot( normal, lVector );
\n\n\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t
float pointDiffuseWeightFull = max( dotProduct, 0.0 );
\n\t\t\t
float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );
\n\n\t\t\t
vec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );
\n\n\t\t
#else
\n\n\t\t\t
float pointDiffuseWeight = max( dotProduct, 0.0 );
\n\n\t\t
#endif
\n\n\t\t
pointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * attenuation;
\n\n\t\t\t\t
// specular
\n\n\t\t
vec3 pointHalfVector = normalize( lVector + viewPosition );
\n\t\t
float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );
\n\t\t
float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );
\n\n\t\t
float specularNormalization = ( shininess + 2.0 ) / 8.0;
\n\n\t\t
vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );
\n\t\t
pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;
\n\n\t
}
\n\n
#endif
\n\n
#if MAX_SPOT_LIGHTS > 0
\n\n\t
vec3 spotDiffuse = vec3( 0.0 );
\n\t
vec3 spotSpecular = vec3( 0.0 );
\n\n\t
for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {
\n\n\t\t
vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );
\n\t\t
vec3 lVector = lPosition.xyz + vViewPosition.xyz;
\n\n\t\t
float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );
\n\n\t\t
lVector = normalize( lVector );
\n\n\t\t
float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );
\n\n\t\t
if ( spotEffect > spotLightAngleCos[ i ] ) {
\n\n\t\t\t
spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );
\n\n\t\t\t\t\t
// diffuse
\n\n\t\t\t
float dotProduct = dot( normal, lVector );
\n\n\t\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t\t
float spotDiffuseWeightFull = max( dotProduct, 0.0 );
\n\t\t\t\t
float spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );
\n\n\t\t\t\t
vec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );
\n\n\t\t\t
#else
\n\n\t\t\t\t
float spotDiffuseWeight = max( dotProduct, 0.0 );
\n\n\t\t\t
#endif
\n\n\t\t\t
spotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;
\n\n\t\t\t\t\t
// specular
\n\n\t\t\t
vec3 spotHalfVector = normalize( lVector + viewPosition );
\n\t\t\t
float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );
\n\t\t\t
float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );
\n\n\t\t\t
float specularNormalization = ( shininess + 2.0 ) / 8.0;
\n\n\t\t\t
vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );
\n\t\t\t
spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;
\n\n\t\t
}
\n\n\t
}
\n\n
#endif
\n\n
#if MAX_DIR_LIGHTS > 0
\n\n\t
vec3 dirDiffuse = vec3( 0.0 );
\n\t
vec3 dirSpecular = vec3( 0.0 );
\n\n\t
for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {
\n\n\t\t
vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );
\n\n\t\t\t\t
// diffuse
\n\n\t\t
float dotProduct = dot( normal, dirVector );
\n\n\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t
float dirDiffuseWeightFull = max( dotProduct, 0.0 );
\n\t\t\t
float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );
\n\n\t\t\t
vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );
\n\n\t\t
#else
\n\n\t\t\t
float dirDiffuseWeight = max( dotProduct, 0.0 );
\n\n\t\t
#endif
\n\n\t\t
dirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;
\n\n\t\t
// specular
\n\n\t\t
vec3 dirHalfVector = normalize( dirVector + viewPosition );
\n\t\t
float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );
\n\t\t
float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );
\n\n\t\t
/*
\n\t\t
// fresnel term from skin shader
\n\t\t
const float F0 = 0.128;
\n\n\t\t
float base = 1.0 - dot( viewPosition, dirHalfVector );
\n\t\t
float exponential = pow( base, 5.0 );
\n\n\t\t
float fresnel = exponential + F0 * ( 1.0 - exponential );
\n\t\t
*/
\n\n\t\t
/*
\n\t\t
// fresnel term from fresnel shader
\n\t\t
const float mFresnelBias = 0.08;
\n\t\t
const float mFresnelScale = 0.3;
\n\t\t
const float mFresnelPower = 5.0;
\n\n\t\t
float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );
\n\t\t
*/
\n\n\t\t
float specularNormalization = ( shininess + 2.0 ) / 8.0;
\n\n\t\t
//
\t\t
dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;
\n\n\t\t
vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );
\n\t\t
dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;
\n\n\n\t
}
\n\n
#endif
\n\n
#if MAX_HEMI_LIGHTS > 0
\n\n\t
vec3 hemiDiffuse = vec3( 0.0 );
\n\t
vec3 hemiSpecular = vec3( 0.0 );
\n\n\t
for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {
\n\n\t\t
vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );
\n\n\t\t
// diffuse
\n\n\t\t
float dotProduct = dot( normal, lVector );
\n\t\t
float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;
\n\n\t\t
vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );
\n\n\t\t
hemiDiffuse += diffuse * hemiColor;
\n\n\t\t
// specular (sky light)
\n\n\t\t
vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );
\n\t\t
float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;
\n\t\t
float hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );
\n\n\t\t
// specular (ground light)
\n\n\t\t
vec3 lVectorGround = -lVector;
\n\n\t\t
vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );
\n\t\t
float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;
\n\t\t
float hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );
\n\n\t\t
float dotProductGround = dot( normal, lVectorGround );
\n\n\t\t
float specularNormalization = ( shininess + 2.0 ) / 8.0;
\n\n\t\t
vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );
\n\t\t
vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );
\n\t\t
hemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );
\n\n\t
}
\n\n
#endif
\n\n
vec3 totalDiffuse = vec3( 0.0 );
\n
vec3 totalSpecular = vec3( 0.0 );
\n\n
#if MAX_DIR_LIGHTS > 0
\n\n\t
totalDiffuse += dirDiffuse;
\n\t
totalSpecular += dirSpecular;
\n\n
#endif
\n\n
#if MAX_HEMI_LIGHTS > 0
\n\n\t
totalDiffuse += hemiDiffuse;
\n\t
totalSpecular += hemiSpecular;
\n\n
#endif
\n\n
#if MAX_POINT_LIGHTS > 0
\n\n\t
totalDiffuse += pointDiffuse;
\n\t
totalSpecular += pointSpecular;
\n\n
#endif
\n\n
#if MAX_SPOT_LIGHTS > 0
\n\n\t
totalDiffuse += spotDiffuse;
\n\t
totalSpecular += spotSpecular;
\n\n
#endif
\n\n
#ifdef METAL
\n\n\t
gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * diffuse + totalSpecular );
\n\n
#else
\n\n\t
gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * diffuse ) + totalSpecular;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
logdepthbuf_pars_vertex
=
"
#ifdef USE_LOGDEPTHBUF
\n\n\t
#ifdef USE_LOGDEPTHBUF_EXT
\n\n\t\t
varying float vFragDepth;
\n\n\t
#endif
\n\n\t
uniform float logDepthBufFC;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
lightmap_pars_vertex
=
"
#ifdef USE_LIGHTMAP
\n\n\t
varying vec2 vUv2;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
lights_phong_fragment
=
"
#ifndef FLAT_SHADED
\n\n\t
vec3 normal = normalize( vNormal );
\n\n
\t
#ifdef DOUBLE_SIDED
\n\n\t\t
normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );
\n\n\t
#endif
\n\n
#else
\n\n\t
vec3 fdx = dFdx( vViewPosition );
\n\t
vec3 fdy = dFdy( vViewPosition );
\n\t
vec3 normal = normalize( cross( fdx, fdy ) );
\n\n
#endif
\n\n
vec3 viewPosition = normalize( vViewPosition );
\n\n
#ifdef USE_NORMALMAP
\n\n\t
normal = perturbNormal2Arb( -vViewPosition, normal );
\n\n
#elif defined( USE_BUMPMAP )
\n\n\t
normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );
\n\n
#endif
\n\n
#if MAX_POINT_LIGHTS > 0
\n\n\t
vec3 pointDiffuse = vec3( 0.0 );
\n\t
vec3 pointSpecular = vec3( 0.0 );
\n\n\t
for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {
\n\n\t\t
vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );
\n\t\t
vec3 lVector = lPosition.xyz + vViewPosition.xyz;
\n\n\t\t
float attenuation = calcLightAttenuation( length( lVector ), pointLightDistance[ i ], pointLightDecay[ i ] );
\n\n\t\t
lVector = normalize( lVector );
\n\n\t\t\t\t
// diffuse
\n\n\t\t
float dotProduct = dot( normal, lVector );
\n\n\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t
float pointDiffuseWeightFull = max( dotProduct, 0.0 );
\n\t\t\t
float pointDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );
\n\n\t\t\t
vec3 pointDiffuseWeight = mix( vec3( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );
\n\n\t\t
#else
\n\n\t\t\t
float pointDiffuseWeight = max( dotProduct, 0.0 );
\n\n\t\t
#endif
\n\n\t\t
pointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * attenuation;
\n\n\t\t\t\t
// specular
\n\n\t\t
vec3 pointHalfVector = normalize( lVector + viewPosition );
\n\t\t
float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );
\n\t\t
float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );
\n\n\t\t
float specularNormalization = ( shininess + 2.0 ) / 8.0;
\n\n\t\t
vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );
\n\t\t
pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * attenuation * specularNormalization;
\n\n\t
}
\n\n
#endif
\n\n
#if MAX_SPOT_LIGHTS > 0
\n\n\t
vec3 spotDiffuse = vec3( 0.0 );
\n\t
vec3 spotSpecular = vec3( 0.0 );
\n\n\t
for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {
\n\n\t\t
vec4 lPosition = viewMatrix * vec4( spotLightPosition[ i ], 1.0 );
\n\t\t
vec3 lVector = lPosition.xyz + vViewPosition.xyz;
\n\n\t\t
float attenuation = calcLightAttenuation( length( lVector ), spotLightDistance[ i ], spotLightDecay[ i ] );
\n\n\t\t
lVector = normalize( lVector );
\n\n\t\t
float spotEffect = dot( spotLightDirection[ i ], normalize( spotLightPosition[ i ] - vWorldPosition ) );
\n\n\t\t
if ( spotEffect > spotLightAngleCos[ i ] ) {
\n\n\t\t\t
spotEffect = max( pow( max( spotEffect, 0.0 ), spotLightExponent[ i ] ), 0.0 );
\n\n\t\t\t\t\t
// diffuse
\n\n\t\t\t
float dotProduct = dot( normal, lVector );
\n\n\t\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t\t
float spotDiffuseWeightFull = max( dotProduct, 0.0 );
\n\t\t\t\t
float spotDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );
\n\n\t\t\t\t
vec3 spotDiffuseWeight = mix( vec3( spotDiffuseWeightFull ), vec3( spotDiffuseWeightHalf ), wrapRGB );
\n\n\t\t\t
#else
\n\n\t\t\t\t
float spotDiffuseWeight = max( dotProduct, 0.0 );
\n\n\t\t\t
#endif
\n\n\t\t\t
spotDiffuse += diffuse * spotLightColor[ i ] * spotDiffuseWeight * attenuation * spotEffect;
\n\n\t\t\t\t\t
// specular
\n\n\t\t\t
vec3 spotHalfVector = normalize( lVector + viewPosition );
\n\t\t\t
float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );
\n\t\t\t
float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );
\n\n\t\t\t
float specularNormalization = ( shininess + 2.0 ) / 8.0;
\n\n\t\t\t
vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );
\n\t\t\t
spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * attenuation * specularNormalization * spotEffect;
\n\n\t\t
}
\n\n\t
}
\n\n
#endif
\n\n
#if MAX_DIR_LIGHTS > 0
\n\n\t
vec3 dirDiffuse = vec3( 0.0 );
\n\t
vec3 dirSpecular = vec3( 0.0 );
\n\n\t
for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {
\n\n\t\t
vec3 dirVector = transformDirection( directionalLightDirection[ i ], viewMatrix );
\n\n\t\t\t\t
// diffuse
\n\n\t\t
float dotProduct = dot( normal, dirVector );
\n\n\t\t
#ifdef WRAP_AROUND
\n\n\t\t\t
float dirDiffuseWeightFull = max( dotProduct, 0.0 );
\n\t\t\t
float dirDiffuseWeightHalf = max( 0.5 * dotProduct + 0.5, 0.0 );
\n\n\t\t\t
vec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );
\n\n\t\t
#else
\n\n\t\t\t
float dirDiffuseWeight = max( dotProduct, 0.0 );
\n\n\t\t
#endif
\n\n\t\t
dirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;
\n\n\t\t
// specular
\n\n\t\t
vec3 dirHalfVector = normalize( dirVector + viewPosition );
\n\t\t
float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );
\n\t\t
float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );
\n\n\t\t
/*
\n\t\t
// fresnel term from skin shader
\n\t\t
const float F0 = 0.128;
\n\n\t\t
float base = 1.0 - dot( viewPosition, dirHalfVector );
\n\t\t
float exponential = pow( base, 5.0 );
\n\n\t\t
float fresnel = exponential + F0 * ( 1.0 - exponential );
\n\t\t
*/
\n\n\t\t
/*
\n\t\t
// fresnel term from fresnel shader
\n\t\t
const float mFresnelBias = 0.08;
\n\t\t
const float mFresnelScale = 0.3;
\n\t\t
const float mFresnelPower = 5.0;
\n\n\t\t
float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );
\n\t\t
*/
\n\n\t\t
float specularNormalization = ( shininess + 2.0 ) / 8.0;
\n\n\t\t
//
\t\t
dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;
\n\n\t\t
vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );
\n\t\t
dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;
\n\n\n\t
}
\n\n
#endif
\n\n
#if MAX_HEMI_LIGHTS > 0
\n\n\t
vec3 hemiDiffuse = vec3( 0.0 );
\n\t
vec3 hemiSpecular = vec3( 0.0 );
\n\n\t
for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {
\n\n\t\t
vec3 lVector = transformDirection( hemisphereLightDirection[ i ], viewMatrix );
\n\n\t\t
// diffuse
\n\n\t\t
float dotProduct = dot( normal, lVector );
\n\t\t
float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;
\n\n\t\t
vec3 hemiColor = mix( hemisphereLightGroundColor[ i ], hemisphereLightSkyColor[ i ], hemiDiffuseWeight );
\n\n\t\t
hemiDiffuse += diffuse * hemiColor;
\n\n\t\t
// specular (sky light)
\n\n\t\t
vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );
\n\t\t
float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;
\n\t\t
float hemiSpecularWeightSky = specularStrength * max( pow( max( hemiDotNormalHalfSky, 0.0 ), shininess ), 0.0 );
\n\n\t\t
// specular (ground light)
\n\n\t\t
vec3 lVectorGround = -lVector;
\n\n\t\t
vec3 hemiHalfVectorGround = normalize( lVectorGround + viewPosition );
\n\t\t
float hemiDotNormalHalfGround = 0.5 * dot( normal, hemiHalfVectorGround ) + 0.5;
\n\t\t
float hemiSpecularWeightGround = specularStrength * max( pow( max( hemiDotNormalHalfGround, 0.0 ), shininess ), 0.0 );
\n\n\t\t
float dotProductGround = dot( normal, lVectorGround );
\n\n\t\t
float specularNormalization = ( shininess + 2.0 ) / 8.0;
\n\n\t\t
vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );
\n\t\t
vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );
\n\t\t
hemiSpecular += hemiColor * specularNormalization * ( schlickSky * hemiSpecularWeightSky * max( dotProduct, 0.0 ) + schlickGround * hemiSpecularWeightGround * max( dotProductGround, 0.0 ) );
\n\n\t
}
\n\n
#endif
\n\n
vec3 totalDiffuse = vec3( 0.0 );
\n
vec3 totalSpecular = vec3( 0.0 );
\n\n
#if MAX_DIR_LIGHTS > 0
\n\n\t
totalDiffuse += dirDiffuse;
\n\t
totalSpecular += dirSpecular;
\n\n
#endif
\n\n
#if MAX_HEMI_LIGHTS > 0
\n\n\t
totalDiffuse += hemiDiffuse;
\n\t
totalSpecular += hemiSpecular;
\n\n
#endif
\n\n
#if MAX_POINT_LIGHTS > 0
\n\n\t
totalDiffuse += pointDiffuse;
\n\t
totalSpecular += pointSpecular;
\n\n
#endif
\n\n
#if MAX_SPOT_LIGHTS > 0
\n\n\t
totalDiffuse += spotDiffuse;
\n\t
totalSpecular += spotSpecular;
\n\n
#endif
\n\n
#ifdef METAL
\n\n\t
gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * diffuse + totalSpecular );
\n\n
#else
\n\n\t
gl_FragColor.xyz = gl_FragColor.xyz * ( emissive + totalDiffuse + ambientLightColor * diffuse ) + totalSpecular;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
fog_pars_fragment
=
"
#ifdef USE_FOG
\n\n\t
uniform vec3 fogColor;
\n\n\t
#ifdef FOG_EXP2
\n\n\t\t
uniform float fogDensity;
\n\n\t
#else
\n\n\t\t
uniform float fogNear;
\n\t\t
uniform float fogFar;
\n\t
#endif
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
morphnormal_vertex
=
"
#ifdef USE_MORPHNORMALS
\n\n\t
vec3 morphedNormal = vec3( 0.0 );
\n\n\t
morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];
\n\t
morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];
\n\t
morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];
\n\t
morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];
\n\n\t
morphedNormal += normal;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
fog_pars_fragment
=
"
#ifdef USE_FOG
\n\n\t
uniform vec3 fogColor;
\n\n\t
#ifdef FOG_EXP2
\n\n\t\t
uniform float fogDensity;
\n\n\t
#else
\n\n\t\t
uniform float fogNear;
\n\t\t
uniform float fogFar;
\n\t
#endif
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
morphnormal_vertex
=
"
#ifdef USE_MORPHNORMALS
\n\n\t
vec3 morphedNormal = vec3( 0.0 );
\n\n\t
morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];
\n\t
morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];
\n\t
morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];
\n\t
morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];
\n\n\t
morphedNormal += normal;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
envmap_pars_fragment
=
"
#ifdef USE_ENVMAP
\n\n\t
uniform float reflectivity;
\n\t
#ifdef ENVMAP_TYPE_CUBE
\n\t\t
uniform samplerCube envMap;
\n\t
#else
\n\t\t
uniform sampler2D envMap;
\n\t
#endif
\n\t
uniform float flipEnvMap;
\n\n\t
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
\n\n\t\t
uniform float refractionRatio;
\n\n\t
#else
\n\n\t\t
varying vec3 vReflect;
\n\n\t
#endif
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
logdepthbuf_fragment
=
"
#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)
\n\n\t
gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
envmap_pars_fragment
=
"
#ifdef USE_ENVMAP
\n\n\t
uniform float reflectivity;
\n\t
#ifdef ENVMAP_TYPE_CUBE
\n\t\t
uniform samplerCube envMap;
\n\t
#else
\n\t\t
uniform sampler2D envMap;
\n\t
#endif
\n\t
uniform float flipEnvMap;
\n\n\t
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
\n\n\t\t
uniform float refractionRatio;
\n\n\t
#else
\n\n\t\t
varying vec3 vReflect;
\n\n\t
#endif
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
logdepthbuf_fragment
=
"
#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)
\n\n\t
gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
normalmap_pars_fragment
=
"
#ifdef USE_NORMALMAP
\n\n\t
uniform sampler2D normalMap;
\n\t
uniform vec2 normalScale;
\n\n\t
\t\t
// Per-Pixel Tangent Space Normal Mapping
\n\t\t
\t
// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html
\n\n\t
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {
\n\n\t\t
vec3 q0 = dFdx( eye_pos.xyz );
\n\t\t
vec3 q1 = dFdy( eye_pos.xyz );
\n\t\t
vec2 st0 = dFdx( vUv.st );
\n\t\t
vec2 st1 = dFdy( vUv.st );
\n\n\t\t
vec3 S = normalize( q0 * st1.t - q1 * st0.t );
\n\t\t
vec3 T = normalize( -q0 * st1.s + q1 * st0.s );
\n\t\t
vec3 N = normalize( surf_norm );
\n\n\t\t
vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
\n\t\t
mapN.xy = normalScale * mapN.xy;
\n\t\t
mat3 tsn = mat3( S, T, N );
\n\t\t
return normalize( tsn * mapN );
\n\n\t
}
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
normalmap_pars_fragment
=
"
#ifdef USE_NORMALMAP
\n\n\t
uniform sampler2D normalMap;
\n\t
uniform vec2 normalScale;
\n\n\t
// Per-Pixel Tangent Space Normal Mapping
\n
\t
// http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html
\n\n\t
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {
\n\n\t\t
vec3 q0 = dFdx( eye_pos.xyz );
\n\t\t
vec3 q1 = dFdy( eye_pos.xyz );
\n\t\t
vec2 st0 = dFdx( vUv.st );
\n\t\t
vec2 st1 = dFdy( vUv.st );
\n\n\t\t
vec3 S = normalize( q0 * st1.t - q1 * st0.t );
\n\t\t
vec3 T = normalize( -q0 * st1.s + q1 * st0.s );
\n\t\t
vec3 N = normalize( surf_norm );
\n\n\t\t
vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
\n\t\t
mapN.xy = normalScale * mapN.xy;
\n\t\t
mat3 tsn = mat3( S, T, N );
\n\t\t
return normalize( tsn * mapN );
\n\n\t
}
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
lights_phong_pars_vertex
=
"
#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )
\n\n\t
varying vec3 vWorldPosition;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
lightmap_pars_fragment
=
"
#ifdef USE_LIGHTMAP
\n\n\t
varying vec2 vUv2;
\n\t
uniform sampler2D lightMap;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
shadowmap_vertex
=
"
#ifdef USE_SHADOWMAP
\n\n\t
for( int i = 0; i < MAX_SHADOWS; i ++ ) {
\n\n\t\t
vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;
\n\n\t
}
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
lights_phong_pars_vertex
=
"
#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )
\n\n\t
varying vec3 vWorldPosition;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
lightmap_pars_fragment
=
"
#ifdef USE_LIGHTMAP
\n\n\t
varying vec2 vUv2;
\n\t
uniform sampler2D lightMap;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
shadowmap_vertex
=
"
#ifdef USE_SHADOWMAP
\n\n\t
for( int i = 0; i < MAX_SHADOWS; i ++ ) {
\n\n\t\t
vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;
\n\n\t
}
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
lights_phong_vertex
=
"
#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )
\n\n\t
vWorldPosition = worldPosition.xyz;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
map_fragment
=
"
#ifdef USE_MAP
\n\n\t
vec4 texelColor = texture2D( map, vUv );
\n\n\t
texelColor.xyz = inputToLinear( texelColor.xyz );
\n\n\t
gl_FragColor = gl_FragColor * texelColor;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
lightmap_vertex
=
"
#ifdef USE_LIGHTMAP
\n\n\t
vUv2 = uv2;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
map_particle_fragment
=
"
#ifdef USE_MAP
\n\n\t
gl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
lights_phong_vertex
=
"
#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )
\n\n\t
vWorldPosition = worldPosition.xyz;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
map_fragment
=
"
#ifdef USE_MAP
\n\n\t
vec4 texelColor = texture2D( map, vUv );
\n\n\t
texelColor.xyz = inputToLinear( texelColor.xyz );
\n\n\t
gl_FragColor = gl_FragColor * texelColor;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
lightmap_vertex
=
"
#ifdef USE_LIGHTMAP
\n\n\t
vUv2 = uv2;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
map_particle_fragment
=
"
#ifdef USE_MAP
\n\n\t
gl_FragColor = gl_FragColor * texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
color_pars_fragment
=
"
#ifdef USE_COLOR
\n\n\t
varying vec3 vColor;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
color_vertex
=
"
#ifdef USE_COLOR
\n\n\t
vColor.xyz = inputToLinear( color.xyz );
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
skinning_vertex
=
"
#ifdef USE_SKINNING
\n\n\t
#ifdef USE_MORPHTARGETS
\n\n\t
vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );
\n\n\t
#else
\n\n\t
vec4 skinVertex = bindMatrix * vec4( position, 1.0 );
\n\n\t
#endif
\n\n\t
vec4 skinned = vec4( 0.0 );
\n\t
skinned += boneMatX * skinVertex * skinWeight.x;
\n\t
skinned += boneMatY * skinVertex * skinWeight.y;
\n\t
skinned += boneMatZ * skinVertex * skinWeight.z;
\n\t
skinned += boneMatW * skinVertex * skinWeight.w;
\n\t
skinned = bindMatrixInverse * skinned;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
color_pars_fragment
=
"
#ifdef USE_COLOR
\n\n\t
varying vec3 vColor;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
color_vertex
=
"
#ifdef USE_COLOR
\n\n\t
vColor.xyz = inputToLinear( color.xyz );
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
skinning_vertex
=
"
#ifdef USE_SKINNING
\n\n\t
#ifdef USE_MORPHTARGETS
\n\n\t
vec4 skinVertex = bindMatrix * vec4( morphed, 1.0 );
\n\n\t
#else
\n\n\t
vec4 skinVertex = bindMatrix * vec4( position, 1.0 );
\n\n\t
#endif
\n\n\t
vec4 skinned = vec4( 0.0 );
\n\t
skinned += boneMatX * skinVertex * skinWeight.x;
\n\t
skinned += boneMatY * skinVertex * skinWeight.y;
\n\t
skinned += boneMatZ * skinVertex * skinWeight.z;
\n\t
skinned += boneMatW * skinVertex * skinWeight.w;
\n\t
skinned = bindMatrixInverse * skinned;
\n\n
#endif
\n
"
;
...
@@ -398,7 +398,7 @@ THREE.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( US
...
@@ -398,7 +398,7 @@ THREE.ShaderChunk.envmap_pars_vertex="#if defined( USE_ENVMAP ) && ! defined( US
THREE
.
ShaderChunk
.
map_pars_vertex
=
"
#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )
\n\n\t
varying vec2 vUv;
\n\t
uniform vec4 offsetRepeat;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
envmap_fragment
=
"
#ifdef USE_ENVMAP
\n\n\t
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
\n\n\t\t
vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );
\n\n\t\t
// Transforming Normal Vectors with the Inverse Transformation
\n\t\t
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
\n\n\t\t
#ifdef ENVMAP_MODE_REFLECTION
\n\n\t\t\t
vec3 reflectVec = reflect( cameraToVertex, worldNormal );
\n\n\t\t
#else
\n\n\t\t\t
vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );
\n\n\t\t
#endif
\n\n\t
#else
\n\n\t\t
vec3 reflectVec = vReflect;
\n\n\t
#endif
\n\n\t
#ifdef DOUBLE_SIDED
\n\t\t
float flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );
\n\t
#else
\n\t\t
float flipNormal = 1.0;
\n\t
#endif
\n\n\t
#ifdef ENVMAP_TYPE_CUBE
\n\t\t
vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
\n\n\t
#elif defined( ENVMAP_TYPE_EQUIREC )
\n\t\t
vec2 sampleUV;
\n\t\t
sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );
\n\t\t
sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
\n\t\t
vec4 envColor = texture2D( envMap, sampleUV );
\n\t\t\n\t
#elif defined( ENVMAP_TYPE_SPHERE )
\n\t\t
vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));
\n\t\t
vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );
\n\t
#endif
\n\n\t
envColor.xyz = inputToLinear( envColor.xyz );
\n\n\t
#ifdef ENVMAP_BLENDING_MULTIPLY
\n\n\t\t
gl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * envColor.xyz, specularStrength * reflectivity );
\n\n\t
#elif defined( ENVMAP_BLENDING_MIX )
\n\n\t\t
gl_FragColor.xyz = mix( gl_FragColor.xyz, envColor.xyz, specularStrength * reflectivity );
\n\n\t
#elif defined( ENVMAP_BLENDING_ADD )
\n\n\t\t
gl_FragColor.xyz += envColor.xyz * specularStrength * reflectivity;
\n\n\t
#endif
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
map_pars_vertex
=
"
#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )
\n\n\t
varying vec2 vUv;
\n\t
uniform vec4 offsetRepeat;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
envmap_fragment
=
"
#ifdef USE_ENVMAP
\n\n\t
#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
\n\n\t\t
vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );
\n\n\t\t
// Transforming Normal Vectors with the Inverse Transformation
\n\t\t
vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
\n\n\t\t
#ifdef ENVMAP_MODE_REFLECTION
\n\n\t\t\t
vec3 reflectVec = reflect( cameraToVertex, worldNormal );
\n\n\t\t
#else
\n\n\t\t\t
vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );
\n\n\t\t
#endif
\n\n\t
#else
\n\n\t\t
vec3 reflectVec = vReflect;
\n\n\t
#endif
\n\n\t
#ifdef DOUBLE_SIDED
\n\t\t
float flipNormal = ( -1.0 + 2.0 * float( gl_FrontFacing ) );
\n\t
#else
\n\t\t
float flipNormal = 1.0;
\n\t
#endif
\n\n\t
#ifdef ENVMAP_TYPE_CUBE
\n\t\t
vec4 envColor = textureCube( envMap, flipNormal * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
\n\n\t
#elif defined( ENVMAP_TYPE_EQUIREC )
\n\t\t
vec2 sampleUV;
\n\t\t
sampleUV.y = saturate( flipNormal * reflectVec.y * 0.5 + 0.5 );
\n\t\t
sampleUV.x = atan( flipNormal * reflectVec.z, flipNormal * reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
\n\t\t
vec4 envColor = texture2D( envMap, sampleUV );
\n\t\t\n\t
#elif defined( ENVMAP_TYPE_SPHERE )
\n\t\t
vec3 reflectView = flipNormal * normalize((viewMatrix * vec4( reflectVec, 0.0 )).xyz + vec3(0.0,0.0,1.0));
\n\t\t
vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );
\n\t
#endif
\n\n\t
envColor.xyz = inputToLinear( envColor.xyz );
\n\n\t
#ifdef ENVMAP_BLENDING_MULTIPLY
\n\n\t\t
gl_FragColor.xyz = mix( gl_FragColor.xyz, gl_FragColor.xyz * envColor.xyz, specularStrength * reflectivity );
\n\n\t
#elif defined( ENVMAP_BLENDING_MIX )
\n\n\t\t
gl_FragColor.xyz = mix( gl_FragColor.xyz, envColor.xyz, specularStrength * reflectivity );
\n\n\t
#elif defined( ENVMAP_BLENDING_ADD )
\n\n\t\t
gl_FragColor.xyz += envColor.xyz * specularStrength * reflectivity;
\n\n\t
#endif
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
specularmap_pars_fragment
=
"
#ifdef USE_SPECULARMAP
\n\n\t
uniform sampler2D specularMap;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
logdepthbuf_vertex
=
"
#ifdef USE_LOGDEPTHBUF
\n\n\t
gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;
\n\n\t
#ifdef USE_LOGDEPTHBUF_EXT
\n\n\t\t
vFragDepth = 1.0 + gl_Position.w;
\n\n
#else
\n\n\t\t
gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;
\n\n\t
#endif
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
=
"
#ifdef USE_MORPHTARGETS
\n\n\t
#ifndef USE_MORPHNORMALS
\n\n\t
uniform float morphTargetInfluences[ 8 ];
\n\n\t
#else
\n\n\t
uniform float morphTargetInfluences[ 4 ];
\n\n\t
#endif
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
specularmap_pars_fragment
=
"
#ifdef USE_SPECULARMAP
\n\n\t
uniform sampler2D specularMap;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
logdepthbuf_vertex
=
"
#ifdef USE_LOGDEPTHBUF
\n\n\t
gl_Position.z = log2(max( EPSILON, gl_Position.w + 1.0 )) * logDepthBufFC;
\n\n\t
#ifdef USE_LOGDEPTHBUF_EXT
\n\n\t\t
vFragDepth = 1.0 + gl_Position.w;
\n\n
#else
\n\n\t\t
gl_Position.z = (gl_Position.z - 1.0) * gl_Position.w;
\n\n\t
#endif
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
=
"
#ifdef USE_MORPHTARGETS
\n\n\t
#ifndef USE_MORPHNORMALS
\n\n\t
uniform float morphTargetInfluences[ 8 ];
\n\n\t
#else
\n\n\t
uniform float morphTargetInfluences[ 4 ];
\n\n\t
#endif
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
specularmap_fragment
=
"
float specularStrength;
\n\n
#ifdef USE_SPECULARMAP
\n\n\t
vec4 texelSpecular = texture2D( specularMap, vUv );
\n\t
specularStrength = texelSpecular.r;
\n\n
#else
\n\n\t
specularStrength = 1.0;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
fog_fragment
=
"
#ifdef USE_FOG
\n\n\t
#ifdef USE_LOGDEPTHBUF_EXT
\n\n\t\t
float depth = gl_FragDepthEXT / gl_FragCoord.w;
\n\n\t
#else
\n\n\t\t
float depth = gl_FragCoord.z / gl_FragCoord.w;
\n\n\t
#endif
\n\n\t
#ifdef FOG_EXP2
\n\n\t\t
float fogFactor = exp2( - square( fogDensity ) * square( depth ) * LOG2 );
\n\t\t
fogFactor = whiteCompliment( fogFactor );
\n\n\t
#else
\n\n\t\t
float fogFactor = smoothstep( fogNear, fogFar, depth );
\n\n\t
#endif
\n\t\n\t
gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
specularmap_fragment
=
"
float specularStrength;
\n\n
#ifdef USE_SPECULARMAP
\n\n\t
vec4 texelSpecular = texture2D( specularMap, vUv );
\n\t
specularStrength = texelSpecular.r;
\n\n
#else
\n\n\t
specularStrength = 1.0;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
fog_fragment
=
"
#ifdef USE_FOG
\n\n\t
#ifdef USE_LOGDEPTHBUF_EXT
\n\n\t\t
float depth = gl_FragDepthEXT / gl_FragCoord.w;
\n\n\t
#else
\n\n\t\t
float depth = gl_FragCoord.z / gl_FragCoord.w;
\n\n\t
#endif
\n\n\t
#ifdef FOG_EXP2
\n\n\t\t
float fogFactor = exp2( - square( fogDensity ) * square( depth ) * LOG2 );
\n\t\t
fogFactor = whiteCompliment( fogFactor );
\n\n\t
#else
\n\n\t\t
float fogFactor = smoothstep( fogNear, fogFar, depth );
\n\n\t
#endif
\n\t\n\t
gl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
bumpmap_pars_fragment
=
"
#ifdef USE_BUMPMAP
\n\n\t
uniform sampler2D bumpMap;
\n\t
uniform float bumpScale;
\n\n\t
\t\t
// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen
\n\t\t\t
//
\t
http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html
\n\n\t\t\t
// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)
\n\n\t
vec2 dHdxy_fwd() {
\n\n\t\t
vec2 dSTdx = dFdx( vUv );
\n\t\t
vec2 dSTdy = dFdy( vUv );
\n\n\t\t
float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
\n\t\t
float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
\n\t\t
float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
\n\n\t\t
return vec2( dBx, dBy );
\n\n\t
}
\n\n\t
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {
\n\n\t\t
vec3 vSigmaX = dFdx( surf_pos );
\n\t\t
vec3 vSigmaY = dFdy( surf_pos );
\n\t\t
vec3 vN = surf_norm;
\t\t
// normalized
\n\n\t\t
vec3 R1 = cross( vSigmaY, vN );
\n\t\t
vec3 R2 = cross( vN, vSigmaX );
\n\n\t\t
float fDet = dot( vSigmaX, R1 );
\n\n\t\t
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
\n\t\t
return normalize( abs( fDet ) * surf_norm - vGrad );
\n\n\t
}
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
bumpmap_pars_fragment
=
"
#ifdef USE_BUMPMAP
\n\n\t
uniform sampler2D bumpMap;
\n\t
uniform float bumpScale;
\n\n\t
// Derivative maps - bump mapping unparametrized surfaces by Morten Mikkelsen
\n\t
// http://mmikkelsen3d.blogspot.sk/2011/07/derivative-maps.html
\n\n\t
// Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)
\n\n\t
vec2 dHdxy_fwd() {
\n\n\t\t
vec2 dSTdx = dFdx( vUv );
\n\t\t
vec2 dSTdy = dFdy( vUv );
\n\n\t\t
float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
\n\t\t
float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
\n\t\t
float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
\n\n\t\t
return vec2( dBx, dBy );
\n\n\t
}
\n\n\t
vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {
\n\n\t\t
vec3 vSigmaX = dFdx( surf_pos );
\n\t\t
vec3 vSigmaY = dFdy( surf_pos );
\n\t\t
vec3 vN = surf_norm;
\t\t
// normalized
\n\n\t\t
vec3 R1 = cross( vSigmaY, vN );
\n\t\t
vec3 R2 = cross( vN, vSigmaX );
\n\n\t\t
float fDet = dot( vSigmaX, R1 );
\n\n\t\t
vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
\n\t\t
return normalize( abs( fDet ) * surf_norm - vGrad );
\n\n\t
}
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
defaultnormal_vertex
=
"
#ifdef USE_SKINNING
\n\n\t
vec3 objectNormal = skinnedNormal.xyz;
\n\n
#elif defined( USE_MORPHNORMALS )
\n\n\t
vec3 objectNormal = morphedNormal;
\n\n
#else
\n\n\t
vec3 objectNormal = normal;
\n\n
#endif
\n\n
#ifdef FLIP_SIDED
\n\n\t
objectNormal = -objectNormal;
\n\n
#endif
\n\n
vec3 transformedNormal = normalMatrix * objectNormal;
\n
"
;
THREE
.
ShaderChunk
.
lights_phong_pars_fragment
=
"
uniform vec3 ambientLightColor;
\n\n
#if MAX_DIR_LIGHTS > 0
\n\n\t
uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];
\n\t
uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];
\n\n
#endif
\n\n
#if MAX_HEMI_LIGHTS > 0
\n\n\t
uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];
\n\t
uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];
\n\t
uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];
\n\n
#endif
\n\n
#if MAX_POINT_LIGHTS > 0
\n\n\t
uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];
\n\n\t
uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];
\n\t
uniform float pointLightDistance[ MAX_POINT_LIGHTS ];
\n\t
uniform float pointLightDecay[ MAX_POINT_LIGHTS ];
\n\n
#endif
\n\n
#if MAX_SPOT_LIGHTS > 0
\n\n\t
uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];
\n\t
uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];
\n\t
uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];
\n\t
uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];
\n\t
uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];
\n\t
uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];
\n\t
uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];
\n\n
#endif
\n\n
#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )
\n\n\t
varying vec3 vWorldPosition;
\n\n
#endif
\n\n
#ifdef WRAP_AROUND
\n\n\t
uniform vec3 wrapRGB;
\n\n
#endif
\n\n
varying vec3 vViewPosition;
\n\n
#ifndef FLAT_SHADED
\n\n\t
varying vec3 vNormal;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
defaultnormal_vertex
=
"
#ifdef USE_SKINNING
\n\n\t
vec3 objectNormal = skinnedNormal.xyz;
\n\n
#elif defined( USE_MORPHNORMALS )
\n\n\t
vec3 objectNormal = morphedNormal;
\n\n
#else
\n\n\t
vec3 objectNormal = normal;
\n\n
#endif
\n\n
#ifdef FLIP_SIDED
\n\n\t
objectNormal = -objectNormal;
\n\n
#endif
\n\n
vec3 transformedNormal = normalMatrix * objectNormal;
\n
"
;
THREE
.
ShaderChunk
.
lights_phong_pars_fragment
=
"
uniform vec3 ambientLightColor;
\n\n
#if MAX_DIR_LIGHTS > 0
\n\n\t
uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];
\n\t
uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];
\n\n
#endif
\n\n
#if MAX_HEMI_LIGHTS > 0
\n\n\t
uniform vec3 hemisphereLightSkyColor[ MAX_HEMI_LIGHTS ];
\n\t
uniform vec3 hemisphereLightGroundColor[ MAX_HEMI_LIGHTS ];
\n\t
uniform vec3 hemisphereLightDirection[ MAX_HEMI_LIGHTS ];
\n\n
#endif
\n\n
#if MAX_POINT_LIGHTS > 0
\n\n\t
uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];
\n\n\t
uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];
\n\t
uniform float pointLightDistance[ MAX_POINT_LIGHTS ];
\n\t
uniform float pointLightDecay[ MAX_POINT_LIGHTS ];
\n\n
#endif
\n\n
#if MAX_SPOT_LIGHTS > 0
\n\n\t
uniform vec3 spotLightColor[ MAX_SPOT_LIGHTS ];
\n\t
uniform vec3 spotLightPosition[ MAX_SPOT_LIGHTS ];
\n\t
uniform vec3 spotLightDirection[ MAX_SPOT_LIGHTS ];
\n\t
uniform float spotLightAngleCos[ MAX_SPOT_LIGHTS ];
\n\t
uniform float spotLightExponent[ MAX_SPOT_LIGHTS ];
\n\t
uniform float spotLightDistance[ MAX_SPOT_LIGHTS ];
\n\t
uniform float spotLightDecay[ MAX_SPOT_LIGHTS ];
\n\n
#endif
\n\n
#if MAX_SPOT_LIGHTS > 0 || defined( USE_BUMPMAP ) || defined( USE_ENVMAP )
\n\n\t
varying vec3 vWorldPosition;
\n\n
#endif
\n\n
#ifdef WRAP_AROUND
\n\n\t
uniform vec3 wrapRGB;
\n\n
#endif
\n\n
varying vec3 vViewPosition;
\n\n
#ifndef FLAT_SHADED
\n\n\t
varying vec3 vNormal;
\n\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
skinbase_vertex
=
"
#ifdef USE_SKINNING
\n\n\t
mat4 boneMatX = getBoneMatrix( skinIndex.x );
\n\t
mat4 boneMatY = getBoneMatrix( skinIndex.y );
\n\t
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
\n\t
mat4 boneMatW = getBoneMatrix( skinIndex.w );
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
map_vertex
=
"
#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )
\n\n\t
vUv = uv * offsetRepeat.zw + offsetRepeat.xy;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
skinbase_vertex
=
"
#ifdef USE_SKINNING
\n\n\t
mat4 boneMatX = getBoneMatrix( skinIndex.x );
\n\t
mat4 boneMatY = getBoneMatrix( skinIndex.y );
\n\t
mat4 boneMatZ = getBoneMatrix( skinIndex.z );
\n\t
mat4 boneMatW = getBoneMatrix( skinIndex.w );
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
map_vertex
=
"
#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP )
\n\n\t
vUv = uv * offsetRepeat.zw + offsetRepeat.xy;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
lightmap_fragment
=
"
#ifdef USE_LIGHTMAP
\n\n\t
gl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
=
"
#ifdef USE_SHADOWMAP
\n\n\t
varying vec4 vShadowCoord[ MAX_SHADOWS ];
\n\t
uniform mat4 shadowMatrix[ MAX_SHADOWS ];
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
color_fragment
=
"
#ifdef USE_COLOR
\n\n\t
gl_FragColor = gl_FragColor * vec4( vColor, 1.0 );
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
morphtarget_vertex
=
"
#ifdef USE_MORPHTARGETS
\n\n\t
vec3 morphed = vec3( 0.0 );
\n\t
morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];
\n\t
morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];
\n\t
morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];
\n\t
morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];
\n\n\t
#ifndef USE_MORPHNORMALS
\n\n\t
morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];
\n\t
morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];
\n\t
morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];
\n\t
morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];
\n\n\t
#endif
\n\n\t
morphed += position;
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
lightmap_fragment
=
"
#ifdef USE_LIGHTMAP
\n\n\t
gl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
=
"
#ifdef USE_SHADOWMAP
\n\n\t
varying vec4 vShadowCoord[ MAX_SHADOWS ];
\n\t
uniform mat4 shadowMatrix[ MAX_SHADOWS ];
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
color_fragment
=
"
#ifdef USE_COLOR
\n\n\t
gl_FragColor = gl_FragColor * vec4( vColor, 1.0 );
\n\n
#endif
"
;
THREE
.
ShaderChunk
.
morphtarget_vertex
=
"
#ifdef USE_MORPHTARGETS
\n\n\t
vec3 morphed = vec3( 0.0 );
\n\t
morphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];
\n\t
morphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];
\n\t
morphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];
\n\t
morphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];
\n\n\t
#ifndef USE_MORPHNORMALS
\n\n\t
morphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];
\n\t
morphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];
\n\t
morphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];
\n\t
morphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];
\n\n\t
#endif
\n\n\t
morphed += position;
\n\n
#endif
"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录