Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
6b63c04d
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,发现更多精彩内容 >>
提交
6b63c04d
编写于
2月 20, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
ca90b0aa
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
60 addition
and
60 deletion
+60
-60
build/Three.js
build/Three.js
+17
-17
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+7
-7
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+7
-7
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+7
-7
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+7
-7
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+15
-15
未找到文件。
build/Three.js
浏览文件 @
6b63c04d
此差异已折叠。
点击以展开。
build/custom/ThreeCanvas.js
浏览文件 @
6b63c04d
...
...
@@ -30,12 +30,12 @@ THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b
THREE
.
Matrix3
.
prototype
=
{
constructor
:
THREE
.
Matrix3
,
transpose
:
function
(){
var
a
,
b
=
this
.
m
;
a
=
b
[
1
];
b
[
1
]
=
b
[
3
];
b
[
3
]
=
a
;
a
=
b
[
2
];
b
[
2
]
=
b
[
6
];
b
[
6
]
=
a
;
a
=
b
[
5
];
b
[
5
]
=
b
[
7
];
b
[
7
]
=
a
;
return
this
},
transposeIntoArray
:
function
(
a
){
var
b
=
this
.
m
;
a
[
0
]
=
b
[
0
];
a
[
1
]
=
b
[
3
];
a
[
2
]
=
b
[
6
];
a
[
3
]
=
b
[
1
];
a
[
4
]
=
b
[
4
];
a
[
5
]
=
b
[
7
];
a
[
6
]
=
b
[
2
];
a
[
7
]
=
b
[
5
];
a
[
8
]
=
b
[
8
];
return
this
}};
THREE
.
Matrix4
=
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
l
,
j
,
i
,
o
,
m
,
n
,
p
,
k
){
this
.
set
(
void
0
!==
a
?
a
:
1
,
b
||
0
,
c
||
0
,
d
||
0
,
e
||
0
,
void
0
!==
f
?
f
:
1
,
g
||
0
,
h
||
0
,
l
||
0
,
j
||
0
,
void
0
!==
i
?
i
:
1
,
o
||
0
,
m
||
0
,
n
||
0
,
p
||
0
,
void
0
!==
k
?
k
:
1
);
this
.
flat
=
Array
(
16
);
this
.
m33
=
new
THREE
.
Matrix3
};
THREE
.
Matrix4
.
prototype
=
{
constructor
:
THREE
.
Matrix4
,
set
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
l
,
j
,
i
,
o
,
m
,
n
,
p
,
k
){
this
.
n11
=
a
;
this
.
n12
=
b
;
this
.
n13
=
c
;
this
.
n14
=
d
;
this
.
n21
=
e
;
this
.
n22
=
f
;
this
.
n23
=
g
;
this
.
n24
=
h
;
this
.
n31
=
l
;
this
.
n32
=
j
;
this
.
n33
=
i
;
this
.
n34
=
o
;
this
.
n41
=
m
;
this
.
n42
=
n
;
this
.
n43
=
p
;
this
.
n44
=
k
;
return
this
},
identity
:
function
(){
this
.
set
(
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
n11
,
a
.
n12
,
a
.
n13
,
a
.
n14
,
a
.
n21
,
a
.
n22
,
a
.
n23
,
a
.
n24
,
a
.
n31
,
a
.
n32
,
a
.
n33
,
a
.
n34
,
a
.
n41
,
a
.
n42
,
a
.
n43
,
a
.
n44
);
return
this
},
lookAt
:
function
(
a
,
b
,
c
){
var
d
=
THREE
.
Matrix4
.
__v1
,
e
=
THREE
.
Matrix4
.
__v2
,
f
=
THREE
.
Matrix4
.
__v3
;
f
.
sub
(
a
,
b
).
normalize
();
if
(
0
===
f
.
length
())
f
.
z
=
1
;
d
.
cross
(
c
,
f
).
normalize
();
0
===
d
.
length
()
&&
(
f
.
x
+=
1.0
E
-
4
,
d
.
cross
(
c
,
f
).
normalize
());
e
.
cross
(
f
,
d
)
.
normalize
();
this
.
n11
=
d
.
x
;
this
.
n12
=
e
.
x
;
this
.
n13
=
f
.
x
;
this
.
n21
=
d
.
y
;
this
.
n22
=
e
.
y
;
this
.
n23
=
f
.
y
;
this
.
n31
=
d
.
z
;
this
.
n32
=
e
.
z
;
this
.
n33
=
f
.
z
;
return
this
},
multiply
:
function
(
a
,
b
){
var
c
=
a
.
n11
,
d
=
a
.
n12
,
e
=
a
.
n13
,
f
=
a
.
n14
,
g
=
a
.
n21
,
h
=
a
.
n22
,
l
=
a
.
n23
,
j
=
a
.
n24
,
i
=
a
.
n31
,
o
=
a
.
n32
,
m
=
a
.
n33
,
n
=
a
.
n34
,
p
=
a
.
n41
,
k
=
a
.
n42
,
r
=
a
.
n43
,
D
=
a
.
n44
,
u
=
b
.
n11
,
G
=
b
.
n12
,
I
=
b
.
n13
,
v
=
b
.
n14
,
H
=
b
.
n21
,
A
=
b
.
n22
,
F
=
b
.
n23
,
s
=
b
.
n24
,
w
=
b
.
n31
,
z
=
b
.
n32
,
K
=
b
.
n33
,
$
=
b
.
n34
,
da
=
b
.
n41
,
N
=
b
.
n42
,
P
=
b
.
n43
,
T
=
b
.
n44
;
this
.
n11
=
c
*
u
+
d
*
H
+
e
*
w
+
f
*
da
;
this
.
n12
=
c
*
G
+
d
*
A
+
e
*
z
+
f
*
N
;
this
.
n13
=
c
*
I
+
d
*
F
+
e
*
K
+
f
*
P
;
this
.
n14
=
c
*
v
+
d
*
s
+
e
*
$
+
f
*
T
;
this
.
n21
=
g
*
u
+
h
*
H
+
l
*
w
+
j
*
da
;
this
.
n22
=
g
*
G
+
h
*
A
+
l
*
z
+
j
*
N
;
this
.
n23
=
g
*
I
+
h
*
F
+
l
*
K
+
j
*
P
;
this
.
n24
=
g
*
v
+
h
*
s
+
l
*
$
+
j
*
T
;
this
.
n31
=
i
*
u
+
o
*
H
+
m
*
w
+
n
*
da
;
this
.
n32
=
i
*
G
+
o
*
A
+
m
*
z
+
n
*
N
;
this
.
n33
=
i
*
I
+
o
*
F
+
m
*
K
+
n
*
P
;
this
.
n34
=
i
*
v
+
o
*
s
+
m
*
$
+
n
*
T
;
this
.
n41
=
p
*
u
+
k
*
H
+
r
*
w
+
D
*
da
;
this
.
n42
=
p
*
G
+
k
*
A
+
r
*
z
+
D
*
N
;
this
.
n43
=
p
*
I
+
k
*
F
+
r
*
K
+
D
*
P
;
this
.
n44
=
p
*
v
+
k
*
s
+
r
*
$
+
D
*
T
;
return
this
},
multiplySelf
:
function
(
a
){
return
this
.
multiply
(
this
,
a
)},
multiplyToArray
:
function
(
a
,
b
,
c
){
this
.
multiply
(
a
,
b
);
c
[
0
]
=
this
.
n11
;
c
[
1
]
=
this
.
n21
;
c
[
2
]
=
this
.
n31
;
c
[
3
]
=
this
.
n41
;
c
[
4
]
=
this
.
n12
;
c
[
5
]
=
this
.
n22
;
c
[
6
]
=
this
.
n32
;
c
[
7
]
=
this
.
n42
;
c
[
8
]
=
this
.
n13
;
c
[
9
]
=
this
.
n23
;
c
[
10
]
=
this
.
n33
;
c
[
11
]
=
this
.
n43
;
c
[
12
]
=
this
.
n14
;
c
[
13
]
=
this
.
n24
;
c
[
14
]
=
this
.
n34
;
c
[
15
]
=
this
.
n44
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
n11
*=
a
;
this
.
n12
*=
a
;
this
.
n13
*=
a
;
this
.
n14
*=
a
;
this
.
n21
*=
a
;
this
.
n22
*=
a
;
this
.
n23
*=
a
;
this
.
n24
*=
a
;
this
.
n31
*=
a
;
this
.
n32
*=
a
;
this
.
n33
*=
a
;
this
.
n34
*=
a
;
this
.
n41
*=
a
;
this
.
n42
*=
a
;
this
.
n43
*=
a
;
this
.
n44
*=
a
;
return
this
},
multiplyVector3
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
,
e
=
1
/
(
this
.
n41
*
b
+
this
.
n42
*
c
+
this
.
n43
*
d
+
this
.
n44
);
a
.
x
=
(
this
.
n11
*
b
+
this
.
n12
*
c
+
this
.
n13
*
d
+
this
.
n14
)
*
e
;
a
.
y
=
(
this
.
n21
*
b
+
this
.
n22
*
c
+
this
.
n23
*
d
+
this
.
n24
)
*
e
;
a
.
z
=
(
this
.
n31
*
b
+
this
.
n32
*
c
+
this
.
n33
*
d
+
this
.
n34
)
*
e
;
return
a
},
multiplyVector4
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
,
e
=
a
.
w
;
a
.
x
=
this
.
n11
*
b
+
this
.
n12
*
c
+
this
.
n13
*
d
+
this
.
n14
*
e
;
a
.
y
=
this
.
n21
*
b
+
this
.
n22
*
c
+
this
.
n23
*
d
+
this
.
n24
*
e
;
a
.
z
=
this
.
n31
*
b
+
this
.
n32
*
c
+
this
.
n33
*
d
+
this
.
n34
*
e
;
a
.
w
=
this
.
n41
*
b
+
this
.
n42
*
c
+
this
.
n43
*
d
+
this
.
n44
*
e
;
return
a
},
rotateAxis
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
;
a
.
x
=
b
*
this
.
n11
+
c
*
this
.
n12
+
d
*
this
.
n13
;
a
.
y
=
b
*
this
.
n21
+
c
*
this
.
n22
+
d
*
this
.
n23
;
a
.
z
=
b
*
this
.
n31
+
c
*
this
.
n32
+
d
*
this
.
n33
;
a
.
normalize
();
return
a
},
crossVector
:
function
(
a
){
var
b
=
new
THREE
.
Vector4
;
b
.
x
=
this
.
n11
*
a
.
x
+
this
.
n12
*
a
.
y
+
this
.
n13
*
a
.
z
+
this
.
n14
*
a
.
w
;
b
.
y
=
this
.
n21
*
a
.
x
+
this
.
n22
*
a
.
y
+
this
.
n23
*
a
.
z
+
this
.
n24
*
a
.
w
;
b
.
z
=
this
.
n31
*
a
.
x
+
this
.
n32
*
a
.
y
+
this
.
n33
*
a
.
z
+
this
.
n34
*
a
.
w
;
b
.
w
=
a
.
w
?
this
.
n41
*
a
.
x
+
this
.
n42
*
a
.
y
+
this
.
n43
*
a
.
z
+
this
.
n44
*
a
.
w
:
1
;
return
b
},
determinant
:
function
(){
var
a
=
this
.
n11
,
b
=
this
.
n12
,
c
=
this
.
n13
,
d
=
this
.
n14
,
e
=
this
.
n21
,
f
=
this
.
n22
,
g
=
this
.
n23
,
h
=
this
.
n24
,
l
=
this
.
n31
,
j
=
this
.
n32
,
i
=
this
.
n33
,
o
=
this
.
n34
,
m
=
this
.
n41
,
n
=
this
.
n42
,
p
=
this
.
n43
,
k
=
this
.
n44
;
return
d
*
g
*
j
*
m
-
c
*
h
*
j
*
m
-
d
*
f
*
i
*
m
+
b
*
h
*
i
*
m
+
c
*
f
*
o
*
m
-
b
*
g
*
o
*
m
-
d
*
g
*
l
*
n
+
c
*
h
*
l
*
n
+
d
*
e
*
i
*
n
-
a
*
h
*
i
*
n
-
c
*
e
*
o
*
n
+
a
*
g
*
o
*
n
+
d
*
f
*
l
*
p
-
b
*
h
*
l
*
p
-
d
*
e
*
j
*
p
+
a
*
h
*
j
*
p
+
b
*
e
*
o
*
p
-
a
*
f
*
o
*
p
-
c
*
f
*
l
*
k
+
b
*
g
*
l
*
k
+
c
*
e
*
j
*
k
-
a
*
g
*
j
*
k
-
b
*
e
*
i
*
k
+
a
*
f
*
i
*
k
},
transpose
:
function
(){
var
a
;
b
,
c
){
var
d
=
THREE
.
Matrix4
.
__v1
,
e
=
THREE
.
Matrix4
.
__v2
,
f
=
THREE
.
Matrix4
.
__v3
;
f
.
sub
(
a
,
b
).
normalize
();
if
(
0
===
f
.
length
())
f
.
z
=
1
;
d
.
cross
(
c
,
f
).
normalize
();
0
===
d
.
length
()
&&
(
f
.
x
+=
1.0
E
-
4
,
d
.
cross
(
c
,
f
).
normalize
());
e
.
cross
(
f
,
d
)
;
this
.
n11
=
d
.
x
;
this
.
n12
=
e
.
x
;
this
.
n13
=
f
.
x
;
this
.
n21
=
d
.
y
;
this
.
n22
=
e
.
y
;
this
.
n23
=
f
.
y
;
this
.
n31
=
d
.
z
;
this
.
n32
=
e
.
z
;
this
.
n33
=
f
.
z
;
return
this
},
multiply
:
function
(
a
,
b
){
var
c
=
a
.
n11
,
d
=
a
.
n12
,
e
=
a
.
n13
,
f
=
a
.
n14
,
g
=
a
.
n21
,
h
=
a
.
n22
,
l
=
a
.
n23
,
j
=
a
.
n24
,
i
=
a
.
n31
,
o
=
a
.
n32
,
m
=
a
.
n33
,
n
=
a
.
n34
,
p
=
a
.
n41
,
k
=
a
.
n42
,
r
=
a
.
n43
,
D
=
a
.
n44
,
u
=
b
.
n11
,
G
=
b
.
n12
,
I
=
b
.
n13
,
v
=
b
.
n14
,
H
=
b
.
n21
,
A
=
b
.
n22
,
F
=
b
.
n23
,
s
=
b
.
n24
,
w
=
b
.
n31
,
z
=
b
.
n32
,
K
=
b
.
n33
,
$
=
b
.
n34
,
da
=
b
.
n41
,
N
=
b
.
n42
,
P
=
b
.
n43
,
T
=
b
.
n44
;
this
.
n11
=
c
*
u
+
d
*
H
+
e
*
w
+
f
*
da
;
this
.
n12
=
c
*
G
+
d
*
A
+
e
*
z
+
f
*
N
;
this
.
n13
=
c
*
I
+
d
*
F
+
e
*
K
+
f
*
P
;
this
.
n14
=
c
*
v
+
d
*
s
+
e
*
$
+
f
*
T
;
this
.
n21
=
g
*
u
+
h
*
H
+
l
*
w
+
j
*
da
;
this
.
n22
=
g
*
G
+
h
*
A
+
l
*
z
+
j
*
N
;
this
.
n23
=
g
*
I
+
h
*
F
+
l
*
K
+
j
*
P
;
this
.
n24
=
g
*
v
+
h
*
s
+
l
*
$
+
j
*
T
;
this
.
n31
=
i
*
u
+
o
*
H
+
m
*
w
+
n
*
da
;
this
.
n32
=
i
*
G
+
o
*
A
+
m
*
z
+
n
*
N
;
this
.
n33
=
i
*
I
+
o
*
F
+
m
*
K
+
n
*
P
;
this
.
n34
=
i
*
v
+
o
*
s
+
m
*
$
+
n
*
T
;
this
.
n41
=
p
*
u
+
k
*
H
+
r
*
w
+
D
*
da
;
this
.
n42
=
p
*
G
+
k
*
A
+
r
*
z
+
D
*
N
;
this
.
n43
=
p
*
I
+
k
*
F
+
r
*
K
+
D
*
P
;
this
.
n44
=
p
*
v
+
k
*
s
+
r
*
$
+
D
*
T
;
return
this
},
multiplySelf
:
function
(
a
){
return
this
.
multiply
(
this
,
a
)},
multiplyToArray
:
function
(
a
,
b
,
c
){
this
.
multiply
(
a
,
b
);
c
[
0
]
=
this
.
n11
;
c
[
1
]
=
this
.
n21
;
c
[
2
]
=
this
.
n31
;
c
[
3
]
=
this
.
n41
;
c
[
4
]
=
this
.
n12
;
c
[
5
]
=
this
.
n22
;
c
[
6
]
=
this
.
n32
;
c
[
7
]
=
this
.
n42
;
c
[
8
]
=
this
.
n13
;
c
[
9
]
=
this
.
n23
;
c
[
10
]
=
this
.
n33
;
c
[
11
]
=
this
.
n43
;
c
[
12
]
=
this
.
n14
;
c
[
13
]
=
this
.
n24
;
c
[
14
]
=
this
.
n34
;
c
[
15
]
=
this
.
n44
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
n11
*=
a
;
this
.
n12
*=
a
;
this
.
n13
*=
a
;
this
.
n14
*=
a
;
this
.
n21
*=
a
;
this
.
n22
*=
a
;
this
.
n23
*=
a
;
this
.
n24
*=
a
;
this
.
n31
*=
a
;
this
.
n32
*=
a
;
this
.
n33
*=
a
;
this
.
n34
*=
a
;
this
.
n41
*=
a
;
this
.
n42
*=
a
;
this
.
n43
*=
a
;
this
.
n44
*=
a
;
return
this
},
multiplyVector3
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
,
e
=
1
/
(
this
.
n41
*
b
+
this
.
n42
*
c
+
this
.
n43
*
d
+
this
.
n44
);
a
.
x
=
(
this
.
n11
*
b
+
this
.
n12
*
c
+
this
.
n13
*
d
+
this
.
n14
)
*
e
;
a
.
y
=
(
this
.
n21
*
b
+
this
.
n22
*
c
+
this
.
n23
*
d
+
this
.
n24
)
*
e
;
a
.
z
=
(
this
.
n31
*
b
+
this
.
n32
*
c
+
this
.
n33
*
d
+
this
.
n34
)
*
e
;
return
a
},
multiplyVector4
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
,
e
=
a
.
w
;
a
.
x
=
this
.
n11
*
b
+
this
.
n12
*
c
+
this
.
n13
*
d
+
this
.
n14
*
e
;
a
.
y
=
this
.
n21
*
b
+
this
.
n22
*
c
+
this
.
n23
*
d
+
this
.
n24
*
e
;
a
.
z
=
this
.
n31
*
b
+
this
.
n32
*
c
+
this
.
n33
*
d
+
this
.
n34
*
e
;
a
.
w
=
this
.
n41
*
b
+
this
.
n42
*
c
+
this
.
n43
*
d
+
this
.
n44
*
e
;
return
a
},
rotateAxis
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
;
a
.
x
=
b
*
this
.
n11
+
c
*
this
.
n12
+
d
*
this
.
n13
;
a
.
y
=
b
*
this
.
n21
+
c
*
this
.
n22
+
d
*
this
.
n23
;
a
.
z
=
b
*
this
.
n31
+
c
*
this
.
n32
+
d
*
this
.
n33
;
a
.
normalize
();
return
a
},
crossVector
:
function
(
a
){
var
b
=
new
THREE
.
Vector4
;
b
.
x
=
this
.
n11
*
a
.
x
+
this
.
n12
*
a
.
y
+
this
.
n13
*
a
.
z
+
this
.
n14
*
a
.
w
;
b
.
y
=
this
.
n21
*
a
.
x
+
this
.
n22
*
a
.
y
+
this
.
n23
*
a
.
z
+
this
.
n24
*
a
.
w
;
b
.
z
=
this
.
n31
*
a
.
x
+
this
.
n32
*
a
.
y
+
this
.
n33
*
a
.
z
+
this
.
n34
*
a
.
w
;
b
.
w
=
a
.
w
?
this
.
n41
*
a
.
x
+
this
.
n42
*
a
.
y
+
this
.
n43
*
a
.
z
+
this
.
n44
*
a
.
w
:
1
;
return
b
},
determinant
:
function
(){
var
a
=
this
.
n11
,
b
=
this
.
n12
,
c
=
this
.
n13
,
d
=
this
.
n14
,
e
=
this
.
n21
,
f
=
this
.
n22
,
g
=
this
.
n23
,
h
=
this
.
n24
,
l
=
this
.
n31
,
j
=
this
.
n32
,
i
=
this
.
n33
,
o
=
this
.
n34
,
m
=
this
.
n41
,
n
=
this
.
n42
,
p
=
this
.
n43
,
k
=
this
.
n44
;
return
d
*
g
*
j
*
m
-
c
*
h
*
j
*
m
-
d
*
f
*
i
*
m
+
b
*
h
*
i
*
m
+
c
*
f
*
o
*
m
-
b
*
g
*
o
*
m
-
d
*
g
*
l
*
n
+
c
*
h
*
l
*
n
+
d
*
e
*
i
*
n
-
a
*
h
*
i
*
n
-
c
*
e
*
o
*
n
+
a
*
g
*
o
*
n
+
d
*
f
*
l
*
p
-
b
*
h
*
l
*
p
-
d
*
e
*
j
*
p
+
a
*
h
*
j
*
p
+
b
*
e
*
o
*
p
-
a
*
f
*
o
*
p
-
c
*
f
*
l
*
k
+
b
*
g
*
l
*
k
+
c
*
e
*
j
*
k
-
a
*
g
*
j
*
k
-
b
*
e
*
i
*
k
+
a
*
f
*
i
*
k
},
transpose
:
function
(){
var
a
;
a
=
this
.
n21
;
this
.
n21
=
this
.
n12
;
this
.
n12
=
a
;
a
=
this
.
n31
;
this
.
n31
=
this
.
n13
;
this
.
n13
=
a
;
a
=
this
.
n32
;
this
.
n32
=
this
.
n23
;
this
.
n23
=
a
;
a
=
this
.
n41
;
this
.
n41
=
this
.
n14
;
this
.
n14
=
a
;
a
=
this
.
n42
;
this
.
n42
=
this
.
n24
;
this
.
n24
=
a
;
a
=
this
.
n43
;
this
.
n43
=
this
.
n34
;
this
.
n34
=
a
;
return
this
},
clone
:
function
(){
var
a
=
new
THREE
.
Matrix4
;
a
.
n11
=
this
.
n11
;
a
.
n12
=
this
.
n12
;
a
.
n13
=
this
.
n13
;
a
.
n14
=
this
.
n14
;
a
.
n21
=
this
.
n21
;
a
.
n22
=
this
.
n22
;
a
.
n23
=
this
.
n23
;
a
.
n24
=
this
.
n24
;
a
.
n31
=
this
.
n31
;
a
.
n32
=
this
.
n32
;
a
.
n33
=
this
.
n33
;
a
.
n34
=
this
.
n34
;
a
.
n41
=
this
.
n41
;
a
.
n42
=
this
.
n42
;
a
.
n43
=
this
.
n43
;
a
.
n44
=
this
.
n44
;
return
a
},
flatten
:
function
(){
this
.
flat
[
0
]
=
this
.
n11
;
this
.
flat
[
1
]
=
this
.
n21
;
this
.
flat
[
2
]
=
this
.
n31
;
this
.
flat
[
3
]
=
this
.
n41
;
this
.
flat
[
4
]
=
this
.
n12
;
this
.
flat
[
5
]
=
this
.
n22
;
this
.
flat
[
6
]
=
this
.
n32
;
this
.
flat
[
7
]
=
this
.
n42
;
this
.
flat
[
8
]
=
this
.
n13
;
this
.
flat
[
9
]
=
this
.
n23
;
this
.
flat
[
10
]
=
this
.
n33
;
this
.
flat
[
11
]
=
this
.
n43
;
this
.
flat
[
12
]
=
this
.
n14
;
this
.
flat
[
13
]
=
this
.
n24
;
this
.
flat
[
14
]
=
this
.
n34
;
this
.
flat
[
15
]
=
this
.
n44
;
return
this
.
flat
},
flattenToArray
:
function
(
a
){
a
[
0
]
=
this
.
n11
;
a
[
1
]
=
this
.
n21
;
a
[
2
]
=
this
.
n31
;
a
[
3
]
=
this
.
n41
;
a
[
4
]
=
this
.
n12
;
a
[
5
]
=
this
.
n22
;
a
[
6
]
=
this
.
n32
;
a
[
7
]
=
this
.
n42
;
a
[
8
]
=
this
.
n13
;
a
[
9
]
=
this
.
n23
;
a
[
10
]
=
this
.
n33
;
a
[
11
]
=
this
.
n43
;
a
[
12
]
=
this
.
n14
;
a
[
13
]
=
this
.
n24
;
a
[
14
]
=
this
.
n34
;
a
[
15
]
=
this
.
n44
;
return
a
},
flattenToArrayOffset
:
function
(
a
,
b
){
a
[
b
]
=
this
.
n11
;
a
[
b
+
1
]
=
this
.
n21
;
a
[
b
+
2
]
=
this
.
n31
;
a
[
b
+
3
]
=
this
.
n41
;
a
[
b
+
4
]
=
this
.
n12
;
a
[
b
+
5
]
=
this
.
n22
;
a
[
b
+
6
]
=
this
.
n32
;
a
[
b
+
7
]
=
this
.
n42
;
a
[
b
+
8
]
=
this
.
n13
;
a
[
b
+
9
]
=
this
.
n23
;
a
[
b
+
10
]
=
this
.
n33
;
a
[
b
+
11
]
=
this
.
n43
;
a
[
b
+
12
]
=
this
.
n14
;
a
[
b
+
13
]
=
this
.
n24
;
a
[
b
+
14
]
=
this
.
n34
;
a
[
b
+
15
]
=
this
.
n44
;
return
a
},
...
...
@@ -79,7 +79,7 @@ f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this
-
Math
.
abs
(
this
.
y
):
Math
.
abs
(
this
.
y
);
this
.
z
=
0
>
a
.
n21
-
a
.
n12
?
-
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
);
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
,
o
=
l
*
e
+
f
*
d
-
g
*
c
,
c
=-
f
*
c
-
g
*
d
-
h
*
e
;
b
.
x
=
j
*
l
+
c
*-
f
+
i
*-
h
-
o
*-
g
;
b
.
y
=
i
*
l
+
c
*-
g
+
o
*-
f
-
j
*-
h
;
b
.
z
=
o
*
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
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
.
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
.
Vertex
.
prototype
=
{
constructor
:
THREE
.
Vertex
,
clone
:
function
(){
return
new
THREE
.
Vertex
(
this
.
position
.
clone
())}};
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
.
Face3
.
prototype
=
{
constructor
:
THREE
.
Face3
,
clone
:
function
(){
var
a
=
new
THREE
.
Face3
(
this
.
a
,
this
.
b
,
this
.
c
);
a
.
normal
.
copy
(
this
.
normal
);
a
.
color
.
copy
(
this
.
color
);
a
.
centroid
.
copy
(
this
.
centroid
);
a
.
materialIndex
=
this
.
materialIndex
;
var
b
,
c
;
for
(
b
=
0
,
c
=
this
.
vertexNormals
.
length
;
b
<
c
;
b
++
)
a
.
vertexNormals
[
b
]
=
this
.
vertexNormals
[
b
].
clone
();
for
(
b
=
0
,
c
=
this
.
vertexColors
.
length
;
b
<
c
;
b
++
)
a
.
vertexColors
[
b
]
=
this
.
vertexColors
[
b
].
clone
();
for
(
b
=
0
,
c
=
this
.
vertexTangents
.
length
;
b
<
c
;
b
++
)
a
.
vertexTangents
[
b
]
=
this
.
vertexTangents
[
b
].
clone
();
return
a
}};
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
};
...
...
build/custom/ThreeDOM.js
浏览文件 @
6b63c04d
...
...
@@ -30,12 +30,12 @@ THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b
THREE
.
Matrix3
.
prototype
=
{
constructor
:
THREE
.
Matrix3
,
transpose
:
function
(){
var
a
,
b
=
this
.
m
;
a
=
b
[
1
];
b
[
1
]
=
b
[
3
];
b
[
3
]
=
a
;
a
=
b
[
2
];
b
[
2
]
=
b
[
6
];
b
[
6
]
=
a
;
a
=
b
[
5
];
b
[
5
]
=
b
[
7
];
b
[
7
]
=
a
;
return
this
},
transposeIntoArray
:
function
(
a
){
var
b
=
this
.
m
;
a
[
0
]
=
b
[
0
];
a
[
1
]
=
b
[
3
];
a
[
2
]
=
b
[
6
];
a
[
3
]
=
b
[
1
];
a
[
4
]
=
b
[
4
];
a
[
5
]
=
b
[
7
];
a
[
6
]
=
b
[
2
];
a
[
7
]
=
b
[
5
];
a
[
8
]
=
b
[
8
];
return
this
}};
THREE
.
Matrix4
=
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
l
,
i
,
j
,
k
,
n
,
m
,
q
,
o
){
this
.
set
(
void
0
!==
a
?
a
:
1
,
b
||
0
,
c
||
0
,
d
||
0
,
e
||
0
,
void
0
!==
f
?
f
:
1
,
g
||
0
,
h
||
0
,
l
||
0
,
i
||
0
,
void
0
!==
j
?
j
:
1
,
k
||
0
,
n
||
0
,
m
||
0
,
q
||
0
,
void
0
!==
o
?
o
:
1
);
this
.
flat
=
Array
(
16
);
this
.
m33
=
new
THREE
.
Matrix3
};
THREE
.
Matrix4
.
prototype
=
{
constructor
:
THREE
.
Matrix4
,
set
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
l
,
i
,
j
,
k
,
n
,
m
,
q
,
o
){
this
.
n11
=
a
;
this
.
n12
=
b
;
this
.
n13
=
c
;
this
.
n14
=
d
;
this
.
n21
=
e
;
this
.
n22
=
f
;
this
.
n23
=
g
;
this
.
n24
=
h
;
this
.
n31
=
l
;
this
.
n32
=
i
;
this
.
n33
=
j
;
this
.
n34
=
k
;
this
.
n41
=
n
;
this
.
n42
=
m
;
this
.
n43
=
q
;
this
.
n44
=
o
;
return
this
},
identity
:
function
(){
this
.
set
(
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
n11
,
a
.
n12
,
a
.
n13
,
a
.
n14
,
a
.
n21
,
a
.
n22
,
a
.
n23
,
a
.
n24
,
a
.
n31
,
a
.
n32
,
a
.
n33
,
a
.
n34
,
a
.
n41
,
a
.
n42
,
a
.
n43
,
a
.
n44
);
return
this
},
lookAt
:
function
(
a
,
b
,
c
){
var
d
=
THREE
.
Matrix4
.
__v1
,
e
=
THREE
.
Matrix4
.
__v2
,
f
=
THREE
.
Matrix4
.
__v3
;
f
.
sub
(
a
,
b
).
normalize
();
if
(
0
===
f
.
length
())
f
.
z
=
1
;
d
.
cross
(
c
,
f
).
normalize
();
0
===
d
.
length
()
&&
(
f
.
x
+=
1.0
E
-
4
,
d
.
cross
(
c
,
f
).
normalize
());
e
.
cross
(
f
,
d
)
.
normalize
();
this
.
n11
=
d
.
x
;
this
.
n12
=
e
.
x
;
this
.
n13
=
f
.
x
;
this
.
n21
=
d
.
y
;
this
.
n22
=
e
.
y
;
this
.
n23
=
f
.
y
;
this
.
n31
=
d
.
z
;
this
.
n32
=
e
.
z
;
this
.
n33
=
f
.
z
;
return
this
},
multiply
:
function
(
a
,
b
){
var
c
=
a
.
n11
,
d
=
a
.
n12
,
e
=
a
.
n13
,
f
=
a
.
n14
,
g
=
a
.
n21
,
h
=
a
.
n22
,
l
=
a
.
n23
,
i
=
a
.
n24
,
j
=
a
.
n31
,
k
=
a
.
n32
,
n
=
a
.
n33
,
m
=
a
.
n34
,
q
=
a
.
n41
,
o
=
a
.
n42
,
p
=
a
.
n43
,
u
=
a
.
n44
,
r
=
b
.
n11
,
y
=
b
.
n12
,
D
=
b
.
n13
,
s
=
b
.
n14
,
B
=
b
.
n21
,
w
=
b
.
n22
,
z
=
b
.
n23
,
G
=
b
.
n24
,
J
=
b
.
n31
,
E
=
b
.
n32
,
I
=
b
.
n33
,
P
=
b
.
n34
,
Q
=
b
.
n41
,
R
=
b
.
n42
,
S
=
b
.
n43
,
T
=
b
.
n44
;
this
.
n11
=
c
*
r
+
d
*
B
+
e
*
J
+
f
*
Q
;
this
.
n12
=
c
*
y
+
d
*
w
+
e
*
E
+
f
*
R
;
this
.
n13
=
c
*
D
+
d
*
z
+
e
*
I
+
f
*
S
;
this
.
n14
=
c
*
s
+
d
*
G
+
e
*
P
+
f
*
T
;
this
.
n21
=
g
*
r
+
h
*
B
+
l
*
J
+
i
*
Q
;
this
.
n22
=
g
*
y
+
h
*
w
+
l
*
E
+
i
*
R
;
this
.
n23
=
g
*
D
+
h
*
z
+
l
*
I
+
i
*
S
;
this
.
n24
=
g
*
s
+
h
*
G
+
l
*
P
+
i
*
T
;
this
.
n31
=
j
*
r
+
k
*
B
+
n
*
J
+
m
*
Q
;
this
.
n32
=
j
*
y
+
k
*
w
+
n
*
E
+
m
*
R
;
this
.
n33
=
j
*
D
+
k
*
z
+
n
*
I
+
m
*
S
;
this
.
n34
=
j
*
s
+
k
*
G
+
n
*
P
+
m
*
T
;
this
.
n41
=
q
*
r
+
o
*
B
+
p
*
J
+
u
*
Q
;
this
.
n42
=
q
*
y
+
o
*
w
+
p
*
E
+
u
*
R
;
this
.
n43
=
q
*
D
+
o
*
z
+
p
*
I
+
u
*
S
;
this
.
n44
=
q
*
s
+
o
*
G
+
p
*
P
+
u
*
T
;
return
this
},
multiplySelf
:
function
(
a
){
return
this
.
multiply
(
this
,
a
)},
multiplyToArray
:
function
(
a
,
b
,
c
){
this
.
multiply
(
a
,
b
);
c
[
0
]
=
this
.
n11
;
c
[
1
]
=
this
.
n21
;
c
[
2
]
=
this
.
n31
;
c
[
3
]
=
this
.
n41
;
c
[
4
]
=
this
.
n12
;
c
[
5
]
=
this
.
n22
;
c
[
6
]
=
this
.
n32
;
c
[
7
]
=
this
.
n42
;
c
[
8
]
=
this
.
n13
;
c
[
9
]
=
this
.
n23
;
c
[
10
]
=
this
.
n33
;
c
[
11
]
=
this
.
n43
;
c
[
12
]
=
this
.
n14
;
c
[
13
]
=
this
.
n24
;
c
[
14
]
=
this
.
n34
;
c
[
15
]
=
this
.
n44
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
n11
*=
a
;
this
.
n12
*=
a
;
this
.
n13
*=
a
;
this
.
n14
*=
a
;
this
.
n21
*=
a
;
this
.
n22
*=
a
;
this
.
n23
*=
a
;
this
.
n24
*=
a
;
this
.
n31
*=
a
;
this
.
n32
*=
a
;
this
.
n33
*=
a
;
this
.
n34
*=
a
;
this
.
n41
*=
a
;
this
.
n42
*=
a
;
this
.
n43
*=
a
;
this
.
n44
*=
a
;
return
this
},
multiplyVector3
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
,
e
=
1
/
(
this
.
n41
*
b
+
this
.
n42
*
c
+
this
.
n43
*
d
+
this
.
n44
);
a
.
x
=
(
this
.
n11
*
b
+
this
.
n12
*
c
+
this
.
n13
*
d
+
this
.
n14
)
*
e
;
a
.
y
=
(
this
.
n21
*
b
+
this
.
n22
*
c
+
this
.
n23
*
d
+
this
.
n24
)
*
e
;
a
.
z
=
(
this
.
n31
*
b
+
this
.
n32
*
c
+
this
.
n33
*
d
+
this
.
n34
)
*
e
;
return
a
},
multiplyVector4
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
,
e
=
a
.
w
;
a
.
x
=
this
.
n11
*
b
+
this
.
n12
*
c
+
this
.
n13
*
d
+
this
.
n14
*
e
;
a
.
y
=
this
.
n21
*
b
+
this
.
n22
*
c
+
this
.
n23
*
d
+
this
.
n24
*
e
;
a
.
z
=
this
.
n31
*
b
+
this
.
n32
*
c
+
this
.
n33
*
d
+
this
.
n34
*
e
;
a
.
w
=
this
.
n41
*
b
+
this
.
n42
*
c
+
this
.
n43
*
d
+
this
.
n44
*
e
;
return
a
},
rotateAxis
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
;
a
.
x
=
b
*
this
.
n11
+
c
*
this
.
n12
+
d
*
this
.
n13
;
a
.
y
=
b
*
this
.
n21
+
c
*
this
.
n22
+
d
*
this
.
n23
;
a
.
z
=
b
*
this
.
n31
+
c
*
this
.
n32
+
d
*
this
.
n33
;
a
.
normalize
();
return
a
},
crossVector
:
function
(
a
){
var
b
=
new
THREE
.
Vector4
;
b
.
x
=
this
.
n11
*
a
.
x
+
this
.
n12
*
a
.
y
+
this
.
n13
*
a
.
z
+
this
.
n14
*
a
.
w
;
b
.
y
=
this
.
n21
*
a
.
x
+
this
.
n22
*
a
.
y
+
this
.
n23
*
a
.
z
+
this
.
n24
*
a
.
w
;
b
.
z
=
this
.
n31
*
a
.
x
+
this
.
n32
*
a
.
y
+
this
.
n33
*
a
.
z
+
this
.
n34
*
a
.
w
;
b
.
w
=
a
.
w
?
this
.
n41
*
a
.
x
+
this
.
n42
*
a
.
y
+
this
.
n43
*
a
.
z
+
this
.
n44
*
a
.
w
:
1
;
return
b
},
determinant
:
function
(){
var
a
=
this
.
n11
,
b
=
this
.
n12
,
c
=
this
.
n13
,
d
=
this
.
n14
,
e
=
this
.
n21
,
f
=
this
.
n22
,
g
=
this
.
n23
,
h
=
this
.
n24
,
l
=
this
.
n31
,
i
=
this
.
n32
,
j
=
this
.
n33
,
k
=
this
.
n34
,
n
=
this
.
n41
,
m
=
this
.
n42
,
q
=
this
.
n43
,
o
=
this
.
n44
;
return
d
*
g
*
i
*
n
-
c
*
h
*
i
*
n
-
d
*
f
*
j
*
n
+
b
*
h
*
j
*
n
+
c
*
f
*
k
*
n
-
b
*
g
*
k
*
n
-
d
*
g
*
l
*
m
+
c
*
h
*
l
*
m
+
d
*
e
*
j
*
m
-
a
*
h
*
j
*
m
-
c
*
e
*
k
*
m
+
a
*
g
*
k
*
m
+
d
*
f
*
l
*
q
-
b
*
h
*
l
*
q
-
d
*
e
*
i
*
q
+
a
*
h
*
i
*
q
+
b
*
e
*
k
*
q
-
a
*
f
*
k
*
q
-
c
*
f
*
l
*
o
+
b
*
g
*
l
*
o
+
c
*
e
*
i
*
o
-
a
*
g
*
i
*
o
-
b
*
e
*
j
*
o
+
a
*
f
*
j
*
o
},
transpose
:
function
(){
var
a
;
b
,
c
){
var
d
=
THREE
.
Matrix4
.
__v1
,
e
=
THREE
.
Matrix4
.
__v2
,
f
=
THREE
.
Matrix4
.
__v3
;
f
.
sub
(
a
,
b
).
normalize
();
if
(
0
===
f
.
length
())
f
.
z
=
1
;
d
.
cross
(
c
,
f
).
normalize
();
0
===
d
.
length
()
&&
(
f
.
x
+=
1.0
E
-
4
,
d
.
cross
(
c
,
f
).
normalize
());
e
.
cross
(
f
,
d
)
;
this
.
n11
=
d
.
x
;
this
.
n12
=
e
.
x
;
this
.
n13
=
f
.
x
;
this
.
n21
=
d
.
y
;
this
.
n22
=
e
.
y
;
this
.
n23
=
f
.
y
;
this
.
n31
=
d
.
z
;
this
.
n32
=
e
.
z
;
this
.
n33
=
f
.
z
;
return
this
},
multiply
:
function
(
a
,
b
){
var
c
=
a
.
n11
,
d
=
a
.
n12
,
e
=
a
.
n13
,
f
=
a
.
n14
,
g
=
a
.
n21
,
h
=
a
.
n22
,
l
=
a
.
n23
,
i
=
a
.
n24
,
j
=
a
.
n31
,
k
=
a
.
n32
,
n
=
a
.
n33
,
m
=
a
.
n34
,
q
=
a
.
n41
,
o
=
a
.
n42
,
p
=
a
.
n43
,
u
=
a
.
n44
,
r
=
b
.
n11
,
y
=
b
.
n12
,
D
=
b
.
n13
,
s
=
b
.
n14
,
B
=
b
.
n21
,
w
=
b
.
n22
,
z
=
b
.
n23
,
G
=
b
.
n24
,
J
=
b
.
n31
,
E
=
b
.
n32
,
I
=
b
.
n33
,
P
=
b
.
n34
,
Q
=
b
.
n41
,
R
=
b
.
n42
,
S
=
b
.
n43
,
T
=
b
.
n44
;
this
.
n11
=
c
*
r
+
d
*
B
+
e
*
J
+
f
*
Q
;
this
.
n12
=
c
*
y
+
d
*
w
+
e
*
E
+
f
*
R
;
this
.
n13
=
c
*
D
+
d
*
z
+
e
*
I
+
f
*
S
;
this
.
n14
=
c
*
s
+
d
*
G
+
e
*
P
+
f
*
T
;
this
.
n21
=
g
*
r
+
h
*
B
+
l
*
J
+
i
*
Q
;
this
.
n22
=
g
*
y
+
h
*
w
+
l
*
E
+
i
*
R
;
this
.
n23
=
g
*
D
+
h
*
z
+
l
*
I
+
i
*
S
;
this
.
n24
=
g
*
s
+
h
*
G
+
l
*
P
+
i
*
T
;
this
.
n31
=
j
*
r
+
k
*
B
+
n
*
J
+
m
*
Q
;
this
.
n32
=
j
*
y
+
k
*
w
+
n
*
E
+
m
*
R
;
this
.
n33
=
j
*
D
+
k
*
z
+
n
*
I
+
m
*
S
;
this
.
n34
=
j
*
s
+
k
*
G
+
n
*
P
+
m
*
T
;
this
.
n41
=
q
*
r
+
o
*
B
+
p
*
J
+
u
*
Q
;
this
.
n42
=
q
*
y
+
o
*
w
+
p
*
E
+
u
*
R
;
this
.
n43
=
q
*
D
+
o
*
z
+
p
*
I
+
u
*
S
;
this
.
n44
=
q
*
s
+
o
*
G
+
p
*
P
+
u
*
T
;
return
this
},
multiplySelf
:
function
(
a
){
return
this
.
multiply
(
this
,
a
)},
multiplyToArray
:
function
(
a
,
b
,
c
){
this
.
multiply
(
a
,
b
);
c
[
0
]
=
this
.
n11
;
c
[
1
]
=
this
.
n21
;
c
[
2
]
=
this
.
n31
;
c
[
3
]
=
this
.
n41
;
c
[
4
]
=
this
.
n12
;
c
[
5
]
=
this
.
n22
;
c
[
6
]
=
this
.
n32
;
c
[
7
]
=
this
.
n42
;
c
[
8
]
=
this
.
n13
;
c
[
9
]
=
this
.
n23
;
c
[
10
]
=
this
.
n33
;
c
[
11
]
=
this
.
n43
;
c
[
12
]
=
this
.
n14
;
c
[
13
]
=
this
.
n24
;
c
[
14
]
=
this
.
n34
;
c
[
15
]
=
this
.
n44
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
n11
*=
a
;
this
.
n12
*=
a
;
this
.
n13
*=
a
;
this
.
n14
*=
a
;
this
.
n21
*=
a
;
this
.
n22
*=
a
;
this
.
n23
*=
a
;
this
.
n24
*=
a
;
this
.
n31
*=
a
;
this
.
n32
*=
a
;
this
.
n33
*=
a
;
this
.
n34
*=
a
;
this
.
n41
*=
a
;
this
.
n42
*=
a
;
this
.
n43
*=
a
;
this
.
n44
*=
a
;
return
this
},
multiplyVector3
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
,
e
=
1
/
(
this
.
n41
*
b
+
this
.
n42
*
c
+
this
.
n43
*
d
+
this
.
n44
);
a
.
x
=
(
this
.
n11
*
b
+
this
.
n12
*
c
+
this
.
n13
*
d
+
this
.
n14
)
*
e
;
a
.
y
=
(
this
.
n21
*
b
+
this
.
n22
*
c
+
this
.
n23
*
d
+
this
.
n24
)
*
e
;
a
.
z
=
(
this
.
n31
*
b
+
this
.
n32
*
c
+
this
.
n33
*
d
+
this
.
n34
)
*
e
;
return
a
},
multiplyVector4
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
,
e
=
a
.
w
;
a
.
x
=
this
.
n11
*
b
+
this
.
n12
*
c
+
this
.
n13
*
d
+
this
.
n14
*
e
;
a
.
y
=
this
.
n21
*
b
+
this
.
n22
*
c
+
this
.
n23
*
d
+
this
.
n24
*
e
;
a
.
z
=
this
.
n31
*
b
+
this
.
n32
*
c
+
this
.
n33
*
d
+
this
.
n34
*
e
;
a
.
w
=
this
.
n41
*
b
+
this
.
n42
*
c
+
this
.
n43
*
d
+
this
.
n44
*
e
;
return
a
},
rotateAxis
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
;
a
.
x
=
b
*
this
.
n11
+
c
*
this
.
n12
+
d
*
this
.
n13
;
a
.
y
=
b
*
this
.
n21
+
c
*
this
.
n22
+
d
*
this
.
n23
;
a
.
z
=
b
*
this
.
n31
+
c
*
this
.
n32
+
d
*
this
.
n33
;
a
.
normalize
();
return
a
},
crossVector
:
function
(
a
){
var
b
=
new
THREE
.
Vector4
;
b
.
x
=
this
.
n11
*
a
.
x
+
this
.
n12
*
a
.
y
+
this
.
n13
*
a
.
z
+
this
.
n14
*
a
.
w
;
b
.
y
=
this
.
n21
*
a
.
x
+
this
.
n22
*
a
.
y
+
this
.
n23
*
a
.
z
+
this
.
n24
*
a
.
w
;
b
.
z
=
this
.
n31
*
a
.
x
+
this
.
n32
*
a
.
y
+
this
.
n33
*
a
.
z
+
this
.
n34
*
a
.
w
;
b
.
w
=
a
.
w
?
this
.
n41
*
a
.
x
+
this
.
n42
*
a
.
y
+
this
.
n43
*
a
.
z
+
this
.
n44
*
a
.
w
:
1
;
return
b
},
determinant
:
function
(){
var
a
=
this
.
n11
,
b
=
this
.
n12
,
c
=
this
.
n13
,
d
=
this
.
n14
,
e
=
this
.
n21
,
f
=
this
.
n22
,
g
=
this
.
n23
,
h
=
this
.
n24
,
l
=
this
.
n31
,
i
=
this
.
n32
,
j
=
this
.
n33
,
k
=
this
.
n34
,
n
=
this
.
n41
,
m
=
this
.
n42
,
q
=
this
.
n43
,
o
=
this
.
n44
;
return
d
*
g
*
i
*
n
-
c
*
h
*
i
*
n
-
d
*
f
*
j
*
n
+
b
*
h
*
j
*
n
+
c
*
f
*
k
*
n
-
b
*
g
*
k
*
n
-
d
*
g
*
l
*
m
+
c
*
h
*
l
*
m
+
d
*
e
*
j
*
m
-
a
*
h
*
j
*
m
-
c
*
e
*
k
*
m
+
a
*
g
*
k
*
m
+
d
*
f
*
l
*
q
-
b
*
h
*
l
*
q
-
d
*
e
*
i
*
q
+
a
*
h
*
i
*
q
+
b
*
e
*
k
*
q
-
a
*
f
*
k
*
q
-
c
*
f
*
l
*
o
+
b
*
g
*
l
*
o
+
c
*
e
*
i
*
o
-
a
*
g
*
i
*
o
-
b
*
e
*
j
*
o
+
a
*
f
*
j
*
o
},
transpose
:
function
(){
var
a
;
a
=
this
.
n21
;
this
.
n21
=
this
.
n12
;
this
.
n12
=
a
;
a
=
this
.
n31
;
this
.
n31
=
this
.
n13
;
this
.
n13
=
a
;
a
=
this
.
n32
;
this
.
n32
=
this
.
n23
;
this
.
n23
=
a
;
a
=
this
.
n41
;
this
.
n41
=
this
.
n14
;
this
.
n14
=
a
;
a
=
this
.
n42
;
this
.
n42
=
this
.
n24
;
this
.
n24
=
a
;
a
=
this
.
n43
;
this
.
n43
=
this
.
n34
;
this
.
n34
=
a
;
return
this
},
clone
:
function
(){
var
a
=
new
THREE
.
Matrix4
;
a
.
n11
=
this
.
n11
;
a
.
n12
=
this
.
n12
;
a
.
n13
=
this
.
n13
;
a
.
n14
=
this
.
n14
;
a
.
n21
=
this
.
n21
;
a
.
n22
=
this
.
n22
;
a
.
n23
=
this
.
n23
;
a
.
n24
=
this
.
n24
;
a
.
n31
=
this
.
n31
;
a
.
n32
=
this
.
n32
;
a
.
n33
=
this
.
n33
;
a
.
n34
=
this
.
n34
;
a
.
n41
=
this
.
n41
;
a
.
n42
=
this
.
n42
;
a
.
n43
=
this
.
n43
;
a
.
n44
=
this
.
n44
;
return
a
},
flatten
:
function
(){
this
.
flat
[
0
]
=
this
.
n11
;
this
.
flat
[
1
]
=
this
.
n21
;
this
.
flat
[
2
]
=
this
.
n31
;
this
.
flat
[
3
]
=
this
.
n41
;
this
.
flat
[
4
]
=
this
.
n12
;
this
.
flat
[
5
]
=
this
.
n22
;
this
.
flat
[
6
]
=
this
.
n32
;
this
.
flat
[
7
]
=
this
.
n42
;
this
.
flat
[
8
]
=
this
.
n13
;
this
.
flat
[
9
]
=
this
.
n23
;
this
.
flat
[
10
]
=
this
.
n33
;
this
.
flat
[
11
]
=
this
.
n43
;
this
.
flat
[
12
]
=
this
.
n14
;
this
.
flat
[
13
]
=
this
.
n24
;
this
.
flat
[
14
]
=
this
.
n34
;
this
.
flat
[
15
]
=
this
.
n44
;
return
this
.
flat
},
flattenToArray
:
function
(
a
){
a
[
0
]
=
this
.
n11
;
a
[
1
]
=
this
.
n21
;
a
[
2
]
=
this
.
n31
;
a
[
3
]
=
this
.
n41
;
a
[
4
]
=
this
.
n12
;
a
[
5
]
=
this
.
n22
;
a
[
6
]
=
this
.
n32
;
a
[
7
]
=
this
.
n42
;
a
[
8
]
=
this
.
n13
;
a
[
9
]
=
this
.
n23
;
a
[
10
]
=
this
.
n33
;
a
[
11
]
=
this
.
n43
;
a
[
12
]
=
this
.
n14
;
a
[
13
]
=
this
.
n24
;
a
[
14
]
=
this
.
n34
;
a
[
15
]
=
this
.
n44
;
return
a
},
flattenToArrayOffset
:
function
(
a
,
b
){
a
[
b
]
=
this
.
n11
;
a
[
b
+
1
]
=
this
.
n21
;
a
[
b
+
2
]
=
this
.
n31
;
a
[
b
+
3
]
=
this
.
n41
;
a
[
b
+
4
]
=
this
.
n12
;
a
[
b
+
5
]
=
this
.
n22
;
a
[
b
+
6
]
=
this
.
n32
;
a
[
b
+
7
]
=
this
.
n42
;
a
[
b
+
8
]
=
this
.
n13
;
a
[
b
+
9
]
=
this
.
n23
;
a
[
b
+
10
]
=
this
.
n33
;
a
[
b
+
11
]
=
this
.
n43
;
a
[
b
+
12
]
=
this
.
n14
;
a
[
b
+
13
]
=
this
.
n24
;
a
[
b
+
14
]
=
this
.
n34
;
a
[
b
+
15
]
=
this
.
n44
;
return
a
},
...
...
@@ -78,7 +78,7 @@ f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this
-
Math
.
abs
(
this
.
y
):
Math
.
abs
(
this
.
y
);
this
.
z
=
0
>
a
.
n21
-
a
.
n12
?
-
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
);
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
,
i
=
l
*
c
+
g
*
e
-
h
*
d
,
j
=
l
*
d
+
h
*
c
-
f
*
e
,
k
=
l
*
e
+
f
*
d
-
g
*
c
,
c
=-
f
*
c
-
g
*
d
-
h
*
e
;
b
.
x
=
i
*
l
+
c
*-
f
+
j
*-
h
-
k
*-
g
;
b
.
y
=
j
*
l
+
c
*-
g
+
k
*-
f
-
i
*-
h
;
b
.
z
=
k
*
l
+
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
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
.
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
.
Vertex
.
prototype
=
{
constructor
:
THREE
.
Vertex
,
clone
:
function
(){
return
new
THREE
.
Vertex
(
this
.
position
.
clone
())}};
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
.
Face3
.
prototype
=
{
constructor
:
THREE
.
Face3
,
clone
:
function
(){
var
a
=
new
THREE
.
Face3
(
this
.
a
,
this
.
b
,
this
.
c
);
a
.
normal
.
copy
(
this
.
normal
);
a
.
color
.
copy
(
this
.
color
);
a
.
centroid
.
copy
(
this
.
centroid
);
a
.
materialIndex
=
this
.
materialIndex
;
var
b
,
c
;
for
(
b
=
0
,
c
=
this
.
vertexNormals
.
length
;
b
<
c
;
b
++
)
a
.
vertexNormals
[
b
]
=
this
.
vertexNormals
[
b
].
clone
();
for
(
b
=
0
,
c
=
this
.
vertexColors
.
length
;
b
<
c
;
b
++
)
a
.
vertexColors
[
b
]
=
this
.
vertexColors
[
b
].
clone
();
for
(
b
=
0
,
c
=
this
.
vertexTangents
.
length
;
b
<
c
;
b
++
)
a
.
vertexTangents
[
b
]
=
this
.
vertexTangents
[
b
].
clone
();
return
a
}};
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
};
...
...
build/custom/ThreeExtras.js
浏览文件 @
6b63c04d
此差异已折叠。
点击以展开。
build/custom/ThreeSVG.js
浏览文件 @
6b63c04d
...
...
@@ -30,12 +30,12 @@ THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b
THREE
.
Matrix3
.
prototype
=
{
constructor
:
THREE
.
Matrix3
,
transpose
:
function
(){
var
a
,
b
=
this
.
m
;
a
=
b
[
1
];
b
[
1
]
=
b
[
3
];
b
[
3
]
=
a
;
a
=
b
[
2
];
b
[
2
]
=
b
[
6
];
b
[
6
]
=
a
;
a
=
b
[
5
];
b
[
5
]
=
b
[
7
];
b
[
7
]
=
a
;
return
this
},
transposeIntoArray
:
function
(
a
){
var
b
=
this
.
m
;
a
[
0
]
=
b
[
0
];
a
[
1
]
=
b
[
3
];
a
[
2
]
=
b
[
6
];
a
[
3
]
=
b
[
1
];
a
[
4
]
=
b
[
4
];
a
[
5
]
=
b
[
7
];
a
[
6
]
=
b
[
2
];
a
[
7
]
=
b
[
5
];
a
[
8
]
=
b
[
8
];
return
this
}};
THREE
.
Matrix4
=
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
k
,
i
,
j
,
m
,
n
,
l
,
p
,
o
){
this
.
set
(
void
0
!==
a
?
a
:
1
,
b
||
0
,
c
||
0
,
d
||
0
,
e
||
0
,
void
0
!==
f
?
f
:
1
,
g
||
0
,
h
||
0
,
k
||
0
,
i
||
0
,
void
0
!==
j
?
j
:
1
,
m
||
0
,
n
||
0
,
l
||
0
,
p
||
0
,
void
0
!==
o
?
o
:
1
);
this
.
flat
=
Array
(
16
);
this
.
m33
=
new
THREE
.
Matrix3
};
THREE
.
Matrix4
.
prototype
=
{
constructor
:
THREE
.
Matrix4
,
set
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
k
,
i
,
j
,
m
,
n
,
l
,
p
,
o
){
this
.
n11
=
a
;
this
.
n12
=
b
;
this
.
n13
=
c
;
this
.
n14
=
d
;
this
.
n21
=
e
;
this
.
n22
=
f
;
this
.
n23
=
g
;
this
.
n24
=
h
;
this
.
n31
=
k
;
this
.
n32
=
i
;
this
.
n33
=
j
;
this
.
n34
=
m
;
this
.
n41
=
n
;
this
.
n42
=
l
;
this
.
n43
=
p
;
this
.
n44
=
o
;
return
this
},
identity
:
function
(){
this
.
set
(
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
,
0
,
0
,
0
,
0
,
1
);
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
n11
,
a
.
n12
,
a
.
n13
,
a
.
n14
,
a
.
n21
,
a
.
n22
,
a
.
n23
,
a
.
n24
,
a
.
n31
,
a
.
n32
,
a
.
n33
,
a
.
n34
,
a
.
n41
,
a
.
n42
,
a
.
n43
,
a
.
n44
);
return
this
},
lookAt
:
function
(
a
,
b
,
c
){
var
d
=
THREE
.
Matrix4
.
__v1
,
e
=
THREE
.
Matrix4
.
__v2
,
f
=
THREE
.
Matrix4
.
__v3
;
f
.
sub
(
a
,
b
).
normalize
();
if
(
0
===
f
.
length
())
f
.
z
=
1
;
d
.
cross
(
c
,
f
).
normalize
();
0
===
d
.
length
()
&&
(
f
.
x
+=
1.0
E
-
4
,
d
.
cross
(
c
,
f
).
normalize
());
e
.
cross
(
f
,
d
)
.
normalize
();
this
.
n11
=
d
.
x
;
this
.
n12
=
e
.
x
;
this
.
n13
=
f
.
x
;
this
.
n21
=
d
.
y
;
this
.
n22
=
e
.
y
;
this
.
n23
=
f
.
y
;
this
.
n31
=
d
.
z
;
this
.
n32
=
e
.
z
;
this
.
n33
=
f
.
z
;
return
this
},
multiply
:
function
(
a
,
b
){
var
c
=
a
.
n11
,
d
=
a
.
n12
,
e
=
a
.
n13
,
f
=
a
.
n14
,
g
=
a
.
n21
,
h
=
a
.
n22
,
k
=
a
.
n23
,
i
=
a
.
n24
,
j
=
a
.
n31
,
m
=
a
.
n32
,
n
=
a
.
n33
,
l
=
a
.
n34
,
p
=
a
.
n41
,
o
=
a
.
n42
,
q
=
a
.
n43
,
y
=
a
.
n44
,
v
=
b
.
n11
,
D
=
b
.
n12
,
t
=
b
.
n13
,
u
=
b
.
n14
,
B
=
b
.
n21
,
x
=
b
.
n22
,
z
=
b
.
n23
,
E
=
b
.
n24
,
C
=
b
.
n31
,
F
=
b
.
n32
,
A
=
b
.
n33
,
L
=
b
.
n34
,
O
=
b
.
n41
,
M
=
b
.
n42
,
Q
=
b
.
n43
,
T
=
b
.
n44
;
this
.
n11
=
c
*
v
+
d
*
B
+
e
*
C
+
f
*
O
;
this
.
n12
=
c
*
D
+
d
*
x
+
e
*
F
+
f
*
M
;
this
.
n13
=
c
*
t
+
d
*
z
+
e
*
A
+
f
*
Q
;
this
.
n14
=
c
*
u
+
d
*
E
+
e
*
L
+
f
*
T
;
this
.
n21
=
g
*
v
+
h
*
B
+
k
*
C
+
i
*
O
;
this
.
n22
=
g
*
D
+
h
*
x
+
k
*
F
+
i
*
M
;
this
.
n23
=
g
*
t
+
h
*
z
+
k
*
A
+
i
*
Q
;
this
.
n24
=
g
*
u
+
h
*
E
+
k
*
L
+
i
*
T
;
this
.
n31
=
j
*
v
+
m
*
B
+
n
*
C
+
l
*
O
;
this
.
n32
=
j
*
D
+
m
*
x
+
n
*
F
+
l
*
M
;
this
.
n33
=
j
*
t
+
m
*
z
+
n
*
A
+
l
*
Q
;
this
.
n34
=
j
*
u
+
m
*
E
+
n
*
L
+
l
*
T
;
this
.
n41
=
p
*
v
+
o
*
B
+
q
*
C
+
y
*
O
;
this
.
n42
=
p
*
D
+
o
*
x
+
q
*
F
+
y
*
M
;
this
.
n43
=
p
*
t
+
o
*
z
+
q
*
A
+
y
*
Q
;
this
.
n44
=
p
*
u
+
o
*
E
+
q
*
L
+
y
*
T
;
return
this
},
multiplySelf
:
function
(
a
){
return
this
.
multiply
(
this
,
a
)},
multiplyToArray
:
function
(
a
,
b
,
c
){
this
.
multiply
(
a
,
b
);
c
[
0
]
=
this
.
n11
;
c
[
1
]
=
this
.
n21
;
c
[
2
]
=
this
.
n31
;
c
[
3
]
=
this
.
n41
;
c
[
4
]
=
this
.
n12
;
c
[
5
]
=
this
.
n22
;
c
[
6
]
=
this
.
n32
;
c
[
7
]
=
this
.
n42
;
c
[
8
]
=
this
.
n13
;
c
[
9
]
=
this
.
n23
;
c
[
10
]
=
this
.
n33
;
c
[
11
]
=
this
.
n43
;
c
[
12
]
=
this
.
n14
;
c
[
13
]
=
this
.
n24
;
c
[
14
]
=
this
.
n34
;
c
[
15
]
=
this
.
n44
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
n11
*=
a
;
this
.
n12
*=
a
;
this
.
n13
*=
a
;
this
.
n14
*=
a
;
this
.
n21
*=
a
;
this
.
n22
*=
a
;
this
.
n23
*=
a
;
this
.
n24
*=
a
;
this
.
n31
*=
a
;
this
.
n32
*=
a
;
this
.
n33
*=
a
;
this
.
n34
*=
a
;
this
.
n41
*=
a
;
this
.
n42
*=
a
;
this
.
n43
*=
a
;
this
.
n44
*=
a
;
return
this
},
multiplyVector3
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
,
e
=
1
/
(
this
.
n41
*
b
+
this
.
n42
*
c
+
this
.
n43
*
d
+
this
.
n44
);
a
.
x
=
(
this
.
n11
*
b
+
this
.
n12
*
c
+
this
.
n13
*
d
+
this
.
n14
)
*
e
;
a
.
y
=
(
this
.
n21
*
b
+
this
.
n22
*
c
+
this
.
n23
*
d
+
this
.
n24
)
*
e
;
a
.
z
=
(
this
.
n31
*
b
+
this
.
n32
*
c
+
this
.
n33
*
d
+
this
.
n34
)
*
e
;
return
a
},
multiplyVector4
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
,
e
=
a
.
w
;
a
.
x
=
this
.
n11
*
b
+
this
.
n12
*
c
+
this
.
n13
*
d
+
this
.
n14
*
e
;
a
.
y
=
this
.
n21
*
b
+
this
.
n22
*
c
+
this
.
n23
*
d
+
this
.
n24
*
e
;
a
.
z
=
this
.
n31
*
b
+
this
.
n32
*
c
+
this
.
n33
*
d
+
this
.
n34
*
e
;
a
.
w
=
this
.
n41
*
b
+
this
.
n42
*
c
+
this
.
n43
*
d
+
this
.
n44
*
e
;
return
a
},
rotateAxis
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
;
a
.
x
=
b
*
this
.
n11
+
c
*
this
.
n12
+
d
*
this
.
n13
;
a
.
y
=
b
*
this
.
n21
+
c
*
this
.
n22
+
d
*
this
.
n23
;
a
.
z
=
b
*
this
.
n31
+
c
*
this
.
n32
+
d
*
this
.
n33
;
a
.
normalize
();
return
a
},
crossVector
:
function
(
a
){
var
b
=
new
THREE
.
Vector4
;
b
.
x
=
this
.
n11
*
a
.
x
+
this
.
n12
*
a
.
y
+
this
.
n13
*
a
.
z
+
this
.
n14
*
a
.
w
;
b
.
y
=
this
.
n21
*
a
.
x
+
this
.
n22
*
a
.
y
+
this
.
n23
*
a
.
z
+
this
.
n24
*
a
.
w
;
b
.
z
=
this
.
n31
*
a
.
x
+
this
.
n32
*
a
.
y
+
this
.
n33
*
a
.
z
+
this
.
n34
*
a
.
w
;
b
.
w
=
a
.
w
?
this
.
n41
*
a
.
x
+
this
.
n42
*
a
.
y
+
this
.
n43
*
a
.
z
+
this
.
n44
*
a
.
w
:
1
;
return
b
},
determinant
:
function
(){
var
a
=
this
.
n11
,
b
=
this
.
n12
,
c
=
this
.
n13
,
d
=
this
.
n14
,
e
=
this
.
n21
,
f
=
this
.
n22
,
g
=
this
.
n23
,
h
=
this
.
n24
,
k
=
this
.
n31
,
i
=
this
.
n32
,
j
=
this
.
n33
,
m
=
this
.
n34
,
n
=
this
.
n41
,
l
=
this
.
n42
,
p
=
this
.
n43
,
o
=
this
.
n44
;
return
d
*
g
*
i
*
n
-
c
*
h
*
i
*
n
-
d
*
f
*
j
*
n
+
b
*
h
*
j
*
n
+
c
*
f
*
m
*
n
-
b
*
g
*
m
*
n
-
d
*
g
*
k
*
l
+
c
*
h
*
k
*
l
+
d
*
e
*
j
*
l
-
a
*
h
*
j
*
l
-
c
*
e
*
m
*
l
+
a
*
g
*
m
*
l
+
d
*
f
*
k
*
p
-
b
*
h
*
k
*
p
-
d
*
e
*
i
*
p
+
a
*
h
*
i
*
p
+
b
*
e
*
m
*
p
-
a
*
f
*
m
*
p
-
c
*
f
*
k
*
o
+
b
*
g
*
k
*
o
+
c
*
e
*
i
*
o
-
a
*
g
*
i
*
o
-
b
*
e
*
j
*
o
+
a
*
f
*
j
*
o
},
transpose
:
function
(){
var
a
;
b
,
c
){
var
d
=
THREE
.
Matrix4
.
__v1
,
e
=
THREE
.
Matrix4
.
__v2
,
f
=
THREE
.
Matrix4
.
__v3
;
f
.
sub
(
a
,
b
).
normalize
();
if
(
0
===
f
.
length
())
f
.
z
=
1
;
d
.
cross
(
c
,
f
).
normalize
();
0
===
d
.
length
()
&&
(
f
.
x
+=
1.0
E
-
4
,
d
.
cross
(
c
,
f
).
normalize
());
e
.
cross
(
f
,
d
)
;
this
.
n11
=
d
.
x
;
this
.
n12
=
e
.
x
;
this
.
n13
=
f
.
x
;
this
.
n21
=
d
.
y
;
this
.
n22
=
e
.
y
;
this
.
n23
=
f
.
y
;
this
.
n31
=
d
.
z
;
this
.
n32
=
e
.
z
;
this
.
n33
=
f
.
z
;
return
this
},
multiply
:
function
(
a
,
b
){
var
c
=
a
.
n11
,
d
=
a
.
n12
,
e
=
a
.
n13
,
f
=
a
.
n14
,
g
=
a
.
n21
,
h
=
a
.
n22
,
k
=
a
.
n23
,
i
=
a
.
n24
,
j
=
a
.
n31
,
m
=
a
.
n32
,
n
=
a
.
n33
,
l
=
a
.
n34
,
p
=
a
.
n41
,
o
=
a
.
n42
,
q
=
a
.
n43
,
y
=
a
.
n44
,
v
=
b
.
n11
,
D
=
b
.
n12
,
t
=
b
.
n13
,
u
=
b
.
n14
,
B
=
b
.
n21
,
x
=
b
.
n22
,
z
=
b
.
n23
,
E
=
b
.
n24
,
C
=
b
.
n31
,
F
=
b
.
n32
,
A
=
b
.
n33
,
L
=
b
.
n34
,
O
=
b
.
n41
,
M
=
b
.
n42
,
Q
=
b
.
n43
,
T
=
b
.
n44
;
this
.
n11
=
c
*
v
+
d
*
B
+
e
*
C
+
f
*
O
;
this
.
n12
=
c
*
D
+
d
*
x
+
e
*
F
+
f
*
M
;
this
.
n13
=
c
*
t
+
d
*
z
+
e
*
A
+
f
*
Q
;
this
.
n14
=
c
*
u
+
d
*
E
+
e
*
L
+
f
*
T
;
this
.
n21
=
g
*
v
+
h
*
B
+
k
*
C
+
i
*
O
;
this
.
n22
=
g
*
D
+
h
*
x
+
k
*
F
+
i
*
M
;
this
.
n23
=
g
*
t
+
h
*
z
+
k
*
A
+
i
*
Q
;
this
.
n24
=
g
*
u
+
h
*
E
+
k
*
L
+
i
*
T
;
this
.
n31
=
j
*
v
+
m
*
B
+
n
*
C
+
l
*
O
;
this
.
n32
=
j
*
D
+
m
*
x
+
n
*
F
+
l
*
M
;
this
.
n33
=
j
*
t
+
m
*
z
+
n
*
A
+
l
*
Q
;
this
.
n34
=
j
*
u
+
m
*
E
+
n
*
L
+
l
*
T
;
this
.
n41
=
p
*
v
+
o
*
B
+
q
*
C
+
y
*
O
;
this
.
n42
=
p
*
D
+
o
*
x
+
q
*
F
+
y
*
M
;
this
.
n43
=
p
*
t
+
o
*
z
+
q
*
A
+
y
*
Q
;
this
.
n44
=
p
*
u
+
o
*
E
+
q
*
L
+
y
*
T
;
return
this
},
multiplySelf
:
function
(
a
){
return
this
.
multiply
(
this
,
a
)},
multiplyToArray
:
function
(
a
,
b
,
c
){
this
.
multiply
(
a
,
b
);
c
[
0
]
=
this
.
n11
;
c
[
1
]
=
this
.
n21
;
c
[
2
]
=
this
.
n31
;
c
[
3
]
=
this
.
n41
;
c
[
4
]
=
this
.
n12
;
c
[
5
]
=
this
.
n22
;
c
[
6
]
=
this
.
n32
;
c
[
7
]
=
this
.
n42
;
c
[
8
]
=
this
.
n13
;
c
[
9
]
=
this
.
n23
;
c
[
10
]
=
this
.
n33
;
c
[
11
]
=
this
.
n43
;
c
[
12
]
=
this
.
n14
;
c
[
13
]
=
this
.
n24
;
c
[
14
]
=
this
.
n34
;
c
[
15
]
=
this
.
n44
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
n11
*=
a
;
this
.
n12
*=
a
;
this
.
n13
*=
a
;
this
.
n14
*=
a
;
this
.
n21
*=
a
;
this
.
n22
*=
a
;
this
.
n23
*=
a
;
this
.
n24
*=
a
;
this
.
n31
*=
a
;
this
.
n32
*=
a
;
this
.
n33
*=
a
;
this
.
n34
*=
a
;
this
.
n41
*=
a
;
this
.
n42
*=
a
;
this
.
n43
*=
a
;
this
.
n44
*=
a
;
return
this
},
multiplyVector3
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
,
e
=
1
/
(
this
.
n41
*
b
+
this
.
n42
*
c
+
this
.
n43
*
d
+
this
.
n44
);
a
.
x
=
(
this
.
n11
*
b
+
this
.
n12
*
c
+
this
.
n13
*
d
+
this
.
n14
)
*
e
;
a
.
y
=
(
this
.
n21
*
b
+
this
.
n22
*
c
+
this
.
n23
*
d
+
this
.
n24
)
*
e
;
a
.
z
=
(
this
.
n31
*
b
+
this
.
n32
*
c
+
this
.
n33
*
d
+
this
.
n34
)
*
e
;
return
a
},
multiplyVector4
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
,
e
=
a
.
w
;
a
.
x
=
this
.
n11
*
b
+
this
.
n12
*
c
+
this
.
n13
*
d
+
this
.
n14
*
e
;
a
.
y
=
this
.
n21
*
b
+
this
.
n22
*
c
+
this
.
n23
*
d
+
this
.
n24
*
e
;
a
.
z
=
this
.
n31
*
b
+
this
.
n32
*
c
+
this
.
n33
*
d
+
this
.
n34
*
e
;
a
.
w
=
this
.
n41
*
b
+
this
.
n42
*
c
+
this
.
n43
*
d
+
this
.
n44
*
e
;
return
a
},
rotateAxis
:
function
(
a
){
var
b
=
a
.
x
,
c
=
a
.
y
,
d
=
a
.
z
;
a
.
x
=
b
*
this
.
n11
+
c
*
this
.
n12
+
d
*
this
.
n13
;
a
.
y
=
b
*
this
.
n21
+
c
*
this
.
n22
+
d
*
this
.
n23
;
a
.
z
=
b
*
this
.
n31
+
c
*
this
.
n32
+
d
*
this
.
n33
;
a
.
normalize
();
return
a
},
crossVector
:
function
(
a
){
var
b
=
new
THREE
.
Vector4
;
b
.
x
=
this
.
n11
*
a
.
x
+
this
.
n12
*
a
.
y
+
this
.
n13
*
a
.
z
+
this
.
n14
*
a
.
w
;
b
.
y
=
this
.
n21
*
a
.
x
+
this
.
n22
*
a
.
y
+
this
.
n23
*
a
.
z
+
this
.
n24
*
a
.
w
;
b
.
z
=
this
.
n31
*
a
.
x
+
this
.
n32
*
a
.
y
+
this
.
n33
*
a
.
z
+
this
.
n34
*
a
.
w
;
b
.
w
=
a
.
w
?
this
.
n41
*
a
.
x
+
this
.
n42
*
a
.
y
+
this
.
n43
*
a
.
z
+
this
.
n44
*
a
.
w
:
1
;
return
b
},
determinant
:
function
(){
var
a
=
this
.
n11
,
b
=
this
.
n12
,
c
=
this
.
n13
,
d
=
this
.
n14
,
e
=
this
.
n21
,
f
=
this
.
n22
,
g
=
this
.
n23
,
h
=
this
.
n24
,
k
=
this
.
n31
,
i
=
this
.
n32
,
j
=
this
.
n33
,
m
=
this
.
n34
,
n
=
this
.
n41
,
l
=
this
.
n42
,
p
=
this
.
n43
,
o
=
this
.
n44
;
return
d
*
g
*
i
*
n
-
c
*
h
*
i
*
n
-
d
*
f
*
j
*
n
+
b
*
h
*
j
*
n
+
c
*
f
*
m
*
n
-
b
*
g
*
m
*
n
-
d
*
g
*
k
*
l
+
c
*
h
*
k
*
l
+
d
*
e
*
j
*
l
-
a
*
h
*
j
*
l
-
c
*
e
*
m
*
l
+
a
*
g
*
m
*
l
+
d
*
f
*
k
*
p
-
b
*
h
*
k
*
p
-
d
*
e
*
i
*
p
+
a
*
h
*
i
*
p
+
b
*
e
*
m
*
p
-
a
*
f
*
m
*
p
-
c
*
f
*
k
*
o
+
b
*
g
*
k
*
o
+
c
*
e
*
i
*
o
-
a
*
g
*
i
*
o
-
b
*
e
*
j
*
o
+
a
*
f
*
j
*
o
},
transpose
:
function
(){
var
a
;
a
=
this
.
n21
;
this
.
n21
=
this
.
n12
;
this
.
n12
=
a
;
a
=
this
.
n31
;
this
.
n31
=
this
.
n13
;
this
.
n13
=
a
;
a
=
this
.
n32
;
this
.
n32
=
this
.
n23
;
this
.
n23
=
a
;
a
=
this
.
n41
;
this
.
n41
=
this
.
n14
;
this
.
n14
=
a
;
a
=
this
.
n42
;
this
.
n42
=
this
.
n24
;
this
.
n24
=
a
;
a
=
this
.
n43
;
this
.
n43
=
this
.
n34
;
this
.
n34
=
a
;
return
this
},
clone
:
function
(){
var
a
=
new
THREE
.
Matrix4
;
a
.
n11
=
this
.
n11
;
a
.
n12
=
this
.
n12
;
a
.
n13
=
this
.
n13
;
a
.
n14
=
this
.
n14
;
a
.
n21
=
this
.
n21
;
a
.
n22
=
this
.
n22
;
a
.
n23
=
this
.
n23
;
a
.
n24
=
this
.
n24
;
a
.
n31
=
this
.
n31
;
a
.
n32
=
this
.
n32
;
a
.
n33
=
this
.
n33
;
a
.
n34
=
this
.
n34
;
a
.
n41
=
this
.
n41
;
a
.
n42
=
this
.
n42
;
a
.
n43
=
this
.
n43
;
a
.
n44
=
this
.
n44
;
return
a
},
flatten
:
function
(){
this
.
flat
[
0
]
=
this
.
n11
;
this
.
flat
[
1
]
=
this
.
n21
;
this
.
flat
[
2
]
=
this
.
n31
;
this
.
flat
[
3
]
=
this
.
n41
;
this
.
flat
[
4
]
=
this
.
n12
;
this
.
flat
[
5
]
=
this
.
n22
;
this
.
flat
[
6
]
=
this
.
n32
;
this
.
flat
[
7
]
=
this
.
n42
;
this
.
flat
[
8
]
=
this
.
n13
;
this
.
flat
[
9
]
=
this
.
n23
;
this
.
flat
[
10
]
=
this
.
n33
;
this
.
flat
[
11
]
=
this
.
n43
;
this
.
flat
[
12
]
=
this
.
n14
;
this
.
flat
[
13
]
=
this
.
n24
;
this
.
flat
[
14
]
=
this
.
n34
;
this
.
flat
[
15
]
=
this
.
n44
;
return
this
.
flat
},
flattenToArray
:
function
(
a
){
a
[
0
]
=
this
.
n11
;
a
[
1
]
=
this
.
n21
;
a
[
2
]
=
this
.
n31
;
a
[
3
]
=
this
.
n41
;
a
[
4
]
=
this
.
n12
;
a
[
5
]
=
this
.
n22
;
a
[
6
]
=
this
.
n32
;
a
[
7
]
=
this
.
n42
;
a
[
8
]
=
this
.
n13
;
a
[
9
]
=
this
.
n23
;
a
[
10
]
=
this
.
n33
;
a
[
11
]
=
this
.
n43
;
a
[
12
]
=
this
.
n14
;
a
[
13
]
=
this
.
n24
;
a
[
14
]
=
this
.
n34
;
a
[
15
]
=
this
.
n44
;
return
a
},
flattenToArrayOffset
:
function
(
a
,
b
){
a
[
b
]
=
this
.
n11
;
a
[
b
+
1
]
=
this
.
n21
;
a
[
b
+
2
]
=
this
.
n31
;
a
[
b
+
3
]
=
this
.
n41
;
a
[
b
+
4
]
=
this
.
n12
;
a
[
b
+
5
]
=
this
.
n22
;
a
[
b
+
6
]
=
this
.
n32
;
a
[
b
+
7
]
=
this
.
n42
;
a
[
b
+
8
]
=
this
.
n13
;
a
[
b
+
9
]
=
this
.
n23
;
a
[
b
+
10
]
=
this
.
n33
;
a
[
b
+
11
]
=
this
.
n43
;
a
[
b
+
12
]
=
this
.
n14
;
a
[
b
+
13
]
=
this
.
n24
;
a
[
b
+
14
]
=
this
.
n34
;
a
[
b
+
15
]
=
this
.
n44
;
return
a
},
...
...
@@ -78,7 +78,7 @@ f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);this
-
Math
.
abs
(
this
.
y
):
Math
.
abs
(
this
.
y
);
this
.
z
=
0
>
a
.
n21
-
a
.
n12
?
-
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
);
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
,
m
=
k
*
e
+
f
*
d
-
g
*
c
,
c
=-
f
*
c
-
g
*
d
-
h
*
e
;
b
.
x
=
i
*
k
+
c
*-
f
+
j
*-
h
-
m
*-
g
;
b
.
y
=
j
*
k
+
c
*-
g
+
m
*-
f
-
i
*-
h
;
b
.
z
=
m
*
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
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
.
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
.
Vertex
.
prototype
=
{
constructor
:
THREE
.
Vertex
,
clone
:
function
(){
return
new
THREE
.
Vertex
(
this
.
position
.
clone
())}};
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
.
Face3
.
prototype
=
{
constructor
:
THREE
.
Face3
,
clone
:
function
(){
var
a
=
new
THREE
.
Face3
(
this
.
a
,
this
.
b
,
this
.
c
);
a
.
normal
.
copy
(
this
.
normal
);
a
.
color
.
copy
(
this
.
color
);
a
.
centroid
.
copy
(
this
.
centroid
);
a
.
materialIndex
=
this
.
materialIndex
;
var
b
,
c
;
for
(
b
=
0
,
c
=
this
.
vertexNormals
.
length
;
b
<
c
;
b
++
)
a
.
vertexNormals
[
b
]
=
this
.
vertexNormals
[
b
].
clone
();
for
(
b
=
0
,
c
=
this
.
vertexColors
.
length
;
b
<
c
;
b
++
)
a
.
vertexColors
[
b
]
=
this
.
vertexColors
[
b
].
clone
();
for
(
b
=
0
,
c
=
this
.
vertexTangents
.
length
;
b
<
c
;
b
++
)
a
.
vertexTangents
[
b
]
=
this
.
vertexTangents
[
b
].
clone
();
return
a
}};
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
};
...
...
build/custom/ThreeWebGL.js
浏览文件 @
6b63c04d
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录