Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
b5f77a8a
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,体验更适合开发者的 AI 搜索 >>
提交
b5f77a8a
编写于
2月 11, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
4684e290
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
2 addition
and
2 deletion
+2
-2
build/three.js
build/three.js
+1
-1
build/three.min.js
build/three.min.js
+1
-1
未找到文件。
build/three.js
浏览文件 @
b5f77a8a
...
...
@@ -23559,7 +23559,7 @@ THREE.ShaderChunk[ 'morphtarget_vertex' ] = "#ifdef USE_MORPHTARGETS\n transform
// File:src/renderers/shaders/ShaderChunk/normal_fragment.glsl
THREE.ShaderChunk[ 'normal_fragment' ] = "#ifdef FLAT_SHADED\n vec3 fdx =
dFdx( vViewPosition );\n vec3 fdy = dFdy( vViewPosition
);\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n #endif\n#endif\n#ifdef USE_NORMALMAP\n normal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n";
THREE.ShaderChunk[ 'normal_fragment' ] = "#ifdef FLAT_SHADED\n vec3 fdx =
vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z )
);\n vec3 normal = normalize( cross( fdx, fdy ) );\n#else\n vec3 normal = normalize( vNormal );\n #ifdef DOUBLE_SIDED\n normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );\n #endif\n#endif\n#ifdef USE_NORMALMAP\n normal = perturbNormal2Arb( -vViewPosition, normal );\n#elif defined( USE_BUMPMAP )\n normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif\n";
// File:src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl
...
...
build/three.min.js
浏览文件 @
b5f77a8a
...
...
@@ -537,7 +537,7 @@ THREE.ShaderChunk.logdepthbuf_vertex="#ifdef USE_LOGDEPTHBUF\n\tgl_Position.z =
THREE
.
ShaderChunk
.
map_pars_fragment
=
"
#ifdef USE_MAP
\n\t
uniform sampler2D map;
\n
#endif
"
;
THREE
.
ShaderChunk
.
map_particle_fragment
=
"
#ifdef USE_MAP
\n\t
diffuseColor *= texture2D( map, vec2( gl_PointCoord.x, 1.0 - gl_PointCoord.y ) * offsetRepeat.zw + offsetRepeat.xy );
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
map_particle_pars_fragment
=
"
#ifdef USE_MAP
\n\t
uniform vec4 offsetRepeat;
\n\t
uniform sampler2D map;
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
metalnessmap_fragment
=
"
float metalnessFactor = metalness;
\n
#ifdef USE_METALNESSMAP
\n\t
vec4 texelMetalness = texture2D( metalnessMap, vUv );
\n\t
metalnessFactor *= texelMetalness.r;
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
metalnessmap_pars_fragment
=
"
#ifdef USE_METALNESSMAP
\n\t
uniform sampler2D metalnessMap;
\n
#endif
"
;
THREE
.
ShaderChunk
.
morphnormal_vertex
=
"
#ifdef USE_MORPHNORMALS
\n\t
objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];
\n\t
objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];
\n\t
objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];
\n\t
objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
=
"
#ifdef USE_MORPHTARGETS
\n\t
#ifndef USE_MORPHNORMALS
\n\t
uniform float morphTargetInfluences[ 8 ];
\n\t
#else
\n\t
uniform float morphTargetInfluences[ 4 ];
\n\t
#endif
\n
#endif
"
;
THREE
.
ShaderChunk
.
morphtarget_vertex
=
"
#ifdef USE_MORPHTARGETS
\n\t
transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];
\n\t
transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];
\n\t
transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];
\n\t
transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];
\n\t
#ifndef USE_MORPHNORMALS
\n\t
transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];
\n\t
transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];
\n\t
transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];
\n\t
transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];
\n\t
#endif
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
normal_fragment
=
"
#ifdef FLAT_SHADED
\n\t
vec3 fdx =
dFdx( vViewPosition );
\n\t
vec3 fdy = dFdy( vViewPosition
);
\n\t
vec3 normal = normalize( cross( fdx, fdy ) );
\n
#else
\n\t
vec3 normal = normalize( vNormal );
\n\t
#ifdef DOUBLE_SIDED
\n\t\t
normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );
\n\t
#endif
\n
#endif
\n
#ifdef USE_NORMALMAP
\n\t
normal = perturbNormal2Arb( -vViewPosition, normal );
\n
#elif defined( USE_BUMPMAP )
\n\t
normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
normal_fragment
=
"
#ifdef FLAT_SHADED
\n\t
vec3 fdx =
vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
\n\t
vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z )
);
\n\t
vec3 normal = normalize( cross( fdx, fdy ) );
\n
#else
\n\t
vec3 normal = normalize( vNormal );
\n\t
#ifdef DOUBLE_SIDED
\n\t\t
normal = normal * ( -1.0 + 2.0 * float( gl_FrontFacing ) );
\n\t
#endif
\n
#endif
\n
#ifdef USE_NORMALMAP
\n\t
normal = perturbNormal2Arb( -vViewPosition, normal );
\n
#elif defined( USE_BUMPMAP )
\n\t
normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
normalmap_pars_fragment
=
"
#ifdef USE_NORMALMAP
\n\t
uniform sampler2D normalMap;
\n\t
uniform vec2 normalScale;
\n\t
vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {
\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\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\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\t
}
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
project_vertex
=
"
#ifdef USE_SKINNING
\n\t
vec4 mvPosition = modelViewMatrix * skinned;
\n
#else
\n\t
vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );
\n
#endif
\n
gl_Position = projectionMatrix * mvPosition;
\n
"
;
THREE
.
ShaderChunk
.
roughnessmap_fragment
=
"
float roughnessFactor = roughness;
\n
#ifdef USE_ROUGHNESSMAP
\n\t
vec4 texelRoughness = texture2D( roughnessMap, vUv );
\n\t
roughnessFactor *= texelRoughness.r;
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
roughnessmap_pars_fragment
=
"
#ifdef USE_ROUGHNESSMAP
\n\t
uniform sampler2D roughnessMap;
\n
#endif
"
;
THREE
.
ShaderChunk
.
shadowmap_pars_fragment
=
"
#ifdef USE_SHADOWMAP
\n\t
#if NUM_DIR_LIGHTS > 0
\n\t\t
uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];
\n\t\t
varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];
\n\t
#endif
\n\t
#if NUM_SPOT_LIGHTS > 0
\n\t\t
uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];
\n\t\t
varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];
\n\t
#endif
\n\t
#if NUM_POINT_LIGHTS > 0
\n\t\t
uniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];
\n\t\t
varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];
\n\t
#endif
\n\t
float unpackDepth( const in vec4 rgba_depth ) {
\n\t\t
const vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );
\n\t\t
return dot( rgba_depth, bit_shift );
\n\t
}
\n\t
float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
\n\t\t
return step( compare, unpackDepth( texture2D( depths, uv ) ) );
\n\t
}
\n\t
float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {
\n\t\t
const vec2 offset = vec2( 0.0, 1.0 );
\n\t\t
vec2 texelSize = vec2( 1.0 ) / size;
\n\t\t
vec2 centroidUV = floor( uv * size + 0.5 ) / size;
\n\t\t
float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );
\n\t\t
float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );
\n\t\t
float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );
\n\t\t
float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );
\n\t\t
vec2 f = fract( uv * size + 0.5 );
\n\t\t
float a = mix( lb, lt, f.y );
\n\t\t
float b = mix( rb, rt, f.y );
\n\t\t
float c = mix( a, b, f.x );
\n\t\t
return c;
\n\t
}
\n\t
float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
\n\t\t
shadowCoord.xyz /= shadowCoord.w;
\n\t\t
shadowCoord.z += shadowBias;
\n\t\t
bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
\n\t\t
bool inFrustum = all( inFrustumVec );
\n\t\t
bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
\n\t\t
bool frustumTest = all( frustumTestVec );
\n\t\t
if ( frustumTest ) {
\n\t\t
#if defined( SHADOWMAP_TYPE_PCF )
\n\t\t\t
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
\n\t\t\t
float dx0 = - texelSize.x * shadowRadius;
\n\t\t\t
float dy0 = - texelSize.y * shadowRadius;
\n\t\t\t
float dx1 = + texelSize.x * shadowRadius;
\n\t\t\t
float dy1 = + texelSize.y * shadowRadius;
\n\t\t\t
return (
\n\t\t\t\t
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
\n\t\t\t\t
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
\n\t\t\t
) * ( 1.0 / 9.0 );
\n\t\t
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
\n\t\t\t
vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
\n\t\t\t
float dx0 = - texelSize.x * shadowRadius;
\n\t\t\t
float dy0 = - texelSize.y * shadowRadius;
\n\t\t\t
float dx1 = + texelSize.x * shadowRadius;
\n\t\t\t
float dy1 = + texelSize.y * shadowRadius;
\n\t\t\t
return (
\n\t\t\t\t
texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +
\n\t\t\t\t
texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
\n\t\t\t\t
texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
\n\t\t\t
) * ( 1.0 / 9.0 );
\n\t\t
#else
\n\t\t\t
return texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
\n\t\t
#endif
\n\t\t
}
\n\t\t
return 1.0;
\n\t
}
\n\t
vec2 cubeToUV( vec3 v, float texelSizeY ) {
\n\t\t
vec3 absV = abs( v );
\n\t\t
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
\n\t\t
absV *= scaleToCube;
\n\t\t
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
\n\t\t
vec2 planar = v.xy;
\n\t\t
float almostATexel = 1.5 * texelSizeY;
\n\t\t
float almostOne = 1.0 - almostATexel;
\n\t\t
if ( absV.z >= almostOne ) {
\n\t\t\t
if ( v.z > 0.0 )
\n\t\t\t\t
planar.x = 4.0 - v.x;
\n\t\t
} else if ( absV.x >= almostOne ) {
\n\t\t\t
float signX = sign( v.x );
\n\t\t\t
planar.x = v.z * signX + 2.0 * signX;
\n\t\t
} else if ( absV.y >= almostOne ) {
\n\t\t\t
float signY = sign( v.y );
\n\t\t\t
planar.x = v.x + 2.0 * signY + 2.0;
\n\t\t\t
planar.y = v.z * signY - 2.0;
\n\t\t
}
\n\t\t
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
\n\t
}
\n\t
float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
\n\t\t
vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
\n\t\t
vec3 lightToPosition = shadowCoord.xyz;
\n\t\t
vec3 bd3D = normalize( lightToPosition );
\n\t\t
float dp = ( length( lightToPosition ) - shadowBias ) / 1000.0;
\n\t\t
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )
\n\t\t\t
vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
\n\t\t\t
return (
\n\t\t\t\t
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
\n\t\t\t\t
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
\n\t\t\t\t
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
\n\t\t\t\t
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
\n\t\t\t\t
texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
\n\t\t\t\t
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
\n\t\t\t\t
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
\n\t\t\t\t
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
\n\t\t\t\t
texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
\n\t\t\t
) * ( 1.0 / 9.0 );
\n\t\t
#else
\n\t\t\t
return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
\n\t\t
#endif
\n\t
}
\n
#endif
\n
"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录