Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
7bd18d59
T
three.js
项目概览
车家大少爷
/
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,发现更多精彩内容 >>
提交
7bd18d59
编写于
11月 24, 2015
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
afd61259
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
10 deletion
+10
-10
build/three.js
build/three.js
+8
-8
build/three.min.js
build/three.min.js
+2
-2
未找到文件。
build/three.js
浏览文件 @
7bd18d59
...
...
@@ -9944,7 +9944,7 @@ THREE.Geometry.prototype = {
var indices = geometry.index !== null ? geometry.index.array : undefined;
var attributes = geometry.attributes;
var
vertice
s = attributes.position.array;
var
position
s = attributes.position.array;
var normals = attributes.normal !== undefined ? attributes.normal.array : undefined;
var colors = attributes.color !== undefined ? attributes.color.array : undefined;
var uvs = attributes.uv !== undefined ? attributes.uv.array : undefined;
...
...
@@ -9956,9 +9956,9 @@ THREE.Geometry.prototype = {
var tempUVs = [];
var tempUVs2 = [];
for ( var i = 0, j = 0; i <
vertice
s.length; i += 3, j += 2 ) {
for ( var i = 0, j = 0; i <
position
s.length; i += 3, j += 2 ) {
scope.vertices.push( new THREE.Vector3(
vertices[ i ], vertices[ i + 1 ], vertice
s[ i + 2 ] ) );
scope.vertices.push( new THREE.Vector3(
positions[ i ], positions[ i + 1 ], position
s[ i + 2 ] ) );
if ( normals !== undefined ) {
...
...
@@ -10007,7 +10007,7 @@ THREE.Geometry.prototype = {
}
}
;
}
if ( indices !== undefined ) {
...
...
@@ -10042,7 +10042,7 @@ THREE.Geometry.prototype = {
} else {
for ( var i = 0; i <
vertice
s.length / 3; i += 3 ) {
for ( var i = 0; i <
position
s.length / 3; i += 3 ) {
addFace( i, i + 1, i + 2 );
...
...
@@ -23414,7 +23414,7 @@ THREE.ShaderChunk[ 'shadowmap_pars_fragment'] = "#ifdef USE_SHADOWMAP\n uniform
// File:src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl
THREE.ShaderChunk[ 'shadowmap_pars_vertex'] = "#ifdef USE_SHADOWMAP\n uniform
float shadowDarkness[ NUM_SHADOWS ];\n uniform mat4 shadowMatrix[ NUM_SHADOWS ];\n varying vec4 vShadowCoord[ NUM_SHADOWS ];\n#endif
";
THREE.ShaderChunk[ 'shadowmap_pars_vertex'] = "#ifdef USE_SHADOWMAP\n uniform
mat4 shadowMatrix[ NUM_SHADOWS ];\n varying vec4 vShadowCoord[ NUM_SHADOWS ];\n#endif\n
";
// File:src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl
...
...
@@ -25369,14 +25369,14 @@ THREE.WebGLRenderer = function ( parameters ) {
for ( var i = 0; i < 6; i ++ ) {
_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer[ i ] );
_gl.deleteRenderbuffer( renderTargetProperties.__webgl
Render
buffer[ i ] );
_gl.deleteRenderbuffer( renderTargetProperties.__webgl
Depth
buffer[ i ] );
}
} else {
_gl.deleteFramebuffer( renderTargetProperties.__webglFramebuffer );
_gl.deleteRenderbuffer( renderTargetProperties.__webgl
Render
buffer );
_gl.deleteRenderbuffer( renderTargetProperties.__webgl
Depth
buffer );
}
...
...
build/three.min.js
浏览文件 @
7bd18d59
...
...
@@ -536,7 +536,7 @@ THREE.ShaderChunk.normalmap_pars_fragment="#ifdef USE_NORMALMAP\n\tuniform sampl
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_fragment
=
"
vec3 shadowMask = vec3( 1.0 );
\n
#ifdef USE_SHADOWMAP
\n\t
float shadows[ NUM_SHADOWS ];
\n\t
for ( int i = 0; i < NUM_SHADOWS; i ++ ) {
\n\t\t
float texelSizeY = 1.0 / shadowMapSize[ i ].y;
\n\t\t
float shadow = 0.0;
\n
#ifdef POINT_LIGHT_SHADOWS
\n\t\t
bool isPointLight = shadowDarkness[ i ] < 0.0;
\n\t\t
if ( isPointLight ) {
\n\t\t\t
float realShadowDarkness = abs( shadowDarkness[ i ] );
\n\t\t\t
vec3 lightToPosition = vShadowCoord[ i ].xyz;
\n\t
#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )
\n\t\t\t
vec3 bd3D = normalize( lightToPosition );
\n\t\t\t
float dp = length( lightToPosition );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t
#if defined( SHADOWMAP_TYPE_PCF )
\n\t\t\t
const float Dr = 1.25;
\n\t
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
\n\t\t\t
const float Dr = 2.25;
\n\t
#endif
\n\t\t\t
float os = Dr * 2.0 * texelSizeY;
\n\t\t\t
const vec3 Gsd = vec3( - 1, 0, 1 );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzz * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxz * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxz * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzz * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzx * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxx * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxx * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzx * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zzy * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zxy * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xxy * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xzy * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zyz * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xyz * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.zyx * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.xyx * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yzz * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yxz * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yxx * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D + Gsd.yzx * os, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
shadow *= realShadowDarkness * ( 1.0 / 21.0 );
\n\t
#else
\n\t\t\t
vec3 bd3D = normalize( lightToPosition );
\n\t\t\t
float dp = length( lightToPosition );
\n\t\t\t
adjustShadowValue1K( dp, texture2D( shadowMap[ i ], cubeToUV( bd3D, texelSizeY ) ), shadowBias[ i ], shadow );
\n\t\t\t
shadow *= realShadowDarkness;
\n\t
#endif
\n\t\t
} else {
\n
#endif
\n\t\t\t
float texelSizeX = 1.0 / shadowMapSize[ i ].x;
\n\t\t\t
vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;
\n\t\t\t
bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
\n\t\t\t
bool inFrustum = all( inFrustumVec );
\n\t\t\t
bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
\n\t\t\t
bool frustumTest = all( frustumTestVec );
\n\t\t\t
if ( frustumTest ) {
\n\t
#if defined( SHADOWMAP_TYPE_PCF )
\n\t\t\t\t
shadowCoord.z += shadowBias[ i ];
\n\t\t\t\t
const float ShadowDelta = 1.0 / 9.0;
\n\t\t\t\t
float xPixelOffset = texelSizeX;
\n\t\t\t\t
float yPixelOffset = texelSizeY;
\n\t\t\t\t
float dx0 = - 1.25 * xPixelOffset;
\n\t\t\t\t
float dy0 = - 1.25 * yPixelOffset;
\n\t\t\t\t
float dx1 = 1.25 * xPixelOffset;
\n\t\t\t\t
float dy1 = 1.25 * yPixelOffset;
\n\t\t\t\t
float fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );
\n\t\t\t\t
if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;
\n\t\t\t\t
fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );
\n\t\t\t\t
if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;
\n\t\t\t\t
fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );
\n\t\t\t\t
if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;
\n\t\t\t\t
fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );
\n\t\t\t\t
if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;
\n\t\t\t\t
fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );
\n\t\t\t\t
if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;
\n\t\t\t\t
fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );
\n\t\t\t\t
if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;
\n\t\t\t\t
fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );
\n\t\t\t\t
if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;
\n\t\t\t\t
fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );
\n\t\t\t\t
if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;
\n\t\t\t\t
fDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );
\n\t\t\t\t
if ( fDepth < shadowCoord.z ) shadow += ShadowDelta;
\n\t\t\t\t
shadow *= shadowDarkness[ i ];
\n\t
#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
\n\t\t\t\t
shadowCoord.z += shadowBias[ i ];
\n\t\t\t\t
float xPixelOffset = texelSizeX;
\n\t\t\t\t
float yPixelOffset = texelSizeY;
\n\t\t\t\t
float dx0 = - 1.0 * xPixelOffset;
\n\t\t\t\t
float dy0 = - 1.0 * yPixelOffset;
\n\t\t\t\t
float dx1 = 1.0 * xPixelOffset;
\n\t\t\t\t
float dy1 = 1.0 * yPixelOffset;
\n\t\t\t\t
mat3 shadowKernel;
\n\t\t\t\t
mat3 depthKernel;
\n\t\t\t\t
depthKernel[ 0 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );
\n\t\t\t\t
depthKernel[ 0 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );
\n\t\t\t\t
depthKernel[ 0 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );
\n\t\t\t\t
depthKernel[ 1 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );
\n\t\t\t\t
depthKernel[ 1 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );
\n\t\t\t\t
depthKernel[ 1 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );
\n\t\t\t\t
depthKernel[ 2 ][ 0 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );
\n\t\t\t\t
depthKernel[ 2 ][ 1 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );
\n\t\t\t\t
depthKernel[ 2 ][ 2 ] = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );
\n\t\t\t\t
vec3 shadowZ = vec3( shadowCoord.z );
\n\t\t\t\t
shadowKernel[ 0 ] = vec3( lessThan( depthKernel[ 0 ], shadowZ ) );
\n\t\t\t\t
shadowKernel[ 0 ] *= vec3( 0.25 );
\n\t\t\t\t
shadowKernel[ 1 ] = vec3( lessThan( depthKernel[ 1 ], shadowZ ) );
\n\t\t\t\t
shadowKernel[ 1 ] *= vec3( 0.25 );
\n\t\t\t\t
shadowKernel[ 2 ] = vec3( lessThan( depthKernel[ 2 ], shadowZ ) );
\n\t\t\t\t
shadowKernel[ 2 ] *= vec3( 0.25 );
\n\t\t\t\t
vec2 fractionalCoord = 1.0 - fract( shadowCoord.xy * shadowMapSize[ i ].xy );
\n\t\t\t\t
shadowKernel[ 0 ] = mix( shadowKernel[ 1 ], shadowKernel[ 0 ], fractionalCoord.x );
\n\t\t\t\t
shadowKernel[ 1 ] = mix( shadowKernel[ 2 ], shadowKernel[ 1 ], fractionalCoord.x );
\n\t\t\t\t
vec4 shadowValues;
\n\t\t\t\t
shadowValues.x = mix( shadowKernel[ 0 ][ 1 ], shadowKernel[ 0 ][ 0 ], fractionalCoord.y );
\n\t\t\t\t
shadowValues.y = mix( shadowKernel[ 0 ][ 2 ], shadowKernel[ 0 ][ 1 ], fractionalCoord.y );
\n\t\t\t\t
shadowValues.z = mix( shadowKernel[ 1 ][ 1 ], shadowKernel[ 1 ][ 0 ], fractionalCoord.y );
\n\t\t\t\t
shadowValues.w = mix( shadowKernel[ 1 ][ 2 ], shadowKernel[ 1 ][ 1 ], fractionalCoord.y );
\n\t\t\t\t
shadow = dot( shadowValues, vec4( 1.0 ) ) * shadowDarkness[ i ];
\n\t
#else
\n\t\t\t\t
shadowCoord.z += shadowBias[ i ];
\n\t\t\t\t
vec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );
\n\t\t\t\t
float fDepth = unpackDepth( rgbaDepth );
\n\t\t\t\t
if ( fDepth < shadowCoord.z )
\n\t\t\t\t\t
shadow = shadowDarkness[ i ];
\n\t
#endif
\n\t\t\t
}
\n
#ifdef SHADOWMAP_DEBUG
\n\t\t\t
if ( inFrustum ) {
\n\t\t\t\t
if ( i == 0 ) {
\n\t\t\t\t\t
outgoingLight *= vec3( 1.0, 0.5, 0.0 );
\n\t\t\t\t
} else if ( i == 1 ) {
\n\t\t\t\t\t
outgoingLight *= vec3( 0.0, 1.0, 0.8 );
\n\t\t\t\t
} else {
\n\t\t\t\t\t
outgoingLight *= vec3( 0.0, 0.5, 1.0 );
\n\t\t\t\t
}
\n\t\t\t
}
\n
#endif
\n
#ifdef POINT_LIGHT_SHADOWS
\n\t\t
}
\n
#endif
\n\t\t
shadowMask = shadowMask * vec3( 1.0 - shadow );
\n\t\t
shadows[ i ] = 1.0 - shadow;
\n\t
}
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
shadowmap_pars_fragment
=
"
#ifdef USE_SHADOWMAP
\n\t
uniform sampler2D shadowMap[ NUM_SHADOWS ];
\n\t
uniform vec2 shadowMapSize[ NUM_SHADOWS ];
\n\t
uniform float shadowDarkness[ NUM_SHADOWS ];
\n\t
uniform float shadowBias[ NUM_SHADOWS ];
\n\t
varying vec4 vShadowCoord[ NUM_SHADOWS ];
\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
float depth = dot( rgba_depth, bit_shift );
\n\t\t
return depth;
\n\t
}
\n\t
#ifdef POINT_LIGHT_SHADOWS
\n\t\t
void adjustShadowValue1K( const float testDepth, const vec4 textureData, const float bias, inout float shadowValue ) {
\n\t\t\t
const vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );
\n\t\t\t
if ( testDepth >= dot( textureData, bitSh ) * 1000.0 + bias )
\n\t\t\t\t
shadowValue += 1.0;
\n\t\t
}
\n\t\t
vec2 cubeToUV( vec3 v, float texelSizeY ) {
\n\t\t\t
vec3 absV = abs( v );
\n\t\t\t
float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
\n\t\t\t
absV *= scaleToCube;
\n\t\t\t
v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
\n\t\t\t
vec2 planar = v.xy;
\n\t\t\t
float almostATexel = 1.5 * texelSizeY;
\n\t\t\t
float almostOne = 1.0 - almostATexel;
\n\t\t\t
if ( absV.z >= almostOne ) {
\n\t\t\t\t
if ( v.z > 0.0 )
\n\t\t\t\t\t
planar.x = 4.0 - v.x;
\n\t\t\t
} else if ( absV.x >= almostOne ) {
\n\t\t\t\t
float signX = sign( v.x );
\n\t\t\t\t
planar.x = v.z * signX + 2.0 * signX;
\n\t\t\t
} else if ( absV.y >= almostOne ) {
\n\t\t\t\t
float signY = sign( v.y );
\n\t\t\t\t
planar.x = v.x + 2.0 * signY + 2.0;
\n\t\t\t\t
planar.y = v.z * signY - 2.0;
\n\t\t\t
}
\n\t\t\t
return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
\n\t\t
}
\n\t
#endif
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
=
"
#ifdef USE_SHADOWMAP
\n\t
uniform
float shadowDarkness[ NUM_SHADOWS ];
\n\t
uniform mat4 shadowMatrix[ NUM_SHADOWS ];
\n\t
varying vec4 vShadowCoord[ NUM_SHADOWS ];
\n
#endif
"
;
THREE
.
ShaderChunk
.
shadowmap_vertex
=
"
#ifdef USE_SHADOWMAP
\n\t
for ( int i = 0; i < NUM_SHADOWS; i ++ ) {
\n\t\t\t
vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;
\n\t
}
\n
#endif
"
;
THREE
.
ShaderChunk
.
skinbase_vertex
=
"
#ifdef USE_SKINNING
\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
#endif
"
;
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
=
"
#ifdef USE_SHADOWMAP
\n\t
uniform
mat4 shadowMatrix[ NUM_SHADOWS ];
\n\t
varying vec4 vShadowCoord[ NUM_SHADOWS ];
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
shadowmap_vertex
=
"
#ifdef USE_SHADOWMAP
\n\t
for ( int i = 0; i < NUM_SHADOWS; i ++ ) {
\n\t\t\t
vShadowCoord[ i ] = shadowMatrix[ i ] * worldPosition;
\n\t
}
\n
#endif
"
;
THREE
.
ShaderChunk
.
skinbase_vertex
=
"
#ifdef USE_SKINNING
\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
#endif
"
;
THREE
.
ShaderChunk
.
skinning_pars_vertex
=
"
#ifdef USE_SKINNING
\n\t
uniform mat4 bindMatrix;
\n\t
uniform mat4 bindMatrixInverse;
\n\t
#ifdef BONE_TEXTURE
\n\t\t
uniform sampler2D boneTexture;
\n\t\t
uniform int boneTextureWidth;
\n\t\t
uniform int boneTextureHeight;
\n\t\t
mat4 getBoneMatrix( const in float i ) {
\n\t\t\t
float j = i * 4.0;
\n\t\t\t
float x = mod( j, float( boneTextureWidth ) );
\n\t\t\t
float y = floor( j / float( boneTextureWidth ) );
\n\t\t\t
float dx = 1.0 / float( boneTextureWidth );
\n\t\t\t
float dy = 1.0 / float( boneTextureHeight );
\n\t\t\t
y = dy * ( y + 0.5 );
\n\t\t\t
vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
\n\t\t\t
vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
\n\t\t\t
vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
\n\t\t\t
vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
\n\t\t\t
mat4 bone = mat4( v1, v2, v3, v4 );
\n\t\t\t
return bone;
\n\t\t
}
\n\t
#else
\n\t\t
uniform mat4 boneGlobalMatrices[ MAX_BONES ];
\n\t\t
mat4 getBoneMatrix( const in float i ) {
\n\t\t\t
mat4 bone = boneGlobalMatrices[ int(i) ];
\n\t\t\t
return bone;
\n\t\t
}
\n\t
#endif
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
skinning_vertex
=
"
#ifdef USE_SKINNING
\n\t
vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
\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
#endif
\n
"
;
THREE
.
ShaderChunk
.
skinnormal_vertex
=
"
#ifdef USE_SKINNING
\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\t
objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
\n
#endif
\n
"
;
THREE
.
ShaderChunk
.
specularmap_fragment
=
"
float specularStrength;
\n
#ifdef USE_SPECULARMAP
\n\t
vec4 texelSpecular = texture2D( specularMap, vUv );
\n\t
specularStrength = texelSpecular.r;
\n
#else
\n\t
specularStrength = 1.0;
\n
#endif
"
;
THREE
.
ShaderChunk
.
specularmap_pars_fragment
=
"
#ifdef USE_SPECULARMAP
\n\t
uniform sampler2D specularMap;
\n
#endif
"
;
THREE
.
ShaderChunk
.
uv2_pars_fragment
=
"
#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
\n\t
varying vec2 vUv2;
\n
#endif
"
;
THREE
.
ShaderChunk
.
uv2_pars_vertex
=
"
#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
\n\t
attribute vec2 uv2;
\n\t
varying vec2 vUv2;
\n
#endif
"
;
...
...
@@ -589,7 +589,7 @@ THREE.ShaderChunk.logdepthbuf_vertex,"}"].join("\n"),fragmentShader:["uniform sa
distanceRGBA
:{
uniforms
:{
lightPos
:{
type
:
"
v3
"
,
value
:
new
THREE
.
Vector3
(
0
,
0
,
0
)}},
vertexShader
:[
"
varying vec4 vWorldPosition;
"
,
THREE
.
ShaderChunk
.
common
,
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
,
THREE
.
ShaderChunk
.
skinning_pars_vertex
,
"
void main() {
"
,
THREE
.
ShaderChunk
.
skinbase_vertex
,
THREE
.
ShaderChunk
.
begin_vertex
,
THREE
.
ShaderChunk
.
morphtarget_vertex
,
THREE
.
ShaderChunk
.
skinning_vertex
,
THREE
.
ShaderChunk
.
project_vertex
,
THREE
.
ShaderChunk
.
worldpos_vertex
,
"
vWorldPosition = worldPosition;
\n
}
"
].
join
(
"
\n
"
),
fragmentShader
:[
"
uniform vec3 lightPos;
\n
varying vec4 vWorldPosition;
"
,
THREE
.
ShaderChunk
.
common
,
"
vec4 pack1K ( float depth ) {
\n
depth /= 1000.0;
\n
const vec4 bitSh = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );
\n\t
const vec4 bitMsk = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );
\n\t
vec4 res = fract( depth * bitSh );
\n\t
res -= res.xxyz * bitMsk;
\n\t
return res;
\n
}
\n
float unpack1K ( vec4 color ) {
\n\t
const vec4 bitSh = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );
\n\t
return dot( color, bitSh ) * 1000.0;
\n
}
\n
void main () {
\n\t
gl_FragColor = pack1K( length( vWorldPosition.xyz - lightPos.xyz ) );
\n
}
"
].
join
(
"
\n
"
)}};
THREE
.
WebGLRenderer
=
function
(
a
){
function
b
(
a
,
b
,
c
,
d
){
!
0
===
L
&&
(
a
*=
d
,
b
*=
d
,
c
*=
d
);
r
.
clearColor
(
a
,
b
,
c
,
d
)}
function
c
(){
I
.
init
();
r
.
viewport
(
ia
,
ja
,
ka
,
la
);
b
(
R
.
r
,
R
.
g
,
R
.
b
,
T
)}
function
d
(){
ma
=
wa
=
null
;
na
=
""
;
qa
=-
1
;
I
.
reset
()}
function
e
(
a
){
a
.
preventDefault
();
d
();
c
();
V
.
clear
()}
function
f
(
a
){
a
=
a
.
target
;
a
.
removeEventListener
(
"
dispose
"
,
f
);
a
:{
var
b
=
V
.
get
(
a
);
if
(
a
.
image
&&
b
.
__image__webglTextureCube
)
r
.
deleteTexture
(
b
.
__image__webglTextureCube
);
else
{
if
(
void
0
===
b
.
__webglInit
)
break
a
;
r
.
deleteTexture
(
b
.
__webglTexture
)}
V
.
delete
(
a
)}
ga
.
textures
--
}
function
g
(
a
){
a
=
a
.
target
;
a
.
removeEventListener
(
"
dispose
"
,
g
);
var
b
=
V
.
get
(
a
),
c
=
V
.
get
(
a
.
texture
);
if
(
a
&&
void
0
!==
c
.
__webglTexture
){
r
.
deleteTexture
(
c
.
__webglTexture
);
if
(
a
instanceof
THREE
.
WebGLRenderTargetCube
)
for
(
c
=
0
;
6
>
c
;
c
++
)
r
.
deleteFramebuffer
(
b
.
__webglFramebuffer
[
c
]),
r
.
deleteRenderbuffer
(
b
.
__webgl
Renderbuffer
[
c
]);
else
r
.
deleteFramebuffer
(
b
.
__webglFramebuffer
),
r
.
deleteRenderbuffer
(
b
.
__webglRender
buffer
);
V
.
delete
(
a
.
texture
);
V
.
delete
(
a
)}
ga
.
textures
--
}
function
h
(
a
){
a
=
a
.
target
;
a
.
removeEventListener
(
"
dispose
"
,
function
g
(
a
){
a
=
a
.
target
;
a
.
removeEventListener
(
"
dispose
"
,
g
);
var
b
=
V
.
get
(
a
),
c
=
V
.
get
(
a
.
texture
);
if
(
a
&&
void
0
!==
c
.
__webglTexture
){
r
.
deleteTexture
(
c
.
__webglTexture
);
if
(
a
instanceof
THREE
.
WebGLRenderTargetCube
)
for
(
c
=
0
;
6
>
c
;
c
++
)
r
.
deleteFramebuffer
(
b
.
__webglFramebuffer
[
c
]),
r
.
deleteRenderbuffer
(
b
.
__webgl
Depthbuffer
[
c
]);
else
r
.
deleteFramebuffer
(
b
.
__webglFramebuffer
),
r
.
deleteRenderbuffer
(
b
.
__webglDepth
buffer
);
V
.
delete
(
a
.
texture
);
V
.
delete
(
a
)}
ga
.
textures
--
}
function
h
(
a
){
a
=
a
.
target
;
a
.
removeEventListener
(
"
dispose
"
,
h
);
k
(
a
);
V
.
delete
(
a
)}
function
k
(
a
){
var
b
=
V
.
get
(
a
).
program
;
a
.
program
=
void
0
;
void
0
!==
b
&&
oa
.
releaseProgram
(
b
)}
function
l
(
a
,
b
){
return
b
[
0
]
-
a
[
0
]}
function
n
(
a
,
b
){
return
a
.
object
.
renderOrder
!==
b
.
object
.
renderOrder
?
a
.
object
.
renderOrder
-
b
.
object
.
renderOrder
:
a
.
material
.
id
!==
b
.
material
.
id
?
a
.
material
.
id
-
b
.
material
.
id
:
a
.
z
!==
b
.
z
?
a
.
z
-
b
.
z
:
a
.
id
-
b
.
id
}
function
p
(
a
,
b
){
return
a
.
object
.
renderOrder
!==
b
.
object
.
renderOrder
?
a
.
object
.
renderOrder
-
b
.
object
.
renderOrder
:
a
.
z
!==
b
.
z
?
b
.
z
-
a
.
z
:
a
.
id
-
b
.
id
}
function
m
(
a
,
b
,
c
,
d
,
e
){
var
f
;
c
.
transparent
?
(
d
=
da
,
f
=++
ea
):(
d
=
aa
,
f
=++
ba
);
f
=
d
[
f
];
void
0
!==
f
?(
f
.
id
=
a
.
id
,
f
.
object
=
a
,
f
.
geometry
=
b
,
f
.
material
=
c
,
f
.
z
=
X
.
z
,
f
.
group
=
e
):(
f
=
{
id
:
a
.
id
,
object
:
a
,
geometry
:
b
,
material
:
c
,
z
:
X
.
z
,
group
:
e
},
d
.
push
(
f
))}
function
q
(
a
,
b
){
if
(
!
1
!==
a
.
visible
){
if
(
a
.
layers
.
test
(
b
.
layers
))
if
(
a
instanceof
THREE
.
Light
)
Y
.
push
(
a
);
else
if
(
a
instanceof
THREE
.
Sprite
)
!
1
!==
a
.
frustumCulled
&&!
0
!==
xa
.
intersectsObject
(
a
)
||
ha
.
push
(
a
);
else
if
(
a
instanceof
THREE
.
LensFlare
)
$
.
push
(
a
);
else
if
(
a
instanceof
THREE
.
ImmediateRenderObject
)
!
0
===
Z
.
sortObjects
&&
(
X
.
setFromMatrixPosition
(
a
.
matrixWorld
),
X
.
applyProjection
(
ra
)),
m
(
a
,
null
,
a
.
material
,
X
.
z
,
null
);
else
if
(
a
instanceof
THREE
.
Mesh
||
a
instanceof
THREE
.
Line
||
a
instanceof
THREE
.
Points
)
if
(
a
instanceof
THREE
.
SkinnedMesh
&&
a
.
skeleton
.
update
(),
!
1
===
a
.
frustumCulled
||!
0
===
xa
.
intersectsObject
(
a
)){
var
c
=
a
.
material
;
if
(
!
0
===
c
.
visible
){
!
0
===
Z
.
sortObjects
&&
(
X
.
setFromMatrixPosition
(
a
.
matrixWorld
),
X
.
applyProjection
(
ra
));
var
d
=
pa
.
update
(
a
);
if
(
c
instanceof
THREE
.
MeshFaceMaterial
)
for
(
var
e
=
d
.
groups
,
f
=
c
.
materials
,
c
=
0
,
g
=
e
.
length
;
c
<
g
;
c
++
){
var
h
=
e
[
c
],
k
=
f
[
h
.
materialIndex
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录