Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
2603ccf4
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2603ccf4
编写于
9月 02, 2011
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Applied specular highlights fix from @evanw also to Phong shader.
上级
5d898fa2
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
18 addition
and
16 deletion
+18
-16
build/Three.js
build/Three.js
+6
-6
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+1
-1
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+1
-1
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+4
-4
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+1
-1
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+2
-2
src/extras/ShaderUtils.js
src/extras/ShaderUtils.js
+2
-0
src/renderers/WebGLShaders.js
src/renderers/WebGLShaders.js
+1
-1
未找到文件。
build/Three.js
浏览文件 @
2603ccf4
...
...
@@ -56,7 +56,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){t
this
.
x
=
b
.
x
*
f
;
this
.
y
=
b
.
y
*
f
;
this
.
z
=
b
.
z
*
f
;
this
.
w
=
Math
.
cos
(
e
);
return
this
},
setFromRotationMatrix
:
function
(
b
){
var
c
=
Math
.
pow
(
b
.
determinant
(),
1
/
3
);
this
.
w
=
Math
.
sqrt
(
Math
.
max
(
0
,
c
+
b
.
n11
+
b
.
n22
+
b
.
n33
))
/
2
;
this
.
x
=
Math
.
sqrt
(
Math
.
max
(
0
,
c
+
b
.
n11
-
b
.
n22
-
b
.
n33
))
/
2
;
this
.
y
=
Math
.
sqrt
(
Math
.
max
(
0
,
c
-
b
.
n11
+
b
.
n22
-
b
.
n33
))
/
2
;
this
.
z
=
Math
.
sqrt
(
Math
.
max
(
0
,
c
-
b
.
n11
-
b
.
n22
+
b
.
n33
))
/
2
;
this
.
x
=
b
.
n32
-
b
.
n23
<
0
?
-
Math
.
abs
(
this
.
x
):
Math
.
abs
(
this
.
x
);
this
.
y
=
b
.
n13
-
b
.
n31
<
0
?
-
Math
.
abs
(
this
.
y
):
Math
.
abs
(
this
.
y
);
this
.
z
=
b
.
n21
-
b
.
n12
<
0
?
-
Math
.
abs
(
this
.
z
):
Math
.
abs
(
this
.
z
);
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
b
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
b
==
0
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
b
=
1
/
b
,
this
.
x
*=
b
,
this
.
y
*=
b
,
this
.
z
*=
b
,
this
.
w
*=
b
);
return
this
},
multiplySelf
:
function
(
b
){
var
c
=
this
.
x
,
e
=
this
.
y
,
f
=
this
.
z
,
h
=
this
.
w
,
k
=
b
.
x
,
j
=
b
.
y
,
m
=
b
.
z
,
b
=
b
.
w
;
this
.
x
=
c
*
b
+
h
*
k
+
e
*
m
-
f
*
j
;
this
.
y
=
e
*
b
+
h
*
j
+
f
*
k
-
c
*
m
;
this
.
z
=
f
*
b
+
h
*
m
+
c
*
j
-
e
*
k
;
this
.
w
=
h
*
b
-
c
*
k
-
e
*
j
-
f
*
m
;
return
this
},
multiply
:
function
(
b
,
c
){
this
.
x
=
b
.
x
*
c
.
w
+
b
.
y
*
c
.
z
-
b
.
z
*
c
.
y
+
b
.
w
*
c
.
x
;
this
.
y
=-
b
.
x
*
c
.
z
+
b
.
y
*
c
.
w
+
b
.
z
*
c
.
x
+
b
.
w
*
c
.
y
;
this
.
z
=
b
.
x
*
c
.
y
-
b
.
y
*
c
.
x
+
b
.
z
*
c
.
w
+
b
.
w
*
c
.
z
;
this
.
w
=-
b
.
x
*
c
.
x
-
b
.
y
*
c
.
y
-
b
.
z
*
c
.
z
+
b
.
w
*
c
.
w
;
return
this
},
multiplyVector3
:
function
(
b
,
c
){
c
||
(
c
=
b
);
var
e
=
b
.
x
,
f
=
b
.
y
,
h
=
b
.
z
,
k
=
this
.
x
,
j
=
this
.
y
,
m
=
this
.
z
,
o
=
this
.
w
,
t
=
o
*
e
+
j
*
h
-
m
*
f
,
p
=
o
*
f
+
m
*
e
-
k
*
h
,
v
=
o
*
h
+
k
*
f
-
j
*
e
,
e
=-
k
*
e
-
j
*
f
-
m
*
h
;
c
.
x
=
t
*
o
+
e
*-
k
+
p
*-
m
-
v
*-
j
;
c
.
y
=
p
*
o
+
e
*-
j
+
v
*-
k
-
t
*-
m
;
c
.
z
=
v
*
o
+
e
*-
m
+
t
*-
j
-
p
*-
k
;
return
c
}};
THREE
.
Quaternion
.
slerp
=
function
(
b
,
c
,
e
,
f
){
var
h
=
b
.
w
*
c
.
w
+
b
.
x
*
c
.
x
+
b
.
y
*
c
.
y
+
b
.
z
*
c
.
z
;
if
(
Math
.
abs
(
h
)
>=
1
)
return
e
.
w
=
b
.
w
,
e
.
x
=
b
.
x
,
e
.
y
=
b
.
y
,
e
.
z
=
b
.
z
,
e
;
var
k
=
Math
.
acos
(
h
),
j
=
Math
.
sqrt
(
1
-
h
*
h
);
if
(
Math
.
abs
(
j
)
<
0.001
)
return
e
.
w
=
0.5
*
(
b
.
w
+
c
.
w
),
e
.
x
=
0.5
*
(
b
.
x
+
c
.
x
),
e
.
y
=
0.5
*
(
b
.
y
+
c
.
y
),
e
.
z
=
0.5
*
(
b
.
z
+
c
.
z
),
e
;
h
=
Math
.
sin
((
1
-
f
)
*
k
)
/
j
;
f
=
Math
.
sin
(
f
*
k
)
/
j
;
e
.
w
=
b
.
w
*
h
+
c
.
w
*
f
;
e
.
x
=
b
.
x
*
h
+
c
.
x
*
f
;
e
.
y
=
b
.
y
*
h
+
c
.
y
*
f
;
e
.
z
=
b
.
z
*
h
+
c
.
z
*
f
;
return
e
};
e
-
j
*
f
-
m
*
h
;
c
.
x
=
t
*
o
+
e
*-
k
+
p
*-
m
-
v
*-
j
;
c
.
y
=
p
*
o
+
e
*-
j
+
v
*-
k
-
t
*-
m
;
c
.
z
=
v
*
o
+
e
*-
m
+
t
*-
j
-
p
*-
k
;
return
c
}};
THREE
.
Quaternion
.
slerp
=
function
(
b
,
c
,
e
,
f
){
var
h
=
b
.
w
*
c
.
w
+
b
.
x
*
c
.
x
+
b
.
y
*
c
.
y
+
b
.
z
*
c
.
z
;
if
(
Math
.
abs
(
h
)
>=
1
)
return
e
.
w
=
b
.
w
,
e
.
x
=
b
.
x
,
e
.
y
=
b
.
y
,
e
.
z
=
b
.
z
,
e
;
var
k
=
Math
.
acos
(
h
),
j
=
Math
.
sqrt
(
1
-
h
*
h
);
if
(
Math
.
abs
(
j
)
<
0.001
0
)
return
e
.
w
=
0.5
*
(
b
.
w
+
c
.
w
),
e
.
x
=
0.5
*
(
b
.
x
+
c
.
x
),
e
.
y
=
0.5
*
(
b
.
y
+
c
.
y
),
e
.
z
=
0.5
*
(
b
.
z
+
c
.
z
),
e
;
h
=
Math
.
sin
((
1
-
f
)
*
k
)
/
j
;
f
=
Math
.
sin
(
f
*
k
)
/
j
;
e
.
w
=
b
.
w
*
h
+
c
.
w
*
f
;
e
.
x
=
b
.
x
*
h
+
c
.
x
*
f
;
e
.
y
=
b
.
y
*
h
+
c
.
y
*
f
;
e
.
z
=
b
.
z
*
h
+
c
.
z
*
f
;
return
e
};
THREE
.
Vertex
=
function
(
b
){
this
.
position
=
b
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
b
,
c
,
e
,
f
,
h
,
k
){
this
.
a
=
b
;
this
.
b
=
c
;
this
.
c
=
e
;
this
.
normal
=
f
instanceof
THREE
.
Vector3
?
f
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
f
instanceof
Array
?
f
:[];
this
.
color
=
h
instanceof
THREE
.
Color
?
h
:
new
THREE
.
Color
;
this
.
vertexColors
=
h
instanceof
Array
?
h
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
k
instanceof
Array
?
k
:[
k
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
b
,
c
,
e
,
f
,
h
,
k
,
j
){
this
.
a
=
b
;
this
.
b
=
c
;
this
.
c
=
e
;
this
.
d
=
f
;
this
.
normal
=
h
instanceof
THREE
.
Vector3
?
h
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
h
instanceof
Array
?
h
:[];
this
.
color
=
k
instanceof
THREE
.
Color
?
k
:
new
THREE
.
Color
;
this
.
vertexColors
=
k
instanceof
Array
?
k
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
j
instanceof
Array
?
j
:[
j
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
b
,
c
){
this
.
u
=
b
||
0
;
this
.
v
=
c
||
0
};
THREE
.
UV
.
prototype
=
{
constructor
:
THREE
.
UV
,
set
:
function
(
b
,
c
){
this
.
u
=
b
;
this
.
v
=
c
;
return
this
},
copy
:
function
(
b
){
this
.
u
=
b
.
u
;
this
.
v
=
b
.
v
;
return
this
},
clone
:
function
(){
return
new
THREE
.
UV
(
this
.
u
,
this
.
v
)}};
...
...
@@ -213,7 +213,7 @@ THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,
THREE
.
ShaderChunk
.
envmap_vertex
,
THREE
.
ShaderChunk
.
color_vertex
,
"
vec3 transformedNormal = normalize( normalMatrix * normal );
"
,
THREE
.
ShaderChunk
.
lights_vertex
,
THREE
.
ShaderChunk
.
skinning_vertex
,
THREE
.
ShaderChunk
.
morphtarget_vertex
,
THREE
.
ShaderChunk
.
default_vertex
,
THREE
.
ShaderChunk
.
shadowmap_vertex
,
"
}
"
].
join
(
"
\n
"
)},
phong
:{
uniforms
:
THREE
.
UniformsUtils
.
merge
([
THREE
.
UniformsLib
.
common
,
THREE
.
UniformsLib
.
fog
,
THREE
.
UniformsLib
.
lights
,
THREE
.
UniformsLib
.
shadowmap
,{
ambient
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
328965
)},
specular
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
1118481
)},
shininess
:{
type
:
"
f
"
,
value
:
30
}}]),
fragmentShader
:[
"
uniform vec3 diffuse;
\n
uniform float opacity;
\n
uniform vec3 ambient;
\n
uniform vec3 specular;
\n
uniform float shininess;
\n
varying vec3 vLightWeighting;
"
,
THREE
.
ShaderChunk
.
color_pars_fragment
,
THREE
.
ShaderChunk
.
map_pars_fragment
,
THREE
.
ShaderChunk
.
lightmap_pars_fragment
,
THREE
.
ShaderChunk
.
envmap_pars_fragment
,
THREE
.
ShaderChunk
.
fog_pars_fragment
,
THREE
.
ShaderChunk
.
lights_pars_fragment
,
THREE
.
ShaderChunk
.
shadowmap_pars_fragment
,
"
void main() {
\n
gl_FragColor = vec4( vLightWeighting, 1.0 );
"
,
THREE
.
ShaderChunk
.
map_fragment
,
THREE
.
ShaderChunk
.
alphatest_fragment
,
THREE
.
ShaderChunk
.
lights_fragment
,
THREE
.
ShaderChunk
.
lightmap_fragment
,
THREE
.
ShaderChunk
.
color_fragment
,
THREE
.
ShaderChunk
.
envmap_fragment
,
THREE
.
ShaderChunk
.
shadowmap_fragment
,
THREE
.
ShaderChunk
.
fog_fragment
,
"
}
"
].
join
(
"
\n
"
),
vertexShader
:[
"
#define PHONG
\n
varying vec3 vLightWeighting;
\n
varying vec3 vViewPosition;
\n
varying vec3 vNormal;
"
,
THREE
.
ShaderChunk
.
map_pars_vertex
,
THREE
.
ShaderChunk
.
lightmap_pars_vertex
,
THREE
.
ShaderChunk
.
envmap_pars_vertex
,
THREE
.
ShaderChunk
.
lights_pars_vertex
,
THREE
.
ShaderChunk
.
color_pars_vertex
,
THREE
.
ShaderChunk
.
skinning_pars_vertex
,
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
,
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
,
"
void main() {
\n
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
"
,
THREE
.
ShaderChunk
.
map_vertex
,
THREE
.
ShaderChunk
.
lightmap_vertex
,
THREE
.
ShaderChunk
.
envmap_vertex
,
THREE
.
ShaderChunk
.
color_vertex
,
"
#ifndef USE_ENVMAP
\n
vec4 mPosition = objectMatrix * vec4( position, 1.0 );
\n
#endif
\n
vViewPosition =
cameraPosition - m
Position.xyz;
\n
vec3 transformedNormal = normalize( normalMatrix * normal );
\n
vNormal = transformedNormal;
"
,
THREE
.
ShaderChunk
.
envmap_pars_vertex
,
THREE
.
ShaderChunk
.
lights_pars_vertex
,
THREE
.
ShaderChunk
.
color_pars_vertex
,
THREE
.
ShaderChunk
.
skinning_pars_vertex
,
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
,
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
,
"
void main() {
\n
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
"
,
THREE
.
ShaderChunk
.
map_vertex
,
THREE
.
ShaderChunk
.
lightmap_vertex
,
THREE
.
ShaderChunk
.
envmap_vertex
,
THREE
.
ShaderChunk
.
color_vertex
,
"
#ifndef USE_ENVMAP
\n
vec4 mPosition = objectMatrix * vec4( position, 1.0 );
\n
#endif
\n
vViewPosition =
-mv
Position.xyz;
\n
vec3 transformedNormal = normalize( normalMatrix * normal );
\n
vNormal = transformedNormal;
"
,
THREE
.
ShaderChunk
.
lights_vertex
,
THREE
.
ShaderChunk
.
skinning_vertex
,
THREE
.
ShaderChunk
.
morphtarget_vertex
,
THREE
.
ShaderChunk
.
default_vertex
,
THREE
.
ShaderChunk
.
shadowmap_vertex
,
"
}
"
].
join
(
"
\n
"
)},
particle_basic
:{
uniforms
:
THREE
.
UniformsUtils
.
merge
([
THREE
.
UniformsLib
.
particle
,
THREE
.
UniformsLib
.
shadowmap
]),
fragmentShader
:[
"
uniform vec3 psColor;
\n
uniform float opacity;
"
,
THREE
.
ShaderChunk
.
color_pars_fragment
,
THREE
.
ShaderChunk
.
map_particle_pars_fragment
,
THREE
.
ShaderChunk
.
fog_pars_fragment
,
THREE
.
ShaderChunk
.
shadowmap_pars_fragment
,
"
void main() {
\n
gl_FragColor = vec4( psColor, opacity );
"
,
THREE
.
ShaderChunk
.
map_particle_fragment
,
THREE
.
ShaderChunk
.
alphatest_fragment
,
THREE
.
ShaderChunk
.
color_fragment
,
THREE
.
ShaderChunk
.
shadowmap_fragment
,
THREE
.
ShaderChunk
.
fog_fragment
,
"
}
"
].
join
(
"
\n
"
),
vertexShader
:[
"
uniform float size;
\n
uniform float scale;
"
,
THREE
.
ShaderChunk
.
color_pars_vertex
,
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
,
"
void main() {
"
,
THREE
.
ShaderChunk
.
color_vertex
,
"
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
\n
#ifdef USE_SIZEATTENUATION
\n
gl_PointSize = size * ( scale / length( mvPosition.xyz ) );
\n
#else
\n
gl_PointSize = size;
\n
#endif
\n
gl_Position = projectionMatrix * mvPosition;
"
,
THREE
.
ShaderChunk
.
shadowmap_vertex
,
"
}
"
].
join
(
"
\n
"
)},
depthRGBA
:{
uniforms
:{},
fragmentShader
:
"
vec4 pack_depth( const in float depth ) {
\n
const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );
\n
const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );
\n
vec4 res = fract( depth * bit_shift );
\n
res -= res.xxyz * bit_mask;
\n
return res;
\n
}
\n
void main() {
\n
gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );
\n
}
"
,
vertexShader
:[
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
,
...
...
@@ -376,7 +376,7 @@ this.getPrevKeyWith("pos",u,j.index-1).pos,this.points[1]=h,this.points[2]=k,thi
THREE
.
Animation
.
prototype
.
interpolateCatmullRom
=
function
(
b
,
c
){
var
e
=
[],
f
=
[],
h
,
k
,
j
,
m
,
o
,
t
;
h
=
(
b
.
length
-
1
)
*
c
;
k
=
Math
.
floor
(
h
);
h
-=
k
;
e
[
0
]
=
k
==
0
?
k
:
k
-
1
;
e
[
1
]
=
k
;
e
[
2
]
=
k
>
b
.
length
-
2
?
k
:
k
+
1
;
e
[
3
]
=
k
>
b
.
length
-
3
?
k
:
k
+
2
;
k
=
b
[
e
[
0
]];
m
=
b
[
e
[
1
]];
o
=
b
[
e
[
2
]];
t
=
b
[
e
[
3
]];
e
=
h
*
h
;
j
=
h
*
e
;
f
[
0
]
=
this
.
interpolate
(
k
[
0
],
m
[
0
],
o
[
0
],
t
[
0
],
h
,
e
,
j
);
f
[
1
]
=
this
.
interpolate
(
k
[
1
],
m
[
1
],
o
[
1
],
t
[
1
],
h
,
e
,
j
);
f
[
2
]
=
this
.
interpolate
(
k
[
2
],
m
[
2
],
o
[
2
],
t
[
2
],
h
,
e
,
j
);
return
f
};
THREE
.
Animation
.
prototype
.
interpolate
=
function
(
b
,
c
,
e
,
f
,
h
,
k
,
j
){
b
=
(
e
-
b
)
*
0.5
;
f
=
(
f
-
c
)
*
0.5
;
return
(
2
*
(
c
-
e
)
+
b
+
f
)
*
j
+
(
-
3
*
(
c
-
e
)
-
2
*
b
-
f
)
*
k
+
b
*
h
+
c
};
THREE
.
Animation
.
prototype
.
getNextKeyWith
=
function
(
b
,
c
,
e
){
var
f
=
this
.
data
.
hierarchy
[
c
].
keys
;
for
(
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM
||
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
?
e
=
e
<
f
.
length
-
1
?
e
:
f
.
length
-
1
:
e
%=
f
.
length
;
e
<
f
.
length
;
e
++
)
if
(
f
[
e
][
b
]
!==
void
0
)
return
f
[
e
];
return
this
.
data
.
hierarchy
[
c
].
keys
[
0
]};
THREE
.
Animation
.
prototype
.
getPrevKeyWith
=
function
(
b
,
c
,
e
){
for
(
var
f
=
this
.
data
.
hierarchy
[
c
].
keys
,
e
=
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM
||
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
?
e
>
0
?
e
:
0
:
e
>=
0
?
e
:
e
+
f
.
length
;
e
>=
0
;
e
--
)
if
(
f
[
e
][
b
]
!==
void
0
)
return
f
[
e
];
return
this
.
data
.
hierarchy
[
c
].
keys
[
f
.
length
-
1
]};
THREE
.
FirstPersonCamera
=
function
(
b
){
function
c
(
b
,
c
){
return
function
(){
c
.
apply
(
b
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
b
.
fov
,
b
.
aspect
,
b
.
near
,
b
.
far
,
b
.
target
);
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.005
;
this
.
noFly
=!
1
;
this
.
lookVertical
=!
0
;
this
.
autoForward
=!
1
;
this
.
activeLook
=!
0
;
this
.
heightSpeed
=!
1
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
constrainVertical
=!
1
;
this
.
verticalMin
=
0
;
this
.
verticalMax
=
3.14
;
this
.
domElement
=
document
;
this
.
lastUpdate
=
(
new
Date
).
getTime
();
this
.
tdiff
=
0
;
if
(
b
){
if
(
b
.
movementSpeed
!==
void
0
)
this
.
movementSpeed
=
THREE
.
FirstPersonCamera
=
function
(
b
){
function
c
(
b
,
c
){
return
function
(){
c
.
apply
(
b
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
b
.
fov
,
b
.
aspect
,
b
.
near
,
b
.
far
,
b
.
target
);
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.005
0
;
this
.
noFly
=!
1
;
this
.
lookVertical
=!
0
;
this
.
autoForward
=!
1
;
this
.
activeLook
=!
0
;
this
.
heightSpeed
=!
1
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
constrainVertical
=!
1
;
this
.
verticalMin
=
0
;
this
.
verticalMax
=
3.14
;
this
.
domElement
=
document
;
this
.
lastUpdate
=
(
new
Date
).
getTime
();
this
.
tdiff
=
0
;
if
(
b
){
if
(
b
.
movementSpeed
!==
void
0
)
this
.
movementSpeed
=
b
.
movementSpeed
;
if
(
b
.
lookSpeed
!==
void
0
)
this
.
lookSpeed
=
b
.
lookSpeed
;
if
(
b
.
noFly
!==
void
0
)
this
.
noFly
=
b
.
noFly
;
if
(
b
.
lookVertical
!==
void
0
)
this
.
lookVertical
=
b
.
lookVertical
;
if
(
b
.
autoForward
!==
void
0
)
this
.
autoForward
=
b
.
autoForward
;
if
(
b
.
activeLook
!==
void
0
)
this
.
activeLook
=
b
.
activeLook
;
if
(
b
.
heightSpeed
!==
void
0
)
this
.
heightSpeed
=
b
.
heightSpeed
;
if
(
b
.
heightCoef
!==
void
0
)
this
.
heightCoef
=
b
.
heightCoef
;
if
(
b
.
heightMin
!==
void
0
)
this
.
heightMin
=
b
.
heightMin
;
if
(
b
.
heightMax
!==
void
0
)
this
.
heightMax
=
b
.
heightMax
;
if
(
b
.
constrainVertical
!==
void
0
)
this
.
constrainVertical
=
b
.
constrainVertical
;
if
(
b
.
verticalMin
!==
void
0
)
this
.
verticalMin
=
b
.
verticalMin
;
if
(
b
.
verticalMax
!==
void
0
)
this
.
verticalMax
=
b
.
verticalMax
;
if
(
b
.
domElement
!==
void
0
)
this
.
domElement
=
b
.
domElement
}
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
this
.
autoSpeedFactor
=
0
;
this
.
mouseDragOn
=
this
.
freeze
=
this
.
moveRight
=
this
.
moveLeft
=
this
.
moveBackward
=
this
.
moveForward
=!
1
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
this
.
onMouseDown
=
function
(
b
){
b
.
preventDefault
();
b
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
b
.
button
){
case
0
:
this
.
moveForward
=!
0
;
break
;
case
2
:
this
.
moveBackward
=!
0
}
this
.
mouseDragOn
=!
0
};
this
.
onMouseUp
=
function
(
b
){
b
.
preventDefault
();
b
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
b
.
button
){
case
0
:
this
.
moveForward
=!
1
;
break
;
case
2
:
this
.
moveBackward
=!
1
}
this
.
mouseDragOn
=!
1
};
this
.
onMouseMove
=
function
(
b
){
this
.
mouseX
=
b
.
clientX
-
this
.
windowHalfX
;
this
.
mouseY
=
b
.
clientY
-
this
.
windowHalfY
};
this
.
onKeyDown
=
function
(
b
){
switch
(
b
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=
...
...
@@ -388,7 +388,7 @@ Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListen
THREE
.
FirstPersonCamera
.
prototype
=
new
THREE
.
Camera
;
THREE
.
FirstPersonCamera
.
prototype
.
constructor
=
THREE
.
FirstPersonCamera
;
THREE
.
FirstPersonCamera
.
prototype
.
supr
=
THREE
.
Camera
.
prototype
;
THREE
.
FirstPersonCamera
.
prototype
.
translate
=
function
(
b
,
c
){
this
.
matrix
.
rotateAxis
(
c
);
if
(
this
.
noFly
)
c
.
y
=
0
;
this
.
position
.
addSelf
(
c
.
multiplyScalar
(
b
));
this
.
target
.
position
.
addSelf
(
c
.
multiplyScalar
(
b
))};
THREE
.
PathCamera
=
function
(
b
){
function
c
(
b
,
c
,
e
,
f
){
var
h
=
{
name
:
e
,
fps
:
0.6
,
length
:
f
,
hierarchy
:[]},
j
,
k
=
c
.
getControlPointsArray
(),
m
=
c
.
getLength
(),
o
=
k
.
length
,
H
=
0
;
j
=
o
-
1
;
c
=
{
parent
:
-
1
,
keys
:[]};
c
.
keys
[
0
]
=
{
time
:
0
,
pos
:
k
[
0
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
c
.
keys
[
j
]
=
{
time
:
f
,
pos
:
k
[
j
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
for
(
j
=
1
;
j
<
o
-
1
;
j
++
)
H
=
f
*
m
.
chunks
[
j
]
/
m
.
total
,
c
.
keys
[
j
]
=
{
time
:
H
,
pos
:
k
[
j
]};
h
.
hierarchy
[
0
]
=
c
;
THREE
.
AnimationHandler
.
add
(
h
);
return
new
THREE
.
Animation
(
b
,
e
,
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
,
!
1
)}
function
e
(
b
,
c
){
var
e
,
f
,
h
=
new
THREE
.
Geometry
;
for
(
e
=
0
;
e
<
b
.
points
.
length
*
c
;
e
++
)
f
=
e
/
(
b
.
points
.
length
*
c
),
f
=
b
.
getPoint
(
f
),
h
.
vertices
[
e
]
=
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
f
.
x
,
f
.
y
,
f
.
z
));
return
h
}
function
f
(
b
,
c
){
var
f
=
e
(
c
,
10
),
h
=
e
(
c
,
10
),
j
=
new
THREE
.
LineBasicMaterial
({
color
:
16711680
,
linewidth
:
3
});
lineObj
=
new
THREE
.
Line
(
f
,
j
);
particleObj
=
new
THREE
.
ParticleSystem
(
h
,
new
THREE
.
ParticleBasicMaterial
({
color
:
16755200
,
size
:
3
}));
lineObj
.
scale
.
set
(
1
,
1
,
1
);
b
.
addChild
(
lineObj
);
particleObj
.
scale
.
set
(
1
,
1
,
1
);
b
.
addChild
(
particleObj
);
h
=
new
THREE
.
SphereGeometry
(
1
,
16
,
8
);
j
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
});
for
(
i
=
0
;
i
<
c
.
points
.
length
;
i
++
)
f
=
new
THREE
.
Mesh
(
h
,
j
),
f
.
position
.
copy
(
c
.
points
[
i
]),
f
.
updateMatrix
(),
b
.
addChild
(
f
)}
THREE
.
Camera
.
call
(
this
,
b
.
fov
,
b
.
aspect
,
b
.
near
,
b
.
far
,
b
.
target
);
this
.
id
=
"
PathCamera
"
+
THREE
.
PathCameraIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=!
0
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.005
;
this
.
lookHorizontal
=
16
,
8
);
j
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
});
for
(
i
=
0
;
i
<
c
.
points
.
length
;
i
++
)
f
=
new
THREE
.
Mesh
(
h
,
j
),
f
.
position
.
copy
(
c
.
points
[
i
]),
f
.
updateMatrix
(),
b
.
addChild
(
f
)}
THREE
.
Camera
.
call
(
this
,
b
.
fov
,
b
.
aspect
,
b
.
near
,
b
.
far
,
b
.
target
);
this
.
id
=
"
PathCamera
"
+
THREE
.
PathCameraIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=!
0
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.005
0
;
this
.
lookHorizontal
=
this
.
lookVertical
=!
0
;
this
.
verticalAngleMap
=
{
srcRange
:[
0
,
6.28
],
dstRange
:[
0
,
6.28
]};
this
.
horizontalAngleMap
=
{
srcRange
:[
0
,
6.28
],
dstRange
:[
0
,
6.28
]};
this
.
domElement
=
document
;
if
(
b
){
if
(
b
.
duration
!==
void
0
)
this
.
duration
=
b
.
duration
*
1
E3
;
if
(
b
.
waypoints
!==
void
0
)
this
.
waypoints
=
b
.
waypoints
;
if
(
b
.
useConstantSpeed
!==
void
0
)
this
.
useConstantSpeed
=
b
.
useConstantSpeed
;
if
(
b
.
resamplingCoef
!==
void
0
)
this
.
resamplingCoef
=
b
.
resamplingCoef
;
if
(
b
.
createDebugPath
!==
void
0
)
this
.
createDebugPath
=
b
.
createDebugPath
;
if
(
b
.
createDebugDummy
!==
void
0
)
this
.
createDebugDummy
=
b
.
createDebugDummy
;
if
(
b
.
lookSpeed
!==
void
0
)
this
.
lookSpeed
=
b
.
lookSpeed
;
if
(
b
.
lookVertical
!==
void
0
)
this
.
lookVertical
=
b
.
lookVertical
;
if
(
b
.
lookHorizontal
!==
void
0
)
this
.
lookHorizontal
=
b
.
lookHorizontal
;
if
(
b
.
verticalAngleMap
!==
void
0
)
this
.
verticalAngleMap
=
b
.
verticalAngleMap
;
if
(
b
.
horizontalAngleMap
!==
void
0
)
this
.
horizontalAngleMap
=
b
.
horizontalAngleMap
;
if
(
b
.
domElement
!==
void
0
)
this
.
domElement
=
b
.
domElement
}
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
0
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
var
h
=
Math
.
PI
*
2
,
k
=
Math
.
PI
/
180
;
this
.
update
=
function
(
b
,
c
,
e
){
var
f
,
j
;
this
.
lookHorizontal
&&
(
this
.
lon
+=
this
.
mouseX
*
this
.
lookSpeed
);
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
this
.
lookSpeed
);
this
.
lon
=
Math
.
max
(
0
,
Math
.
min
(
360
,
this
.
lon
));
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
k
;
this
.
theta
=
this
.
lon
*
k
;
f
=
this
.
phi
%
h
;
this
.
phi
=
f
>=
0
?
f
:
f
+
h
;
f
=
this
.
verticalAngleMap
.
srcRange
;
j
=
this
.
verticalAngleMap
.
dstRange
;
var
m
=
j
[
1
]
-
j
[
0
];
this
.
phi
=
...
...
@@ -396,7 +396,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(j[1]-j[0])/(f[1]-f[0])+j[0]-j
b
.
clientX
-
this
.
windowHalfX
;
this
.
mouseY
=
b
.
clientY
-
this
.
windowHalfY
};
this
.
spline
=
new
THREE
.
Spline
;
this
.
spline
.
initFromArray
(
this
.
waypoints
);
this
.
useConstantSpeed
&&
this
.
spline
.
reparametrizeByArcLength
(
this
.
resamplingCoef
);
if
(
this
.
createDebugDummy
){
var
b
=
new
THREE
.
MeshLambertMaterial
({
color
:
30719
}),
j
=
new
THREE
.
MeshLambertMaterial
({
color
:
65280
}),
m
=
new
THREE
.
CubeGeometry
(
10
,
10
,
20
),
o
=
new
THREE
.
CubeGeometry
(
2
,
2
,
10
);
this
.
animationParent
=
new
THREE
.
Mesh
(
m
,
b
);
b
=
new
THREE
.
Mesh
(
o
,
j
);
b
.
position
.
set
(
0
,
10
,
0
);
this
.
animation
=
c
(
this
.
animationParent
,
this
.
spline
,
this
.
id
,
this
.
duration
);
this
.
animationParent
.
addChild
(
this
);
this
.
animationParent
.
addChild
(
this
.
target
);
this
.
animationParent
.
addChild
(
b
)}
else
this
.
animation
=
c
(
this
.
animationParent
,
this
.
spline
,
this
.
id
,
this
.
duration
),
this
.
animationParent
.
addChild
(
this
.
target
),
this
.
animationParent
.
addChild
(
this
);
this
.
createDebugPath
&&
f
(
this
.
debugPath
,
this
.
spline
);
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
function
(
b
,
c
){
return
function
(){
c
.
apply
(
b
,
arguments
)}}(
this
,
this
.
onMouseMove
),
!
1
)};
THREE
.
PathCamera
.
prototype
=
new
THREE
.
Camera
;
THREE
.
PathCamera
.
prototype
.
constructor
=
THREE
.
PathCamera
;
THREE
.
PathCamera
.
prototype
.
supr
=
THREE
.
Camera
.
prototype
;
THREE
.
PathCameraIdCounter
=
0
;
THREE
.
FlyCamera
=
function
(
b
){
function
c
(
b
,
c
){
return
function
(){
c
.
apply
(
b
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
b
.
fov
,
b
.
aspect
,
b
.
near
,
b
.
far
,
b
.
target
);
this
.
tmpQuaternion
=
new
THREE
.
Quaternion
;
this
.
movementSpeed
=
1
;
this
.
rollSpeed
=
0.005
;
this
.
autoForward
=
this
.
dragToLook
=!
1
;
this
.
domElement
=
document
;
if
(
b
){
if
(
b
.
movementSpeed
!==
void
0
)
this
.
movementSpeed
=
b
.
movementSpeed
;
if
(
b
.
rollSpeed
!==
void
0
)
this
.
rollSpeed
=
b
.
rollSpeed
;
if
(
b
.
dragToLook
!==
void
0
)
this
.
dragToLook
=
b
.
dragToLook
;
if
(
b
.
autoForward
!==
void
0
)
this
.
autoForward
=
THREE
.
FlyCamera
=
function
(
b
){
function
c
(
b
,
c
){
return
function
(){
c
.
apply
(
b
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
b
.
fov
,
b
.
aspect
,
b
.
near
,
b
.
far
,
b
.
target
);
this
.
tmpQuaternion
=
new
THREE
.
Quaternion
;
this
.
movementSpeed
=
1
;
this
.
rollSpeed
=
0.005
0
;
this
.
autoForward
=
this
.
dragToLook
=!
1
;
this
.
domElement
=
document
;
if
(
b
){
if
(
b
.
movementSpeed
!==
void
0
)
this
.
movementSpeed
=
b
.
movementSpeed
;
if
(
b
.
rollSpeed
!==
void
0
)
this
.
rollSpeed
=
b
.
rollSpeed
;
if
(
b
.
dragToLook
!==
void
0
)
this
.
dragToLook
=
b
.
dragToLook
;
if
(
b
.
autoForward
!==
void
0
)
this
.
autoForward
=
b
.
autoForward
;
if
(
b
.
domElement
!==
void
0
)
this
.
domElement
=
b
.
domElement
}
this
.
useTarget
=!
1
;
this
.
useQuaternion
=!
0
;
this
.
mouseStatus
=
0
;
this
.
moveState
=
{
up
:
0
,
down
:
0
,
left
:
0
,
right
:
0
,
forward
:
0
,
back
:
0
,
pitchUp
:
0
,
pitchDown
:
0
,
yawLeft
:
0
,
yawRight
:
0
,
rollLeft
:
0
,
rollRight
:
0
};
this
.
moveVector
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
rotationVector
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
lastUpdate
=-
1
;
this
.
tdiff
=
0
;
this
.
handleEvent
=
function
(
b
){
if
(
typeof
this
[
b
.
type
]
==
"
function
"
)
this
[
b
.
type
](
b
)};
this
.
keydown
=
function
(
b
){
if
(
!
b
.
altKey
){
switch
(
b
.
keyCode
){
case
16
:
this
.
movementSpeedMultiplier
=
0.1
;
break
;
case
87
:
this
.
moveState
.
forward
=
1
;
break
;
case
83
:
this
.
moveState
.
back
=
1
;
break
;
case
65
:
this
.
moveState
.
left
=
1
;
break
;
case
68
:
this
.
moveState
.
right
=
1
;
break
;
case
82
:
this
.
moveState
.
up
=
1
;
break
;
case
70
:
this
.
moveState
.
down
=
1
;
break
;
case
38
:
this
.
moveState
.
pitchUp
=
1
;
break
;
case
40
:
this
.
moveState
.
pitchDown
=
1
;
break
;
case
37
:
this
.
moveState
.
yawLeft
=
1
;
break
;
case
39
:
this
.
moveState
.
yawRight
=
1
;
break
;
case
81
:
this
.
moveState
.
rollLeft
=
1
;
break
;
case
69
:
this
.
moveState
.
rollRight
=
1
}
this
.
updateMovementVector
();
this
.
updateRotationVector
()}};
this
.
keyup
=
function
(
b
){
switch
(
b
.
keyCode
){
case
16
:
this
.
movementSpeedMultiplier
=
1
;
break
;
case
87
:
this
.
moveState
.
forward
=
0
;
break
;
case
83
:
this
.
moveState
.
back
=
0
;
break
;
case
65
:
this
.
moveState
.
left
=
0
;
break
;
case
68
:
this
.
moveState
.
right
=
0
;
break
;
case
82
:
this
.
moveState
.
up
=
0
;
break
;
case
70
:
this
.
moveState
.
down
=
0
;
break
;
case
38
:
this
.
moveState
.
pitchUp
=
0
;
break
;
case
40
:
this
.
moveState
.
pitchDown
=
0
;
break
;
case
37
:
this
.
moveState
.
yawLeft
=
0
;
break
;
case
39
:
this
.
moveState
.
yawRight
=
0
;
break
;
case
81
:
this
.
moveState
.
rollLeft
=
0
;
break
;
...
...
@@ -488,7 +488,7 @@ THREE.ExtrudeGeometry.__v2=new THREE.Vector2;THREE.ExtrudeGeometry.__v3=new THRE
THREE
.
IcosahedronGeometry
=
function
(
b
){
function
c
(
b
,
c
,
e
){
var
f
=
Math
.
sqrt
(
b
*
b
+
c
*
c
+
e
*
e
);
return
h
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
b
/
f
,
c
/
f
,
e
/
f
)))
-
1
}
function
e
(
b
,
c
,
e
,
f
){
f
.
faces
.
push
(
new
THREE
.
Face3
(
b
,
c
,
e
))}
function
f
(
b
,
e
){
var
f
=
h
.
vertices
[
b
].
position
,
j
=
h
.
vertices
[
e
].
position
;
return
c
((
f
.
x
+
j
.
x
)
/
2
,(
f
.
y
+
j
.
y
)
/
2
,(
f
.
z
+
j
.
z
)
/
2
)}
var
h
=
this
,
k
=
new
THREE
.
Geometry
;
this
.
subdivisions
=
b
||
0
;
THREE
.
Geometry
.
call
(
this
);
b
=
(
1
+
Math
.
sqrt
(
5
))
/
2
;
c
(
-
1
,
b
,
0
);
c
(
1
,
b
,
0
);
c
(
-
1
,
-
b
,
0
);
c
(
1
,
-
b
,
0
);
c
(
0
,
-
1
,
b
);
c
(
0
,
1
,
b
);
c
(
0
,
-
1
,
-
b
);
c
(
0
,
1
,
-
b
);
c
(
b
,
0
,
-
1
);
c
(
b
,
0
,
1
);
c
(
-
b
,
0
,
-
1
);
c
(
-
b
,
0
,
1
);
e
(
0
,
11
,
5
,
k
);
e
(
0
,
5
,
1
,
k
);
e
(
0
,
1
,
7
,
k
);
e
(
0
,
7
,
10
,
k
);
e
(
0
,
10
,
11
,
k
);
e
(
1
,
5
,
9
,
k
);
e
(
5
,
11
,
4
,
k
);
e
(
11
,
10
,
2
,
k
);
e
(
10
,
7
,
6
,
k
);
e
(
7
,
1
,
8
,
k
);
e
(
3
,
9
,
4
,
k
);
e
(
3
,
4
,
2
,
k
);
e
(
3
,
2
,
6
,
k
);
e
(
3
,
6
,
8
,
k
);
e
(
3
,
8
,
9
,
k
);
e
(
4
,
9
,
5
,
k
);
e
(
2
,
4
,
11
,
k
);
e
(
6
,
2
,
10
,
k
);
e
(
8
,
6
,
7
,
k
);
e
(
9
,
8
,
1
,
k
);
for
(
var
j
=
0
;
j
<
this
.
subdivisions
;
j
++
){
var
b
=
new
THREE
.
Geometry
,
m
;
for
(
m
in
k
.
faces
){
var
o
=
f
(
k
.
faces
[
m
].
a
,
k
.
faces
[
m
].
b
),
t
=
f
(
k
.
faces
[
m
].
b
,
k
.
faces
[
m
].
c
),
p
=
f
(
k
.
faces
[
m
].
c
,
k
.
faces
[
m
].
a
);
e
(
k
.
faces
[
m
].
a
,
o
,
p
,
b
);
e
(
k
.
faces
[
m
].
b
,
t
,
o
,
b
);
e
(
k
.
faces
[
m
].
c
,
p
,
t
,
b
);
e
(
o
,
t
,
p
,
b
)}
k
.
faces
=
b
.
faces
}
h
.
faces
=
k
.
faces
;
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
THREE
.
IcosahedronGeometry
.
prototype
=
new
THREE
.
Geometry
;
THREE
.
IcosahedronGeometry
.
prototype
.
constructor
=
THREE
.
IcosahedronGeometry
;
THREE
.
LatheGeometry
=
function
(
b
,
c
,
e
){
THREE
.
Geometry
.
call
(
this
);
this
.
steps
=
c
||
12
;
this
.
angle
=
e
||
2
*
Math
.
PI
;
for
(
var
c
=
this
.
angle
/
this
.
steps
,
e
=
[],
f
=
[],
h
=
[],
k
=
[],
j
=
(
new
THREE
.
Matrix4
).
setRotationZ
(
c
),
m
=
0
;
m
<
b
.
length
;
m
++
)
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
b
[
m
])),
e
[
m
]
=
b
[
m
].
clone
(),
f
[
m
]
=
this
.
vertices
.
length
-
1
;
for
(
var
o
=
0
;
o
<=
this
.
angle
+
0.001
;
o
+=
c
){
for
(
m
=
0
;
m
<
e
.
length
;
m
++
)
o
<
this
.
angle
?(
e
[
m
]
=
j
.
multiplyVector3
(
e
[
m
].
clone
()),
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
e
[
m
])),
h
[
m
]
=
this
.
vertices
.
length
-
1
):
h
=
k
;
o
==
0
&&
(
k
=
f
);
THREE
.
LatheGeometry
=
function
(
b
,
c
,
e
){
THREE
.
Geometry
.
call
(
this
);
this
.
steps
=
c
||
12
;
this
.
angle
=
e
||
2
*
Math
.
PI
;
for
(
var
c
=
this
.
angle
/
this
.
steps
,
e
=
[],
f
=
[],
h
=
[],
k
=
[],
j
=
(
new
THREE
.
Matrix4
).
setRotationZ
(
c
),
m
=
0
;
m
<
b
.
length
;
m
++
)
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
b
[
m
])),
e
[
m
]
=
b
[
m
].
clone
(),
f
[
m
]
=
this
.
vertices
.
length
-
1
;
for
(
var
o
=
0
;
o
<=
this
.
angle
+
0.001
0
;
o
+=
c
){
for
(
m
=
0
;
m
<
e
.
length
;
m
++
)
o
<
this
.
angle
?(
e
[
m
]
=
j
.
multiplyVector3
(
e
[
m
].
clone
()),
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
e
[
m
])),
h
[
m
]
=
this
.
vertices
.
length
-
1
):
h
=
k
;
o
==
0
&&
(
k
=
f
);
for
(
m
=
0
;
m
<
f
.
length
-
1
;
m
++
)
this
.
faces
.
push
(
new
THREE
.
Face4
(
h
[
m
],
h
[
m
+
1
],
f
[
m
+
1
],
f
[
m
])),
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
1
-
o
/
this
.
angle
,
m
/
b
.
length
),
new
THREE
.
UV
(
1
-
o
/
this
.
angle
,(
m
+
1
)
/
b
.
length
),
new
THREE
.
UV
(
1
-
(
o
-
c
)
/
this
.
angle
,(
m
+
1
)
/
b
.
length
),
new
THREE
.
UV
(
1
-
(
o
-
c
)
/
this
.
angle
,
m
/
b
.
length
)]);
f
=
h
;
h
=
[]}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
THREE
.
LatheGeometry
.
prototype
=
new
THREE
.
Geometry
;
THREE
.
LatheGeometry
.
prototype
.
constructor
=
THREE
.
LatheGeometry
;
THREE
.
PlaneGeometry
=
function
(
b
,
c
,
e
,
f
){
THREE
.
Geometry
.
call
(
this
);
var
h
,
k
=
b
/
2
,
j
=
c
/
2
,
e
=
e
||
1
,
f
=
f
||
1
,
m
=
e
+
1
,
o
=
f
+
1
;
b
/=
e
;
var
t
=
c
/
f
;
for
(
h
=
0
;
h
<
o
;
h
++
)
for
(
c
=
0
;
c
<
m
;
c
++
)
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
c
*
b
-
k
,
-
(
h
*
t
-
j
),
0
)));
for
(
h
=
0
;
h
<
f
;
h
++
)
for
(
c
=
0
;
c
<
e
;
c
++
)
this
.
faces
.
push
(
new
THREE
.
Face4
(
c
+
m
*
h
,
c
+
m
*
(
h
+
1
),
c
+
1
+
m
*
(
h
+
1
),
c
+
1
+
m
*
h
)),
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
c
/
e
,
h
/
f
),
new
THREE
.
UV
(
c
/
e
,(
h
+
1
)
/
f
),
new
THREE
.
UV
((
c
+
1
)
/
e
,(
h
+
1
)
/
f
),
new
THREE
.
UV
((
c
+
1
)
/
e
,
h
/
f
)]);
this
.
computeCentroids
();
this
.
computeFaceNormals
()};
THREE
.
PlaneGeometry
.
prototype
=
new
THREE
.
Geometry
;
THREE
.
PlaneGeometry
.
prototype
.
constructor
=
THREE
.
PlaneGeometry
;
...
...
build/custom/ThreeCanvas.js
浏览文件 @
2603ccf4
...
...
@@ -56,7 +56,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
this
.
x
=
a
.
x
*
d
;
this
.
y
=
a
.
y
*
d
;
this
.
z
=
a
.
z
*
d
;
this
.
w
=
Math
.
cos
(
c
);
return
this
},
setFromRotationMatrix
:
function
(
a
){
var
b
=
Math
.
pow
(
a
.
determinant
(),
1
/
3
);
this
.
w
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
+
a
.
n11
+
a
.
n22
+
a
.
n33
))
/
2
;
this
.
x
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
+
a
.
n11
-
a
.
n22
-
a
.
n33
))
/
2
;
this
.
y
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
-
a
.
n11
+
a
.
n22
-
a
.
n33
))
/
2
;
this
.
z
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
-
a
.
n11
-
a
.
n22
+
a
.
n33
))
/
2
;
this
.
x
=
a
.
n32
-
a
.
n23
<
0
?
-
Math
.
abs
(
this
.
x
):
Math
.
abs
(
this
.
x
);
this
.
y
=
a
.
n13
-
a
.
n31
<
0
?
-
Math
.
abs
(
this
.
y
):
Math
.
abs
(
this
.
y
);
this
.
z
=
a
.
n21
-
a
.
n12
<
0
?
-
Math
.
abs
(
this
.
z
):
Math
.
abs
(
this
.
z
);
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
);
a
==
0
?
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
,
g
=
a
.
x
,
f
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
g
+
c
*
h
-
d
*
f
;
this
.
y
=
c
*
a
+
e
*
f
+
d
*
g
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
f
-
c
*
g
;
this
.
w
=
e
*
a
-
b
*
g
-
c
*
f
-
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
,
g
=
this
.
x
,
f
=
this
.
y
,
h
=
this
.
z
,
j
=
this
.
w
,
l
=
j
*
c
+
f
*
e
-
h
*
d
,
o
=
j
*
d
+
h
*
c
-
g
*
e
,
i
=
j
*
e
+
g
*
d
-
f
*
c
,
c
=-
g
*
c
-
f
*
d
-
h
*
e
;
b
.
x
=
l
*
j
+
c
*-
g
+
o
*-
h
-
i
*-
f
;
b
.
y
=
o
*
j
+
c
*-
f
+
i
*-
g
-
l
*-
h
;
b
.
z
=
i
*
j
+
c
*-
h
+
l
*-
f
-
o
*-
g
;
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
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
)
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
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
c
-
f
*
d
-
h
*
e
;
b
.
x
=
l
*
j
+
c
*-
g
+
o
*-
h
-
i
*-
f
;
b
.
y
=
o
*
j
+
c
*-
f
+
i
*-
g
-
l
*-
h
;
b
.
z
=
i
*
j
+
c
*-
h
+
l
*-
f
-
o
*-
g
;
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
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
0
)
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
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
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
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
g
,
f
){
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
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
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/ThreeDOM.js
浏览文件 @
2603ccf4
...
...
@@ -56,7 +56,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
this
.
x
=
a
.
x
*
d
;
this
.
y
=
a
.
y
*
d
;
this
.
z
=
a
.
z
*
d
;
this
.
w
=
Math
.
cos
(
c
);
return
this
},
setFromRotationMatrix
:
function
(
a
){
var
b
=
Math
.
pow
(
a
.
determinant
(),
1
/
3
);
this
.
w
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
+
a
.
n11
+
a
.
n22
+
a
.
n33
))
/
2
;
this
.
x
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
+
a
.
n11
-
a
.
n22
-
a
.
n33
))
/
2
;
this
.
y
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
-
a
.
n11
+
a
.
n22
-
a
.
n33
))
/
2
;
this
.
z
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
-
a
.
n11
-
a
.
n22
+
a
.
n33
))
/
2
;
this
.
x
=
a
.
n32
-
a
.
n23
<
0
?
-
Math
.
abs
(
this
.
x
):
Math
.
abs
(
this
.
x
);
this
.
y
=
a
.
n13
-
a
.
n31
<
0
?
-
Math
.
abs
(
this
.
y
):
Math
.
abs
(
this
.
y
);
this
.
z
=
a
.
n21
-
a
.
n12
<
0
?
-
Math
.
abs
(
this
.
z
):
Math
.
abs
(
this
.
z
);
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
);
a
==
0
?
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
,
g
=
a
.
x
,
f
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
g
+
c
*
h
-
d
*
f
;
this
.
y
=
c
*
a
+
e
*
f
+
d
*
g
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
f
-
c
*
g
;
this
.
w
=
e
*
a
-
b
*
g
-
c
*
f
-
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
,
g
=
this
.
x
,
f
=
this
.
y
,
h
=
this
.
z
,
j
=
this
.
w
,
i
=
j
*
c
+
f
*
e
-
h
*
d
,
l
=
j
*
d
+
h
*
c
-
g
*
e
,
k
=
j
*
e
+
g
*
d
-
f
*
c
,
c
=-
g
*
c
-
f
*
d
-
h
*
e
;
b
.
x
=
i
*
j
+
c
*-
g
+
l
*-
h
-
k
*-
f
;
b
.
y
=
l
*
j
+
c
*-
f
+
k
*-
g
-
i
*-
h
;
b
.
z
=
k
*
j
+
c
*-
h
+
i
*-
f
-
l
*-
g
;
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
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
)
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
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
c
-
f
*
d
-
h
*
e
;
b
.
x
=
i
*
j
+
c
*-
g
+
l
*-
h
-
k
*-
f
;
b
.
y
=
l
*
j
+
c
*-
f
+
k
*-
g
-
i
*-
h
;
b
.
z
=
k
*
j
+
c
*-
h
+
i
*-
f
-
l
*-
g
;
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
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
0
)
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
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
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
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
g
,
f
){
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
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
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
)}};
THREE
.
Camera
=
function
(
a
,
b
,
c
,
d
,
e
){
THREE
.
Object3D
.
call
(
this
);
this
.
fov
=
a
||
50
;
this
.
aspect
=
b
||
1
;
this
.
near
=
c
||
0.1
;
this
.
far
=
d
||
2
E3
;
this
.
target
=
e
||
new
THREE
.
Object3D
;
this
.
useTarget
=!
0
;
this
.
matrixWorldInverse
=
new
THREE
.
Matrix4
;
this
.
projectionMatrix
=
null
;
this
.
updateProjectionMatrix
()};
THREE
.
Camera
.
prototype
=
new
THREE
.
Object3D
;
...
...
build/custom/ThreeExtras.js
浏览文件 @
2603ccf4
...
...
@@ -37,7 +37,7 @@ this.getPrevKeyWith("pos",p,g.index-1).pos,this.points[1]=f,this.points[2]=h,thi
THREE
.
Animation
.
prototype
.
interpolateCatmullRom
=
function
(
a
,
b
){
var
c
=
[],
e
=
[],
f
,
h
,
g
,
j
,
k
,
l
;
f
=
(
a
.
length
-
1
)
*
b
;
h
=
Math
.
floor
(
f
);
f
-=
h
;
c
[
0
]
=
h
==
0
?
h
:
h
-
1
;
c
[
1
]
=
h
;
c
[
2
]
=
h
>
a
.
length
-
2
?
h
:
h
+
1
;
c
[
3
]
=
h
>
a
.
length
-
3
?
h
:
h
+
2
;
h
=
a
[
c
[
0
]];
j
=
a
[
c
[
1
]];
k
=
a
[
c
[
2
]];
l
=
a
[
c
[
3
]];
c
=
f
*
f
;
g
=
f
*
c
;
e
[
0
]
=
this
.
interpolate
(
h
[
0
],
j
[
0
],
k
[
0
],
l
[
0
],
f
,
c
,
g
);
e
[
1
]
=
this
.
interpolate
(
h
[
1
],
j
[
1
],
k
[
1
],
l
[
1
],
f
,
c
,
g
);
e
[
2
]
=
this
.
interpolate
(
h
[
2
],
j
[
2
],
k
[
2
],
l
[
2
],
f
,
c
,
g
);
return
e
};
THREE
.
Animation
.
prototype
.
interpolate
=
function
(
a
,
b
,
c
,
e
,
f
,
h
,
g
){
a
=
(
c
-
a
)
*
0.5
;
e
=
(
e
-
b
)
*
0.5
;
return
(
2
*
(
b
-
c
)
+
a
+
e
)
*
g
+
(
-
3
*
(
b
-
c
)
-
2
*
a
-
e
)
*
h
+
a
*
f
+
b
};
THREE
.
Animation
.
prototype
.
getNextKeyWith
=
function
(
a
,
b
,
c
){
var
e
=
this
.
data
.
hierarchy
[
b
].
keys
;
for
(
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM
||
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
?
c
=
c
<
e
.
length
-
1
?
c
:
e
.
length
-
1
:
c
%=
e
.
length
;
c
<
e
.
length
;
c
++
)
if
(
e
[
c
][
a
]
!==
void
0
)
return
e
[
c
];
return
this
.
data
.
hierarchy
[
b
].
keys
[
0
]};
THREE
.
Animation
.
prototype
.
getPrevKeyWith
=
function
(
a
,
b
,
c
){
for
(
var
e
=
this
.
data
.
hierarchy
[
b
].
keys
,
c
=
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM
||
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
?
c
>
0
?
c
:
0
:
c
>=
0
?
c
:
c
+
e
.
length
;
c
>=
0
;
c
--
)
if
(
e
[
c
][
a
]
!==
void
0
)
return
e
[
c
];
return
this
.
data
.
hierarchy
[
b
].
keys
[
e
.
length
-
1
]};
THREE
.
FirstPersonCamera
=
function
(
a
){
function
b
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.005
;
this
.
noFly
=!
1
;
this
.
lookVertical
=!
0
;
this
.
autoForward
=!
1
;
this
.
activeLook
=!
0
;
this
.
heightSpeed
=!
1
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
constrainVertical
=!
1
;
this
.
verticalMin
=
0
;
this
.
verticalMax
=
3.14
;
this
.
domElement
=
document
;
this
.
lastUpdate
=
(
new
Date
).
getTime
();
this
.
tdiff
=
0
;
if
(
a
){
if
(
a
.
movementSpeed
!==
void
0
)
this
.
movementSpeed
=
THREE
.
FirstPersonCamera
=
function
(
a
){
function
b
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.005
0
;
this
.
noFly
=!
1
;
this
.
lookVertical
=!
0
;
this
.
autoForward
=!
1
;
this
.
activeLook
=!
0
;
this
.
heightSpeed
=!
1
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
constrainVertical
=!
1
;
this
.
verticalMin
=
0
;
this
.
verticalMax
=
3.14
;
this
.
domElement
=
document
;
this
.
lastUpdate
=
(
new
Date
).
getTime
();
this
.
tdiff
=
0
;
if
(
a
){
if
(
a
.
movementSpeed
!==
void
0
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
lookSpeed
!==
void
0
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
noFly
!==
void
0
)
this
.
noFly
=
a
.
noFly
;
if
(
a
.
lookVertical
!==
void
0
)
this
.
lookVertical
=
a
.
lookVertical
;
if
(
a
.
autoForward
!==
void
0
)
this
.
autoForward
=
a
.
autoForward
;
if
(
a
.
activeLook
!==
void
0
)
this
.
activeLook
=
a
.
activeLook
;
if
(
a
.
heightSpeed
!==
void
0
)
this
.
heightSpeed
=
a
.
heightSpeed
;
if
(
a
.
heightCoef
!==
void
0
)
this
.
heightCoef
=
a
.
heightCoef
;
if
(
a
.
heightMin
!==
void
0
)
this
.
heightMin
=
a
.
heightMin
;
if
(
a
.
heightMax
!==
void
0
)
this
.
heightMax
=
a
.
heightMax
;
if
(
a
.
constrainVertical
!==
void
0
)
this
.
constrainVertical
=
a
.
constrainVertical
;
if
(
a
.
verticalMin
!==
void
0
)
this
.
verticalMin
=
a
.
verticalMin
;
if
(
a
.
verticalMax
!==
void
0
)
this
.
verticalMax
=
a
.
verticalMax
;
if
(
a
.
domElement
!==
void
0
)
this
.
domElement
=
a
.
domElement
}
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
this
.
autoSpeedFactor
=
0
;
this
.
mouseDragOn
=
this
.
freeze
=
this
.
moveRight
=
this
.
moveLeft
=
this
.
moveBackward
=
this
.
moveForward
=!
1
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
this
.
onMouseDown
=
function
(
a
){
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
a
.
button
){
case
0
:
this
.
moveForward
=!
0
;
break
;
case
2
:
this
.
moveBackward
=!
0
}
this
.
mouseDragOn
=!
0
};
this
.
onMouseUp
=
function
(
a
){
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
a
.
button
){
case
0
:
this
.
moveForward
=!
1
;
break
;
case
2
:
this
.
moveBackward
=!
1
}
this
.
mouseDragOn
=!
1
};
this
.
onMouseMove
=
function
(
a
){
this
.
mouseX
=
a
.
clientX
-
this
.
windowHalfX
;
this
.
mouseY
=
a
.
clientY
-
this
.
windowHalfY
};
this
.
onKeyDown
=
function
(
a
){
switch
(
a
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=
...
...
@@ -49,7 +49,7 @@ Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListen
THREE
.
FirstPersonCamera
.
prototype
=
new
THREE
.
Camera
;
THREE
.
FirstPersonCamera
.
prototype
.
constructor
=
THREE
.
FirstPersonCamera
;
THREE
.
FirstPersonCamera
.
prototype
.
supr
=
THREE
.
Camera
.
prototype
;
THREE
.
FirstPersonCamera
.
prototype
.
translate
=
function
(
a
,
b
){
this
.
matrix
.
rotateAxis
(
b
);
if
(
this
.
noFly
)
b
.
y
=
0
;
this
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
));
this
.
target
.
position
.
addSelf
(
b
.
multiplyScalar
(
a
))};
THREE
.
PathCamera
=
function
(
a
){
function
b
(
a
,
c
,
b
,
e
){
var
g
=
{
name
:
b
,
fps
:
0.6
,
length
:
e
,
hierarchy
:[]},
h
,
f
=
c
.
getControlPointsArray
(),
j
=
c
.
getLength
(),
k
=
f
.
length
,
x
=
0
;
h
=
k
-
1
;
c
=
{
parent
:
-
1
,
keys
:[]};
c
.
keys
[
0
]
=
{
time
:
0
,
pos
:
f
[
0
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
c
.
keys
[
h
]
=
{
time
:
e
,
pos
:
f
[
h
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
for
(
h
=
1
;
h
<
k
-
1
;
h
++
)
x
=
e
*
j
.
chunks
[
h
]
/
j
.
total
,
c
.
keys
[
h
]
=
{
time
:
x
,
pos
:
f
[
h
]};
g
.
hierarchy
[
0
]
=
c
;
THREE
.
AnimationHandler
.
add
(
g
);
return
new
THREE
.
Animation
(
a
,
b
,
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
,
!
1
)}
function
c
(
a
,
c
){
var
b
,
e
,
g
=
new
THREE
.
Geometry
;
for
(
b
=
0
;
b
<
a
.
points
.
length
*
c
;
b
++
)
e
=
b
/
(
a
.
points
.
length
*
c
),
e
=
a
.
getPoint
(
e
),
g
.
vertices
[
b
]
=
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
e
.
x
,
e
.
y
,
e
.
z
));
return
g
}
function
e
(
a
,
b
){
var
e
=
c
(
b
,
10
),
g
=
c
(
b
,
10
),
h
=
new
THREE
.
LineBasicMaterial
({
color
:
16711680
,
linewidth
:
3
});
lineObj
=
new
THREE
.
Line
(
e
,
h
);
particleObj
=
new
THREE
.
ParticleSystem
(
g
,
new
THREE
.
ParticleBasicMaterial
({
color
:
16755200
,
size
:
3
}));
lineObj
.
scale
.
set
(
1
,
1
,
1
);
a
.
addChild
(
lineObj
);
particleObj
.
scale
.
set
(
1
,
1
,
1
);
a
.
addChild
(
particleObj
);
g
=
new
THREE
.
SphereGeometry
(
1
,
16
,
8
);
h
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
});
for
(
i
=
0
;
i
<
b
.
points
.
length
;
i
++
)
e
=
new
THREE
.
Mesh
(
g
,
h
),
e
.
position
.
copy
(
b
.
points
[
i
]),
e
.
updateMatrix
(),
a
.
addChild
(
e
)}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
id
=
"
PathCamera
"
+
THREE
.
PathCameraIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=!
0
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.005
;
this
.
lookHorizontal
=
16
,
8
);
h
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
});
for
(
i
=
0
;
i
<
b
.
points
.
length
;
i
++
)
e
=
new
THREE
.
Mesh
(
g
,
h
),
e
.
position
.
copy
(
b
.
points
[
i
]),
e
.
updateMatrix
(),
a
.
addChild
(
e
)}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
id
=
"
PathCamera
"
+
THREE
.
PathCameraIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=!
0
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.005
0
;
this
.
lookHorizontal
=
this
.
lookVertical
=!
0
;
this
.
verticalAngleMap
=
{
srcRange
:[
0
,
6.28
],
dstRange
:[
0
,
6.28
]};
this
.
horizontalAngleMap
=
{
srcRange
:[
0
,
6.28
],
dstRange
:[
0
,
6.28
]};
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
duration
!==
void
0
)
this
.
duration
=
a
.
duration
*
1
E3
;
if
(
a
.
waypoints
!==
void
0
)
this
.
waypoints
=
a
.
waypoints
;
if
(
a
.
useConstantSpeed
!==
void
0
)
this
.
useConstantSpeed
=
a
.
useConstantSpeed
;
if
(
a
.
resamplingCoef
!==
void
0
)
this
.
resamplingCoef
=
a
.
resamplingCoef
;
if
(
a
.
createDebugPath
!==
void
0
)
this
.
createDebugPath
=
a
.
createDebugPath
;
if
(
a
.
createDebugDummy
!==
void
0
)
this
.
createDebugDummy
=
a
.
createDebugDummy
;
if
(
a
.
lookSpeed
!==
void
0
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
lookVertical
!==
void
0
)
this
.
lookVertical
=
a
.
lookVertical
;
if
(
a
.
lookHorizontal
!==
void
0
)
this
.
lookHorizontal
=
a
.
lookHorizontal
;
if
(
a
.
verticalAngleMap
!==
void
0
)
this
.
verticalAngleMap
=
a
.
verticalAngleMap
;
if
(
a
.
horizontalAngleMap
!==
void
0
)
this
.
horizontalAngleMap
=
a
.
horizontalAngleMap
;
if
(
a
.
domElement
!==
void
0
)
this
.
domElement
=
a
.
domElement
}
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
0
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
var
f
=
Math
.
PI
*
2
,
h
=
Math
.
PI
/
180
;
this
.
update
=
function
(
a
,
c
,
b
){
var
e
,
g
;
this
.
lookHorizontal
&&
(
this
.
lon
+=
this
.
mouseX
*
this
.
lookSpeed
);
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
this
.
lookSpeed
);
this
.
lon
=
Math
.
max
(
0
,
Math
.
min
(
360
,
this
.
lon
));
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
h
;
this
.
theta
=
this
.
lon
*
h
;
e
=
this
.
phi
%
f
;
this
.
phi
=
e
>=
0
?
e
:
e
+
f
;
e
=
this
.
verticalAngleMap
.
srcRange
;
g
=
this
.
verticalAngleMap
.
dstRange
;
var
j
=
g
[
1
]
-
g
[
0
];
this
.
phi
=
...
...
@@ -57,7 +57,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-e[0])*(g[1]-g[0])/(e[1]-e[0])+g[0]-g
a
.
clientX
-
this
.
windowHalfX
;
this
.
mouseY
=
a
.
clientY
-
this
.
windowHalfY
};
this
.
spline
=
new
THREE
.
Spline
;
this
.
spline
.
initFromArray
(
this
.
waypoints
);
this
.
useConstantSpeed
&&
this
.
spline
.
reparametrizeByArcLength
(
this
.
resamplingCoef
);
if
(
this
.
createDebugDummy
){
var
a
=
new
THREE
.
MeshLambertMaterial
({
color
:
30719
}),
g
=
new
THREE
.
MeshLambertMaterial
({
color
:
65280
}),
j
=
new
THREE
.
CubeGeometry
(
10
,
10
,
20
),
k
=
new
THREE
.
CubeGeometry
(
2
,
2
,
10
);
this
.
animationParent
=
new
THREE
.
Mesh
(
j
,
a
);
a
=
new
THREE
.
Mesh
(
k
,
g
);
a
.
position
.
set
(
0
,
10
,
0
);
this
.
animation
=
b
(
this
.
animationParent
,
this
.
spline
,
this
.
id
,
this
.
duration
);
this
.
animationParent
.
addChild
(
this
);
this
.
animationParent
.
addChild
(
this
.
target
);
this
.
animationParent
.
addChild
(
a
)}
else
this
.
animation
=
b
(
this
.
animationParent
,
this
.
spline
,
this
.
id
,
this
.
duration
),
this
.
animationParent
.
addChild
(
this
.
target
),
this
.
animationParent
.
addChild
(
this
);
this
.
createDebugPath
&&
e
(
this
.
debugPath
,
this
.
spline
);
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
function
(
a
,
c
){
return
function
(){
c
.
apply
(
a
,
arguments
)}}(
this
,
this
.
onMouseMove
),
!
1
)};
THREE
.
PathCamera
.
prototype
=
new
THREE
.
Camera
;
THREE
.
PathCamera
.
prototype
.
constructor
=
THREE
.
PathCamera
;
THREE
.
PathCamera
.
prototype
.
supr
=
THREE
.
Camera
.
prototype
;
THREE
.
PathCameraIdCounter
=
0
;
THREE
.
FlyCamera
=
function
(
a
){
function
b
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
tmpQuaternion
=
new
THREE
.
Quaternion
;
this
.
movementSpeed
=
1
;
this
.
rollSpeed
=
0.005
;
this
.
autoForward
=
this
.
dragToLook
=!
1
;
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
movementSpeed
!==
void
0
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
rollSpeed
!==
void
0
)
this
.
rollSpeed
=
a
.
rollSpeed
;
if
(
a
.
dragToLook
!==
void
0
)
this
.
dragToLook
=
a
.
dragToLook
;
if
(
a
.
autoForward
!==
void
0
)
this
.
autoForward
=
THREE
.
FlyCamera
=
function
(
a
){
function
b
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
tmpQuaternion
=
new
THREE
.
Quaternion
;
this
.
movementSpeed
=
1
;
this
.
rollSpeed
=
0.005
0
;
this
.
autoForward
=
this
.
dragToLook
=!
1
;
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
movementSpeed
!==
void
0
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
rollSpeed
!==
void
0
)
this
.
rollSpeed
=
a
.
rollSpeed
;
if
(
a
.
dragToLook
!==
void
0
)
this
.
dragToLook
=
a
.
dragToLook
;
if
(
a
.
autoForward
!==
void
0
)
this
.
autoForward
=
a
.
autoForward
;
if
(
a
.
domElement
!==
void
0
)
this
.
domElement
=
a
.
domElement
}
this
.
useTarget
=!
1
;
this
.
useQuaternion
=!
0
;
this
.
mouseStatus
=
0
;
this
.
moveState
=
{
up
:
0
,
down
:
0
,
left
:
0
,
right
:
0
,
forward
:
0
,
back
:
0
,
pitchUp
:
0
,
pitchDown
:
0
,
yawLeft
:
0
,
yawRight
:
0
,
rollLeft
:
0
,
rollRight
:
0
};
this
.
moveVector
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
rotationVector
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
lastUpdate
=-
1
;
this
.
tdiff
=
0
;
this
.
handleEvent
=
function
(
a
){
if
(
typeof
this
[
a
.
type
]
==
"
function
"
)
this
[
a
.
type
](
a
)};
this
.
keydown
=
function
(
a
){
if
(
!
a
.
altKey
){
switch
(
a
.
keyCode
){
case
16
:
this
.
movementSpeedMultiplier
=
0.1
;
break
;
case
87
:
this
.
moveState
.
forward
=
1
;
break
;
case
83
:
this
.
moveState
.
back
=
1
;
break
;
case
65
:
this
.
moveState
.
left
=
1
;
break
;
case
68
:
this
.
moveState
.
right
=
1
;
break
;
case
82
:
this
.
moveState
.
up
=
1
;
break
;
case
70
:
this
.
moveState
.
down
=
1
;
break
;
case
38
:
this
.
moveState
.
pitchUp
=
1
;
break
;
case
40
:
this
.
moveState
.
pitchDown
=
1
;
break
;
case
37
:
this
.
moveState
.
yawLeft
=
1
;
break
;
case
39
:
this
.
moveState
.
yawRight
=
1
;
break
;
case
81
:
this
.
moveState
.
rollLeft
=
1
;
break
;
case
69
:
this
.
moveState
.
rollRight
=
1
}
this
.
updateMovementVector
();
this
.
updateRotationVector
()}};
this
.
keyup
=
function
(
a
){
switch
(
a
.
keyCode
){
case
16
:
this
.
movementSpeedMultiplier
=
1
;
break
;
case
87
:
this
.
moveState
.
forward
=
0
;
break
;
case
83
:
this
.
moveState
.
back
=
0
;
break
;
case
65
:
this
.
moveState
.
left
=
0
;
break
;
case
68
:
this
.
moveState
.
right
=
0
;
break
;
case
82
:
this
.
moveState
.
up
=
0
;
break
;
case
70
:
this
.
moveState
.
down
=
0
;
break
;
case
38
:
this
.
moveState
.
pitchUp
=
0
;
break
;
case
40
:
this
.
moveState
.
pitchDown
=
0
;
break
;
case
37
:
this
.
moveState
.
yawLeft
=
0
;
break
;
case
39
:
this
.
moveState
.
yawRight
=
0
;
break
;
case
81
:
this
.
moveState
.
rollLeft
=
0
;
break
;
...
...
@@ -149,7 +149,7 @@ THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THRE
THREE
.
IcosahedronGeometry
=
function
(
a
){
function
b
(
a
,
b
,
c
){
var
e
=
Math
.
sqrt
(
a
*
a
+
b
*
b
+
c
*
c
);
return
f
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
a
/
e
,
b
/
e
,
c
/
e
)))
-
1
}
function
c
(
a
,
b
,
c
,
e
){
e
.
faces
.
push
(
new
THREE
.
Face3
(
a
,
b
,
c
))}
function
e
(
a
,
c
){
var
e
=
f
.
vertices
[
a
].
position
,
g
=
f
.
vertices
[
c
].
position
;
return
b
((
e
.
x
+
g
.
x
)
/
2
,(
e
.
y
+
g
.
y
)
/
2
,(
e
.
z
+
g
.
z
)
/
2
)}
var
f
=
this
,
h
=
new
THREE
.
Geometry
;
this
.
subdivisions
=
a
||
0
;
THREE
.
Geometry
.
call
(
this
);
a
=
(
1
+
Math
.
sqrt
(
5
))
/
2
;
b
(
-
1
,
a
,
0
);
b
(
1
,
a
,
0
);
b
(
-
1
,
-
a
,
0
);
b
(
1
,
-
a
,
0
);
b
(
0
,
-
1
,
a
);
b
(
0
,
1
,
a
);
b
(
0
,
-
1
,
-
a
);
b
(
0
,
1
,
-
a
);
b
(
a
,
0
,
-
1
);
b
(
a
,
0
,
1
);
b
(
-
a
,
0
,
-
1
);
b
(
-
a
,
0
,
1
);
c
(
0
,
11
,
5
,
h
);
c
(
0
,
5
,
1
,
h
);
c
(
0
,
1
,
7
,
h
);
c
(
0
,
7
,
10
,
h
);
c
(
0
,
10
,
11
,
h
);
c
(
1
,
5
,
9
,
h
);
c
(
5
,
11
,
4
,
h
);
c
(
11
,
10
,
2
,
h
);
c
(
10
,
7
,
6
,
h
);
c
(
7
,
1
,
8
,
h
);
c
(
3
,
9
,
4
,
h
);
c
(
3
,
4
,
2
,
h
);
c
(
3
,
2
,
6
,
h
);
c
(
3
,
6
,
8
,
h
);
c
(
3
,
8
,
9
,
h
);
c
(
4
,
9
,
5
,
h
);
c
(
2
,
4
,
11
,
h
);
c
(
6
,
2
,
10
,
h
);
c
(
8
,
6
,
7
,
h
);
c
(
9
,
8
,
1
,
h
);
for
(
var
g
=
0
;
g
<
this
.
subdivisions
;
g
++
){
var
a
=
new
THREE
.
Geometry
,
j
;
for
(
j
in
h
.
faces
){
var
k
=
e
(
h
.
faces
[
j
].
a
,
h
.
faces
[
j
].
b
),
l
=
e
(
h
.
faces
[
j
].
b
,
h
.
faces
[
j
].
c
),
m
=
e
(
h
.
faces
[
j
].
c
,
h
.
faces
[
j
].
a
);
c
(
h
.
faces
[
j
].
a
,
k
,
m
,
a
);
c
(
h
.
faces
[
j
].
b
,
l
,
k
,
a
);
c
(
h
.
faces
[
j
].
c
,
m
,
l
,
a
);
c
(
k
,
l
,
m
,
a
)}
h
.
faces
=
a
.
faces
}
f
.
faces
=
h
.
faces
;
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
THREE
.
IcosahedronGeometry
.
prototype
=
new
THREE
.
Geometry
;
THREE
.
IcosahedronGeometry
.
prototype
.
constructor
=
THREE
.
IcosahedronGeometry
;
THREE
.
LatheGeometry
=
function
(
a
,
b
,
c
){
THREE
.
Geometry
.
call
(
this
);
this
.
steps
=
b
||
12
;
this
.
angle
=
c
||
2
*
Math
.
PI
;
for
(
var
b
=
this
.
angle
/
this
.
steps
,
c
=
[],
e
=
[],
f
=
[],
h
=
[],
g
=
(
new
THREE
.
Matrix4
).
setRotationZ
(
b
),
j
=
0
;
j
<
a
.
length
;
j
++
)
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
a
[
j
])),
c
[
j
]
=
a
[
j
].
clone
(),
e
[
j
]
=
this
.
vertices
.
length
-
1
;
for
(
var
k
=
0
;
k
<=
this
.
angle
+
0.001
;
k
+=
b
){
for
(
j
=
0
;
j
<
c
.
length
;
j
++
)
k
<
this
.
angle
?(
c
[
j
]
=
g
.
multiplyVector3
(
c
[
j
].
clone
()),
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
c
[
j
])),
f
[
j
]
=
this
.
vertices
.
length
-
1
):
f
=
h
;
k
==
0
&&
(
h
=
e
);
THREE
.
LatheGeometry
=
function
(
a
,
b
,
c
){
THREE
.
Geometry
.
call
(
this
);
this
.
steps
=
b
||
12
;
this
.
angle
=
c
||
2
*
Math
.
PI
;
for
(
var
b
=
this
.
angle
/
this
.
steps
,
c
=
[],
e
=
[],
f
=
[],
h
=
[],
g
=
(
new
THREE
.
Matrix4
).
setRotationZ
(
b
),
j
=
0
;
j
<
a
.
length
;
j
++
)
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
a
[
j
])),
c
[
j
]
=
a
[
j
].
clone
(),
e
[
j
]
=
this
.
vertices
.
length
-
1
;
for
(
var
k
=
0
;
k
<=
this
.
angle
+
0.001
0
;
k
+=
b
){
for
(
j
=
0
;
j
<
c
.
length
;
j
++
)
k
<
this
.
angle
?(
c
[
j
]
=
g
.
multiplyVector3
(
c
[
j
].
clone
()),
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
c
[
j
])),
f
[
j
]
=
this
.
vertices
.
length
-
1
):
f
=
h
;
k
==
0
&&
(
h
=
e
);
for
(
j
=
0
;
j
<
e
.
length
-
1
;
j
++
)
this
.
faces
.
push
(
new
THREE
.
Face4
(
f
[
j
],
f
[
j
+
1
],
e
[
j
+
1
],
e
[
j
])),
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
1
-
k
/
this
.
angle
,
j
/
a
.
length
),
new
THREE
.
UV
(
1
-
k
/
this
.
angle
,(
j
+
1
)
/
a
.
length
),
new
THREE
.
UV
(
1
-
(
k
-
b
)
/
this
.
angle
,(
j
+
1
)
/
a
.
length
),
new
THREE
.
UV
(
1
-
(
k
-
b
)
/
this
.
angle
,
j
/
a
.
length
)]);
e
=
f
;
f
=
[]}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
THREE
.
LatheGeometry
.
prototype
=
new
THREE
.
Geometry
;
THREE
.
LatheGeometry
.
prototype
.
constructor
=
THREE
.
LatheGeometry
;
THREE
.
PlaneGeometry
=
function
(
a
,
b
,
c
,
e
){
THREE
.
Geometry
.
call
(
this
);
var
f
,
h
=
a
/
2
,
g
=
b
/
2
,
c
=
c
||
1
,
e
=
e
||
1
,
j
=
c
+
1
,
k
=
e
+
1
;
a
/=
c
;
var
l
=
b
/
e
;
for
(
f
=
0
;
f
<
k
;
f
++
)
for
(
b
=
0
;
b
<
j
;
b
++
)
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
b
*
a
-
h
,
-
(
f
*
l
-
g
),
0
)));
for
(
f
=
0
;
f
<
e
;
f
++
)
for
(
b
=
0
;
b
<
c
;
b
++
)
this
.
faces
.
push
(
new
THREE
.
Face4
(
b
+
j
*
f
,
b
+
j
*
(
f
+
1
),
b
+
1
+
j
*
(
f
+
1
),
b
+
1
+
j
*
f
)),
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
b
/
c
,
f
/
e
),
new
THREE
.
UV
(
b
/
c
,(
f
+
1
)
/
e
),
new
THREE
.
UV
((
b
+
1
)
/
c
,(
f
+
1
)
/
e
),
new
THREE
.
UV
((
b
+
1
)
/
c
,
f
/
e
)]);
this
.
computeCentroids
();
this
.
computeFaceNormals
()};
THREE
.
PlaneGeometry
.
prototype
=
new
THREE
.
Geometry
;
THREE
.
PlaneGeometry
.
prototype
.
constructor
=
THREE
.
PlaneGeometry
;
...
...
build/custom/ThreeSVG.js
浏览文件 @
2603ccf4
...
...
@@ -56,7 +56,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){t
this
.
x
=
a
.
x
*
d
;
this
.
y
=
a
.
y
*
d
;
this
.
z
=
a
.
z
*
d
;
this
.
w
=
Math
.
cos
(
c
);
return
this
},
setFromRotationMatrix
:
function
(
a
){
var
b
=
Math
.
pow
(
a
.
determinant
(),
1
/
3
);
this
.
w
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
+
a
.
n11
+
a
.
n22
+
a
.
n33
))
/
2
;
this
.
x
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
+
a
.
n11
-
a
.
n22
-
a
.
n33
))
/
2
;
this
.
y
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
-
a
.
n11
+
a
.
n22
-
a
.
n33
))
/
2
;
this
.
z
=
Math
.
sqrt
(
Math
.
max
(
0
,
b
-
a
.
n11
-
a
.
n22
+
a
.
n33
))
/
2
;
this
.
x
=
a
.
n32
-
a
.
n23
<
0
?
-
Math
.
abs
(
this
.
x
):
Math
.
abs
(
this
.
x
);
this
.
y
=
a
.
n13
-
a
.
n31
<
0
?
-
Math
.
abs
(
this
.
y
):
Math
.
abs
(
this
.
y
);
this
.
z
=
a
.
n21
-
a
.
n12
<
0
?
-
Math
.
abs
(
this
.
z
):
Math
.
abs
(
this
.
z
);
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
);
a
==
0
?
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
,
g
=
a
.
x
,
f
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
g
+
c
*
h
-
d
*
f
;
this
.
y
=
c
*
a
+
e
*
f
+
d
*
g
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
f
-
c
*
g
;
this
.
w
=
e
*
a
-
b
*
g
-
c
*
f
-
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
,
g
=
this
.
x
,
f
=
this
.
y
,
h
=
this
.
z
,
k
=
this
.
w
,
i
=
k
*
c
+
f
*
e
-
h
*
d
,
l
=
k
*
d
+
h
*
c
-
g
*
e
,
j
=
k
*
e
+
g
*
d
-
f
*
c
,
c
=-
g
*
c
-
f
*
d
-
h
*
e
;
b
.
x
=
i
*
k
+
c
*-
g
+
l
*-
h
-
j
*-
f
;
b
.
y
=
l
*
k
+
c
*-
f
+
j
*-
g
-
i
*-
h
;
b
.
z
=
j
*
k
+
c
*-
h
+
i
*-
f
-
l
*-
g
;
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
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
)
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
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
c
-
f
*
d
-
h
*
e
;
b
.
x
=
i
*
k
+
c
*-
g
+
l
*-
h
-
j
*-
f
;
b
.
y
=
l
*
k
+
c
*-
f
+
j
*-
g
-
i
*-
h
;
b
.
z
=
j
*
k
+
c
*-
h
+
i
*-
f
-
l
*-
g
;
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
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
0
)
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
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
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
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
g
,
f
){
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
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
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/ThreeWebGL.js
浏览文件 @
2603ccf4
...
...
@@ -56,7 +56,7 @@ THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,e){t
this
.
x
=
b
.
x
*
e
;
this
.
y
=
b
.
y
*
e
;
this
.
z
=
b
.
z
*
e
;
this
.
w
=
Math
.
cos
(
d
);
return
this
},
setFromRotationMatrix
:
function
(
b
){
var
c
=
Math
.
pow
(
b
.
determinant
(),
1
/
3
);
this
.
w
=
Math
.
sqrt
(
Math
.
max
(
0
,
c
+
b
.
n11
+
b
.
n22
+
b
.
n33
))
/
2
;
this
.
x
=
Math
.
sqrt
(
Math
.
max
(
0
,
c
+
b
.
n11
-
b
.
n22
-
b
.
n33
))
/
2
;
this
.
y
=
Math
.
sqrt
(
Math
.
max
(
0
,
c
-
b
.
n11
+
b
.
n22
-
b
.
n33
))
/
2
;
this
.
z
=
Math
.
sqrt
(
Math
.
max
(
0
,
c
-
b
.
n11
-
b
.
n22
+
b
.
n33
))
/
2
;
this
.
x
=
b
.
n32
-
b
.
n23
<
0
?
-
Math
.
abs
(
this
.
x
):
Math
.
abs
(
this
.
x
);
this
.
y
=
b
.
n13
-
b
.
n31
<
0
?
-
Math
.
abs
(
this
.
y
):
Math
.
abs
(
this
.
y
);
this
.
z
=
b
.
n21
-
b
.
n12
<
0
?
-
Math
.
abs
(
this
.
z
):
Math
.
abs
(
this
.
z
);
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
b
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
b
==
0
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
b
=
1
/
b
,
this
.
x
*=
b
,
this
.
y
*=
b
,
this
.
z
*=
b
,
this
.
w
*=
b
);
return
this
},
multiplySelf
:
function
(
b
){
var
c
=
this
.
x
,
d
=
this
.
y
,
e
=
this
.
z
,
j
=
this
.
w
,
h
=
b
.
x
,
k
=
b
.
y
,
m
=
b
.
z
,
b
=
b
.
w
;
this
.
x
=
c
*
b
+
j
*
h
+
d
*
m
-
e
*
k
;
this
.
y
=
d
*
b
+
j
*
k
+
e
*
h
-
c
*
m
;
this
.
z
=
e
*
b
+
j
*
m
+
c
*
k
-
d
*
h
;
this
.
w
=
j
*
b
-
c
*
h
-
d
*
k
-
e
*
m
;
return
this
},
multiply
:
function
(
b
,
c
){
this
.
x
=
b
.
x
*
c
.
w
+
b
.
y
*
c
.
z
-
b
.
z
*
c
.
y
+
b
.
w
*
c
.
x
;
this
.
y
=-
b
.
x
*
c
.
z
+
b
.
y
*
c
.
w
+
b
.
z
*
c
.
x
+
b
.
w
*
c
.
y
;
this
.
z
=
b
.
x
*
c
.
y
-
b
.
y
*
c
.
x
+
b
.
z
*
c
.
w
+
b
.
w
*
c
.
z
;
this
.
w
=-
b
.
x
*
c
.
x
-
b
.
y
*
c
.
y
-
b
.
z
*
c
.
z
+
b
.
w
*
c
.
w
;
return
this
},
multiplyVector3
:
function
(
b
,
c
){
c
||
(
c
=
b
);
var
d
=
b
.
x
,
e
=
b
.
y
,
j
=
b
.
z
,
h
=
this
.
x
,
k
=
this
.
y
,
m
=
this
.
z
,
r
=
this
.
w
,
p
=
r
*
d
+
k
*
j
-
m
*
e
,
n
=
r
*
e
+
m
*
d
-
h
*
j
,
s
=
r
*
j
+
h
*
e
-
k
*
d
,
d
=-
h
*
d
-
k
*
e
-
m
*
j
;
c
.
x
=
p
*
r
+
d
*-
h
+
n
*-
m
-
s
*-
k
;
c
.
y
=
n
*
r
+
d
*-
k
+
s
*-
h
-
p
*-
m
;
c
.
z
=
s
*
r
+
d
*-
m
+
p
*-
k
-
n
*-
h
;
return
c
}};
THREE
.
Quaternion
.
slerp
=
function
(
b
,
c
,
d
,
e
){
var
j
=
b
.
w
*
c
.
w
+
b
.
x
*
c
.
x
+
b
.
y
*
c
.
y
+
b
.
z
*
c
.
z
;
if
(
Math
.
abs
(
j
)
>=
1
)
return
d
.
w
=
b
.
w
,
d
.
x
=
b
.
x
,
d
.
y
=
b
.
y
,
d
.
z
=
b
.
z
,
d
;
var
h
=
Math
.
acos
(
j
),
k
=
Math
.
sqrt
(
1
-
j
*
j
);
if
(
Math
.
abs
(
k
)
<
0.001
)
return
d
.
w
=
0.5
*
(
b
.
w
+
c
.
w
),
d
.
x
=
0.5
*
(
b
.
x
+
c
.
x
),
d
.
y
=
0.5
*
(
b
.
y
+
c
.
y
),
d
.
z
=
0.5
*
(
b
.
z
+
c
.
z
),
d
;
j
=
Math
.
sin
((
1
-
e
)
*
h
)
/
k
;
e
=
Math
.
sin
(
e
*
h
)
/
k
;
d
.
w
=
b
.
w
*
j
+
c
.
w
*
e
;
d
.
x
=
b
.
x
*
j
+
c
.
x
*
e
;
d
.
y
=
b
.
y
*
j
+
c
.
y
*
e
;
d
.
z
=
b
.
z
*
j
+
c
.
z
*
e
;
return
d
};
d
-
k
*
e
-
m
*
j
;
c
.
x
=
p
*
r
+
d
*-
h
+
n
*-
m
-
s
*-
k
;
c
.
y
=
n
*
r
+
d
*-
k
+
s
*-
h
-
p
*-
m
;
c
.
z
=
s
*
r
+
d
*-
m
+
p
*-
k
-
n
*-
h
;
return
c
}};
THREE
.
Quaternion
.
slerp
=
function
(
b
,
c
,
d
,
e
){
var
j
=
b
.
w
*
c
.
w
+
b
.
x
*
c
.
x
+
b
.
y
*
c
.
y
+
b
.
z
*
c
.
z
;
if
(
Math
.
abs
(
j
)
>=
1
)
return
d
.
w
=
b
.
w
,
d
.
x
=
b
.
x
,
d
.
y
=
b
.
y
,
d
.
z
=
b
.
z
,
d
;
var
h
=
Math
.
acos
(
j
),
k
=
Math
.
sqrt
(
1
-
j
*
j
);
if
(
Math
.
abs
(
k
)
<
0.001
0
)
return
d
.
w
=
0.5
*
(
b
.
w
+
c
.
w
),
d
.
x
=
0.5
*
(
b
.
x
+
c
.
x
),
d
.
y
=
0.5
*
(
b
.
y
+
c
.
y
),
d
.
z
=
0.5
*
(
b
.
z
+
c
.
z
),
d
;
j
=
Math
.
sin
((
1
-
e
)
*
h
)
/
k
;
e
=
Math
.
sin
(
e
*
h
)
/
k
;
d
.
w
=
b
.
w
*
j
+
c
.
w
*
e
;
d
.
x
=
b
.
x
*
j
+
c
.
x
*
e
;
d
.
y
=
b
.
y
*
j
+
c
.
y
*
e
;
d
.
z
=
b
.
z
*
j
+
c
.
z
*
e
;
return
d
};
THREE
.
Vertex
=
function
(
b
){
this
.
position
=
b
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
b
,
c
,
d
,
e
,
j
,
h
){
this
.
a
=
b
;
this
.
b
=
c
;
this
.
c
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
j
instanceof
THREE
.
Color
?
j
:
new
THREE
.
Color
;
this
.
vertexColors
=
j
instanceof
Array
?
j
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
h
instanceof
Array
?
h
:[
h
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
b
,
c
,
d
,
e
,
j
,
h
,
k
){
this
.
a
=
b
;
this
.
b
=
c
;
this
.
c
=
d
;
this
.
d
=
e
;
this
.
normal
=
j
instanceof
THREE
.
Vector3
?
j
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
j
instanceof
Array
?
j
:[];
this
.
color
=
h
instanceof
THREE
.
Color
?
h
:
new
THREE
.
Color
;
this
.
vertexColors
=
h
instanceof
Array
?
h
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
k
instanceof
Array
?
k
:[
k
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
b
,
c
){
this
.
u
=
b
||
0
;
this
.
v
=
c
||
0
};
THREE
.
UV
.
prototype
=
{
constructor
:
THREE
.
UV
,
set
:
function
(
b
,
c
){
this
.
u
=
b
;
this
.
v
=
c
;
return
this
},
copy
:
function
(
b
){
this
.
u
=
b
.
u
;
this
.
v
=
b
.
v
;
return
this
},
clone
:
function
(){
return
new
THREE
.
UV
(
this
.
u
,
this
.
v
)}};
...
...
@@ -169,7 +169,7 @@ THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,
THREE
.
ShaderChunk
.
envmap_vertex
,
THREE
.
ShaderChunk
.
color_vertex
,
"
vec3 transformedNormal = normalize( normalMatrix * normal );
"
,
THREE
.
ShaderChunk
.
lights_vertex
,
THREE
.
ShaderChunk
.
skinning_vertex
,
THREE
.
ShaderChunk
.
morphtarget_vertex
,
THREE
.
ShaderChunk
.
default_vertex
,
THREE
.
ShaderChunk
.
shadowmap_vertex
,
"
}
"
].
join
(
"
\n
"
)},
phong
:{
uniforms
:
THREE
.
UniformsUtils
.
merge
([
THREE
.
UniformsLib
.
common
,
THREE
.
UniformsLib
.
fog
,
THREE
.
UniformsLib
.
lights
,
THREE
.
UniformsLib
.
shadowmap
,{
ambient
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
328965
)},
specular
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
1118481
)},
shininess
:{
type
:
"
f
"
,
value
:
30
}}]),
fragmentShader
:[
"
uniform vec3 diffuse;
\n
uniform float opacity;
\n
uniform vec3 ambient;
\n
uniform vec3 specular;
\n
uniform float shininess;
\n
varying vec3 vLightWeighting;
"
,
THREE
.
ShaderChunk
.
color_pars_fragment
,
THREE
.
ShaderChunk
.
map_pars_fragment
,
THREE
.
ShaderChunk
.
lightmap_pars_fragment
,
THREE
.
ShaderChunk
.
envmap_pars_fragment
,
THREE
.
ShaderChunk
.
fog_pars_fragment
,
THREE
.
ShaderChunk
.
lights_pars_fragment
,
THREE
.
ShaderChunk
.
shadowmap_pars_fragment
,
"
void main() {
\n
gl_FragColor = vec4( vLightWeighting, 1.0 );
"
,
THREE
.
ShaderChunk
.
map_fragment
,
THREE
.
ShaderChunk
.
alphatest_fragment
,
THREE
.
ShaderChunk
.
lights_fragment
,
THREE
.
ShaderChunk
.
lightmap_fragment
,
THREE
.
ShaderChunk
.
color_fragment
,
THREE
.
ShaderChunk
.
envmap_fragment
,
THREE
.
ShaderChunk
.
shadowmap_fragment
,
THREE
.
ShaderChunk
.
fog_fragment
,
"
}
"
].
join
(
"
\n
"
),
vertexShader
:[
"
#define PHONG
\n
varying vec3 vLightWeighting;
\n
varying vec3 vViewPosition;
\n
varying vec3 vNormal;
"
,
THREE
.
ShaderChunk
.
map_pars_vertex
,
THREE
.
ShaderChunk
.
lightmap_pars_vertex
,
THREE
.
ShaderChunk
.
envmap_pars_vertex
,
THREE
.
ShaderChunk
.
lights_pars_vertex
,
THREE
.
ShaderChunk
.
color_pars_vertex
,
THREE
.
ShaderChunk
.
skinning_pars_vertex
,
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
,
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
,
"
void main() {
\n
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
"
,
THREE
.
ShaderChunk
.
map_vertex
,
THREE
.
ShaderChunk
.
lightmap_vertex
,
THREE
.
ShaderChunk
.
envmap_vertex
,
THREE
.
ShaderChunk
.
color_vertex
,
"
#ifndef USE_ENVMAP
\n
vec4 mPosition = objectMatrix * vec4( position, 1.0 );
\n
#endif
\n
vViewPosition =
cameraPosition - m
Position.xyz;
\n
vec3 transformedNormal = normalize( normalMatrix * normal );
\n
vNormal = transformedNormal;
"
,
THREE
.
ShaderChunk
.
envmap_pars_vertex
,
THREE
.
ShaderChunk
.
lights_pars_vertex
,
THREE
.
ShaderChunk
.
color_pars_vertex
,
THREE
.
ShaderChunk
.
skinning_pars_vertex
,
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
,
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
,
"
void main() {
\n
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
"
,
THREE
.
ShaderChunk
.
map_vertex
,
THREE
.
ShaderChunk
.
lightmap_vertex
,
THREE
.
ShaderChunk
.
envmap_vertex
,
THREE
.
ShaderChunk
.
color_vertex
,
"
#ifndef USE_ENVMAP
\n
vec4 mPosition = objectMatrix * vec4( position, 1.0 );
\n
#endif
\n
vViewPosition =
-mv
Position.xyz;
\n
vec3 transformedNormal = normalize( normalMatrix * normal );
\n
vNormal = transformedNormal;
"
,
THREE
.
ShaderChunk
.
lights_vertex
,
THREE
.
ShaderChunk
.
skinning_vertex
,
THREE
.
ShaderChunk
.
morphtarget_vertex
,
THREE
.
ShaderChunk
.
default_vertex
,
THREE
.
ShaderChunk
.
shadowmap_vertex
,
"
}
"
].
join
(
"
\n
"
)},
particle_basic
:{
uniforms
:
THREE
.
UniformsUtils
.
merge
([
THREE
.
UniformsLib
.
particle
,
THREE
.
UniformsLib
.
shadowmap
]),
fragmentShader
:[
"
uniform vec3 psColor;
\n
uniform float opacity;
"
,
THREE
.
ShaderChunk
.
color_pars_fragment
,
THREE
.
ShaderChunk
.
map_particle_pars_fragment
,
THREE
.
ShaderChunk
.
fog_pars_fragment
,
THREE
.
ShaderChunk
.
shadowmap_pars_fragment
,
"
void main() {
\n
gl_FragColor = vec4( psColor, opacity );
"
,
THREE
.
ShaderChunk
.
map_particle_fragment
,
THREE
.
ShaderChunk
.
alphatest_fragment
,
THREE
.
ShaderChunk
.
color_fragment
,
THREE
.
ShaderChunk
.
shadowmap_fragment
,
THREE
.
ShaderChunk
.
fog_fragment
,
"
}
"
].
join
(
"
\n
"
),
vertexShader
:[
"
uniform float size;
\n
uniform float scale;
"
,
THREE
.
ShaderChunk
.
color_pars_vertex
,
THREE
.
ShaderChunk
.
shadowmap_pars_vertex
,
"
void main() {
"
,
THREE
.
ShaderChunk
.
color_vertex
,
"
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
\n
#ifdef USE_SIZEATTENUATION
\n
gl_PointSize = size * ( scale / length( mvPosition.xyz ) );
\n
#else
\n
gl_PointSize = size;
\n
#endif
\n
gl_Position = projectionMatrix * mvPosition;
"
,
THREE
.
ShaderChunk
.
shadowmap_vertex
,
"
}
"
].
join
(
"
\n
"
)},
depthRGBA
:{
uniforms
:{},
fragmentShader
:
"
vec4 pack_depth( const in float depth ) {
\n
const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );
\n
const vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );
\n
vec4 res = fract( depth * bit_shift );
\n
res -= res.xxyz * bit_mask;
\n
return res;
\n
}
\n
void main() {
\n
gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );
\n
}
"
,
vertexShader
:[
THREE
.
ShaderChunk
.
morphtarget_pars_vertex
,
...
...
src/extras/ShaderUtils.js
浏览文件 @
2603ccf4
...
...
@@ -304,7 +304,9 @@ THREE.ShaderUtils = {
"
vec4 mPosition = objectMatrix * vec4( position, 1.0 );
"
,
"
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
"
,
"
vViewPosition = -mvPosition.xyz;
"
,
"
vNormal = normalize( normalMatrix * normal );
"
,
// tangent and binormal vectors
...
...
src/renderers/WebGLShaders.js
浏览文件 @
2603ccf4
...
...
@@ -1428,7 +1428,7 @@ THREE.ShaderLib = {
"
#endif
"
,
"
vViewPosition =
cameraPosition - m
Position.xyz;
"
,
"
vViewPosition =
-mv
Position.xyz;
"
,
"
vec3 transformedNormal = normalize( normalMatrix * normal );
"
,
"
vNormal = transformedNormal;
"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录