Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
f59ed3e2
T
three.js
项目概览
fktz008
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
f59ed3e2
编写于
1月 30, 2012
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Changed default ambient color to 0xffffff.
As per discussion in #1207
上级
18c28b64
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
30 addition
and
28 deletion
+30
-28
build/Three.js
build/Three.js
+6
-5
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+4
-4
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+2
-1
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+4
-4
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+4
-4
examples/webgl_loader_ctm.html
examples/webgl_loader_ctm.html
+1
-1
examples/webgl_loader_ctm_materials.html
examples/webgl_loader_ctm_materials.html
+1
-1
examples/webgl_materials_cars.html
examples/webgl_materials_cars.html
+1
-1
examples/webgl_materials_cars_anaglyph.html
examples/webgl_materials_cars_anaglyph.html
+1
-1
examples/webgl_materials_cars_camaro_crosseyed.html
examples/webgl_materials_cars_camaro_crosseyed.html
+1
-1
examples/webgl_morphtargets.html
examples/webgl_morphtargets.html
+1
-1
src/extras/ShaderUtils.js
src/extras/ShaderUtils.js
+2
-2
src/materials/MeshLambertMaterial.js
src/materials/MeshLambertMaterial.js
+1
-1
src/materials/MeshPhongMaterial.js
src/materials/MeshPhongMaterial.js
+1
-1
未找到文件。
build/Three.js
浏览文件 @
f59ed3e2
...
...
@@ -113,10 +113,10 @@ THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.col
THREE
.
MeshBasicMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshBasicMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshBasicMaterial
.
prototype
.
constructor
=
THREE
.
MeshBasicMaterial
;
THREE
.
MeshLambertMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
328965
);
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshLambertMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshLambertMaterial
.
prototype
.
constructor
=
THREE
.
MeshLambertMaterial
;
THREE
.
MeshPhongMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
32896
5
);
this
.
specular
=
void
0
!==
a
.
specular
?
new
THREE
.
Color
(
a
.
specular
):
new
THREE
.
Color
(
1118481
);
this
.
shininess
=
void
0
!==
a
.
shininess
?
a
.
shininess
:
30
;
this
.
metal
=
void
0
!==
a
.
metal
?
a
.
metal
:
!
1
;
this
.
perPixel
=
void
0
!==
a
.
perPixel
?
a
.
perPixel
:
!
1
;
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
THREE
.
MeshLambertMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
16777215
);
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshLambertMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshLambertMaterial
.
prototype
.
constructor
=
THREE
.
MeshLambertMaterial
;
THREE
.
MeshPhongMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
1677721
5
);
this
.
specular
=
void
0
!==
a
.
specular
?
new
THREE
.
Color
(
a
.
specular
):
new
THREE
.
Color
(
1118481
);
this
.
shininess
=
void
0
!==
a
.
shininess
?
a
.
shininess
:
30
;
this
.
metal
=
void
0
!==
a
.
metal
?
a
.
metal
:
!
1
;
this
.
perPixel
=
void
0
!==
a
.
perPixel
?
a
.
perPixel
:
!
1
;
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshPhongMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshPhongMaterial
.
prototype
.
constructor
=
THREE
.
MeshPhongMaterial
;
THREE
.
MeshDepthMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
};
THREE
.
MeshDepthMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshDepthMaterial
.
prototype
.
constructor
=
THREE
.
MeshDepthMaterial
;
...
...
@@ -379,7 +379,8 @@ a.frustumCulled;for(var c=0;c<a.children.length;c++){var d=THREE.SceneUtils.clon
if
(
THREE
.
WebGLRenderer
)
THREE
.
ShaderUtils
=
{
lib
:{
fresnel
:{
uniforms
:{
mRefractionRatio
:{
type
:
"
f
"
,
value
:
1.02
},
mFresnelBias
:{
type
:
"
f
"
,
value
:
0.1
},
mFresnelPower
:{
type
:
"
f
"
,
value
:
2
},
mFresnelScale
:{
type
:
"
f
"
,
value
:
1
},
tCube
:{
type
:
"
t
"
,
value
:
1
,
texture
:
null
}},
fragmentShader
:
"
uniform samplerCube tCube;
\n
varying vec3 vReflect;
\n
varying vec3 vRefract[3];
\n
varying float vReflectionFactor;
\n
void main() {
\n
vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );
\n
vec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );
\n
refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;
\n
refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;
\n
refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;
\n
refractedColor.a = 1.0;
\n
gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );
\n
}
"
,
vertexShader
:
"
uniform float mRefractionRatio;
\n
uniform float mFresnelBias;
\n
uniform float mFresnelScale;
\n
uniform float mFresnelPower;
\n
varying vec3 vReflect;
\n
varying vec3 vRefract[3];
\n
varying float vReflectionFactor;
\n
void main() {
\n
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
\n
vec4 mPosition = objectMatrix * vec4( position, 1.0 );
\n
vec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );
\n
vec3 I = mPosition.xyz - cameraPosition;
\n
vReflect = reflect( I, nWorld );
\n
vRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );
\n
vRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );
\n
vRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );
\n
vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );
\n
gl_Position = projectionMatrix * mvPosition;
\n
}
"
},
normal
:{
uniforms
:
THREE
.
UniformsUtils
.
merge
([
THREE
.
UniformsLib
.
fog
,
THREE
.
UniformsLib
.
lights
,
THREE
.
UniformsLib
.
shadowmap
,{
enableAO
:{
type
:
"
i
"
,
value
:
0
},
enableDiffuse
:{
type
:
"
i
"
,
value
:
0
},
enableSpecular
:{
type
:
"
i
"
,
value
:
0
},
enableReflection
:{
type
:
"
i
"
,
value
:
0
},
tDiffuse
:{
type
:
"
t
"
,
value
:
0
,
texture
:
null
},
tCube
:{
type
:
"
t
"
,
value
:
1
,
texture
:
null
},
tNormal
:{
type
:
"
t
"
,
value
:
2
,
texture
:
null
},
tSpecular
:{
type
:
"
t
"
,
value
:
3
,
texture
:
null
},
tAO
:{
type
:
"
t
"
,
value
:
4
,
texture
:
null
},
tDisplacement
:{
type
:
"
t
"
,
value
:
5
,
texture
:
null
},
uNormalScale
:{
type
:
"
f
"
,
value
:
1
},
uDisplacementBias
:{
type
:
"
f
"
,
value
:
0
},
uDisplacementScale
:{
type
:
"
f
"
,
value
:
1
},
uDiffuseColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
15658734
)},
uSpecularColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
1118481
)},
uAmbientColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
328965
)},
uShininess
:{
type
:
"
f
"
,
value
:
30
},
uOpacity
:{
type
:
"
f
"
,
value
:
1
},
uReflectivity
:{
type
:
"
f
"
,
value
:
0.5
},
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
)}}]),
fragmentShader
:[
"
uniform vec3 uAmbientColor;
\n
uniform vec3 uDiffuseColor;
\n
uniform vec3 uSpecularColor;
\n
uniform float uShininess;
\n
uniform float uOpacity;
\n
uniform bool enableDiffuse;
\n
uniform bool enableSpecular;
\n
uniform bool enableAO;
\n
uniform bool enableReflection;
\n
uniform sampler2D tDiffuse;
\n
uniform sampler2D tNormal;
\n
uniform sampler2D tSpecular;
\n
uniform sampler2D tAO;
\n
uniform samplerCube tCube;
\n
uniform float uNormalScale;
\n
uniform float uReflectivity;
\n
varying vec3 vTangent;
\n
varying vec3 vBinormal;
\n
varying vec3 vNormal;
\n
varying vec2 vUv;
\n
uniform vec3 ambientLightColor;
\n
#if MAX_DIR_LIGHTS > 0
\n
uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];
\n
uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];
\n
#endif
\n
#if MAX_POINT_LIGHTS > 0
\n
uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];
\n
varying vec4 vPointLight[ MAX_POINT_LIGHTS ];
\n
#endif
\n
#ifdef WRAP_AROUND
\n
uniform vec3 wrapRGB;
\n
#endif
\n
varying vec3 vViewPosition;
"
,
value
:
1
},
uDisplacementBias
:{
type
:
"
f
"
,
value
:
0
},
uDisplacementScale
:{
type
:
"
f
"
,
value
:
1
},
uDiffuseColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
16777215
)},
uSpecularColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
1118481
)},
uAmbientColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
16777215
)},
uShininess
:{
type
:
"
f
"
,
value
:
30
},
uOpacity
:{
type
:
"
f
"
,
value
:
1
},
uReflectivity
:{
type
:
"
f
"
,
value
:
0.5
},
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
)}}]),
fragmentShader
:[
"
uniform vec3 uAmbientColor;
\n
uniform vec3 uDiffuseColor;
\n
uniform vec3 uSpecularColor;
\n
uniform float uShininess;
\n
uniform float uOpacity;
\n
uniform bool enableDiffuse;
\n
uniform bool enableSpecular;
\n
uniform bool enableAO;
\n
uniform bool enableReflection;
\n
uniform sampler2D tDiffuse;
\n
uniform sampler2D tNormal;
\n
uniform sampler2D tSpecular;
\n
uniform sampler2D tAO;
\n
uniform samplerCube tCube;
\n
uniform float uNormalScale;
\n
uniform float uReflectivity;
\n
varying vec3 vTangent;
\n
varying vec3 vBinormal;
\n
varying vec3 vNormal;
\n
varying vec2 vUv;
\n
uniform vec3 ambientLightColor;
\n
#if MAX_DIR_LIGHTS > 0
\n
uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];
\n
uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];
\n
#endif
\n
#if MAX_POINT_LIGHTS > 0
\n
uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];
\n
varying vec4 vPointLight[ MAX_POINT_LIGHTS ];
\n
#endif
\n
#ifdef WRAP_AROUND
\n
uniform vec3 wrapRGB;
\n
#endif
\n
varying vec3 vViewPosition;
"
,
THREE
.
ShaderChunk
.
shadowmap_pars_fragment
,
THREE
.
ShaderChunk
.
fog_pars_fragment
,
"
void main() {
\n
gl_FragColor = vec4( vec3( 1.0 ), uOpacity );
\n
vec3 specularTex = vec3( 1.0 );
\n
vec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;
\n
normalTex.xy *= uNormalScale;
\n
normalTex = normalize( normalTex );
\n
if( enableDiffuse ) {
\n
#ifdef GAMMA_INPUT
\n
vec4 texelColor = texture2D( tDiffuse, vUv );
\n
texelColor.xyz *= texelColor.xyz;
\n
gl_FragColor = gl_FragColor * texelColor;
\n
#else
\n
gl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );
\n
#endif
\n
}
\n
if( enableAO ) {
\n
#ifdef GAMMA_INPUT
\n
vec4 aoColor = texture2D( tAO, vUv );
\n
aoColor.xyz *= aoColor.xyz;
\n
gl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;
\n
#else
\n
gl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;
\n
#endif
\n
}
\n
if( enableSpecular )
\n
specularTex = texture2D( tSpecular, vUv ).xyz;
\n
mat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );
\n
vec3 finalNormal = tsb * normalTex;
\n
vec3 normal = normalize( finalNormal );
\n
vec3 viewPosition = normalize( vViewPosition );
\n
#if MAX_POINT_LIGHTS > 0
\n
vec3 pointDiffuse = vec3( 0.0 );
\n
vec3 pointSpecular = vec3( 0.0 );
\n
for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {
\n
vec3 pointVector = normalize( vPointLight[ i ].xyz );
\n
float pointDistance = vPointLight[ i ].w;
\n
#ifdef WRAP_AROUND
\n
float pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );
\n
float pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );
\n
vec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );
\n
#else
\n
float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );
\n
#endif
\n
pointDiffuse += pointDistance * pointLightColor[ i ] * uDiffuseColor * pointDiffuseWeight;
\n
vec3 pointHalfVector = normalize( pointVector + viewPosition );
\n
float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );
\n
float pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, uShininess ), 0.0 );
\n
pointSpecular += pointDistance * pointLightColor[ i ] * uSpecularColor * pointSpecularWeight * pointDiffuseWeight;
\n
}
\n
#endif
\n
#if MAX_DIR_LIGHTS > 0
\n
vec3 dirDiffuse = vec3( 0.0 );
\n
vec3 dirSpecular = vec3( 0.0 );
\n
for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {
\n
vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );
\n
vec3 dirVector = normalize( lDirection.xyz );
\n
#ifdef WRAP_AROUND
\n
float directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );
\n
float directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );
\n
vec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );
\n
#else
\n
float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );
\n
#endif
\n
dirDiffuse += directionalLightColor[ i ] * uDiffuseColor * dirDiffuseWeight;
\n
vec3 dirHalfVector = normalize( dirVector + viewPosition );
\n
float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );
\n
float dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, uShininess ), 0.0 );
\n
dirSpecular += directionalLightColor[ i ] * uSpecularColor * dirSpecularWeight * dirDiffuseWeight;
\n
}
\n
#endif
\n
vec3 totalDiffuse = vec3( 0.0 );
\n
vec3 totalSpecular = vec3( 0.0 );
\n
#if MAX_DIR_LIGHTS > 0
\n
totalDiffuse += dirDiffuse;
\n
totalSpecular += dirSpecular;
\n
#endif
\n
#if MAX_POINT_LIGHTS > 0
\n
totalDiffuse += pointDiffuse;
\n
totalSpecular += pointSpecular;
\n
#endif
\n
gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor) + totalSpecular;
\n
if ( enableReflection ) {
\n
vec3 wPos = cameraPosition - vViewPosition;
\n
vec3 vReflect = reflect( normalize( wPos ), normal );
\n
vec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );
\n
#ifdef GAMMA_INPUT
\n
cubeColor.xyz *= cubeColor.xyz;
\n
#endif
\n
gl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * uReflectivity );
\n
}
"
,
THREE
.
ShaderChunk
.
shadowmap_fragment
,
THREE
.
ShaderChunk
.
linear_to_gamma_fragment
,
THREE
.
ShaderChunk
.
fog_fragment
,
"
}
"
].
join
(
"
\n
"
),
vertexShader
:[
"
attribute vec4 tangent;
\n
uniform vec2 uOffset;
\n
uniform vec2 uRepeat;
\n
#ifdef VERTEX_TEXTURES
\n
uniform sampler2D tDisplacement;
\n
uniform float uDisplacementScale;
\n
uniform float uDisplacementBias;
\n
#endif
\n
varying vec3 vTangent;
\n
varying vec3 vBinormal;
\n
varying vec3 vNormal;
\n
varying vec2 vUv;
\n
#if MAX_POINT_LIGHTS > 0
\n
uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];
\n
uniform float pointLightDistance[ MAX_POINT_LIGHTS ];
\n
varying vec4 vPointLight[ MAX_POINT_LIGHTS ];
\n
#endif
\n
varying vec3 vViewPosition;
"
,
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
,
"
void main() {
\n
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
\n
vViewPosition = -mvPosition.xyz;
\n
vNormal = normalMatrix * normal;
\n
vTangent = normalMatrix * tangent.xyz;
\n
vBinormal = cross( vNormal, vTangent ) * tangent.w;
\n
vUv = uv * uRepeat + uOffset;
\n
#if MAX_POINT_LIGHTS > 0
\n
for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {
\n
vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );
\n
vec3 lVector = lPosition.xyz - mvPosition.xyz;
\n
float lDistance = 1.0;
\n
if ( pointLightDistance[ i ] > 0.0 )
\n
lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );
\n
lVector = normalize( lVector );
\n
vPointLight[ i ] = vec4( lVector, lDistance );
\n
}
\n
#endif
\n
#ifdef VERTEX_TEXTURES
\n
vec3 dv = texture2D( tDisplacement, uv ).xyz;
\n
float df = uDisplacementScale * dv.x + uDisplacementBias;
\n
vec4 displacedPosition = vec4( normalize( vNormal.xyz ) * df, 0.0 ) + mvPosition;
\n
gl_Position = projectionMatrix * displacedPosition;
\n
#else
\n
gl_Position = projectionMatrix * mvPosition;
\n
#endif
"
,
...
...
build/custom/ThreeCanvas.js
浏览文件 @
f59ed3e2
...
...
@@ -107,10 +107,10 @@ THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.col
THREE
.
MeshBasicMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshBasicMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshBasicMaterial
.
prototype
.
constructor
=
THREE
.
MeshBasicMaterial
;
THREE
.
MeshLambertMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
328965
);
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshLambertMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshLambertMaterial
.
prototype
.
constructor
=
THREE
.
MeshLambertMaterial
;
THREE
.
MeshPhongMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
32896
5
);
this
.
specular
=
void
0
!==
a
.
specular
?
new
THREE
.
Color
(
a
.
specular
):
new
THREE
.
Color
(
1118481
);
this
.
shininess
=
void
0
!==
a
.
shininess
?
a
.
shininess
:
30
;
this
.
metal
=
void
0
!==
a
.
metal
?
a
.
metal
:
!
1
;
this
.
perPixel
=
void
0
!==
a
.
perPixel
?
a
.
perPixel
:
!
1
;
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
THREE
.
MeshLambertMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
16777215
);
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshLambertMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshLambertMaterial
.
prototype
.
constructor
=
THREE
.
MeshLambertMaterial
;
THREE
.
MeshPhongMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
1677721
5
);
this
.
specular
=
void
0
!==
a
.
specular
?
new
THREE
.
Color
(
a
.
specular
):
new
THREE
.
Color
(
1118481
);
this
.
shininess
=
void
0
!==
a
.
shininess
?
a
.
shininess
:
30
;
this
.
metal
=
void
0
!==
a
.
metal
?
a
.
metal
:
!
1
;
this
.
perPixel
=
void
0
!==
a
.
perPixel
?
a
.
perPixel
:
!
1
;
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshPhongMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshPhongMaterial
.
prototype
.
constructor
=
THREE
.
MeshPhongMaterial
;
THREE
.
MeshDepthMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
};
THREE
.
MeshDepthMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshDepthMaterial
.
prototype
.
constructor
=
THREE
.
MeshDepthMaterial
;
...
...
build/custom/ThreeExtras.js
浏览文件 @
f59ed3e2
...
...
@@ -24,7 +24,8 @@ a.frustumCulled;for(var c=0;c<a.children.length;c++){var d=THREE.SceneUtils.clon
if
(
THREE
.
WebGLRenderer
)
THREE
.
ShaderUtils
=
{
lib
:{
fresnel
:{
uniforms
:{
mRefractionRatio
:{
type
:
"
f
"
,
value
:
1.02
},
mFresnelBias
:{
type
:
"
f
"
,
value
:
0.1
},
mFresnelPower
:{
type
:
"
f
"
,
value
:
2
},
mFresnelScale
:{
type
:
"
f
"
,
value
:
1
},
tCube
:{
type
:
"
t
"
,
value
:
1
,
texture
:
null
}},
fragmentShader
:
"
uniform samplerCube tCube;
\n
varying vec3 vReflect;
\n
varying vec3 vRefract[3];
\n
varying float vReflectionFactor;
\n
void main() {
\n
vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );
\n
vec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );
\n
refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;
\n
refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;
\n
refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;
\n
refractedColor.a = 1.0;
\n
gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );
\n
}
"
,
vertexShader
:
"
uniform float mRefractionRatio;
\n
uniform float mFresnelBias;
\n
uniform float mFresnelScale;
\n
uniform float mFresnelPower;
\n
varying vec3 vReflect;
\n
varying vec3 vRefract[3];
\n
varying float vReflectionFactor;
\n
void main() {
\n
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
\n
vec4 mPosition = objectMatrix * vec4( position, 1.0 );
\n
vec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );
\n
vec3 I = mPosition.xyz - cameraPosition;
\n
vReflect = reflect( I, nWorld );
\n
vRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );
\n
vRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );
\n
vRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );
\n
vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );
\n
gl_Position = projectionMatrix * mvPosition;
\n
}
"
},
normal
:{
uniforms
:
THREE
.
UniformsUtils
.
merge
([
THREE
.
UniformsLib
.
fog
,
THREE
.
UniformsLib
.
lights
,
THREE
.
UniformsLib
.
shadowmap
,{
enableAO
:{
type
:
"
i
"
,
value
:
0
},
enableDiffuse
:{
type
:
"
i
"
,
value
:
0
},
enableSpecular
:{
type
:
"
i
"
,
value
:
0
},
enableReflection
:{
type
:
"
i
"
,
value
:
0
},
tDiffuse
:{
type
:
"
t
"
,
value
:
0
,
texture
:
null
},
tCube
:{
type
:
"
t
"
,
value
:
1
,
texture
:
null
},
tNormal
:{
type
:
"
t
"
,
value
:
2
,
texture
:
null
},
tSpecular
:{
type
:
"
t
"
,
value
:
3
,
texture
:
null
},
tAO
:{
type
:
"
t
"
,
value
:
4
,
texture
:
null
},
tDisplacement
:{
type
:
"
t
"
,
value
:
5
,
texture
:
null
},
uNormalScale
:{
type
:
"
f
"
,
value
:
1
},
uDisplacementBias
:{
type
:
"
f
"
,
value
:
0
},
uDisplacementScale
:{
type
:
"
f
"
,
value
:
1
},
uDiffuseColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
15658734
)},
uSpecularColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
1118481
)},
uAmbientColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
328965
)},
uShininess
:{
type
:
"
f
"
,
value
:
30
},
uOpacity
:{
type
:
"
f
"
,
value
:
1
},
uReflectivity
:{
type
:
"
f
"
,
value
:
0.5
},
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
)}}]),
fragmentShader
:[
"
uniform vec3 uAmbientColor;
\n
uniform vec3 uDiffuseColor;
\n
uniform vec3 uSpecularColor;
\n
uniform float uShininess;
\n
uniform float uOpacity;
\n
uniform bool enableDiffuse;
\n
uniform bool enableSpecular;
\n
uniform bool enableAO;
\n
uniform bool enableReflection;
\n
uniform sampler2D tDiffuse;
\n
uniform sampler2D tNormal;
\n
uniform sampler2D tSpecular;
\n
uniform sampler2D tAO;
\n
uniform samplerCube tCube;
\n
uniform float uNormalScale;
\n
uniform float uReflectivity;
\n
varying vec3 vTangent;
\n
varying vec3 vBinormal;
\n
varying vec3 vNormal;
\n
varying vec2 vUv;
\n
uniform vec3 ambientLightColor;
\n
#if MAX_DIR_LIGHTS > 0
\n
uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];
\n
uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];
\n
#endif
\n
#if MAX_POINT_LIGHTS > 0
\n
uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];
\n
varying vec4 vPointLight[ MAX_POINT_LIGHTS ];
\n
#endif
\n
#ifdef WRAP_AROUND
\n
uniform vec3 wrapRGB;
\n
#endif
\n
varying vec3 vViewPosition;
"
,
value
:
1
},
uDisplacementBias
:{
type
:
"
f
"
,
value
:
0
},
uDisplacementScale
:{
type
:
"
f
"
,
value
:
1
},
uDiffuseColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
16777215
)},
uSpecularColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
1118481
)},
uAmbientColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
16777215
)},
uShininess
:{
type
:
"
f
"
,
value
:
30
},
uOpacity
:{
type
:
"
f
"
,
value
:
1
},
uReflectivity
:{
type
:
"
f
"
,
value
:
0.5
},
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
)}}]),
fragmentShader
:[
"
uniform vec3 uAmbientColor;
\n
uniform vec3 uDiffuseColor;
\n
uniform vec3 uSpecularColor;
\n
uniform float uShininess;
\n
uniform float uOpacity;
\n
uniform bool enableDiffuse;
\n
uniform bool enableSpecular;
\n
uniform bool enableAO;
\n
uniform bool enableReflection;
\n
uniform sampler2D tDiffuse;
\n
uniform sampler2D tNormal;
\n
uniform sampler2D tSpecular;
\n
uniform sampler2D tAO;
\n
uniform samplerCube tCube;
\n
uniform float uNormalScale;
\n
uniform float uReflectivity;
\n
varying vec3 vTangent;
\n
varying vec3 vBinormal;
\n
varying vec3 vNormal;
\n
varying vec2 vUv;
\n
uniform vec3 ambientLightColor;
\n
#if MAX_DIR_LIGHTS > 0
\n
uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];
\n
uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];
\n
#endif
\n
#if MAX_POINT_LIGHTS > 0
\n
uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];
\n
varying vec4 vPointLight[ MAX_POINT_LIGHTS ];
\n
#endif
\n
#ifdef WRAP_AROUND
\n
uniform vec3 wrapRGB;
\n
#endif
\n
varying vec3 vViewPosition;
"
,
THREE
.
ShaderChunk
.
shadowmap_pars_fragment
,
THREE
.
ShaderChunk
.
fog_pars_fragment
,
"
void main() {
\n
gl_FragColor = vec4( vec3( 1.0 ), uOpacity );
\n
vec3 specularTex = vec3( 1.0 );
\n
vec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;
\n
normalTex.xy *= uNormalScale;
\n
normalTex = normalize( normalTex );
\n
if( enableDiffuse ) {
\n
#ifdef GAMMA_INPUT
\n
vec4 texelColor = texture2D( tDiffuse, vUv );
\n
texelColor.xyz *= texelColor.xyz;
\n
gl_FragColor = gl_FragColor * texelColor;
\n
#else
\n
gl_FragColor = gl_FragColor * texture2D( tDiffuse, vUv );
\n
#endif
\n
}
\n
if( enableAO ) {
\n
#ifdef GAMMA_INPUT
\n
vec4 aoColor = texture2D( tAO, vUv );
\n
aoColor.xyz *= aoColor.xyz;
\n
gl_FragColor.xyz = gl_FragColor.xyz * aoColor.xyz;
\n
#else
\n
gl_FragColor.xyz = gl_FragColor.xyz * texture2D( tAO, vUv ).xyz;
\n
#endif
\n
}
\n
if( enableSpecular )
\n
specularTex = texture2D( tSpecular, vUv ).xyz;
\n
mat3 tsb = mat3( normalize( vTangent ), normalize( vBinormal ), normalize( vNormal ) );
\n
vec3 finalNormal = tsb * normalTex;
\n
vec3 normal = normalize( finalNormal );
\n
vec3 viewPosition = normalize( vViewPosition );
\n
#if MAX_POINT_LIGHTS > 0
\n
vec3 pointDiffuse = vec3( 0.0 );
\n
vec3 pointSpecular = vec3( 0.0 );
\n
for ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {
\n
vec3 pointVector = normalize( vPointLight[ i ].xyz );
\n
float pointDistance = vPointLight[ i ].w;
\n
#ifdef WRAP_AROUND
\n
float pointDiffuseWeightFull = max( dot( normal, pointVector ), 0.0 );
\n
float pointDiffuseWeightHalf = max( 0.5 * dot( normal, pointVector ) + 0.5, 0.0 );
\n
vec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );
\n
#else
\n
float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );
\n
#endif
\n
pointDiffuse += pointDistance * pointLightColor[ i ] * uDiffuseColor * pointDiffuseWeight;
\n
vec3 pointHalfVector = normalize( pointVector + viewPosition );
\n
float pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );
\n
float pointSpecularWeight = specularTex.r * max( pow( pointDotNormalHalf, uShininess ), 0.0 );
\n
pointSpecular += pointDistance * pointLightColor[ i ] * uSpecularColor * pointSpecularWeight * pointDiffuseWeight;
\n
}
\n
#endif
\n
#if MAX_DIR_LIGHTS > 0
\n
vec3 dirDiffuse = vec3( 0.0 );
\n
vec3 dirSpecular = vec3( 0.0 );
\n
for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {
\n
vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );
\n
vec3 dirVector = normalize( lDirection.xyz );
\n
#ifdef WRAP_AROUND
\n
float directionalLightWeightingFull = max( dot( normal, dirVector ), 0.0 );
\n
float directionalLightWeightingHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );
\n
vec3 dirDiffuseWeight = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );
\n
#else
\n
float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );
\n
#endif
\n
dirDiffuse += directionalLightColor[ i ] * uDiffuseColor * dirDiffuseWeight;
\n
vec3 dirHalfVector = normalize( dirVector + viewPosition );
\n
float dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );
\n
float dirSpecularWeight = specularTex.r * max( pow( dirDotNormalHalf, uShininess ), 0.0 );
\n
dirSpecular += directionalLightColor[ i ] * uSpecularColor * dirSpecularWeight * dirDiffuseWeight;
\n
}
\n
#endif
\n
vec3 totalDiffuse = vec3( 0.0 );
\n
vec3 totalSpecular = vec3( 0.0 );
\n
#if MAX_DIR_LIGHTS > 0
\n
totalDiffuse += dirDiffuse;
\n
totalSpecular += dirSpecular;
\n
#endif
\n
#if MAX_POINT_LIGHTS > 0
\n
totalDiffuse += pointDiffuse;
\n
totalSpecular += pointSpecular;
\n
#endif
\n
gl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * uAmbientColor) + totalSpecular;
\n
if ( enableReflection ) {
\n
vec3 wPos = cameraPosition - vViewPosition;
\n
vec3 vReflect = reflect( normalize( wPos ), normal );
\n
vec4 cubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );
\n
#ifdef GAMMA_INPUT
\n
cubeColor.xyz *= cubeColor.xyz;
\n
#endif
\n
gl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, specularTex.r * uReflectivity );
\n
}
"
,
THREE
.
ShaderChunk
.
shadowmap_fragment
,
THREE
.
ShaderChunk
.
linear_to_gamma_fragment
,
THREE
.
ShaderChunk
.
fog_fragment
,
"
}
"
].
join
(
"
\n
"
),
vertexShader
:[
"
attribute vec4 tangent;
\n
uniform vec2 uOffset;
\n
uniform vec2 uRepeat;
\n
#ifdef VERTEX_TEXTURES
\n
uniform sampler2D tDisplacement;
\n
uniform float uDisplacementScale;
\n
uniform float uDisplacementBias;
\n
#endif
\n
varying vec3 vTangent;
\n
varying vec3 vBinormal;
\n
varying vec3 vNormal;
\n
varying vec2 vUv;
\n
#if MAX_POINT_LIGHTS > 0
\n
uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];
\n
uniform float pointLightDistance[ MAX_POINT_LIGHTS ];
\n
varying vec4 vPointLight[ MAX_POINT_LIGHTS ];
\n
#endif
\n
varying vec3 vViewPosition;
"
,
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
,
"
void main() {
\n
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
\n
vViewPosition = -mvPosition.xyz;
\n
vNormal = normalMatrix * normal;
\n
vTangent = normalMatrix * tangent.xyz;
\n
vBinormal = cross( vNormal, vTangent ) * tangent.w;
\n
vUv = uv * uRepeat + uOffset;
\n
#if MAX_POINT_LIGHTS > 0
\n
for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {
\n
vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );
\n
vec3 lVector = lPosition.xyz - mvPosition.xyz;
\n
float lDistance = 1.0;
\n
if ( pointLightDistance[ i ] > 0.0 )
\n
lDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );
\n
lVector = normalize( lVector );
\n
vPointLight[ i ] = vec4( lVector, lDistance );
\n
}
\n
#endif
\n
#ifdef VERTEX_TEXTURES
\n
vec3 dv = texture2D( tDisplacement, uv ).xyz;
\n
float df = uDisplacementScale * dv.x + uDisplacementBias;
\n
vec4 displacedPosition = vec4( normalize( vNormal.xyz ) * df, 0.0 ) + mvPosition;
\n
gl_Position = projectionMatrix * displacedPosition;
\n
#else
\n
gl_Position = projectionMatrix * mvPosition;
\n
#endif
"
,
...
...
build/custom/ThreeSVG.js
浏览文件 @
f59ed3e2
...
...
@@ -107,10 +107,10 @@ THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.col
THREE
.
MeshBasicMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshBasicMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshBasicMaterial
.
prototype
.
constructor
=
THREE
.
MeshBasicMaterial
;
THREE
.
MeshLambertMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
328965
);
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshLambertMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshLambertMaterial
.
prototype
.
constructor
=
THREE
.
MeshLambertMaterial
;
THREE
.
MeshPhongMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
32896
5
);
this
.
specular
=
void
0
!==
a
.
specular
?
new
THREE
.
Color
(
a
.
specular
):
new
THREE
.
Color
(
1118481
);
this
.
shininess
=
void
0
!==
a
.
shininess
?
a
.
shininess
:
30
;
this
.
metal
=
void
0
!==
a
.
metal
?
a
.
metal
:
!
1
;
this
.
perPixel
=
void
0
!==
a
.
perPixel
?
a
.
perPixel
:
!
1
;
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
THREE
.
MeshLambertMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
16777215
);
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshLambertMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshLambertMaterial
.
prototype
.
constructor
=
THREE
.
MeshLambertMaterial
;
THREE
.
MeshPhongMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
1677721
5
);
this
.
specular
=
void
0
!==
a
.
specular
?
new
THREE
.
Color
(
a
.
specular
):
new
THREE
.
Color
(
1118481
);
this
.
shininess
=
void
0
!==
a
.
shininess
?
a
.
shininess
:
30
;
this
.
metal
=
void
0
!==
a
.
metal
?
a
.
metal
:
!
1
;
this
.
perPixel
=
void
0
!==
a
.
perPixel
?
a
.
perPixel
:
!
1
;
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshPhongMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshPhongMaterial
.
prototype
.
constructor
=
THREE
.
MeshPhongMaterial
;
THREE
.
MeshDepthMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
};
THREE
.
MeshDepthMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshDepthMaterial
.
prototype
.
constructor
=
THREE
.
MeshDepthMaterial
;
...
...
build/custom/ThreeWebGL.js
浏览文件 @
f59ed3e2
...
...
@@ -112,10 +112,10 @@ THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.col
THREE
.
MeshBasicMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshBasicMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshBasicMaterial
.
prototype
.
constructor
=
THREE
.
MeshBasicMaterial
;
THREE
.
MeshLambertMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
328965
);
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshLambertMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshLambertMaterial
.
prototype
.
constructor
=
THREE
.
MeshLambertMaterial
;
THREE
.
MeshPhongMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
32896
5
);
this
.
specular
=
void
0
!==
a
.
specular
?
new
THREE
.
Color
(
a
.
specular
):
new
THREE
.
Color
(
1118481
);
this
.
shininess
=
void
0
!==
a
.
shininess
?
a
.
shininess
:
30
;
this
.
metal
=
void
0
!==
a
.
metal
?
a
.
metal
:
!
1
;
this
.
perPixel
=
void
0
!==
a
.
perPixel
?
a
.
perPixel
:
!
1
;
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
THREE
.
MeshLambertMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
16777215
);
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshLambertMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshLambertMaterial
.
prototype
.
constructor
=
THREE
.
MeshLambertMaterial
;
THREE
.
MeshPhongMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
color
=
void
0
!==
a
.
color
?
new
THREE
.
Color
(
a
.
color
):
new
THREE
.
Color
(
16777215
);
this
.
ambient
=
void
0
!==
a
.
ambient
?
new
THREE
.
Color
(
a
.
ambient
):
new
THREE
.
Color
(
1677721
5
);
this
.
specular
=
void
0
!==
a
.
specular
?
new
THREE
.
Color
(
a
.
specular
):
new
THREE
.
Color
(
1118481
);
this
.
shininess
=
void
0
!==
a
.
shininess
?
a
.
shininess
:
30
;
this
.
metal
=
void
0
!==
a
.
metal
?
a
.
metal
:
!
1
;
this
.
perPixel
=
void
0
!==
a
.
perPixel
?
a
.
perPixel
:
!
1
;
this
.
wrapAround
=
void
0
!==
a
.
wrapAround
?
a
.
wrapAround
:
!
1
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
this
.
map
=
void
0
!==
a
.
map
?
a
.
map
:
null
;
this
.
lightMap
=
void
0
!==
a
.
lightMap
?
a
.
lightMap
:
null
;
this
.
envMap
=
void
0
!==
a
.
envMap
?
a
.
envMap
:
null
;
this
.
combine
=
void
0
!==
a
.
combine
?
a
.
combine
:
THREE
.
MultiplyOperation
;
this
.
reflectivity
=
void
0
!==
a
.
reflectivity
?
a
.
reflectivity
:
1
;
this
.
refractionRatio
=
void
0
!==
a
.
refractionRatio
?
a
.
refractionRatio
:
0.98
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
;
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
;
this
.
wireframeLinecap
=
void
0
!==
a
.
wireframeLinecap
?
a
.
wireframeLinecap
:
"
round
"
;
this
.
wireframeLinejoin
=
void
0
!==
a
.
wireframeLinejoin
?
a
.
wireframeLinejoin
:
"
round
"
;
this
.
vertexColors
=
void
0
!==
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
skinning
=
void
0
!==
a
.
skinning
?
a
.
skinning
:
!
1
;
this
.
morphTargets
=
void
0
!==
a
.
morphTargets
?
a
.
morphTargets
:
!
1
};
THREE
.
MeshPhongMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshPhongMaterial
.
prototype
.
constructor
=
THREE
.
MeshPhongMaterial
;
THREE
.
MeshDepthMaterial
=
function
(
a
){
THREE
.
Material
.
call
(
this
,
a
);
a
=
a
||
{};
this
.
shading
=
void
0
!==
a
.
shading
?
a
.
shading
:
THREE
.
SmoothShading
;
this
.
wireframe
=
void
0
!==
a
.
wireframe
?
a
.
wireframe
:
!
1
;
this
.
wireframeLinewidth
=
void
0
!==
a
.
wireframeLinewidth
?
a
.
wireframeLinewidth
:
1
};
THREE
.
MeshDepthMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
MeshDepthMaterial
.
prototype
.
constructor
=
THREE
.
MeshDepthMaterial
;
...
...
examples/webgl_loader_ctm.html
浏览文件 @
f59ed3e2
...
...
@@ -90,7 +90,7 @@
// LIGHTS
var
ambient
=
new
THREE
.
AmbientLight
(
0x
aaaaaa
);
var
ambient
=
new
THREE
.
AmbientLight
(
0x
050505
);
scene
.
add
(
ambient
);
var
directionalLight
=
new
THREE
.
DirectionalLight
(
0xffeedd
);
...
...
examples/webgl_loader_ctm_materials.html
浏览文件 @
f59ed3e2
...
...
@@ -139,7 +139,7 @@
THREE
.
ColorUtils
.
adjustHSV
(
light
.
color
,
0
,
-
0.5
,
0
);
scene
.
add
(
new
THREE
.
AmbientLight
(
0x
ffffff
)
);
scene
.
add
(
new
THREE
.
AmbientLight
(
0x
050505
)
);
// RENDERER
...
...
examples/webgl_materials_cars.html
浏览文件 @
f59ed3e2
...
...
@@ -176,7 +176,7 @@
// LIGHTS
var
ambient
=
new
THREE
.
AmbientLight
(
0x
55555
5
);
var
ambient
=
new
THREE
.
AmbientLight
(
0x
05050
5
);
scene
.
add
(
ambient
);
directionalLight
=
new
THREE
.
DirectionalLight
(
0xffffff
,
2
);
...
...
examples/webgl_materials_cars_anaglyph.html
浏览文件 @
f59ed3e2
...
...
@@ -166,7 +166,7 @@
// LIGHTS
var
ambient
=
new
THREE
.
AmbientLight
(
0x
55555
5
);
var
ambient
=
new
THREE
.
AmbientLight
(
0x
05050
5
);
scene
.
add
(
ambient
);
directionalLight
=
new
THREE
.
DirectionalLight
(
0xffffff
,
2
);
...
...
examples/webgl_materials_cars_camaro_crosseyed.html
浏览文件 @
f59ed3e2
...
...
@@ -78,7 +78,7 @@
// LIGHTS
var
ambient
=
new
THREE
.
AmbientLight
(
0x
555555
);
var
ambient
=
new
THREE
.
AmbientLight
(
0x
020202
);
scene
.
add
(
ambient
);
directionalLight
=
new
THREE
.
DirectionalLight
(
0xffffff
);
...
...
examples/webgl_morphtargets.html
浏览文件 @
f59ed3e2
...
...
@@ -104,7 +104,7 @@
light
.
position
.
set
(
100
,
100
,
100
);
scene
.
add
(
light
);
var
light
=
new
THREE
.
AmbientLight
(
0x
333333
);
var
light
=
new
THREE
.
AmbientLight
(
0x
111111
);
scene
.
add
(
light
);
...
...
src/extras/ShaderUtils.js
浏览文件 @
f59ed3e2
...
...
@@ -125,9 +125,9 @@ THREE.ShaderUtils = {
"
uDisplacementBias
"
:
{
type
:
"
f
"
,
value
:
0.0
},
"
uDisplacementScale
"
:
{
type
:
"
f
"
,
value
:
1.0
},
"
uDiffuseColor
"
:
{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
0x
eeeeee
)
},
"
uDiffuseColor
"
:
{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
0x
ffffff
)
},
"
uSpecularColor
"
:
{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
0x111111
)
},
"
uAmbientColor
"
:
{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
0x
050505
)
},
"
uAmbientColor
"
:
{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
0x
ffffff
)
},
"
uShininess
"
:
{
type
:
"
f
"
,
value
:
30
},
"
uOpacity
"
:
{
type
:
"
f
"
,
value
:
1
},
...
...
src/materials/MeshLambertMaterial.js
浏览文件 @
f59ed3e2
...
...
@@ -37,7 +37,7 @@ THREE.MeshLambertMaterial = function ( parameters ) {
parameters
=
parameters
||
{};
this
.
color
=
parameters
.
color
!==
undefined
?
new
THREE
.
Color
(
parameters
.
color
)
:
new
THREE
.
Color
(
0xffffff
);
this
.
ambient
=
parameters
.
ambient
!==
undefined
?
new
THREE
.
Color
(
parameters
.
ambient
)
:
new
THREE
.
Color
(
0x
050505
);
this
.
ambient
=
parameters
.
ambient
!==
undefined
?
new
THREE
.
Color
(
parameters
.
ambient
)
:
new
THREE
.
Color
(
0x
ffffff
);
this
.
wrapAround
=
parameters
.
wrapAround
!==
undefined
?
parameters
.
wrapAround
:
false
;
this
.
wrapRGB
=
new
THREE
.
Vector3
(
1
,
1
,
1
);
...
...
src/materials/MeshPhongMaterial.js
浏览文件 @
f59ed3e2
...
...
@@ -39,7 +39,7 @@ THREE.MeshPhongMaterial = function ( parameters ) {
parameters
=
parameters
||
{};
this
.
color
=
parameters
.
color
!==
undefined
?
new
THREE
.
Color
(
parameters
.
color
)
:
new
THREE
.
Color
(
0xffffff
);
this
.
ambient
=
parameters
.
ambient
!==
undefined
?
new
THREE
.
Color
(
parameters
.
ambient
)
:
new
THREE
.
Color
(
0x
050505
);
this
.
ambient
=
parameters
.
ambient
!==
undefined
?
new
THREE
.
Color
(
parameters
.
ambient
)
:
new
THREE
.
Color
(
0x
ffffff
);
this
.
specular
=
parameters
.
specular
!==
undefined
?
new
THREE
.
Color
(
parameters
.
specular
)
:
new
THREE
.
Color
(
0x111111
);
this
.
shininess
=
parameters
.
shininess
!==
undefined
?
parameters
.
shininess
:
30
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录