Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
57078053
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,发现更多精彩内容 >>
提交
57078053
编写于
5月 10, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
e123b1ce
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
96 addition
and
103 deletion
+96
-103
build/three.js
build/three.js
+88
-95
build/three.min.js
build/three.min.js
+8
-8
未找到文件。
build/three.js
浏览文件 @
57078053
...
...
@@ -16931,7 +16931,7 @@ THREE.ShaderChunk = {
" vec2 st0 = dFdx( vUv.st );",
" vec2 st1 = dFdy( vUv.st );",
" vec3 S = normalize(
q0 * st1.t - q1 * st0.t );",
" vec3 S = normalize( q0 * st1.t - q1 * st0.t );",
" vec3 T = normalize( -q0 * st1.s + q1 * st0.s );",
" vec3 N = normalize( surf_norm );",
...
...
@@ -17337,7 +17337,7 @@ THREE.ShaderChunk = {
"#if MAX_POINT_LIGHTS > 0",
" vec3 pointDiffuse
= vec3( 0.0 );",
" vec3 pointDiffuse = vec3( 0.0 );",
" vec3 pointSpecular = vec3( 0.0 );",
" for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {",
...
...
@@ -17368,7 +17368,7 @@ THREE.ShaderChunk = {
" #endif",
" pointDiffuse
+= diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;",
" pointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;",
// specular
...
...
@@ -17376,9 +17376,7 @@ THREE.ShaderChunk = {
" float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );",
" float pointSpecularWeight = specularStrength * max( pow( pointDotNormalHalf, shininess ), 0.0 );",
// 2.0 => 2.0001 is hack to work around ANGLE bug
" float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
" float specularNormalization = ( shininess + 2.0 ) / 8.0;",
" vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, pointHalfVector ), 0.0 ), 5.0 );",
" pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance * specularNormalization;",
...
...
@@ -17389,7 +17387,7 @@ THREE.ShaderChunk = {
"#if MAX_SPOT_LIGHTS > 0",
" vec3 spotDiffuse
= vec3( 0.0 );",
" vec3 spotDiffuse = vec3( 0.0 );",
" vec3 spotSpecular = vec3( 0.0 );",
" for ( int i = 0; i < MAX_SPOT_LIGHTS; i ++ ) {",
...
...
@@ -17434,9 +17432,7 @@ THREE.ShaderChunk = {
" float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );",
" float spotSpecularWeight = specularStrength * max( pow( spotDotNormalHalf, shininess ), 0.0 );",
// 2.0 => 2.0001 is hack to work around ANGLE bug
" float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
" float specularNormalization = ( shininess + 2.0 ) / 8.0;",
" vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, spotHalfVector ), 0.0 ), 5.0 );",
" spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * lDistance * specularNormalization * spotEffect;",
...
...
@@ -17449,7 +17445,7 @@ THREE.ShaderChunk = {
"#if MAX_DIR_LIGHTS > 0",
" vec3 dirDiffuse
= vec3( 0.0 );",
" vec3 dirDiffuse = vec3( 0.0 );",
" vec3 dirSpecular = vec3( 0.0 );" ,
" for( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {",
...
...
@@ -17474,38 +17470,36 @@ THREE.ShaderChunk = {
" #endif",
" dirDiffuse
+= diffuse * directionalLightColor[ i ] * dirDiffuseWeight;",
" dirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;",
// specular
// specular
" vec3 dirHalfVector = normalize( dirVector + viewPosition );",
" float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );",
" float dirSpecularWeight = specularStrength * max( pow( dirDotNormalHalf, shininess ), 0.0 );",
/*
// fresnel term from skin shader
/*
// fresnel term from skin shader
" const float F0 = 0.128;",
" float base = 1.0 - dot( viewPosition, dirHalfVector );",
" float exponential = pow( base, 5.0 );",
" float fresnel = exponential + F0 * ( 1.0 - exponential );",
*/
*/
/*
// fresnel term from fresnel shader
/*
// fresnel term from fresnel shader
" const float mFresnelBias = 0.08;",
" const float mFresnelScale = 0.3;",
" const float mFresnelPower = 5.0;",
" float fresnel = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( -viewPosition ), normal ), mFresnelPower );",
*/
// 2.0 => 2.0001 is hack to work around ANGLE bug
*/
" float specularNormalization = ( shininess + 2.0
001
) / 8.0;",
" float specularNormalization = ( shininess + 2.0 ) / 8.0;",
//"
dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;",
// "
dirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization * fresnel;",
" vec3 schlick = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( dirVector, dirHalfVector ), 0.0 ), 5.0 );",
" dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;",
...
...
@@ -17517,7 +17511,7 @@ THREE.ShaderChunk = {
"#if MAX_HEMI_LIGHTS > 0",
" vec3 hemiDiffuse
= vec3( 0.0 );",
" vec3 hemiDiffuse = vec3( 0.0 );",
" vec3 hemiSpecular = vec3( 0.0 );" ,
" for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {",
...
...
@@ -17525,7 +17519,7 @@ THREE.ShaderChunk = {
" vec4 lDirection = viewMatrix * vec4( hemisphereLightDirection[ i ], 0.0 );",
" vec3 lVector = normalize( lDirection.xyz );",
// diffuse
// diffuse
" float dotProduct = dot( normal, lVector );",
" float hemiDiffuseWeight = 0.5 * dotProduct + 0.5;",
...
...
@@ -17534,13 +17528,13 @@ THREE.ShaderChunk = {
" hemiDiffuse += diffuse * hemiColor;",
// specular (sky light)
// specular (sky light)
" vec3 hemiHalfVectorSky = normalize( lVector + viewPosition );",
" float hemiDotNormalHalfSky = 0.5 * dot( normal, hemiHalfVectorSky ) + 0.5;",
" float hemiSpecularWeightSky = specularStrength * max( pow( hemiDotNormalHalfSky, shininess ), 0.0 );",
// specular (ground light)
// specular (ground light)
" vec3 lVectorGround = -lVector;",
...
...
@@ -17550,9 +17544,7 @@ THREE.ShaderChunk = {
" float dotProductGround = dot( normal, lVectorGround );",
// 2.0 => 2.0001 is hack to work around ANGLE bug
" float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
" float specularNormalization = ( shininess + 2.0 ) / 8.0;",
" vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVector, hemiHalfVectorSky ), 0.0 ), 5.0 );",
" vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( max( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 0.0 ), 5.0 );",
...
...
@@ -17735,10 +17727,11 @@ THREE.ShaderChunk = {
" #endif",
" vec4 skinned = boneMatX * skinVertex * skinWeight.x;",
" skinned += boneMatY * skinVertex * skinWeight.y;",
" skinned += boneMatZ * skinVertex * skinWeight.z;",
" skinned += boneMatW * skinVertex * skinWeight.w;",
" vec4 skinned = vec4( 0.0 )'",
" skinned += boneMatX * skinVertex * skinWeight.x;",
" skinned += boneMatY * skinVertex * skinWeight.y;",
" skinned += boneMatZ * skinVertex * skinWeight.z;",
" skinned += boneMatW * skinVertex * skinWeight.w;",
"#endif"
...
...
@@ -17821,10 +17814,10 @@ THREE.ShaderChunk = {
" vec3 morphedNormal = vec3( 0.0 );",
" morphedNormal +=
( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];",
" morphedNormal +=
( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];",
" morphedNormal +=
( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];",
" morphedNormal +=
( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];",
" morphedNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];",
" morphedNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];",
" morphedNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];",
" morphedNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];",
" morphedNormal += normal;",
...
...
@@ -17836,10 +17829,11 @@ THREE.ShaderChunk = {
"#ifdef USE_SKINNING",
" mat4 skinMatrix = skinWeight.x * boneMatX;",
" skinMatrix += skinWeight.y * boneMatY;",
" skinMatrix += skinWeight.z * boneMatZ;",
" skinMatrix += skinWeight.w * boneMatW;",
" mat4 skinMatrix = mat4( 0.0 );",
" skinMatrix += skinWeight.x * boneMatX;",
" skinMatrix += skinWeight.y * boneMatY;",
" skinMatrix += skinWeight.z * boneMatZ;",
" skinMatrix += skinWeight.w * boneMatW;",
" #ifdef USE_MORPHNORMALS",
...
...
@@ -17890,8 +17884,8 @@ THREE.ShaderChunk = {
// SHADOW MAP
// based on SpiderGL shadow map and Fabien Sanglard's GLSL shadow mapping examples
//
http://spidergl.org/example.php?id=6
//
http://fabiensanglard.net/shadowmapping
// http://spidergl.org/example.php?id=6
// http://fabiensanglard.net/shadowmapping
shadowmap_pars_fragment: [
...
...
@@ -17943,8 +17937,8 @@ THREE.ShaderChunk = {
" vec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;",
// "if ( something && something )"
breaks ATI OpenGL shader compiler
// "if ( all( something, something ) )"
using this instead
// "if ( something && something )" breaks ATI OpenGL shader compiler
// "if ( all( something, something ) )" using this instead
" bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );",
" bool inFrustum = all( inFrustumVec );",
...
...
@@ -17978,7 +17972,7 @@ THREE.ShaderChunk = {
" float shadow = 0.0;",
/*
/*
// nested loops breaks shader compiler / validator on some ATI cards when using OpenGL
// must enroll loop manually
...
...
@@ -17999,7 +17993,7 @@ THREE.ShaderChunk = {
" shadow /= 9.0;",
*/
*/
" const float shadowDelta = 1.0 / 9.0;",
...
...
@@ -18101,13 +18095,13 @@ THREE.ShaderChunk = {
" if ( fDepth < shadowCoord.z )",
// spot with multiple shadows is darker
// spot with multiple shadows is darker
" shadowColor = shadowColor * vec3( 1.0 - shadowDarkness[ i ] );",
// spot with multiple shadows has the same color as single shadow spot
// spot with multiple shadows has the same color as single shadow spot
//"
shadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );",
// "
shadowColor = min( shadowColor, vec3( shadowDarkness[ i ] ) );",
" #endif",
...
...
@@ -18253,6 +18247,7 @@ THREE.ShaderChunk = {
].join('\n'),
logdepthbuf_fragment: [
"#if defined(USE_LOGDEPTHBUF) && defined(USE_LOGDEPTHBUF_EXT)",
" gl_FragDepthEXT = log2(vFragDepth) * logDepthBufFC * 0.5;",
...
...
@@ -18770,7 +18765,7 @@ THREE.ShaderLib = {
'particle_basic': {
uniforms:
THREE.UniformsUtils.merge( [
uniforms: THREE.UniformsUtils.merge( [
THREE.UniformsLib[ "particle" ],
THREE.UniformsLib[ "shadowmap" ]
...
...
@@ -18844,8 +18839,8 @@ THREE.ShaderLib = {
THREE.UniformsLib[ "fog" ],
{
"scale"
:
{ type: "f", value: 1 },
"dashSize"
:
{ type: "f", value: 1 },
"scale"
:
{ type: "f", value: 1 },
"dashSize"
:
{ type: "f", value: 1 },
"totalSize": { type: "f", value: 2 }
}
...
...
@@ -19029,18 +19024,18 @@ THREE.ShaderLib = {
{
"enableAO"
: { type: "i", value: 0 },
"enableDiffuse"
: { type: "i", value: 0 },
"enableSpecular" : { type: "i", value: 0 },
"enableReflection": { type: "i", value: 0 },
"enableAO"
: { type: "i", value: 0 },
"enableDiffuse"
: { type: "i", value: 0 },
"enableSpecular"
: { type: "i", value: 0 },
"enableReflection"
: { type: "i", value: 0 },
"enableDisplacement": { type: "i", value: 0 },
"tDisplacement": { type: "t", value: null }, // must go first as this is vertex texture
"tDiffuse"
: { type: "t", value: null },
"tCube"
: { type: "t", value: null },
"tNormal"
: { type: "t", value: null },
"tSpecular"
: { type: "t", value: null },
"tAO"
: { type: "t", value: null },
"tDiffuse"
: { type: "t", value: null },
"tCube"
: { type: "t", value: null },
"tNormal"
: { type: "t", value: null },
"tSpecular"
: { type: "t", value: null },
"tAO"
: { type: "t", value: null },
"uNormalScale": { type: "v2", value: new THREE.Vector2( 1, 1 ) },
...
...
@@ -19060,7 +19055,7 @@ THREE.ShaderLib = {
"uOffset" : { type: "v2", value: new THREE.Vector2( 0, 0 ) },
"uRepeat" : { type: "v2", value: new THREE.Vector2( 1, 1 ) },
"wrapRGB"
: { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) }
"wrapRGB" : { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) }
}
...
...
@@ -19247,9 +19242,7 @@ THREE.ShaderLib = {
" float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );",
" float pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, shininess ), 0.0 );",
// 2.0 => 2.0001 is hack to work around ANGLE bug
" float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
" float specularNormalization = ( shininess + 2.0 ) / 8.0;",
" vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( pointVector, pointHalfVector ), 5.0 );",
" pointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance * specularNormalization;",
...
...
@@ -19305,9 +19298,7 @@ THREE.ShaderLib = {
" float spotDotNormalHalf = max( dot( normal, spotHalfVector ), 0.0 );",
" float spotSpecularWeight = specularTex.r * max( pow( spotDotNormalHalf, shininess ), 0.0 );",
// 2.0 => 2.0001 is hack to work around ANGLE bug
" float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
" float specularNormalization = ( shininess + 2.0 ) / 8.0;",
" vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( spotVector, spotHalfVector ), 5.0 );",
" spotSpecular += schlick * spotLightColor[ i ] * spotSpecularWeight * spotDiffuseWeight * spotDistance * specularNormalization * spotEffect;",
...
...
@@ -19353,9 +19344,7 @@ THREE.ShaderLib = {
" float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );",
" float dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, shininess ), 0.0 );",
// 2.0 => 2.0001 is hack to work around ANGLE bug
" float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
" float specularNormalization = ( shininess + 2.0 ) / 8.0;",
" vec3 schlick = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( dirVector, dirHalfVector ), 5.0 );",
" dirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight * specularNormalization;",
...
...
@@ -19368,7 +19357,7 @@ THREE.ShaderLib = {
" #if MAX_HEMI_LIGHTS > 0",
" vec3 hemiDiffuse
= vec3( 0.0 );",
" vec3 hemiDiffuse = vec3( 0.0 );",
" vec3 hemiSpecular = vec3( 0.0 );" ,
" for( int i = 0; i < MAX_HEMI_LIGHTS; i ++ ) {",
...
...
@@ -19402,9 +19391,7 @@ THREE.ShaderLib = {
" float dotProductGround = dot( normal, lVectorGround );",
// 2.0 => 2.0001 is hack to work around ANGLE bug
" float specularNormalization = ( shininess + 2.0001 ) / 8.0;",
" float specularNormalization = ( shininess + 2.0 ) / 8.0;",
" vec3 schlickSky = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVector, hemiHalfVectorSky ), 5.0 );",
" vec3 schlickGround = specular + vec3( 1.0 - specular ) * pow( 1.0 - dot( lVectorGround, hemiHalfVectorGround ), 5.0 );",
...
...
@@ -19564,12 +19551,13 @@ THREE.ShaderLib = {
" vec4 skinVertex = vec4( position, 1.0 );",
" vec4 skinned = boneMatX * skinVertex * skinWeight.x;",
" skinned += boneMatY * skinVertex * skinWeight.y;",
" skinned += boneMatZ * skinVertex * skinWeight.z;",
" skinned += boneMatW * skinVertex * skinWeight.w;",
" vec4 skinned = vec4( 0.0 );",
" skinned += boneMatX * skinVertex * skinWeight.x;",
" skinned += boneMatY * skinVertex * skinWeight.y;",
" skinned += boneMatZ * skinVertex * skinWeight.z;",
" skinned += boneMatW * skinVertex * skinWeight.w;",
" displacedPosition
= skinned.xyz;",
" displacedPosition = skinned.xyz;",
" #else",
...
...
@@ -19585,12 +19573,13 @@ THREE.ShaderLib = {
" vec4 skinVertex = vec4( position, 1.0 );",
" vec4 skinned = boneMatX * skinVertex * skinWeight.x;",
" skinned += boneMatY * skinVertex * skinWeight.y;",
" skinned += boneMatZ * skinVertex * skinWeight.z;",
" skinned += boneMatW * skinVertex * skinWeight.w;",
" vec4 skinned = vec4( 0.0 );",
" skinned += boneMatX * skinVertex * skinWeight.x;",
" skinned += boneMatY * skinVertex * skinWeight.y;",
" skinned += boneMatZ * skinVertex * skinWeight.z;",
" skinned += boneMatW * skinVertex * skinWeight.w;",
" displacedPosition
= skinned.xyz;",
" displacedPosition = skinned.xyz;",
" #else",
...
...
@@ -19681,13 +19670,17 @@ THREE.ShaderLib = {
},
// Depth encoding into RGBA texture
// based on SpiderGL shadow map example
// http://spidergl.org/example.php?id=6
// originally from
// http://www.gamedev.net/topic/442138-packing-a-float-into-a-a8r8g8b8-texture-shader/page__whichpage__1%25EF%25BF%25BD
// see also here:
// http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
/* Depth encoding into RGBA texture
*
* based on SpiderGL shadow map example
* http://spidergl.org/example.php?id=6
*
* originally from
* http://www.gamedev.net/topic/442138-packing-a-float-into-a-a8r8g8b8-texture-shader/page__whichpage__1%25EF%25BF%25BD
*
* see also
* http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
*/
'depthRGBA': {
...
...
@@ -19718,7 +19711,7 @@ THREE.ShaderLib = {
"vec4 pack_depth( const in float depth ) {",
" const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );",
" const vec4 bit_mask
= vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );",
" const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );",
" vec4 res = mod( depth * bit_shift * vec4( 255 ), vec4( 256 ) ) / vec4( 255 );", // " vec4 res = fract( depth * bit_shift );",
" res -= res.xxyz * bit_mask;",
" return res;",
...
...
build/three.min.js
浏览文件 @
57078053
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录