Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
0f13495f
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,发现更多精彩内容 >>
提交
0f13495f
编写于
1月 19, 2012
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added docs for lights. Added default shadow parameters for DirectionalLight.
上级
bb67cbe1
变更
14
展开全部
隐藏空白更改
内联
并排
Showing
14 changed file
with
350 addition
and
54 deletion
+350
-54
build/Three.js
build/Three.js
+11
-11
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+3
-3
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+1
-1
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+7
-7
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+3
-3
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+4
-4
docs/api/lights/AmbientLight.rst
docs/api/lights/AmbientLight.rst
+16
-4
docs/api/lights/DirectionalLight.rst
docs/api/lights/DirectionalLight.rst
+124
-4
docs/api/lights/Light.rst
docs/api/lights/Light.rst
+9
-7
docs/api/lights/PointLight.rst
docs/api/lights/PointLight.rst
+37
-4
docs/api/lights/SpotLight.rst
docs/api/lights/SpotLight.rst
+121
-5
docs/api/lights/index.rst
docs/api/lights/index.rst
+2
-1
docs/static/nature.css
docs/static/nature.css
+9
-0
src/lights/DirectionalLight.js
src/lights/DirectionalLight.js
+3
-0
未找到文件。
build/Three.js
浏览文件 @
0f13495f
此差异已折叠。
点击以展开。
build/custom/ThreeCanvas.js
浏览文件 @
0f13495f
...
...
@@ -78,7 +78,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
this
.
normalize
();
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
0
===
a
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
a
=
1
/
a
,
this
.
x
*=
a
,
this
.
y
*=
a
,
this
.
z
*=
a
,
this
.
w
*=
a
);
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
f
=
a
.
x
,
g
=
a
.
y
,
i
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
f
+
c
*
i
-
d
*
g
;
this
.
y
=
c
*
a
+
e
*
g
+
d
*
f
-
b
*
i
;
this
.
z
=
d
*
a
+
e
*
i
+
b
*
g
-
c
*
f
;
this
.
w
=
e
*
a
-
b
*
f
-
c
*
g
-
d
*
i
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
w
+
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
+
a
.
w
*
b
.
x
;
this
.
y
=-
a
.
x
*
b
.
z
+
a
.
y
*
b
.
w
+
a
.
z
*
b
.
x
+
a
.
w
*
b
.
y
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
+
a
.
z
*
b
.
w
+
a
.
w
*
b
.
z
;
this
.
w
=-
a
.
x
*
b
.
x
-
a
.
y
*
b
.
y
-
a
.
z
*
b
.
z
+
a
.
w
*
b
.
w
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
f
=
this
.
x
,
g
=
this
.
y
,
i
=
this
.
z
,
m
=
this
.
w
,
h
=
m
*
c
+
g
*
e
-
i
*
d
,
l
=
m
*
d
+
i
*
c
-
f
*
e
,
o
=
m
*
e
+
f
*
d
-
g
*
c
,
c
=-
f
*
c
-
g
*
d
-
i
*
e
;
b
.
x
=
h
*
m
+
c
*-
f
+
l
*-
i
-
o
*-
g
;
b
.
y
=
l
*
m
+
c
*-
g
+
o
*-
f
-
h
*-
i
;
b
.
z
=
o
*
m
+
c
*-
i
+
h
*-
g
-
l
*-
f
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
0
>
e
?(
c
.
w
=-
b
.
w
,
c
.
x
=-
b
.
x
,
c
.
y
=-
b
.
y
,
c
.
z
=-
b
.
z
,
e
=-
e
):
c
.
copy
(
b
);
if
(
1
<=
Math
.
abs
(
e
))
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
f
=
Math
.
acos
(
e
),
e
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
0.001
>
Math
.
abs
(
e
))
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
b
=
Math
.
sin
((
1
-
d
)
*
f
)
/
e
;
d
=
Math
.
sin
(
d
*
f
)
/
e
;
c
.
w
=
a
.
w
*
b
+
c
.
w
*
d
;
c
.
x
=
a
.
x
*
b
+
c
.
x
*
d
;
c
.
y
=
a
.
y
*
b
+
c
.
y
*
d
;
c
.
z
=
a
.
z
*
b
+
c
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
0
>
e
?(
c
.
w
=-
b
.
w
,
c
.
x
=-
b
.
x
,
c
.
y
=-
b
.
y
,
c
.
z
=-
b
.
z
,
e
=-
e
):
c
.
copy
(
b
);
if
(
1
<=
Math
.
abs
(
e
))
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
f
=
Math
.
acos
(
e
),
e
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
0.001
0
>
Math
.
abs
(
e
))
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
b
=
Math
.
sin
((
1
-
d
)
*
f
)
/
e
;
d
=
Math
.
sin
(
d
*
f
)
/
e
;
c
.
w
=
a
.
w
*
b
+
c
.
w
*
d
;
c
.
x
=
a
.
x
*
b
+
c
.
x
*
d
;
c
.
y
=
a
.
y
*
b
+
c
.
y
*
d
;
c
.
z
=
a
.
z
*
b
+
c
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materialIndex
=
f
;
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
f
instanceof
THREE
.
Color
?
f
:
new
THREE
.
Color
;
this
.
vertexColors
=
f
instanceof
Array
?
f
:[];
this
.
vertexTangents
=
[];
this
.
materialIndex
=
g
;
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
u
=
a
||
0
;
this
.
v
=
b
||
0
};
THREE
.
UV
.
prototype
=
{
constructor
:
THREE
.
UV
,
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
u
=
a
.
u
;
this
.
v
=
a
.
v
;
return
this
},
clone
:
function
(){
return
new
THREE
.
UV
(
this
.
u
,
this
.
v
)}};
...
...
@@ -99,8 +99,8 @@ THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projec
THREE
.
PerspectiveCamera
.
prototype
.
setLens
=
function
(
a
,
b
){
this
.
fov
=
2
*
Math
.
atan
((
void
0
!==
b
?
b
:
43.25
)
/
(
2
*
a
));
this
.
fov
*=
180
/
Math
.
PI
;
this
.
updateProjectionMatrix
()};
THREE
.
PerspectiveCamera
.
prototype
.
setViewOffset
=
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
fullWidth
=
a
;
this
.
fullHeight
=
b
;
this
.
x
=
c
;
this
.
y
=
d
;
this
.
width
=
e
;
this
.
height
=
f
;
this
.
updateProjectionMatrix
()};
THREE
.
PerspectiveCamera
.
prototype
.
updateProjectionMatrix
=
function
(){
if
(
this
.
fullWidth
){
var
a
=
this
.
fullWidth
/
this
.
fullHeight
,
b
=
Math
.
tan
(
this
.
fov
*
Math
.
PI
/
360
)
*
this
.
near
,
c
=-
b
,
d
=
a
*
c
,
a
=
Math
.
abs
(
a
*
b
-
d
),
c
=
Math
.
abs
(
b
-
c
);
this
.
projectionMatrix
=
THREE
.
Matrix4
.
makeFrustum
(
d
+
this
.
x
*
a
/
this
.
fullWidth
,
d
+
(
this
.
x
+
this
.
width
)
*
a
/
this
.
fullWidth
,
b
-
(
this
.
y
+
this
.
height
)
*
c
/
this
.
fullHeight
,
b
-
this
.
y
*
c
/
this
.
fullHeight
,
this
.
near
,
this
.
far
)}
else
this
.
projectionMatrix
=
THREE
.
Matrix4
.
makePerspective
(
this
.
fov
,
this
.
aspect
,
this
.
near
,
this
.
far
)};
THREE
.
Light
=
function
(
a
){
THREE
.
Object3D
.
call
(
this
);
this
.
color
=
new
THREE
.
Color
(
a
)};
THREE
.
Light
.
prototype
=
new
THREE
.
Object3D
;
THREE
.
Light
.
prototype
.
constructor
=
THREE
.
Light
;
THREE
.
Light
.
prototype
.
supr
=
THREE
.
Object3D
.
prototype
;
THREE
.
AmbientLight
=
function
(
a
){
THREE
.
Light
.
call
(
this
,
a
)};
THREE
.
AmbientLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
AmbientLight
.
prototype
.
constructor
=
THREE
.
AmbientLight
;
THREE
.
DirectionalLight
=
function
(
a
,
b
,
c
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
target
=
new
THREE
.
Object3D
;
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
distance
=
void
0
!==
c
?
c
:
0
;
this
.
onlyShadow
=
this
.
castShadow
=!
1
;
this
.
shadowCamera
Left
=-
500
;
this
.
shadowCameraTop
=
this
.
shadowCameraRight
=
500
;
this
.
shadowCameraBottom
=-
500
;
this
.
shadowCameraVisible
=!
1
;
this
.
shadowBias
=
0
;
this
.
shadowDarkness
=
0.5
;
this
.
shadowMapHeight
=
this
.
shadowMapWidth
=
512
;
this
.
shadowMatrix
=
this
.
shadowCamera
=
this
.
shadowMapSize
=
this
.
shadowMap
=
null
};
THREE
.
DirectionalLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
DirectionalLight
.
prototype
.
constructor
=
THREE
.
DirectionalLight
;
THREE
.
PointLight
=
function
(
a
,
b
,
c
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
distance
=
void
0
!==
c
?
c
:
0
};
THREE
.
PointLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
PointLight
.
prototype
.
constructor
=
THREE
.
PointLight
;
THREE
.
DirectionalLight
=
function
(
a
,
b
,
c
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
target
=
new
THREE
.
Object3D
;
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
distance
=
void
0
!==
c
?
c
:
0
;
this
.
onlyShadow
=
this
.
castShadow
=!
1
;
this
.
shadowCamera
Near
=
50
;
this
.
shadowCameraFar
=
5
E3
;
this
.
shadowCameraLeft
=-
500
;
this
.
shadowCameraTop
=
this
.
shadowCameraRight
=
500
;
this
.
shadowCameraBottom
=-
500
;
this
.
shadowCameraVisible
=!
1
;
this
.
shadowBias
=
0
;
this
.
shadowDarkness
=
0.5
;
this
.
shadowMapHeight
=
this
.
shadowMapWidth
=
512
;
this
.
shadowMatrix
=
this
.
shadow
Camera
=
this
.
shadowMapSize
=
this
.
shadow
Map
=
null
};
THREE
.
DirectionalLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
DirectionalLight
.
prototype
.
constructor
=
THREE
.
DirectionalLight
;
THREE
.
PointLight
=
function
(
a
,
b
,
c
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
distance
=
void
0
!==
c
?
c
:
0
};
THREE
.
PointLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
PointLight
.
prototype
.
constructor
=
THREE
.
PointLight
;
THREE
.
Material
=
function
(
a
){
a
=
a
||
{};
this
.
id
=
THREE
.
MaterialCount
++
;
this
.
name
=
""
;
this
.
opacity
=
void
0
!==
a
.
opacity
?
a
.
opacity
:
1
;
this
.
transparent
=
void
0
!==
a
.
transparent
?
a
.
transparent
:
!
1
;
this
.
blending
=
void
0
!==
a
.
blending
?
a
.
blending
:
THREE
.
NormalBlending
;
this
.
depthTest
=
void
0
!==
a
.
depthTest
?
a
.
depthTest
:
!
0
;
this
.
depthWrite
=
void
0
!==
a
.
depthWrite
?
a
.
depthWrite
:
!
0
;
this
.
polygonOffset
=
void
0
!==
a
.
polygonOffset
?
a
.
polygonOffset
:
!
1
;
this
.
polygonOffsetFactor
=
void
0
!==
a
.
polygonOffsetFactor
?
a
.
polygonOffsetFactor
:
0
;
this
.
polygonOffsetUnits
=
void
0
!==
a
.
polygonOffsetUnits
?
a
.
polygonOffsetUnits
:
0
;
this
.
alphaTest
=
void
0
!==
a
.
alphaTest
?
a
.
alphaTest
:
0
;
this
.
overdraw
=
void
0
!==
a
.
overdraw
?
a
.
overdraw
:
!
1
};
THREE
.
MaterialCount
=
0
;
THREE
.
NoShading
=
0
;
THREE
.
FlatShading
=
1
;
THREE
.
SmoothShading
=
2
;
THREE
.
NoColors
=
0
;
THREE
.
FaceColors
=
1
;
THREE
.
VertexColors
=
2
;
THREE
.
NormalBlending
=
0
;
THREE
.
AdditiveBlending
=
1
;
THREE
.
SubtractiveBlending
=
2
;
THREE
.
MultiplyBlending
=
3
;
THREE
.
AdditiveAlphaBlending
=
4
;
THREE
.
LineBasicMaterial
=
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
.
linewidth
=
void
0
!==
a
.
linewidth
?
a
.
linewidth
:
1
;
this
.
linecap
=
void
0
!==
a
.
linecap
?
a
.
linecap
:
"
round
"
;
this
.
linejoin
=
void
0
!==
a
.
linejoin
?
a
.
linejoin
:
"
round
"
;
this
.
vertexColors
=
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
};
THREE
.
LineBasicMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
LineBasicMaterial
.
prototype
.
constructor
=
THREE
.
LineBasicMaterial
;
...
...
build/custom/ThreeDOM.js
浏览文件 @
0f13495f
...
...
@@ -78,7 +78,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
this
.
normalize
();
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
0
===
a
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
a
=
1
/
a
,
this
.
x
*=
a
,
this
.
y
*=
a
,
this
.
z
*=
a
,
this
.
w
*=
a
);
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
f
=
a
.
x
,
g
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
f
+
c
*
h
-
d
*
g
;
this
.
y
=
c
*
a
+
e
*
g
+
d
*
f
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
g
-
c
*
f
;
this
.
w
=
e
*
a
-
b
*
f
-
c
*
g
-
d
*
h
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
w
+
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
+
a
.
w
*
b
.
x
;
this
.
y
=-
a
.
x
*
b
.
z
+
a
.
y
*
b
.
w
+
a
.
z
*
b
.
x
+
a
.
w
*
b
.
y
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
+
a
.
z
*
b
.
w
+
a
.
w
*
b
.
z
;
this
.
w
=-
a
.
x
*
b
.
x
-
a
.
y
*
b
.
y
-
a
.
z
*
b
.
z
+
a
.
w
*
b
.
w
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
f
=
this
.
x
,
g
=
this
.
y
,
h
=
this
.
z
,
k
=
this
.
w
,
i
=
k
*
c
+
g
*
e
-
h
*
d
,
j
=
k
*
d
+
h
*
c
-
f
*
e
,
l
=
k
*
e
+
f
*
d
-
g
*
c
,
c
=-
f
*
c
-
g
*
d
-
h
*
e
;
b
.
x
=
i
*
k
+
c
*-
f
+
j
*-
h
-
l
*-
g
;
b
.
y
=
j
*
k
+
c
*-
g
+
l
*-
f
-
i
*-
h
;
b
.
z
=
l
*
k
+
c
*-
h
+
i
*-
g
-
j
*-
f
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
0
>
e
?(
c
.
w
=-
b
.
w
,
c
.
x
=-
b
.
x
,
c
.
y
=-
b
.
y
,
c
.
z
=-
b
.
z
,
e
=-
e
):
c
.
copy
(
b
);
if
(
1
<=
Math
.
abs
(
e
))
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
f
=
Math
.
acos
(
e
),
e
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
0.001
>
Math
.
abs
(
e
))
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
b
=
Math
.
sin
((
1
-
d
)
*
f
)
/
e
;
d
=
Math
.
sin
(
d
*
f
)
/
e
;
c
.
w
=
a
.
w
*
b
+
c
.
w
*
d
;
c
.
x
=
a
.
x
*
b
+
c
.
x
*
d
;
c
.
y
=
a
.
y
*
b
+
c
.
y
*
d
;
c
.
z
=
a
.
z
*
b
+
c
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
0
>
e
?(
c
.
w
=-
b
.
w
,
c
.
x
=-
b
.
x
,
c
.
y
=-
b
.
y
,
c
.
z
=-
b
.
z
,
e
=-
e
):
c
.
copy
(
b
);
if
(
1
<=
Math
.
abs
(
e
))
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
f
=
Math
.
acos
(
e
),
e
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
0.001
0
>
Math
.
abs
(
e
))
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
b
=
Math
.
sin
((
1
-
d
)
*
f
)
/
e
;
d
=
Math
.
sin
(
d
*
f
)
/
e
;
c
.
w
=
a
.
w
*
b
+
c
.
w
*
d
;
c
.
x
=
a
.
x
*
b
+
c
.
x
*
d
;
c
.
y
=
a
.
y
*
b
+
c
.
y
*
d
;
c
.
z
=
a
.
z
*
b
+
c
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materialIndex
=
f
;
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
f
instanceof
THREE
.
Color
?
f
:
new
THREE
.
Color
;
this
.
vertexColors
=
f
instanceof
Array
?
f
:[];
this
.
vertexTangents
=
[];
this
.
materialIndex
=
g
;
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
u
=
a
||
0
;
this
.
v
=
b
||
0
};
THREE
.
UV
.
prototype
=
{
constructor
:
THREE
.
UV
,
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
u
=
a
.
u
;
this
.
v
=
a
.
v
;
return
this
},
clone
:
function
(){
return
new
THREE
.
UV
(
this
.
u
,
this
.
v
)}};
...
...
build/custom/ThreeExtras.js
浏览文件 @
0f13495f
此差异已折叠。
点击以展开。
build/custom/ThreeSVG.js
浏览文件 @
0f13495f
...
...
@@ -78,7 +78,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
this
.
normalize
();
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
0
===
a
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
a
=
1
/
a
,
this
.
x
*=
a
,
this
.
y
*=
a
,
this
.
z
*=
a
,
this
.
w
*=
a
);
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
f
=
a
.
x
,
g
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
f
+
c
*
h
-
d
*
g
;
this
.
y
=
c
*
a
+
e
*
g
+
d
*
f
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
g
-
c
*
f
;
this
.
w
=
e
*
a
-
b
*
f
-
c
*
g
-
d
*
h
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
w
+
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
+
a
.
w
*
b
.
x
;
this
.
y
=-
a
.
x
*
b
.
z
+
a
.
y
*
b
.
w
+
a
.
z
*
b
.
x
+
a
.
w
*
b
.
y
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
+
a
.
z
*
b
.
w
+
a
.
w
*
b
.
z
;
this
.
w
=-
a
.
x
*
b
.
x
-
a
.
y
*
b
.
y
-
a
.
z
*
b
.
z
+
a
.
w
*
b
.
w
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
f
=
this
.
x
,
g
=
this
.
y
,
h
=
this
.
z
,
l
=
this
.
w
,
j
=
l
*
c
+
g
*
e
-
h
*
d
,
i
=
l
*
d
+
h
*
c
-
f
*
e
,
m
=
l
*
e
+
f
*
d
-
g
*
c
,
c
=-
f
*
c
-
g
*
d
-
h
*
e
;
b
.
x
=
j
*
l
+
c
*-
f
+
i
*-
h
-
m
*-
g
;
b
.
y
=
i
*
l
+
c
*-
g
+
m
*-
f
-
j
*-
h
;
b
.
z
=
m
*
l
+
c
*-
h
+
j
*-
g
-
i
*-
f
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
0
>
e
?(
c
.
w
=-
b
.
w
,
c
.
x
=-
b
.
x
,
c
.
y
=-
b
.
y
,
c
.
z
=-
b
.
z
,
e
=-
e
):
c
.
copy
(
b
);
if
(
1
<=
Math
.
abs
(
e
))
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
f
=
Math
.
acos
(
e
),
e
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
0.001
>
Math
.
abs
(
e
))
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
b
=
Math
.
sin
((
1
-
d
)
*
f
)
/
e
;
d
=
Math
.
sin
(
d
*
f
)
/
e
;
c
.
w
=
a
.
w
*
b
+
c
.
w
*
d
;
c
.
x
=
a
.
x
*
b
+
c
.
x
*
d
;
c
.
y
=
a
.
y
*
b
+
c
.
y
*
d
;
c
.
z
=
a
.
z
*
b
+
c
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
0
>
e
?(
c
.
w
=-
b
.
w
,
c
.
x
=-
b
.
x
,
c
.
y
=-
b
.
y
,
c
.
z
=-
b
.
z
,
e
=-
e
):
c
.
copy
(
b
);
if
(
1
<=
Math
.
abs
(
e
))
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
f
=
Math
.
acos
(
e
),
e
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
0.001
0
>
Math
.
abs
(
e
))
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
b
=
Math
.
sin
((
1
-
d
)
*
f
)
/
e
;
d
=
Math
.
sin
(
d
*
f
)
/
e
;
c
.
w
=
a
.
w
*
b
+
c
.
w
*
d
;
c
.
x
=
a
.
x
*
b
+
c
.
x
*
d
;
c
.
y
=
a
.
y
*
b
+
c
.
y
*
d
;
c
.
z
=
a
.
z
*
b
+
c
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materialIndex
=
f
;
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
f
instanceof
THREE
.
Color
?
f
:
new
THREE
.
Color
;
this
.
vertexColors
=
f
instanceof
Array
?
f
:[];
this
.
vertexTangents
=
[];
this
.
materialIndex
=
g
;
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
u
=
a
||
0
;
this
.
v
=
b
||
0
};
THREE
.
UV
.
prototype
=
{
constructor
:
THREE
.
UV
,
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
u
=
a
.
u
;
this
.
v
=
a
.
v
;
return
this
},
clone
:
function
(){
return
new
THREE
.
UV
(
this
.
u
,
this
.
v
)}};
...
...
@@ -99,8 +99,8 @@ THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projec
THREE
.
PerspectiveCamera
.
prototype
.
setLens
=
function
(
a
,
b
){
this
.
fov
=
2
*
Math
.
atan
((
void
0
!==
b
?
b
:
43.25
)
/
(
2
*
a
));
this
.
fov
*=
180
/
Math
.
PI
;
this
.
updateProjectionMatrix
()};
THREE
.
PerspectiveCamera
.
prototype
.
setViewOffset
=
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
fullWidth
=
a
;
this
.
fullHeight
=
b
;
this
.
x
=
c
;
this
.
y
=
d
;
this
.
width
=
e
;
this
.
height
=
f
;
this
.
updateProjectionMatrix
()};
THREE
.
PerspectiveCamera
.
prototype
.
updateProjectionMatrix
=
function
(){
if
(
this
.
fullWidth
){
var
a
=
this
.
fullWidth
/
this
.
fullHeight
,
b
=
Math
.
tan
(
this
.
fov
*
Math
.
PI
/
360
)
*
this
.
near
,
c
=-
b
,
d
=
a
*
c
,
a
=
Math
.
abs
(
a
*
b
-
d
),
c
=
Math
.
abs
(
b
-
c
);
this
.
projectionMatrix
=
THREE
.
Matrix4
.
makeFrustum
(
d
+
this
.
x
*
a
/
this
.
fullWidth
,
d
+
(
this
.
x
+
this
.
width
)
*
a
/
this
.
fullWidth
,
b
-
(
this
.
y
+
this
.
height
)
*
c
/
this
.
fullHeight
,
b
-
this
.
y
*
c
/
this
.
fullHeight
,
this
.
near
,
this
.
far
)}
else
this
.
projectionMatrix
=
THREE
.
Matrix4
.
makePerspective
(
this
.
fov
,
this
.
aspect
,
this
.
near
,
this
.
far
)};
THREE
.
Light
=
function
(
a
){
THREE
.
Object3D
.
call
(
this
);
this
.
color
=
new
THREE
.
Color
(
a
)};
THREE
.
Light
.
prototype
=
new
THREE
.
Object3D
;
THREE
.
Light
.
prototype
.
constructor
=
THREE
.
Light
;
THREE
.
Light
.
prototype
.
supr
=
THREE
.
Object3D
.
prototype
;
THREE
.
AmbientLight
=
function
(
a
){
THREE
.
Light
.
call
(
this
,
a
)};
THREE
.
AmbientLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
AmbientLight
.
prototype
.
constructor
=
THREE
.
AmbientLight
;
THREE
.
DirectionalLight
=
function
(
a
,
b
,
c
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
target
=
new
THREE
.
Object3D
;
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
distance
=
void
0
!==
c
?
c
:
0
;
this
.
onlyShadow
=
this
.
castShadow
=!
1
;
this
.
shadowCamera
Left
=-
500
;
this
.
shadowCameraTop
=
this
.
shadowCameraRight
=
500
;
this
.
shadowCameraBottom
=-
500
;
this
.
shadowCameraVisible
=!
1
;
this
.
shadowBias
=
0
;
this
.
shadowDarkness
=
0.5
;
this
.
shadowMapHeight
=
this
.
shadowMapWidth
=
512
;
this
.
shadowMatrix
=
this
.
shadowCamera
=
this
.
shadowMapSize
=
this
.
shadowMap
=
null
};
THREE
.
DirectionalLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
DirectionalLight
.
prototype
.
constructor
=
THREE
.
DirectionalLight
;
THREE
.
PointLight
=
function
(
a
,
b
,
c
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
distance
=
void
0
!==
c
?
c
:
0
};
THREE
.
PointLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
PointLight
.
prototype
.
constructor
=
THREE
.
PointLight
;
THREE
.
DirectionalLight
=
function
(
a
,
b
,
c
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
target
=
new
THREE
.
Object3D
;
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
distance
=
void
0
!==
c
?
c
:
0
;
this
.
onlyShadow
=
this
.
castShadow
=!
1
;
this
.
shadowCamera
Near
=
50
;
this
.
shadowCameraFar
=
5
E3
;
this
.
shadowCameraLeft
=-
500
;
this
.
shadowCameraTop
=
this
.
shadowCameraRight
=
500
;
this
.
shadowCameraBottom
=-
500
;
this
.
shadowCameraVisible
=!
1
;
this
.
shadowBias
=
0
;
this
.
shadowDarkness
=
0.5
;
this
.
shadowMapHeight
=
this
.
shadowMapWidth
=
512
;
this
.
shadowMatrix
=
this
.
shadow
Camera
=
this
.
shadowMapSize
=
this
.
shadow
Map
=
null
};
THREE
.
DirectionalLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
DirectionalLight
.
prototype
.
constructor
=
THREE
.
DirectionalLight
;
THREE
.
PointLight
=
function
(
a
,
b
,
c
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
distance
=
void
0
!==
c
?
c
:
0
};
THREE
.
PointLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
PointLight
.
prototype
.
constructor
=
THREE
.
PointLight
;
THREE
.
Material
=
function
(
a
){
a
=
a
||
{};
this
.
id
=
THREE
.
MaterialCount
++
;
this
.
name
=
""
;
this
.
opacity
=
void
0
!==
a
.
opacity
?
a
.
opacity
:
1
;
this
.
transparent
=
void
0
!==
a
.
transparent
?
a
.
transparent
:
!
1
;
this
.
blending
=
void
0
!==
a
.
blending
?
a
.
blending
:
THREE
.
NormalBlending
;
this
.
depthTest
=
void
0
!==
a
.
depthTest
?
a
.
depthTest
:
!
0
;
this
.
depthWrite
=
void
0
!==
a
.
depthWrite
?
a
.
depthWrite
:
!
0
;
this
.
polygonOffset
=
void
0
!==
a
.
polygonOffset
?
a
.
polygonOffset
:
!
1
;
this
.
polygonOffsetFactor
=
void
0
!==
a
.
polygonOffsetFactor
?
a
.
polygonOffsetFactor
:
0
;
this
.
polygonOffsetUnits
=
void
0
!==
a
.
polygonOffsetUnits
?
a
.
polygonOffsetUnits
:
0
;
this
.
alphaTest
=
void
0
!==
a
.
alphaTest
?
a
.
alphaTest
:
0
;
this
.
overdraw
=
void
0
!==
a
.
overdraw
?
a
.
overdraw
:
!
1
};
THREE
.
MaterialCount
=
0
;
THREE
.
NoShading
=
0
;
THREE
.
FlatShading
=
1
;
THREE
.
SmoothShading
=
2
;
THREE
.
NoColors
=
0
;
THREE
.
FaceColors
=
1
;
THREE
.
VertexColors
=
2
;
THREE
.
NormalBlending
=
0
;
THREE
.
AdditiveBlending
=
1
;
THREE
.
SubtractiveBlending
=
2
;
THREE
.
MultiplyBlending
=
3
;
THREE
.
AdditiveAlphaBlending
=
4
;
THREE
.
LineBasicMaterial
=
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
.
linewidth
=
void
0
!==
a
.
linewidth
?
a
.
linewidth
:
1
;
this
.
linecap
=
void
0
!==
a
.
linecap
?
a
.
linecap
:
"
round
"
;
this
.
linejoin
=
void
0
!==
a
.
linejoin
?
a
.
linejoin
:
"
round
"
;
this
.
vertexColors
=
a
.
vertexColors
?
a
.
vertexColors
:
!
1
;
this
.
fog
=
void
0
!==
a
.
fog
?
a
.
fog
:
!
0
};
THREE
.
LineBasicMaterial
.
prototype
=
new
THREE
.
Material
;
THREE
.
LineBasicMaterial
.
prototype
.
constructor
=
THREE
.
LineBasicMaterial
;
...
...
build/custom/ThreeWebGL.js
浏览文件 @
0f13495f
...
...
@@ -78,7 +78,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
this
.
normalize
();
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
0
===
a
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
a
=
1
/
a
,
this
.
x
*=
a
,
this
.
y
*=
a
,
this
.
z
*=
a
,
this
.
w
*=
a
);
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
f
=
a
.
x
,
h
=
a
.
y
,
i
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
f
+
c
*
i
-
d
*
h
;
this
.
y
=
c
*
a
+
e
*
h
+
d
*
f
-
b
*
i
;
this
.
z
=
d
*
a
+
e
*
i
+
b
*
h
-
c
*
f
;
this
.
w
=
e
*
a
-
b
*
f
-
c
*
h
-
d
*
i
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
w
+
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
+
a
.
w
*
b
.
x
;
this
.
y
=-
a
.
x
*
b
.
z
+
a
.
y
*
b
.
w
+
a
.
z
*
b
.
x
+
a
.
w
*
b
.
y
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
+
a
.
z
*
b
.
w
+
a
.
w
*
b
.
z
;
this
.
w
=-
a
.
x
*
b
.
x
-
a
.
y
*
b
.
y
-
a
.
z
*
b
.
z
+
a
.
w
*
b
.
w
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
f
=
this
.
x
,
h
=
this
.
y
,
i
=
this
.
z
,
k
=
this
.
w
,
l
=
k
*
c
+
h
*
e
-
i
*
d
,
j
=
k
*
d
+
i
*
c
-
f
*
e
,
n
=
k
*
e
+
f
*
d
-
h
*
c
,
c
=-
f
*
c
-
h
*
d
-
i
*
e
;
b
.
x
=
l
*
k
+
c
*-
f
+
j
*-
i
-
n
*-
h
;
b
.
y
=
j
*
k
+
c
*-
h
+
n
*-
f
-
l
*-
i
;
b
.
z
=
n
*
k
+
c
*-
i
+
l
*-
h
-
j
*-
f
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
0
>
e
?(
c
.
w
=-
b
.
w
,
c
.
x
=-
b
.
x
,
c
.
y
=-
b
.
y
,
c
.
z
=-
b
.
z
,
e
=-
e
):
c
.
copy
(
b
);
if
(
1
<=
Math
.
abs
(
e
))
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
f
=
Math
.
acos
(
e
),
e
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
0.001
>
Math
.
abs
(
e
))
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
b
=
Math
.
sin
((
1
-
d
)
*
f
)
/
e
;
d
=
Math
.
sin
(
d
*
f
)
/
e
;
c
.
w
=
a
.
w
*
b
+
c
.
w
*
d
;
c
.
x
=
a
.
x
*
b
+
c
.
x
*
d
;
c
.
y
=
a
.
y
*
b
+
c
.
y
*
d
;
c
.
z
=
a
.
z
*
b
+
c
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
0
>
e
?(
c
.
w
=-
b
.
w
,
c
.
x
=-
b
.
x
,
c
.
y
=-
b
.
y
,
c
.
z
=-
b
.
z
,
e
=-
e
):
c
.
copy
(
b
);
if
(
1
<=
Math
.
abs
(
e
))
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
f
=
Math
.
acos
(
e
),
e
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
0.001
0
>
Math
.
abs
(
e
))
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
b
=
Math
.
sin
((
1
-
d
)
*
f
)
/
e
;
d
=
Math
.
sin
(
d
*
f
)
/
e
;
c
.
w
=
a
.
w
*
b
+
c
.
w
*
d
;
c
.
x
=
a
.
x
*
b
+
c
.
x
*
d
;
c
.
y
=
a
.
y
*
b
+
c
.
y
*
d
;
c
.
z
=
a
.
z
*
b
+
c
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materialIndex
=
f
;
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
f
,
h
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
f
instanceof
THREE
.
Color
?
f
:
new
THREE
.
Color
;
this
.
vertexColors
=
f
instanceof
Array
?
f
:[];
this
.
vertexTangents
=
[];
this
.
materialIndex
=
h
;
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
u
=
a
||
0
;
this
.
v
=
b
||
0
};
THREE
.
UV
.
prototype
=
{
constructor
:
THREE
.
UV
,
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
u
=
a
.
u
;
this
.
v
=
a
.
v
;
return
this
},
clone
:
function
(){
return
new
THREE
.
UV
(
this
.
u
,
this
.
v
)}};
...
...
@@ -102,8 +102,8 @@ THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.Or
THREE
.
PerspectiveCamera
.
prototype
.
constructor
=
THREE
.
PerspectiveCamera
;
THREE
.
PerspectiveCamera
.
prototype
.
setLens
=
function
(
a
,
b
){
this
.
fov
=
2
*
Math
.
atan
((
void
0
!==
b
?
b
:
43.25
)
/
(
2
*
a
));
this
.
fov
*=
180
/
Math
.
PI
;
this
.
updateProjectionMatrix
()};
THREE
.
PerspectiveCamera
.
prototype
.
setViewOffset
=
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
fullWidth
=
a
;
this
.
fullHeight
=
b
;
this
.
x
=
c
;
this
.
y
=
d
;
this
.
width
=
e
;
this
.
height
=
f
;
this
.
updateProjectionMatrix
()};
THREE
.
PerspectiveCamera
.
prototype
.
updateProjectionMatrix
=
function
(){
if
(
this
.
fullWidth
){
var
a
=
this
.
fullWidth
/
this
.
fullHeight
,
b
=
Math
.
tan
(
this
.
fov
*
Math
.
PI
/
360
)
*
this
.
near
,
c
=-
b
,
d
=
a
*
c
,
a
=
Math
.
abs
(
a
*
b
-
d
),
c
=
Math
.
abs
(
b
-
c
);
this
.
projectionMatrix
=
THREE
.
Matrix4
.
makeFrustum
(
d
+
this
.
x
*
a
/
this
.
fullWidth
,
d
+
(
this
.
x
+
this
.
width
)
*
a
/
this
.
fullWidth
,
b
-
(
this
.
y
+
this
.
height
)
*
c
/
this
.
fullHeight
,
b
-
this
.
y
*
c
/
this
.
fullHeight
,
this
.
near
,
this
.
far
)}
else
this
.
projectionMatrix
=
THREE
.
Matrix4
.
makePerspective
(
this
.
fov
,
this
.
aspect
,
this
.
near
,
this
.
far
)};
THREE
.
Light
=
function
(
a
){
THREE
.
Object3D
.
call
(
this
);
this
.
color
=
new
THREE
.
Color
(
a
)};
THREE
.
Light
.
prototype
=
new
THREE
.
Object3D
;
THREE
.
Light
.
prototype
.
constructor
=
THREE
.
Light
;
THREE
.
Light
.
prototype
.
supr
=
THREE
.
Object3D
.
prototype
;
THREE
.
AmbientLight
=
function
(
a
){
THREE
.
Light
.
call
(
this
,
a
)};
THREE
.
AmbientLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
AmbientLight
.
prototype
.
constructor
=
THREE
.
AmbientLight
;
THREE
.
DirectionalLight
=
function
(
a
,
b
,
c
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
target
=
new
THREE
.
Object3D
;
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
distance
=
void
0
!==
c
?
c
:
0
;
this
.
onlyShadow
=
this
.
castShadow
=!
1
;
this
.
shadowCamera
Left
=-
500
;
this
.
shadowCameraTop
=
this
.
shadowCameraRight
=
500
;
this
.
shadowCameraBottom
=-
500
;
this
.
shadowCameraVisible
=!
1
;
this
.
shadowBias
=
0
;
this
.
shadowDarkness
=
0.5
;
this
.
shadowMapHeight
=
this
.
shadowMapWidth
=
512
;
this
.
shadowMatrix
=
this
.
shadowCamera
=
this
.
shadowMapSize
=
this
.
shadowMap
=
null
};
THREE
.
DirectionalLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
DirectionalLight
.
prototype
.
constructor
=
THREE
.
DirectionalLight
;
THREE
.
PointLight
=
function
(
a
,
b
,
c
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
distance
=
void
0
!==
c
?
c
:
0
};
THREE
.
PointLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
PointLight
.
prototype
.
constructor
=
THREE
.
PointLight
;
THREE
.
DirectionalLight
=
function
(
a
,
b
,
c
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
target
=
new
THREE
.
Object3D
;
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
distance
=
void
0
!==
c
?
c
:
0
;
this
.
onlyShadow
=
this
.
castShadow
=!
1
;
this
.
shadowCamera
Near
=
50
;
this
.
shadowCameraFar
=
5
E3
;
this
.
shadowCameraLeft
=-
500
;
this
.
shadowCameraTop
=
this
.
shadowCameraRight
=
500
;
this
.
shadowCameraBottom
=-
500
;
this
.
shadowCameraVisible
=!
1
;
this
.
shadowBias
=
0
;
this
.
shadowDarkness
=
0.5
;
this
.
shadowMapHeight
=
this
.
shadowMapWidth
=
512
;
this
.
shadowMatrix
=
this
.
shadow
Camera
=
this
.
shadowMapSize
=
this
.
shadow
Map
=
null
};
THREE
.
DirectionalLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
DirectionalLight
.
prototype
.
constructor
=
THREE
.
DirectionalLight
;
THREE
.
PointLight
=
function
(
a
,
b
,
c
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
distance
=
void
0
!==
c
?
c
:
0
};
THREE
.
PointLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
PointLight
.
prototype
.
constructor
=
THREE
.
PointLight
;
THREE
.
SpotLight
=
function
(
a
,
b
,
c
,
d
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
target
=
new
THREE
.
Object3D
;
this
.
intensity
=
void
0
!==
b
?
b
:
1
;
this
.
distance
=
void
0
!==
c
?
c
:
0
;
this
.
castShadow
=
void
0
!==
d
?
d
:
!
1
;
this
.
onlyShadow
=!
1
;
this
.
shadowCameraNear
=
50
;
this
.
shadowCameraFar
=
5
E3
;
this
.
shadowCameraFov
=
50
;
this
.
shadowCameraVisible
=!
1
;
this
.
shadowBias
=
0
;
this
.
shadowDarkness
=
0.5
;
this
.
shadowMapHeight
=
this
.
shadowMapWidth
=
512
;
this
.
shadowMatrix
=
this
.
shadowCamera
=
this
.
shadowMapSize
=
this
.
shadowMap
=
null
};
THREE
.
SpotLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
SpotLight
.
prototype
.
constructor
=
THREE
.
SpotLight
;
THREE
.
Material
=
function
(
a
){
a
=
a
||
{};
this
.
id
=
THREE
.
MaterialCount
++
;
this
.
name
=
""
;
this
.
opacity
=
void
0
!==
a
.
opacity
?
a
.
opacity
:
1
;
this
.
transparent
=
void
0
!==
a
.
transparent
?
a
.
transparent
:
!
1
;
this
.
blending
=
void
0
!==
a
.
blending
?
a
.
blending
:
THREE
.
NormalBlending
;
this
.
depthTest
=
void
0
!==
a
.
depthTest
?
a
.
depthTest
:
!
0
;
this
.
depthWrite
=
void
0
!==
a
.
depthWrite
?
a
.
depthWrite
:
!
0
;
this
.
polygonOffset
=
void
0
!==
a
.
polygonOffset
?
a
.
polygonOffset
:
!
1
;
this
.
polygonOffsetFactor
=
void
0
!==
a
.
polygonOffsetFactor
?
a
.
polygonOffsetFactor
:
0
;
this
.
polygonOffsetUnits
=
...
...
@@ -361,7 +361,7 @@ b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b
"
color
"
);
p
.
scale
=
b
.
getUniformLocation
(
j
,
"
scale
"
);
p
.
rotation
=
b
.
getUniformLocation
(
j
,
"
rotation
"
);
p
.
screenPosition
=
b
.
getUniformLocation
(
j
,
"
screenPosition
"
);
o
=!
1
};
this
.
render
=
function
(
a
,
d
,
e
,
z
){
var
a
=
a
.
__webglFlares
,
y
=
a
.
length
;
if
(
y
){
var
J
=
new
THREE
.
Vector3
,
K
=
z
/
e
,
u
=
0.5
*
e
,
B
=
0.5
*
z
,
H
=
16
/
z
,
A
=
new
THREE
.
Vector2
(
H
*
K
,
H
),
M
=
new
THREE
.
Vector3
(
1
,
1
,
0
),
N
=
new
THREE
.
Vector2
(
1
,
1
),
I
=
p
,
H
=
n
;
b
.
useProgram
(
j
);
o
||
(
b
.
enableVertexAttribArray
(
n
.
vertex
),
b
.
enableVertexAttribArray
(
n
.
uv
),
o
=!
0
);
b
.
uniform1i
(
I
.
occlusionMap
,
0
);
b
.
uniform1i
(
I
.
map
,
1
);
b
.
bindBuffer
(
b
.
ARRAY_BUFFER
,
f
);
b
.
vertexAttribPointer
(
H
.
vertex
,
2
,
b
.
FLOAT
,
!
1
,
16
,
0
);
b
.
vertexAttribPointer
(
H
.
uv
,
2
,
b
.
FLOAT
,
!
1
,
16
,
8
);
b
.
bindBuffer
(
b
.
ELEMENT_ARRAY_BUFFER
,
h
);
b
.
disable
(
b
.
CULL_FACE
);
b
.
depthMask
(
!
1
);
var
S
,
ua
,
ka
,
$
,
Z
;
for
(
S
=
0
;
S
<
y
;
S
++
)
if
(
H
=
16
/
z
,
A
.
set
(
H
*
K
,
H
),
$
=
a
[
S
],
J
.
set
(
$
.
matrixWorld
.
n14
,
$
.
matrixWorld
.
n24
,
$
.
matrixWorld
.
n34
),
d
.
matrixWorldInverse
.
multiplyVector3
(
J
),
d
.
projectionMatrix
.
multiplyVector3
(
J
),
M
.
copy
(
J
),
N
.
x
=
M
.
x
*
u
+
u
,
N
.
y
=
M
.
y
*
B
+
B
,
l
||
0
<
N
.
x
&&
N
.
x
<
e
&&
0
<
N
.
y
&&
N
.
y
<
z
){
b
.
activeTexture
(
b
.
TEXTURE1
);
b
.
bindTexture
(
b
.
TEXTURE_2D
,
i
);
b
.
copyTexImage2D
(
b
.
TEXTURE_2D
,
0
,
b
.
RGB
,
N
.
x
-
8
,
N
.
y
-
8
,
16
,
16
,
0
);
b
.
uniform1i
(
I
.
renderType
,
0
);
b
.
uniform2f
(
I
.
scale
,
A
.
x
,
A
.
y
);
b
.
uniform3f
(
I
.
screenPosition
,
M
.
x
,
M
.
y
,
M
.
z
);
b
.
disable
(
b
.
BLEND
);
b
.
enable
(
b
.
DEPTH_TEST
);
b
.
drawElements
(
b
.
TRIANGLES
,
6
,
b
.
UNSIGNED_SHORT
,
0
);
b
.
activeTexture
(
b
.
TEXTURE0
);
b
.
bindTexture
(
b
.
TEXTURE_2D
,
k
);
b
.
copyTexImage2D
(
b
.
TEXTURE_2D
,
0
,
b
.
RGBA
,
N
.
x
-
8
,
N
.
y
-
8
,
16
,
16
,
0
);
b
.
uniform1i
(
I
.
renderType
,
1
);
b
.
disable
(
b
.
DEPTH_TEST
);
b
.
activeTexture
(
b
.
TEXTURE1
);
b
.
bindTexture
(
b
.
TEXTURE_2D
,
i
);
b
.
drawElements
(
b
.
TRIANGLES
,
6
,
b
.
UNSIGNED_SHORT
,
0
);
$
.
positionScreen
.
copy
(
M
);
$
.
customUpdateCallback
?
$
.
customUpdateCallback
(
$
):
$
.
updateLensFlares
();
b
.
uniform1i
(
I
.
renderType
,
2
);
b
.
enable
(
b
.
BLEND
);
for
(
ua
=
0
,
ka
=
$
.
lensFlares
.
length
;
ua
<
ka
;
ua
++
)
if
(
Z
=
$
.
lensFlares
[
ua
],
0.001
<
Z
.
opacity
&&
0.001
<
Z
.
scale
)
M
.
x
=
Z
.
x
,
M
.
y
=
Z
.
y
,
M
.
z
=
Z
.
z
,
H
=
Z
.
size
*
Z
.
scale
/
z
,
A
.
x
=
H
*
K
,
A
.
y
=
H
,
b
.
uniform3f
(
I
.
screenPosition
,
M
.
x
,
M
.
y
,
M
.
z
),
b
.
uniform2f
(
I
.
scale
,
A
.
x
,
A
.
y
),
b
.
uniform1f
(
I
.
rotation
,
Z
.
rotation
),
b
.
uniform1f
(
I
.
opacity
,
Z
.
opacity
),
b
.
uniform3f
(
I
.
color
,
i
);
b
.
drawElements
(
b
.
TRIANGLES
,
6
,
b
.
UNSIGNED_SHORT
,
0
);
$
.
positionScreen
.
copy
(
M
);
$
.
customUpdateCallback
?
$
.
customUpdateCallback
(
$
):
$
.
updateLensFlares
();
b
.
uniform1i
(
I
.
renderType
,
2
);
b
.
enable
(
b
.
BLEND
);
for
(
ua
=
0
,
ka
=
$
.
lensFlares
.
length
;
ua
<
ka
;
ua
++
)
if
(
Z
=
$
.
lensFlares
[
ua
],
0.001
0
<
Z
.
opacity
&&
0.0010
<
Z
.
scale
)
M
.
x
=
Z
.
x
,
M
.
y
=
Z
.
y
,
M
.
z
=
Z
.
z
,
H
=
Z
.
size
*
Z
.
scale
/
z
,
A
.
x
=
H
*
K
,
A
.
y
=
H
,
b
.
uniform3f
(
I
.
screenPosition
,
M
.
x
,
M
.
y
,
M
.
z
),
b
.
uniform2f
(
I
.
scale
,
A
.
x
,
A
.
y
),
b
.
uniform1f
(
I
.
rotation
,
Z
.
rotation
),
b
.
uniform1f
(
I
.
opacity
,
Z
.
opacity
),
b
.
uniform3f
(
I
.
color
,
Z
.
color
.
r
,
Z
.
color
.
g
,
Z
.
color
.
b
),
c
.
setBlending
(
Z
.
blending
),
c
.
setTexture
(
Z
.
texture
,
1
),
b
.
drawElements
(
b
.
TRIANGLES
,
6
,
b
.
UNSIGNED_SHORT
,
0
)}
b
.
enable
(
b
.
CULL_FACE
);
b
.
enable
(
b
.
DEPTH_TEST
);
b
.
depthMask
(
!
0
)}}};
THREE
.
ShadowMapPlugin
=
function
(){
var
a
,
b
,
c
,
d
,
e
=
new
THREE
.
Frustum
,
f
=
new
THREE
.
Matrix4
;
this
.
init
=
function
(
e
){
a
=
e
.
context
;
b
=
e
;
var
e
=
THREE
.
ShaderLib
.
depthRGBA
,
f
=
THREE
.
UniformsUtils
.
clone
(
e
.
uniforms
);
c
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
e
.
fragmentShader
,
vertexShader
:
e
.
vertexShader
,
uniforms
:
f
});
d
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
e
.
fragmentShader
,
vertexShader
:
e
.
vertexShader
,
uniforms
:
f
,
morphTargets
:
!
0
});
c
.
_shadowPass
=!
0
;
d
.
_shadowPass
=!
0
};
this
.
render
=
function
(
a
,
c
){
b
.
shadowMapEnabled
&&
b
.
shadowMapAutoUpdate
&&
this
.
update
(
a
,
c
)};
this
.
update
=
function
(
h
){
var
i
,
k
,
l
,
j
,
n
,
p
,
o
,
m
,
r
,
t
=
h
.
lights
;
a
.
clearColor
(
1
,
1
,
1
,
1
);
a
.
disable
(
a
.
BLEND
);
b
.
shadowMapCullFrontFaces
&&
a
.
cullFace
(
a
.
FRONT
);
b
.
setDepthTest
(
!
0
);
for
(
i
=
0
,
k
=
t
.
length
;
i
<
k
;
i
++
)
if
(
m
=
t
[
i
],
m
.
castShadow
){
if
(
!
m
.
shadowMap
)
m
.
shadowMap
=
new
THREE
.
WebGLRenderTarget
(
m
.
shadowMapWidth
,
m
.
shadowMapHeight
,{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
,
format
:
THREE
.
RGBAFormat
}),
m
.
shadowMapSize
=
new
THREE
.
Vector2
(
m
.
shadowMapWidth
,
m
.
shadowMapHeight
),
m
.
shadowMatrix
=
new
THREE
.
Matrix4
;
...
...
docs/api/lights/AmbientLight.rst
浏览文件 @
0f13495f
...
...
@@ -3,13 +3,25 @@ AmbientLight - An ambient light
.. rubric:: Constructor
.. class:: AmbientLight()
.. class:: AmbientLight(
hex
)
An ambient light
Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
:param integer hex: light color
.. rubric:: Attributes
.. rubric:: Method
.. attribute:: AmbientLight.color
Light :class:`Color`
Material's ambient color gets multiplied by this color.
.. rubric:: Example
::
.. rubric:: Example(s)
\ No newline at end of file
var ambientLight = new THREE.AmbientLight( 0x333333 );
scene.add( ambientLight );
docs/api/lights/DirectionalLight.rst
浏览文件 @
0f13495f
...
...
@@ -3,12 +3,132 @@ DirectionalLight - A directional light
.. rubric:: Constructor
.. class:: DirectionalLight()
.. class:: DirectionalLight(
hex, intensity, distance
)
A directional light
Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
Part of scene graph
:param integer hex: light color
:param float intensity: light intensity
:param float distance: distance affected by light
.. rubric:: Attributes
.. rubric:: Method
.. attribute:: DirectionalLight.color
Light :class:`Color`
.. attribute:: DirectionalLight.intensity
Light intensity
``default 1.0``
.. attribute:: DirectionalLight.position
Direction of the light is normalized vector from ``position`` to ``(0,0,0)``.
.. attribute:: DirectionalLight.distance
Modulating directional light by distance not implemented in :class:`WebGLRenderer`
.. rubric:: Shadow attributes
.. attribute:: DirectionalLight.castShadow
If set to `true` light will cast dynamic shadows
Warning: this is expensive and requires tweaking to get shadows looking right.
``default false``
.. attribute:: DirectionalLight.onlyShadow
If set to `true` light will only cast shadow but not contribute any lighting (as if intensity was 0 but cheaper to compute)
``default false``
.. attribute:: DirectionalLight.target
:class:`Object3D` target used for shadow camera orientation
.. attribute:: DirectionalLight.shadowCameraNear
Orthographic shadow camera frustum parameter
``default 50``
.. attribute:: DirectionalLight.shadowCameraFar
Orthographic shadow camera frustum parameter
``default 5000``
.. attribute:: DirectionalLight.shadowCameraLeft
Orthographic shadow camera frustum parameter
``default -500``
.. attribute:: DirectionalLight.shadowCameraRight
Orthographic shadow camera frustum parameter
``default 500``
.. attribute:: DirectionalLight.shadowCameraTop
Orthographic shadow camera frustum parameter
``default 500``
.. attribute:: DirectionalLight.shadowCameraBottom
Orthographic shadow camera frustum parameter
``default -500``
.. attribute:: DirectionalLight.shadowCameraVisible
Show debug shadow camera frustum
``default false``
.. attribute:: DirectionalLight.shadowBias
Shadow map bias
``default 0``
.. attribute:: DirectionalLight.shadowDarkness
Darkness of shadow casted by this light (``float`` from 0 to 1)
``default 0.5``
.. attribute:: DirectionalLight.shadowMapWidth
Shadow map texture width in pixels
``default 512``
.. attribute:: DirectionalLight.shadowMapHeight
Shadow map texture height in pixels
``default 512``
.. rubric:: Example
::
// white directional light at half intensity shining from the top
.. rubric:: Example(s)
\ No newline at end of file
var directionalLight = new THREE.DirectionalLight( 0xffffff, 0.5 );
directionalLight.position.set( 0, 1, 0 );
scene.add( directionalLight );
docs/api/lights/Light.rst
浏览文件 @
0f13495f
Light -
Base class for light type
s
----------------------------------
Light -
Abstract base class for light
s
----------------------------------
----
.. rubric:: Constructor
.. class:: Light()
.. class:: Light( hex )
Abstract base class for lights
:param integer hex: light color
Base class for light types
.. rubric:: Attributes
..
rubric:: Method
..
attribute:: Light.color
.. rubric:: Example(s)
\ No newline at end of file
Light :class:`Color`
docs/api/lights/PointLight.rst
浏览文件 @
0f13495f
...
...
@@ -3,12 +3,45 @@ PointLight - A point light
.. rubric:: Constructor
.. class:: PointLight()
.. class:: PointLight(
hex, intensity, distance
)
A point light
Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
Part of scene graph
:param integer hex: light color
:param float intensity: light intensity
:param float distance: distance affected by light
.. rubric:: Attributes
.. rubric:: Method
.. attribute:: PointLight.color
Light :class:`Color`
.. attribute:: PointLight.intensity
Light intensity
``default 1.0``
.. attribute:: PointLight.position
Position of the light
.. attribute:: PointLight.distance
If non-zero, light will attenuate linearly from maximum intensity at light ``position`` down to zero at ``distance``
.. rubric:: Example
::
// red point light shining from the front
.. rubric:: Example(s)
\ No newline at end of file
var pointLight = new THREE.PointLight( 0xff0000 );
pointLight.position.set( 0, 0, 10 );
scene.add( pointLight );
docs/api/lights/SpotLight.rst
浏览文件 @
0f13495f
...
...
@@ -3,12 +3,128 @@ SpotLight - A spotlight
.. rubric:: Constructor
.. class:: SpotLight()
.. class:: SpotLight( hex, intensity, distance, castShadow )
A point light that can cast shadow in one direction
Affects :class:`MeshLambertMaterial` and :class:`MeshPhongMaterial`
Part of scene graph
:param integer hex: light color
:param float intensity: light intensity
:param float distance: distance affected by light
:param bool castShadow: shadow casting
A spotlight
.. rubric:: Attributes
.. rubric:: Method
.. attribute:: SpotLight.color
Light :class:`Color`
.. attribute:: SpotLight.intensity
Light intensity
``default 1.0``
.. attribute:: SpotLight.position
Position of the light
.. attribute:: SpotLight.distance
If non-zero, light will attenuate linearly from maximum intensity at light ``position`` down to zero at ``distance``
.. rubric:: Shadow attributes
.. attribute:: SpotLight.castShadow
If set to `true` light will cast dynamic shadows
Warning: this is expensive and requires tweaking to get shadows looking right.
``default false``
.. attribute:: SpotLight.onlyShadow
If set to `true` light will only cast shadow but not contribute any lighting (as if intensity was 0 but cheaper to compute)
``default false``
.. attribute:: SpotLight.target
:class:`Object3D` target used for shadow camera orientation
.. attribute:: SpotLight.shadowCameraNear
Perspective shadow camera frustum ``near``
``default 50``
.. attribute:: SpotLight.shadowCameraFar
Perspective shadow camera frustum ``far``
``default 5000``
.. attribute:: SpotLight.shadowCameraFov
Perspective shadow camera frustum ``field-of-view``
``default 50``
.. attribute:: SpotLight.shadowCameraVisible
Show debug shadow camera frustum
``default false``
.. attribute:: SpotLight.shadowBias
Shadow map bias
``default 0``
.. attribute:: SpotLight.shadowDarkness
Darkness of shadow casted by this light (``float`` from 0 to 1)
``default 0.5``
.. attribute:: SpotLight.shadowMapWidth
Shadow map texture width in pixels
``default 512``
.. attribute:: SpotLight.shadowMapHeight
Shadow map texture height in pixels
``default 512``
.. rubric:: Example
::
// white spotlight shining from the side, casting shadow
var spotLight = new THREE.SpotLight( 0xffffff );
spotLight.position.set( 100, 1000, 100 );
spotLight.castShadow = true;
spotLight.shadowMapWidth = 1024;
spotLight.shadowMapHeight = 1024;
spotLight.shadowCameraNear = 500;
spotLight.shadowCameraFar = 4000;
spotLight.shadowCameraFov = 30;
.. rubric:: Example(s)
\ No newline at end of file
scene.add( spotLight );
docs/api/lights/index.rst
浏览文件 @
0f13495f
...
...
@@ -2,8 +2,9 @@ Lights
======
.. toctree::
Light
AmbientLight
DirectionalLight
Light
PointLight
SpotLight
docs/static/nature.css
浏览文件 @
0f13495f
...
...
@@ -395,3 +395,12 @@ table.field-list {
dd
{
margin
:
1em
0
0
0.25em
;
}
/* cross-reference link style */
tt
.xref
{
font-family
:
arial
;
font-weight
:
normal
;
font-size
:
1em
;
color
:
#005B81
;
}
\ No newline at end of file
src/lights/DirectionalLight.js
浏览文件 @
0f13495f
...
...
@@ -18,6 +18,9 @@ THREE.DirectionalLight = function ( hex, intensity, distance ) {
//
this
.
shadowCameraNear
=
50
;
this
.
shadowCameraFar
=
5000
;
this
.
shadowCameraLeft
=
-
500
;
this
.
shadowCameraRight
=
500
;
this
.
shadowCameraTop
=
500
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录