Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
d1ae3fb4
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,发现更多精彩内容 >>
提交
d1ae3fb4
编写于
4月 09, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds. All seems to be good again.
上级
ed1c30ff
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
689 addition
and
668 deletion
+689
-668
build/Three.js
build/Three.js
+356
-353
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
+107
-93
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+1
-1
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+223
-219
未找到文件。
build/Three.js
浏览文件 @
d1ae3fb4
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
build/custom/ThreeCanvas.js
浏览文件 @
d1ae3fb4
...
...
@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
e
;
return
this
},
setFromEuler
:
function
(
a
){
var
b
=
0.5
*
Math
.
PI
/
360
,
c
=
a
.
x
*
b
,
e
=
a
.
y
*
b
,
d
=
a
.
z
*
b
;
a
=
Math
.
cos
(
e
);
e
=
Math
.
sin
(
e
);
b
=
Math
.
cos
(
-
d
);
d
=
Math
.
sin
(
-
d
);
var
g
=
Math
.
cos
(
c
);
c
=
Math
.
sin
(
c
);
var
f
=
a
*
b
,
i
=
e
*
d
;
this
.
w
=
f
*
g
-
i
*
c
;
this
.
x
=
f
*
c
+
i
*
g
;
this
.
y
=
e
*
b
*
g
+
a
*
d
*
c
;
this
.
z
=
a
*
d
*
g
-
e
*
b
*
c
;
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
);
if
(
a
==
0
)
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
;
else
{
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
,
e
=
this
.
z
,
d
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
i
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
b
*
a
+
d
*
g
+
c
*
i
-
e
*
f
;
this
.
y
=
c
*
a
+
d
*
f
+
e
*
g
-
b
*
i
;
this
.
z
=
e
*
a
+
d
*
i
+
b
*
f
-
c
*
g
;
this
.
w
=
d
*
a
-
b
*
g
-
c
*
f
-
e
*
i
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
e
=
a
.
y
,
d
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
i
=
this
.
z
,
h
=
this
.
w
,
j
=
h
*
c
+
f
*
d
-
i
*
e
,
k
=
h
*
e
+
i
*
c
-
g
*
d
,
n
=
h
*
d
+
g
*
e
-
f
*
c
;
c
=-
g
*
c
-
f
*
e
-
i
*
d
;
b
.
x
=
j
*
h
+
c
*-
g
+
k
*-
i
-
n
*-
f
;
b
.
y
=
k
*
h
+
c
*-
f
+
n
*-
g
-
j
*-
i
;
b
.
z
=
n
*
h
+
c
*-
i
+
j
*-
f
-
k
*-
g
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
0
){
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
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
){
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
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
e
,
d
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
d
instanceof
THREE
.
Color
?
d
:
new
THREE
.
Color
;
this
.
vertexColors
=
d
instanceof
Array
?
d
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
e
,
d
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
e
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
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
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
edges
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
morphColors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
...
...
build/custom/ThreeDOM.js
浏览文件 @
d1ae3fb4
...
...
@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
e
;
return
this
},
setFromEuler
:
function
(
a
){
var
b
=
0.5
*
Math
.
PI
/
360
,
c
=
a
.
x
*
b
,
e
=
a
.
y
*
b
,
d
=
a
.
z
*
b
;
a
=
Math
.
cos
(
e
);
e
=
Math
.
sin
(
e
);
b
=
Math
.
cos
(
-
d
);
d
=
Math
.
sin
(
-
d
);
var
g
=
Math
.
cos
(
c
);
c
=
Math
.
sin
(
c
);
var
f
=
a
*
b
,
i
=
e
*
d
;
this
.
w
=
f
*
g
-
i
*
c
;
this
.
x
=
f
*
c
+
i
*
g
;
this
.
y
=
e
*
b
*
g
+
a
*
d
*
c
;
this
.
z
=
a
*
d
*
g
-
e
*
b
*
c
;
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
);
if
(
a
==
0
)
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
;
else
{
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
,
e
=
this
.
z
,
d
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
i
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
b
*
a
+
d
*
g
+
c
*
i
-
e
*
f
;
this
.
y
=
c
*
a
+
d
*
f
+
e
*
g
-
b
*
i
;
this
.
z
=
e
*
a
+
d
*
i
+
b
*
f
-
c
*
g
;
this
.
w
=
d
*
a
-
b
*
g
-
c
*
f
-
e
*
i
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
e
=
a
.
y
,
d
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
i
=
this
.
z
,
h
=
this
.
w
,
j
=
h
*
c
+
f
*
d
-
i
*
e
,
l
=
h
*
e
+
i
*
c
-
g
*
d
,
m
=
h
*
d
+
g
*
e
-
f
*
c
;
c
=-
g
*
c
-
f
*
e
-
i
*
d
;
b
.
x
=
j
*
h
+
c
*-
g
+
l
*-
i
-
m
*-
f
;
b
.
y
=
l
*
h
+
c
*-
f
+
m
*-
g
-
j
*-
i
;
b
.
z
=
m
*
h
+
c
*-
i
+
j
*-
f
-
l
*-
g
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
0
){
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
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
){
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
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
e
,
d
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
d
instanceof
THREE
.
Color
?
d
:
new
THREE
.
Color
;
this
.
vertexColors
=
d
instanceof
Array
?
d
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
e
,
d
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
e
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
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
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
...
...
build/custom/ThreeExtras.js
浏览文件 @
d1ae3fb4
// ThreeExtras.js r38 - http://github.com/mrdoob/three.js
var
GeometryUtils
=
{
merge
:
function
(
a
,
f
){
var
b
=
f
instanceof
THREE
.
Mesh
,
e
=
a
.
vertices
.
length
,
c
=
b
?
f
.
geometry
:
f
,
d
=
a
.
vertices
,
g
=
c
.
vertices
,
h
=
a
.
faces
,
j
=
c
.
faces
,
m
=
a
.
faceVertexUvs
[
0
];
c
=
c
.
faceVertexUvs
[
0
];
b
&&
f
.
matrixAutoUpdate
&&
f
.
updateMatrix
();
for
(
var
k
=
0
,
n
=
g
.
length
;
k
<
n
;
k
++
){
var
p
=
new
THREE
.
Vertex
(
g
[
k
].
position
.
clone
());
b
&&
f
.
matrix
.
multiplyVector3
(
p
.
position
);
d
.
push
(
p
)}
k
=
0
;
for
(
n
=
j
.
length
;
k
<
n
;
k
++
){
g
=
j
[
k
];
var
t
,
w
,
x
=
g
.
vertexNormals
;
p
=
g
.
vertexColors
;
if
(
g
instanceof
THREE
.
Face3
)
t
=
new
THREE
.
Face3
(
g
.
a
+
e
,
g
.
b
+
e
,
g
.
c
+
e
);
else
g
instanceof
THREE
.
Face4
&&
(
t
=
new
THREE
.
Face4
(
g
.
a
+
e
,
g
.
b
+
e
,
g
.
c
+
e
,
g
.
d
+
e
));
t
.
normal
.
copy
(
g
.
normal
);
b
=
0
;
for
(
d
=
x
.
length
;
b
<
d
;
b
++
){
w
=
x
[
b
];
t
.
vertexNormals
.
push
(
w
.
clone
())}
t
.
color
.
copy
(
g
.
color
);
b
=
0
;
for
(
d
=
p
.
length
;
b
<
d
;
b
++
){
w
=
p
[
b
];
t
.
vertexColors
.
push
(
w
.
clone
())}
t
.
materials
=
g
.
materials
.
slice
();
t
.
centroid
.
copy
(
g
.
centroid
);
h
.
push
(
t
)}
k
=
0
;
for
(
n
=
c
.
length
;
k
<
n
;
k
++
){
e
=
c
[
k
];
h
=
[];
b
=
0
;
for
(
d
=
e
.
length
;
b
<
d
;
b
++
)
h
.
push
(
new
THREE
.
UV
(
e
[
b
].
u
,
e
[
b
].
v
));
m
.
push
(
h
)}}},
ImageUtils
=
{
loadTexture
:
function
(
a
,
f
,
b
){
var
e
=
new
Image
,
c
=
new
THREE
.
Texture
(
e
,
f
);
e
.
onload
=
function
(){
c
.
needsUpdate
=!
0
;
b
&&
b
(
this
)};
e
.
src
=
a
;
return
c
},
loadTextureCube
:
function
(
a
,
f
,
b
){
var
e
,
c
=
[],
d
=
new
THREE
.
Texture
(
c
,
f
);
f
=
c
.
loadCount
=
0
;
for
(
e
=
a
.
length
;
f
<
e
;
++
f
){
c
[
f
]
=
new
Image
;
c
[
f
].
onload
=
function
(){
c
.
loadCount
+=
1
;
if
(
c
.
loadCount
==
6
)
d
.
needsUpdate
=!
0
;
b
&&
b
(
this
)};
c
[
f
].
src
=
a
[
f
]}
return
d
}},
SceneUtils
=
{
addMesh
:
function
(
a
,
f
,
b
,
e
,
c
,
d
,
g
,
h
,
j
,
m
){
f
=
new
THREE
.
Mesh
(
f
,
m
);
f
.
scale
.
x
=
f
.
scale
.
y
=
f
.
scale
.
z
=
b
;
f
.
position
.
x
=
e
;
f
.
position
.
y
=
c
;
f
.
position
.
z
=
d
;
f
.
rotation
.
x
=
g
;
f
.
rotation
.
y
=
h
;
f
.
rotation
.
z
=
j
;
a
.
addObject
(
f
);
return
f
},
addPanoramaCubeWebGL
:
function
(
a
,
f
,
b
){
var
e
=
ShaderUtils
.
lib
.
cube
;
e
.
uniforms
.
tCube
.
texture
=
b
;
b
=
new
THREE
.
MeshShaderMaterial
({
fragmentShader
:
e
.
fragmentShader
,
vertexShader
:
e
.
vertexShader
,
uniforms
:
e
.
uniforms
});
f
=
new
THREE
.
Mesh
(
new
Cube
(
f
,
f
,
f
,
1
,
1
,
1
,
null
,
!
0
),
b
);
a
.
addObject
(
f
);
return
f
},
addPanoramaCube
:
function
(
a
,
f
,
b
){
var
e
=
[];
e
.
push
(
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
b
[
0
])}));
e
.
push
(
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
b
[
1
])}));
e
.
push
(
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
b
[
2
])}));
e
.
push
(
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
b
[
3
])}));
e
.
push
(
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
b
[
4
])}));
e
.
push
(
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
b
[
5
])}));
f
=
new
THREE
.
Mesh
(
new
Cube
(
f
,
f
,
f
,
1
,
1
,
e
,
!
0
),
new
THREE
.
MeshFaceMaterial
);
a
.
addObject
(
f
);
return
f
},
addPanoramaCubePlanes
:
function
(
a
,
f
,
b
){
var
e
=
f
/
2
;
f
=
new
Plane
(
f
,
f
);
var
c
=
Math
.
PI
,
d
=
Math
.
PI
/
2
;
SceneUtils
.
addMesh
(
a
,
f
,
1
,
0
,
0
,
-
e
,
0
,
0
,
0
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
b
[
5
])}));
SceneUtils
.
addMesh
(
a
,
f
,
1
,
-
e
,
0
,
0
,
0
,
d
,
0
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
b
[
0
])}));
SceneUtils
.
addMesh
(
a
,
f
,
1
,
e
,
0
,
0
,
0
,
-
d
,
0
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
b
[
1
])}));
SceneUtils
.
addMesh
(
a
,
f
,
1
,
0
,
e
,
0
,
d
,
0
,
c
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
b
[
2
])}));
SceneUtils
.
addMesh
(
a
,
f
,
1
,
0
,
-
e
,
0
,
-
d
,
0
,
c
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
b
[
3
])}))},
showHierarchy
:
function
(
a
,
f
){
SceneUtils
.
traverseHierarchy
(
a
,
function
(
b
){
b
.
visible
=
f
})},
traverseHierarchy
:
function
(
a
,
f
){
var
b
,
e
,
c
=
a
.
children
.
length
;
for
(
e
=
0
;
e
<
c
;
e
++
){
b
=
a
.
children
[
e
];
f
(
b
);
SceneUtils
.
traverseHierarchy
(
b
,
f
)}}},
ShaderUtils
=
{
lib
:{
fresnel
:{
uniforms
:{
mRefractionRatio
:{
type
:
"
f
"
,
value
:
1.02
},
mFresnelBias
:{
type
:
"
f
"
,
value
:
0.1
},
mFresnelPower
:{
type
:
"
f
"
,
value
:
2
},
mFresnelScale
:{
type
:
"
f
"
,
value
:
1
},
tCube
:{
type
:
"
t
"
,
value
:
1
,
texture
:
null
}},
fragmentShader
:
"
uniform samplerCube tCube;
\n
varying vec3 vReflect;
\n
varying vec3 vRefract[3];
\n
varying float vReflectionFactor;
\n
void main() {
\n
vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );
\n
vec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );
\n
refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;
\n
refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;
\n
refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;
\n
refractedColor.a = 1.0;
\n
gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );
\n
}
"
,
var
GeometryUtils
=
{
merge
:
function
(
a
,
b
){
var
c
=
b
instanceof
THREE
.
Mesh
,
d
=
a
.
vertices
.
length
,
e
=
c
?
b
.
geometry
:
b
,
f
=
a
.
vertices
,
h
=
e
.
vertices
,
g
=
a
.
faces
,
j
=
e
.
faces
,
l
=
a
.
faceVertexUvs
[
0
];
e
=
e
.
faceVertexUvs
[
0
];
c
&&
b
.
matrixAutoUpdate
&&
b
.
updateMatrix
();
for
(
var
k
=
0
,
n
=
h
.
length
;
k
<
n
;
k
++
){
var
p
=
new
THREE
.
Vertex
(
h
[
k
].
position
.
clone
());
c
&&
b
.
matrix
.
multiplyVector3
(
p
.
position
);
f
.
push
(
p
)}
k
=
0
;
for
(
n
=
j
.
length
;
k
<
n
;
k
++
){
h
=
j
[
k
];
var
t
,
w
,
x
=
h
.
vertexNormals
;
p
=
h
.
vertexColors
;
if
(
h
instanceof
THREE
.
Face3
)
t
=
new
THREE
.
Face3
(
h
.
a
+
d
,
h
.
b
+
d
,
h
.
c
+
d
);
else
h
instanceof
THREE
.
Face4
&&
(
t
=
new
THREE
.
Face4
(
h
.
a
+
d
,
h
.
b
+
d
,
h
.
c
+
d
,
h
.
d
+
d
));
t
.
normal
.
copy
(
h
.
normal
);
c
=
0
;
for
(
f
=
x
.
length
;
c
<
f
;
c
++
){
w
=
x
[
c
];
t
.
vertexNormals
.
push
(
w
.
clone
())}
t
.
color
.
copy
(
h
.
color
);
c
=
0
;
for
(
f
=
p
.
length
;
c
<
f
;
c
++
){
w
=
p
[
c
];
t
.
vertexColors
.
push
(
w
.
clone
())}
t
.
materials
=
h
.
materials
.
slice
();
t
.
centroid
.
copy
(
h
.
centroid
);
g
.
push
(
t
)}
k
=
0
;
for
(
n
=
e
.
length
;
k
<
n
;
k
++
){
d
=
e
[
k
];
g
=
[];
c
=
0
;
for
(
f
=
d
.
length
;
c
<
f
;
c
++
)
g
.
push
(
new
THREE
.
UV
(
d
[
c
].
u
,
d
[
c
].
v
));
l
.
push
(
g
)}}},
ImageUtils
=
{
loadTexture
:
function
(
a
,
b
,
c
){
var
d
=
new
Image
,
e
=
new
THREE
.
Texture
(
d
,
b
);
d
.
onload
=
function
(){
e
.
needsUpdate
=!
0
;
c
&&
c
(
this
)};
d
.
src
=
a
;
return
e
},
loadTextureCube
:
function
(
a
,
b
,
c
){
var
d
,
e
=
[],
f
=
new
THREE
.
Texture
(
e
,
b
);
b
=
e
.
loadCount
=
0
;
for
(
d
=
a
.
length
;
b
<
d
;
++
b
){
e
[
b
]
=
new
Image
;
e
[
b
].
onload
=
function
(){
e
.
loadCount
+=
1
;
if
(
e
.
loadCount
==
6
)
f
.
needsUpdate
=!
0
;
c
&&
c
(
this
)};
e
[
b
].
src
=
a
[
b
]}
return
f
}},
SceneUtils
=
{
addMesh
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
h
,
g
,
j
,
l
){
b
=
new
THREE
.
Mesh
(
b
,
l
);
b
.
scale
.
x
=
b
.
scale
.
y
=
b
.
scale
.
z
=
c
;
b
.
position
.
x
=
d
;
b
.
position
.
y
=
e
;
b
.
position
.
z
=
f
;
b
.
rotation
.
x
=
h
;
b
.
rotation
.
y
=
g
;
b
.
rotation
.
z
=
j
;
a
.
addObject
(
b
);
return
b
},
addPanoramaCubeWebGL
:
function
(
a
,
b
,
c
){
var
d
=
ShaderUtils
.
lib
.
cube
;
d
.
uniforms
.
tCube
.
texture
=
c
;
c
=
new
THREE
.
MeshShaderMaterial
({
fragmentShader
:
d
.
fragmentShader
,
vertexShader
:
d
.
vertexShader
,
uniforms
:
d
.
uniforms
});
b
=
new
THREE
.
Mesh
(
new
Cube
(
b
,
b
,
b
,
1
,
1
,
1
,
null
,
!
0
),
c
);
a
.
addObject
(
b
);
return
b
},
addPanoramaCube
:
function
(
a
,
b
,
c
){
var
d
=
[];
d
.
push
(
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
0
])}));
d
.
push
(
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
1
])}));
d
.
push
(
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
2
])}));
d
.
push
(
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
3
])}));
d
.
push
(
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
4
])}));
d
.
push
(
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
5
])}));
b
=
new
THREE
.
Mesh
(
new
Cube
(
b
,
b
,
b
,
1
,
1
,
d
,
!
0
),
new
THREE
.
MeshFaceMaterial
);
a
.
addObject
(
b
);
return
b
},
addPanoramaCubePlanes
:
function
(
a
,
b
,
c
){
var
d
=
b
/
2
;
b
=
new
Plane
(
b
,
b
);
var
e
=
Math
.
PI
,
f
=
Math
.
PI
/
2
;
SceneUtils
.
addMesh
(
a
,
b
,
1
,
0
,
0
,
-
d
,
0
,
0
,
0
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
5
])}));
SceneUtils
.
addMesh
(
a
,
b
,
1
,
-
d
,
0
,
0
,
0
,
f
,
0
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
0
])}));
SceneUtils
.
addMesh
(
a
,
b
,
1
,
d
,
0
,
0
,
0
,
-
f
,
0
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
1
])}));
SceneUtils
.
addMesh
(
a
,
b
,
1
,
0
,
d
,
0
,
f
,
0
,
e
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
2
])}));
SceneUtils
.
addMesh
(
a
,
b
,
1
,
0
,
-
d
,
0
,
-
f
,
0
,
e
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
3
])}))},
showHierarchy
:
function
(
a
,
b
){
SceneUtils
.
traverseHierarchy
(
a
,
function
(
c
){
c
.
visible
=
b
})},
traverseHierarchy
:
function
(
a
,
b
){
var
c
,
d
,
e
=
a
.
children
.
length
;
for
(
d
=
0
;
d
<
e
;
d
++
){
c
=
a
.
children
[
d
];
b
(
c
);
SceneUtils
.
traverseHierarchy
(
c
,
b
)}}},
ShaderUtils
=
{
lib
:{
fresnel
:{
uniforms
:{
mRefractionRatio
:{
type
:
"
f
"
,
value
:
1.02
},
mFresnelBias
:{
type
:
"
f
"
,
value
:
0.1
},
mFresnelPower
:{
type
:
"
f
"
,
value
:
2
},
mFresnelScale
:{
type
:
"
f
"
,
value
:
1
},
tCube
:{
type
:
"
t
"
,
value
:
1
,
texture
:
null
}},
fragmentShader
:
"
uniform samplerCube tCube;
\n
varying vec3 vReflect;
\n
varying vec3 vRefract[3];
\n
varying float vReflectionFactor;
\n
void main() {
\n
vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );
\n
vec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );
\n
refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;
\n
refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;
\n
refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;
\n
refractedColor.a = 1.0;
\n
gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );
\n
}
"
,
vertexShader
:
"
uniform float mRefractionRatio;
\n
uniform float mFresnelBias;
\n
uniform float mFresnelScale;
\n
uniform float mFresnelPower;
\n
varying vec3 vReflect;
\n
varying vec3 vRefract[3];
\n
varying float vReflectionFactor;
\n
void main() {
\n
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
\n
vec4 mPosition = objectMatrix * vec4( position, 1.0 );
\n
vec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );
\n
vec3 I = mPosition.xyz - cameraPosition;
\n
vReflect = reflect( I, nWorld );
\n
vRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );
\n
vRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );
\n
vRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );
\n
vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );
\n
gl_Position = projectionMatrix * mvPosition;
\n
}
"
},
normal
:{
uniforms
:{
enableAO
:{
type
:
"
i
"
,
value
:
0
},
enableDiffuse
:{
type
:
"
i
"
,
value
:
0
},
tDiffuse
:{
type
:
"
t
"
,
value
:
0
,
texture
:
null
},
tNormal
:{
type
:
"
t
"
,
value
:
2
,
texture
:
null
},
tAO
:{
type
:
"
t
"
,
value
:
3
,
texture
:
null
},
uNormalScale
:{
type
:
"
f
"
,
value
:
1
},
tDisplacement
:{
type
:
"
t
"
,
value
:
4
,
texture
:
null
},
uDisplacementBias
:{
type
:
"
f
"
,
value
:
-
0.5
},
uDisplacementScale
:{
type
:
"
f
"
,
value
:
2.5
},
uPointLightPos
:{
type
:
"
v3
"
,
value
:
new
THREE
.
Vector3
},
uPointLightColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
15658734
)},
uDirLightPos
:{
type
:
"
v3
"
,
value
:
new
THREE
.
Vector3
},
uDirLightColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
15658734
)},
uAmbientLightColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
328965
)},
uDiffuseColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
15658734
)},
uSpecularColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
1118481
)},
uAmbientColor
:{
type
:
"
c
"
,
value
:
new
THREE
.
Color
(
328965
)},
uShininess
:{
type
:
"
f
"
,
value
:
30
}},
fragmentShader
:
"
uniform vec3 uDirLightPos;
\n
uniform vec3 uAmbientLightColor;
\n
uniform vec3 uDirLightColor;
\n
uniform vec3 uPointLightColor;
\n
uniform vec3 uAmbientColor;
\n
uniform vec3 uDiffuseColor;
\n
uniform vec3 uSpecularColor;
\n
uniform float uShininess;
\n
uniform bool enableDiffuse;
\n
uniform bool enableAO;
\n
uniform sampler2D tDiffuse;
\n
uniform sampler2D tNormal;
\n
uniform sampler2D tAO;
\n
uniform float uNormalScale;
\n
varying vec3 vTangent;
\n
varying vec3 vBinormal;
\n
varying vec3 vNormal;
\n
varying vec2 vUv;
\n
varying vec3 vPointLightVector;
\n
varying vec3 vViewPosition;
\n
void main() {
\n
vec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );
\n
vec3 aoTex = vec3( 1.0, 1.0, 1.0 );
\n
vec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;
\n
normalTex.xy *= uNormalScale;
\n
normalTex = normalize( normalTex );
\n
if( enableDiffuse )
\n
diffuseTex = texture2D( tDiffuse, vUv ).xyz;
\n
if( enableAO )
\n
aoTex = texture2D( tAO, vUv ).xyz;
\n
mat3 tsb = mat3( vTangent, vBinormal, vNormal );
\n
vec3 finalNormal = tsb * normalTex;
\n
vec3 normal = normalize( finalNormal );
\n
vec3 viewPosition = normalize( vViewPosition );
\n
vec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );
\n
vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );
\n
vec3 pointVector = normalize( vPointLightVector );
\n
vec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );
\n
float pointDotNormalHalf = dot( normal, pointHalfVector );
\n
float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );
\n
float pointSpecularWeight = 0.0;
\n
if ( pointDotNormalHalf >= 0.0 )
\n
pointSpecularWeight = pow( pointDotNormalHalf, uShininess );
\n
pointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;
\n
pointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;
\n
vec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );
\n
vec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );
\n
vec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );
\n
vec3 dirVector = normalize( lDirection.xyz );
\n
vec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );
\n
float dirDotNormalHalf = dot( normal, dirHalfVector );
\n
float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );
\n
float dirSpecularWeight = 0.0;
\n
if ( dirDotNormalHalf >= 0.0 )
\n
dirSpecularWeight = pow( dirDotNormalHalf, uShininess );
\n
dirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;
\n
dirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;
\n
vec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );
\n
totalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );
\n
totalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );
\n
gl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );
\n
}
"
,
...
...
@@ -14,98 +14,98 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
value
:
0
,
texture
:
null
},
uImageIncrement
:{
type
:
"
v2
"
,
value
:
new
THREE
.
Vector2
(
0.001953125
,
0
)},
cKernel
:{
type
:
"
fv1
"
,
value
:[]}},
vertexShader
:
"
varying vec2 vUv;
\n
uniform vec2 uImageIncrement;
\n
void main(void) {
\n
vUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;
\n
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
\n
}
"
,
fragmentShader
:
"
varying vec2 vUv;
\n
uniform sampler2D tDiffuse;
\n
uniform vec2 uImageIncrement;
\n
uniform float cKernel[KERNEL_SIZE];
\n
void main(void) {
\n
vec2 imageCoord = vUv;
\n
vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );
\n
for( int i=0; i<KERNEL_SIZE; ++i ) {
\n
sum += texture2D( tDiffuse, imageCoord ) * cKernel[i];
\n
imageCoord += uImageIncrement;
\n
}
\n
gl_FragColor = sum;
\n
}
"
},
film
:{
uniforms
:{
tDiffuse
:{
type
:
"
t
"
,
value
:
0
,
texture
:
null
},
time
:{
type
:
"
f
"
,
value
:
0
},
nIntensity
:{
type
:
"
f
"
,
value
:
0.5
},
sIntensity
:{
type
:
"
f
"
,
value
:
0.05
},
sCount
:{
type
:
"
f
"
,
value
:
4096
},
grayscale
:{
type
:
"
i
"
,
value
:
1
}},
vertexShader
:
"
varying vec2 vUv;
\n
void main() {
\n
vUv = vec2( uv.x, 1.0 - uv.y );
\n
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
\n
}
"
,
fragmentShader
:
"
varying vec2 vUv;
\n
uniform sampler2D tDiffuse;
\n
uniform float time;
\n
uniform bool grayscale;
\n
uniform float nIntensity;
\n
uniform float sIntensity;
\n
uniform float sCount;
\n
void main() {
\n
vec4 cTextureScreen = texture2D( tDiffuse, vUv );
\n
float x = vUv.x * vUv.y * time * 1000.0;
\n
x = mod( x, 13.0 ) * mod( x, 123.0 );
\n
float dx = mod( x, 0.01 );
\n
vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );
\n
vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );
\n
cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;
\n
cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );
\n
if( grayscale ) {
\n
cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );
\n
}
\n
gl_FragColor = vec4( cResult, cTextureScreen.a );
\n
}
"
},
screen
:{
uniforms
:{
tDiffuse
:{
type
:
"
t
"
,
value
:
0
,
texture
:
null
},
opacity
:{
type
:
"
f
"
,
value
:
1
}},
vertexShader
:
"
varying vec2 vUv;
\n
void main() {
\n
vUv = vec2( uv.x, 1.0 - uv.y );
\n
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
\n
}
"
,
fragmentShader
:
"
varying vec2 vUv;
\n
uniform sampler2D tDiffuse;
\n
uniform float opacity;
\n
void main() {
\n
vec4 texel = texture2D( tDiffuse, vUv );
\n
gl_FragColor = opacity * texel;
\n
}
"
},
basic
:{
uniforms
:{},
vertexShader
:
"
void main() {
\n
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
\n
}
"
,
fragmentShader
:
"
void main() {
\n
gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );
\n
}
"
}},
buildKernel
:
function
(
a
){
var
f
,
b
,
e
,
c
,
d
=
2
*
Math
.
ceil
(
a
*
3
)
+
1
;
d
>
25
&&
(
d
=
25
);
c
=
(
d
-
1
)
*
0.5
;
b
=
Array
(
d
);
for
(
f
=
e
=
0
;
f
<
d
;
++
f
){
b
[
f
]
=
Math
.
exp
(
-
((
f
-
c
)
*
(
f
-
c
))
/
(
2
*
a
*
a
));
e
+=
b
[
f
]}
for
(
f
=
0
;
f
<
d
;
++
f
)
b
[
f
]
/=
e
;
return
b
}};
THREE
.
QuakeCamera
=
function
(
a
){
function
f
(
b
,
e
){
return
function
(){
e
.
apply
(
b
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.0050
;
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
;
if
(
a
){
if
(
a
.
movementSpeed
!==
undefined
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
lookSpeed
!==
undefined
)
this
.
lookSpeed
=
fragmentShader
:
"
void main() {
\n
gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );
\n
}
"
}},
buildKernel
:
function
(
a
){
var
b
,
c
,
d
,
e
,
f
=
2
*
Math
.
ceil
(
a
*
3
)
+
1
;
f
>
25
&&
(
f
=
25
);
e
=
(
f
-
1
)
*
0.5
;
c
=
Array
(
f
);
for
(
b
=
d
=
0
;
b
<
f
;
++
b
){
c
[
b
]
=
Math
.
exp
(
-
((
b
-
e
)
*
(
b
-
e
))
/
(
2
*
a
*
a
));
d
+=
c
[
b
]}
for
(
b
=
0
;
b
<
f
;
++
b
)
c
[
b
]
/=
d
;
return
c
}};
THREE
.
QuakeCamera
=
function
(
a
){
function
b
(
c
,
d
){
return
function
(){
d
.
apply
(
c
,
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
;
if
(
a
){
if
(
a
.
movementSpeed
!==
undefined
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
lookSpeed
!==
undefined
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
noFly
!==
undefined
)
this
.
noFly
=
a
.
noFly
;
if
(
a
.
lookVertical
!==
undefined
)
this
.
lookVertical
=
a
.
lookVertical
;
if
(
a
.
autoForward
!==
undefined
)
this
.
autoForward
=
a
.
autoForward
;
if
(
a
.
activeLook
!==
undefined
)
this
.
activeLook
=
a
.
activeLook
;
if
(
a
.
heightSpeed
!==
undefined
)
this
.
heightSpeed
=
a
.
heightSpeed
;
if
(
a
.
heightCoef
!==
undefined
)
this
.
heightCoef
=
a
.
heightCoef
;
if
(
a
.
heightMin
!==
undefined
)
this
.
heightMin
=
a
.
heightMin
;
if
(
a
.
heightMax
!==
undefined
)
this
.
heightMax
=
a
.
heightMax
;
if
(
a
.
constrainVertical
!==
undefined
)
this
.
constrainVertical
=
a
.
constrainVertical
;
if
(
a
.
verticalMin
!==
undefined
)
this
.
verticalMin
=
a
.
verticalMin
;
if
(
a
.
verticalMax
!==
undefined
)
this
.
verticalMax
=
a
.
verticalMax
;
if
(
a
.
domElement
!==
undefined
)
this
.
domElement
=
a
.
domElement
}
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
this
.
autoSpeedFactor
=
0
;
this
.
moveForward
=!
1
;
this
.
moveBackward
=!
1
;
this
.
moveLeft
=!
1
;
this
.
moveRight
=!
1
;
this
.
freeze
=!
1
;
this
.
mouseDragOn
=!
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
=
!
0
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=!
0
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=!
0
;
break
;
case
39
:
case
68
:
this
.
moveRight
=!
0
;
break
;
case
81
:
this
.
freeze
=!
this
.
freeze
}};
this
.
onKeyUp
=
function
(
b
){
switch
(
b
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=!
1
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=!
1
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=!
1
;
break
;
case
39
:
case
68
:
this
.
moveRight
=!
1
}};
this
.
update
=
function
(){
if
(
!
this
.
freeze
){
this
.
autoSpeedFactor
=
this
.
heightSpeed
?((
this
.
position
.
y
<
this
.
heightMin
?
this
.
heightMin
:
this
.
position
.
y
>
this
.
heightMax
?
this
.
heightMax
:
this
.
position
.
y
)
-
this
.
heightMin
)
*
this
.
heightCoef
:
0
;(
this
.
moveForward
||
this
.
autoForward
)
&&
this
.
translateZ
(
-
(
this
.
movementSpeed
+
this
.
autoSpeedFactor
));
this
.
moveBackward
&&
this
.
translateZ
(
this
.
movementSpeed
);
this
.
moveLeft
&&
this
.
translateX
(
-
this
.
movementSpeed
);
this
.
moveRight
&&
this
.
translateX
(
this
.
movementSpeed
);
var
b
=
this
.
lookSpeed
;
this
.
activeLook
||
(
b
=
0
);
this
.
lon
+=
this
.
mouseX
*
b
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
b
);
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
Math
.
PI
/
180
;
this
.
theta
=
this
.
lon
*
Math
.
PI
/
180
;
var
e
=
this
.
target
.
position
,
c
=
this
.
position
;
e
.
x
=
c
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
e
.
y
=
c
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
e
.
z
=
c
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
)}
this
.
lon
+=
this
.
mouseX
*
b
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
b
);
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
Math
.
PI
/
180
;
this
.
theta
=
this
.
lon
*
Math
.
PI
/
180
;
if
(
this
.
constrainVertical
)
this
.
phi
=
(
this
.
phi
-
0
)
*
(
this
.
verticalMax
-
this
.
verticalMin
)
/
3.14
+
this
.
verticalMin
;
e
=
this
.
target
.
position
;
c
=
this
.
position
;
e
.
x
=
c
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
e
.
y
=
c
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
e
.
z
=
c
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
this
.
supr
.
update
.
call
(
this
)};
this
.
domElement
.
addEventListener
(
"
contextmenu
"
,
function
(
b
){
b
.
preventDefault
()},
!
1
);
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
f
(
this
,
this
.
onMouseMove
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mousedown
"
,
f
(
this
,
this
.
onMouseDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mouseup
"
,
f
(
this
,
this
.
onMouseUp
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keydown
"
,
f
(
this
,
this
.
onKeyDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keyup
"
,
f
(
this
,
this
.
onKeyUp
),
!
1
)};
THREE
.
QuakeCamera
.
prototype
=
new
THREE
.
Camera
;
THREE
.
QuakeCamera
.
prototype
.
constructor
=
THREE
.
QuakeCamera
;
THREE
.
QuakeCamera
.
prototype
.
supr
=
THREE
.
Camera
.
prototype
;
THREE
.
QuakeCamera
.
prototype
.
translate
=
function
(
a
,
f
){
this
.
matrix
.
rotateAxis
(
f
);
if
(
this
.
noFly
)
f
.
y
=
0
;
this
.
position
.
addSelf
(
f
.
multiplyScalar
(
a
));
this
.
target
.
position
.
addSelf
(
f
.
multiplyScalar
(
a
))};
THREE
.
PathCamera
=
function
(
a
){
function
f
(
m
,
k
,
n
,
p
){
var
t
=
{
name
:
n
,
fps
:
0.6
,
length
:
p
,
hierarchy
:[]},
w
,
x
=
k
.
getControlPointsArray
(),
u
=
k
.
getLength
(),
B
=
x
.
length
,
z
=
0
;
w
=
B
-
1
;
k
=
{
parent
:
-
1
,
keys
:[]};
k
.
keys
[
0
]
=
{
time
:
0
,
pos
:
x
[
0
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
k
.
keys
[
w
]
=
{
time
:
p
,
pos
:
x
[
w
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
for
(
w
=
1
;
w
<
B
-
1
;
w
++
){
z
=
p
*
u
.
chunks
[
w
]
/
u
.
total
;
k
.
keys
[
w
]
=
{
time
:
z
,
pos
:
x
[
w
]}}
t
.
hierarchy
[
0
]
=
k
;
THREE
.
AnimationHandler
.
add
(
t
);
return
new
THREE
.
Animation
(
m
,
n
,
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
,
!
1
)}
function
b
(
m
,
k
){
var
n
,
p
,
t
=
new
THREE
.
Geometry
;
for
(
n
=
0
;
n
<
m
.
points
.
length
*
k
;
n
++
){
p
=
n
/
(
m
.
points
.
length
*
k
);
p
=
m
.
getPoint
(
p
);
t
.
vertices
[
n
]
=
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
p
.
x
,
p
.
y
,
p
.
z
))}
return
t
}
function
e
(
m
,
k
){
var
n
=
b
(
k
,
10
),
p
=
b
(
k
,
10
),
t
=
new
THREE
.
LineBasicMaterial
({
color
:
16711680
,
linewidth
:
3
});
lineObj
=
new
THREE
.
Line
(
n
,
t
);
particleObj
=
new
THREE
.
ParticleSystem
(
p
,
new
THREE
.
ParticleBasicMaterial
({
color
:
16755200
,
size
:
3
}));
lineObj
.
scale
.
set
(
1
,
1
,
1
);
m
.
addChild
(
lineObj
);
particleObj
.
scale
.
set
(
1
,
1
,
1
);
m
.
addChild
(
particleObj
);
p
=
new
Sphere
(
1
,
16
,
8
);
t
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
});
for
(
i
=
0
;
i
<
k
.
points
.
length
;
i
++
){
n
=
new
THREE
.
Mesh
(
p
,
t
);
n
.
position
.
copy
(
k
.
points
[
i
]);
n
.
updateMatrix
();
m
.
addChild
(
n
)}}
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.0050
;
this
.
lookVertical
=
a
.
constrainVertical
;
if
(
a
.
verticalMin
!==
undefined
)
this
.
verticalMin
=
a
.
verticalMin
;
if
(
a
.
verticalMax
!==
undefined
)
this
.
verticalMax
=
a
.
verticalMax
;
if
(
a
.
domElement
!==
undefined
)
this
.
domElement
=
a
.
domElement
}
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
this
.
autoSpeedFactor
=
0
;
this
.
moveForward
=!
1
;
this
.
moveBackward
=!
1
;
this
.
moveLeft
=!
1
;
this
.
moveRight
=!
1
;
this
.
freeze
=!
1
;
this
.
mouseDragOn
=!
1
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
this
.
onMouseDown
=
function
(
c
){
c
.
preventDefault
();
c
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
c
.
button
){
case
0
:
this
.
moveForward
=!
0
;
break
;
case
2
:
this
.
moveBackward
=!
0
}
this
.
mouseDragOn
=!
0
};
this
.
onMouseUp
=
function
(
c
){
c
.
preventDefault
();
c
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
c
.
button
){
case
0
:
this
.
moveForward
=!
1
;
break
;
case
2
:
this
.
moveBackward
=!
1
}
this
.
mouseDragOn
=!
1
};
this
.
onMouseMove
=
function
(
c
){
this
.
mouseX
=
c
.
clientX
-
this
.
windowHalfX
;
this
.
mouseY
=
c
.
clientY
-
this
.
windowHalfY
};
this
.
onKeyDown
=
function
(
c
){
switch
(
c
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=
!
0
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=!
0
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=!
0
;
break
;
case
39
:
case
68
:
this
.
moveRight
=!
0
;
break
;
case
81
:
this
.
freeze
=!
this
.
freeze
}};
this
.
onKeyUp
=
function
(
c
){
switch
(
c
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=!
1
;
break
;
case
37
:
case
65
:
this
.
moveLeft
=!
1
;
break
;
case
40
:
case
83
:
this
.
moveBackward
=!
1
;
break
;
case
39
:
case
68
:
this
.
moveRight
=!
1
}};
this
.
update
=
function
(){
if
(
!
this
.
freeze
){
this
.
autoSpeedFactor
=
this
.
heightSpeed
?((
this
.
position
.
y
<
this
.
heightMin
?
this
.
heightMin
:
this
.
position
.
y
>
this
.
heightMax
?
this
.
heightMax
:
this
.
position
.
y
)
-
this
.
heightMin
)
*
this
.
heightCoef
:
0
;(
this
.
moveForward
||
this
.
autoForward
)
&&
this
.
translateZ
(
-
(
this
.
movementSpeed
+
this
.
autoSpeedFactor
));
this
.
moveBackward
&&
this
.
translateZ
(
this
.
movementSpeed
);
this
.
moveLeft
&&
this
.
translateX
(
-
this
.
movementSpeed
);
this
.
moveRight
&&
this
.
translateX
(
this
.
movementSpeed
);
var
c
=
this
.
lookSpeed
;
this
.
activeLook
||
(
c
=
0
);
this
.
lon
+=
this
.
mouseX
*
c
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
c
);
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
Math
.
PI
/
180
;
this
.
theta
=
this
.
lon
*
Math
.
PI
/
180
;
var
d
=
this
.
target
.
position
,
e
=
this
.
position
;
d
.
x
=
e
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
d
.
y
=
e
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
d
.
z
=
e
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
)}
this
.
lon
+=
this
.
mouseX
*
c
;
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
c
);
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
Math
.
PI
/
180
;
this
.
theta
=
this
.
lon
*
Math
.
PI
/
180
;
if
(
this
.
constrainVertical
)
this
.
phi
=
(
this
.
phi
-
0
)
*
(
this
.
verticalMax
-
this
.
verticalMin
)
/
3.14
+
this
.
verticalMin
;
d
=
this
.
target
.
position
;
e
=
this
.
position
;
d
.
x
=
e
.
x
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
d
.
y
=
e
.
y
+
100
*
Math
.
cos
(
this
.
phi
);
d
.
z
=
e
.
z
+
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
this
.
supr
.
update
.
call
(
this
)};
this
.
domElement
.
addEventListener
(
"
contextmenu
"
,
function
(
c
){
c
.
preventDefault
()},
!
1
);
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
b
(
this
,
this
.
onMouseMove
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mousedown
"
,
b
(
this
,
this
.
onMouseDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
mouseup
"
,
b
(
this
,
this
.
onMouseUp
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keydown
"
,
b
(
this
,
this
.
onKeyDown
),
!
1
);
this
.
domElement
.
addEventListener
(
"
keyup
"
,
b
(
this
,
this
.
onKeyUp
),
!
1
)};
THREE
.
QuakeCamera
.
prototype
=
new
THREE
.
Camera
;
THREE
.
QuakeCamera
.
prototype
.
constructor
=
THREE
.
QuakeCamera
;
THREE
.
QuakeCamera
.
prototype
.
supr
=
THREE
.
Camera
.
prototype
;
THREE
.
QuakeCamera
.
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
(
l
,
k
,
n
,
p
){
var
t
=
{
name
:
n
,
fps
:
0.6
,
length
:
p
,
hierarchy
:[]},
w
,
x
=
k
.
getControlPointsArray
(),
u
=
k
.
getLength
(),
B
=
x
.
length
,
z
=
0
;
w
=
B
-
1
;
k
=
{
parent
:
-
1
,
keys
:[]};
k
.
keys
[
0
]
=
{
time
:
0
,
pos
:
x
[
0
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
k
.
keys
[
w
]
=
{
time
:
p
,
pos
:
x
[
w
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
for
(
w
=
1
;
w
<
B
-
1
;
w
++
){
z
=
p
*
u
.
chunks
[
w
]
/
u
.
total
;
k
.
keys
[
w
]
=
{
time
:
z
,
pos
:
x
[
w
]}}
t
.
hierarchy
[
0
]
=
k
;
THREE
.
AnimationHandler
.
add
(
t
);
return
new
THREE
.
Animation
(
l
,
n
,
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
,
!
1
)}
function
c
(
l
,
k
){
var
n
,
p
,
t
=
new
THREE
.
Geometry
;
for
(
n
=
0
;
n
<
l
.
points
.
length
*
k
;
n
++
){
p
=
n
/
(
l
.
points
.
length
*
k
);
p
=
l
.
getPoint
(
p
);
t
.
vertices
[
n
]
=
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
p
.
x
,
p
.
y
,
p
.
z
))}
return
t
}
function
d
(
l
,
k
){
var
n
=
c
(
k
,
10
),
p
=
c
(
k
,
10
),
t
=
new
THREE
.
LineBasicMaterial
({
color
:
16711680
,
linewidth
:
3
});
lineObj
=
new
THREE
.
Line
(
n
,
t
);
particleObj
=
new
THREE
.
ParticleSystem
(
p
,
new
THREE
.
ParticleBasicMaterial
({
color
:
16755200
,
size
:
3
}));
lineObj
.
scale
.
set
(
1
,
1
,
1
);
l
.
addChild
(
lineObj
);
particleObj
.
scale
.
set
(
1
,
1
,
1
);
l
.
addChild
(
particleObj
);
p
=
new
Sphere
(
1
,
16
,
8
);
t
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
});
for
(
i
=
0
;
i
<
k
.
points
.
length
;
i
++
){
n
=
new
THREE
.
Mesh
(
p
,
t
);
n
.
position
.
copy
(
k
.
points
[
i
]);
n
.
updateMatrix
();
l
.
addChild
(
n
)}}
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
.
lookVertical
=
!
0
;
this
.
lookHorizontal
=!
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
!==
undefined
)
this
.
duration
=
a
.
duration
*
1
E3
;
if
(
a
.
waypoints
!==
undefined
)
this
.
waypoints
=
a
.
waypoints
;
if
(
a
.
useConstantSpeed
!==
undefined
)
this
.
useConstantSpeed
=
a
.
useConstantSpeed
;
if
(
a
.
resamplingCoef
!==
undefined
)
this
.
resamplingCoef
=
a
.
resamplingCoef
;
if
(
a
.
createDebugPath
!==
undefined
)
this
.
createDebugPath
=
a
.
createDebugPath
;
if
(
a
.
createDebugDummy
!==
undefined
)
this
.
createDebugDummy
=
a
.
createDebugDummy
;
if
(
a
.
lookSpeed
!==
undefined
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
lookVertical
!==
undefined
)
this
.
lookVertical
=
a
.
lookVertical
;
if
(
a
.
lookHorizontal
!==
undefined
)
this
.
lookHorizontal
=
a
.
lookHorizontal
;
if
(
a
.
verticalAngleMap
!==
undefined
)
this
.
verticalAngleMap
=
a
.
verticalAngleMap
;
if
(
a
.
horizontalAngleMap
!==
undefined
)
this
.
horizontalAngleMap
=
a
.
horizontalAngleMap
;
if
(
a
.
domElement
!==
undefined
)
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
c
=
Math
.
PI
*
2
,
d
=
Math
.
PI
/
180
;
this
.
update
=
function
(
m
,
k
,
n
){
var
p
,
t
;
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
)
*
d
;
this
.
theta
=
this
.
lon
*
d
;
p
=
this
.
phi
%
c
;
this
.
phi
=
p
>=
0
?
p
:
p
+
c
;
p
=
this
.
verticalAngleMap
.
srcRange
;
t
=
this
.
verticalAngleMap
.
dstRange
;
this
.
phi
=
(
this
.
phi
-
p
[
0
])
*
(
t
[
1
]
-
t
[
0
])
/
(
p
[
1
]
-
p
[
0
])
+
t
[
0
];
p
=
this
.
horizontalAngleMap
.
srcRange
;
t
=
this
.
horizontalAngleMap
.
dstRange
;
this
.
theta
=
(
this
.
theta
-
p
[
0
])
*
(
t
[
1
]
-
t
[
0
])
/
(
p
[
1
]
-
p
[
0
])
+
t
[
0
];
p
=
this
.
target
.
position
;
p
.
x
=
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
p
.
y
=
100
*
Math
.
cos
(
this
.
phi
);
p
.
z
=
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
this
.
supr
.
update
.
call
(
this
,
m
,
k
,
n
)};
this
.
onMouseMove
=
function
(
m
){
this
.
mouseX
=
m
.
clientX
-
this
.
windowHalfX
;
this
.
mouseY
=
m
.
clientY
-
this
.
windowHalfY
};
this
.
spline
=
new
THREE
.
Spline
;
this
.
spline
.
initFromArray
(
this
.
waypoints
);
this
.
useConstantSpeed
&&
this
.
spline
.
reparametrizeByArcLength
(
this
.
resamplingCoef
);
if
(
this
.
createDebugDummy
){
a
=
new
THREE
.
MeshLambertMaterial
({
color
:
30719
});
var
g
=
new
THREE
.
MeshLambertMaterial
({
color
:
65280
}),
h
=
new
Cube
(
10
,
10
,
20
),
j
=
new
Cube
(
2
,
2
,
10
);
this
.
animationParent
=
new
THREE
.
Mesh
(
h
,
a
);
a
=
new
THREE
.
Mesh
(
j
,
g
);
a
.
position
.
set
(
0
,
10
,
0
);
this
.
animation
=
f
(
this
.
animationParent
,
this
.
spline
,
this
.
id
,
this
.
duration
);
this
.
animationParent
.
addChild
(
this
);
this
.
animationParent
.
addChild
(
this
.
target
);
this
.
animationParent
.
addChild
(
a
)}
else
{
this
.
animation
=
f
(
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
(
m
,
k
){
return
function
(){
k
.
apply
(
m
,
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
;
var
Cube
=
function
(
a
,
f
,
b
,
e
,
c
,
d
,
g
,
h
,
j
){
function
m
(
u
,
B
,
z
,
l
,
y
,
C
,
G
,
K
){
var
J
,
I
,
E
=
e
||
1
,
L
=
c
||
1
,
P
=
y
/
2
,
Q
=
C
/
2
,
R
=
k
.
vertices
.
length
;
if
(
u
==
"
x
"
&&
B
==
"
y
"
||
u
==
"
y
"
&&
B
==
"
x
"
)
J
=
"
z
"
;
else
if
(
u
==
"
x
"
&&
B
==
"
z
"
||
u
==
"
z
"
&&
B
==
"
x
"
){
J
=
"
y
"
;
L
=
d
||
1
}
else
if
(
u
==
"
z
"
&&
B
==
"
y
"
||
u
==
"
y
"
&&
B
==
"
z
"
){
J
=
"
x
"
;
E
=
d
||
1
}
var
M
=
E
+
1
,
F
=
L
+
1
;
y
/=
E
;
var
N
=
C
/
L
;
for
(
I
=
0
;
I
<
F
;
I
++
)
for
(
C
=
0
;
C
<
M
;
C
++
){
var
O
=
new
THREE
.
Vector3
;
O
[
u
]
=
(
C
*
y
-
P
)
*
z
;
O
[
B
]
=
(
I
*
N
-
Q
)
*
l
;
O
[
J
]
=
G
;
k
.
vertices
.
push
(
new
THREE
.
Vertex
(
O
))}
for
(
I
=
0
;
I
<
L
;
I
++
)
for
(
C
=
0
;
C
<
E
;
C
++
){
k
.
faces
.
push
(
new
THREE
.
Face4
(
C
+
M
*
I
+
R
,
C
+
M
*
(
I
+
1
)
+
R
,
C
+
1
+
M
*
(
I
+
1
)
+
R
,
C
+
1
+
M
*
I
+
R
,
null
,
null
,
K
));
k
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
C
/
E
,
I
/
L
),
new
THREE
.
UV
(
C
/
E
,(
I
+
1
)
/
L
),
new
THREE
.
UV
((
C
+
1
)
/
E
,(
I
+
1
)
/
L
),
new
THREE
.
UV
((
C
+
1
)
/
E
,
I
/
L
)])}}
THREE
.
Geometry
.
call
(
this
);
var
k
=
this
,
n
=
a
/
2
,
p
=
f
/
2
,
t
=
b
/
2
;
h
=
h
?
-
1
:
1
;
if
(
g
!==
undefined
)
if
(
g
instanceof
Array
)
this
.
materials
=
g
;
else
{
this
.
materials
=
[];
for
(
var
w
=
0
;
w
<
6
;
w
++
)
this
.
materials
.
push
([
g
])}
else
this
.
materials
=
[];
this
.
sides
=
{
px
:
!
0
,
nx
:
!
0
,
py
:
!
0
,
ny
:
!
0
,
pz
:
!
0
,
nz
:
!
0
};
if
(
j
!=
undefined
)
for
(
var
x
in
j
)
this
.
sides
[
x
]
!=
undefined
&&
(
this
.
sides
[
x
]
=
j
[
x
]);
this
.
sides
.
px
&&
m
(
"
z
"
,
"
y
"
,
1
*
h
,
-
1
,
b
,
f
,
-
n
,
this
.
materials
[
0
]);
this
.
sides
.
nx
&&
m
(
"
z
"
,
"
y
"
,
-
1
*
h
,
-
1
,
b
,
f
,
n
,
this
.
materials
[
1
]);
this
.
sides
.
py
&&
m
(
"
x
"
,
"
z
"
,
1
*
h
,
1
,
a
,
b
,
p
,
this
.
materials
[
2
]);
this
.
sides
.
ny
&&
m
(
"
x
"
,
"
z
"
,
1
*
h
,
-
1
,
a
,
b
,
-
p
,
this
.
materials
[
3
]);
this
.
sides
.
pz
&&
m
(
"
x
"
,
"
y
"
,
1
*
h
,
-
1
,
a
,
f
,
t
,
this
.
materials
[
4
]);
this
.
sides
.
nz
&&
m
(
"
x
"
,
"
y
"
,
-
1
*
h
,
-
1
,
a
,
f
,
-
t
,
this
.
materials
[
5
]);(
function
(){
for
(
var
u
=
[],
B
=
[],
z
=
0
,
l
=
k
.
vertices
.
length
;
z
<
l
;
z
++
){
for
(
var
y
=
k
.
vertices
[
z
],
C
=!
1
,
G
=
0
,
K
=
u
.
length
;
G
<
K
;
G
++
){
var
J
=
u
[
G
];
if
(
y
.
position
.
x
==
J
.
position
.
x
&&
y
.
position
.
y
==
J
.
position
.
y
&&
y
.
position
.
z
==
J
.
position
.
z
){
B
[
z
]
=
G
;
C
=!
0
;
break
}}
if
(
!
C
){
B
[
z
]
=
u
.
length
;
u
.
push
(
new
THREE
.
Vertex
(
y
.
position
.
clone
()))}}
z
=
0
;
for
(
l
=
k
.
faces
.
length
;
z
<
l
;
z
++
){
y
=
k
.
faces
[
z
];
y
.
a
=
B
[
y
.
a
];
y
.
b
=
B
[
y
.
b
];
y
.
c
=
B
[
y
.
c
];
y
.
d
=
B
[
y
.
d
]}
k
.
vertices
=
u
})();
this
.
computeCentroids
();
this
.
computeFaceNormals
()};
Cube
.
prototype
=
new
THREE
.
Geometry
;
Cube
.
prototype
.
constructor
=
Cube
;
var
Cylinder
=
function
(
a
,
f
,
b
,
e
,
c
,
d
){
function
g
(
p
,
t
,
w
){
h
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
p
,
t
,
w
)))}
THREE
.
Geometry
.
call
(
this
);
var
h
=
this
,
j
,
m
=
Math
.
PI
*
2
,
k
=
e
/
2
;
for
(
j
=
0
;
j
<
a
;
j
++
)
g
(
Math
.
sin
(
m
*
j
/
a
)
*
f
,
Math
.
cos
(
m
*
j
/
a
)
*
f
,
-
k
);
for
(
j
=
0
;
j
<
a
;
j
++
)
g
(
Math
.
sin
(
m
*
j
/
a
)
*
b
,
Math
.
cos
(
m
*
j
/
a
)
*
b
,
k
);
for
(
j
=
0
;
j
<
a
;
j
++
)
h
.
faces
.
push
(
new
THREE
.
Face4
(
j
,
j
+
a
,
a
+
(
j
+
1
)
%
a
,(
j
+
1
)
%
a
));
if
(
b
>
0
){
g
(
0
,
0
,
-
k
-
(
d
||
0
));
for
(
j
=
a
;
j
<
a
+
a
/
2
;
j
++
)
h
.
faces
.
push
(
new
THREE
.
Face4
(
2
*
a
,(
2
*
j
-
2
*
a
)
%
a
,(
2
*
j
-
2
*
a
+
1
)
%
a
,(
2
*
j
-
2
*
a
+
2
)
%
a
))}
if
(
f
>
0
){
g
(
0
,
0
,
k
+
(
c
||
0
));
for
(
j
=
a
+
a
/
2
;
j
<
2
*
a
;
j
++
)
h
.
faces
.
push
(
new
THREE
.
Face4
(
2
*
a
+
1
,(
2
*
j
-
2
*
a
+
2
)
%
a
+
a
,(
2
*
j
-
2
*
a
+
1
)
%
a
+
a
,(
2
*
j
-
2
*
a
)
%
a
+
a
))}
j
=
0
;
for
(
a
=
this
.
faces
.
length
;
j
<
a
;
j
++
){
f
=
[];
b
=
this
.
faces
[
j
];
c
=
this
.
vertices
[
b
.
a
];
d
=
this
.
vertices
[
b
.
b
];
k
=
this
.
vertices
[
b
.
c
];
var
n
=
this
.
vertices
[
b
.
d
];
f
.
push
(
new
THREE
.
UV
(
0.5
+
Math
.
atan2
(
c
.
position
.
x
,
c
.
position
.
y
)
/
m
,
0.5
+
c
.
position
.
z
/
e
));
f
.
push
(
new
THREE
.
UV
(
0.5
+
Math
.
atan2
(
d
.
position
.
x
,
d
.
position
.
y
)
/
m
,
0.5
+
d
.
position
.
z
/
e
));
f
.
push
(
new
THREE
.
UV
(
0.5
+
Math
.
atan2
(
k
.
position
.
x
,
k
.
position
.
y
)
/
m
,
0.5
+
k
.
position
.
z
/
e
));
b
instanceof
THREE
.
Face4
&&
f
.
push
(
new
THREE
.
UV
(
0.5
+
Math
.
atan2
(
n
.
position
.
x
,
n
.
position
.
y
)
/
m
,
0.5
+
n
.
position
.
z
/
e
));
this
.
faceVertexUvs
[
0
].
push
(
f
)}
this
.
computeCentroids
();
this
.
computeFaceNormals
()};
Cylinder
.
prototype
=
new
THREE
.
Geometry
;
Cylinder
.
prototype
.
constructor
=
Cylinder
;
var
Icosahedron
=
function
(
a
){
function
f
(
n
,
p
,
t
){
var
w
=
Math
.
sqrt
(
n
*
n
+
p
*
p
+
t
*
t
);
return
c
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
n
/
w
,
p
/
w
,
t
/
w
)))
-
1
}
function
b
(
n
,
p
,
t
,
w
){
w
.
faces
.
push
(
new
THREE
.
Face3
(
n
,
p
,
t
))}
function
e
(
n
,
p
){
var
t
=
c
.
vertices
[
n
].
position
,
w
=
c
.
vertices
[
p
].
position
;
return
f
((
t
.
x
+
w
.
x
)
/
2
,(
t
.
y
+
w
.
y
)
/
2
,(
t
.
z
+
w
.
z
)
/
2
)}
var
c
=
this
,
d
=
new
THREE
.
Geometry
,
g
;
this
.
subdivisions
=
a
||
0
;
THREE
.
Geometry
.
call
(
this
);
a
=
(
1
+
Math
.
sqrt
(
5
))
/
2
;
f
(
-
1
,
a
,
0
);
f
(
1
,
a
,
0
);
f
(
-
1
,
-
a
,
0
);
f
(
1
,
-
a
,
0
);
f
(
0
,
-
1
,
a
);
f
(
0
,
1
,
a
);
f
(
0
,
-
1
,
-
a
);
f
(
0
,
1
,
-
a
);
f
(
a
,
0
,
-
1
);
f
(
a
,
0
,
1
);
f
(
-
a
,
0
,
-
1
);
f
(
-
a
,
0
,
1
);
b
(
0
,
11
,
5
,
d
);
b
(
0
,
5
,
1
,
d
);
b
(
0
,
1
,
7
,
d
);
b
(
0
,
7
,
10
,
d
);
b
(
0
,
10
,
11
,
d
);
b
(
1
,
5
,
9
,
d
);
b
(
5
,
11
,
4
,
d
);
b
(
11
,
10
,
2
,
d
);
b
(
10
,
7
,
6
,
d
);
b
(
7
,
1
,
8
,
d
);
b
(
3
,
9
,
4
,
d
);
b
(
3
,
4
,
2
,
d
);
b
(
3
,
2
,
6
,
d
);
b
(
3
,
6
,
8
,
d
);
b
(
3
,
8
,
9
,
d
);
b
(
4
,
9
,
5
,
d
);
b
(
2
,
4
,
11
,
d
);
b
(
6
,
2
,
10
,
d
);
b
(
8
,
6
,
7
,
d
);
b
(
9
,
8
,
1
,
d
);
for
(
a
=
0
;
a
<
this
.
subdivisions
;
a
++
){
g
=
new
THREE
.
Geometry
;
for
(
var
h
in
d
.
faces
){
var
j
=
e
(
d
.
faces
[
h
].
a
,
d
.
faces
[
h
].
b
),
m
=
e
(
d
.
faces
[
h
].
b
,
d
.
faces
[
h
].
c
),
k
=
e
(
d
.
faces
[
h
].
c
,
d
.
faces
[
h
].
a
);
b
(
d
.
faces
[
h
].
a
,
j
,
k
,
g
);
b
(
d
.
faces
[
h
].
b
,
m
,
j
,
g
);
b
(
d
.
faces
[
h
].
c
,
k
,
m
,
g
);
b
(
j
,
m
,
k
,
g
)}
d
.
faces
=
g
.
faces
}
c
.
faces
=
d
.
faces
;
delete
d
;
delete
g
;
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
Icosahedron
.
prototype
=
new
THREE
.
Geometry
;
Icosahedron
.
prototype
.
constructor
=
Icosahedron
;
function
Lathe
(
a
,
f
,
b
){
THREE
.
Geometry
.
call
(
this
);
this
.
steps
=
f
||
12
;
this
.
angle
=
b
||
2
*
Math
.
PI
;
f
=
this
.
angle
/
this
.
steps
;
b
=
[];
for
(
var
e
=
[],
c
=
[],
d
=
[],
g
=
(
new
THREE
.
Matrix4
).
setRotationZ
(
f
),
h
=
0
;
h
<
a
.
length
;
h
++
){
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
a
[
h
]));
b
[
h
]
=
a
[
h
].
clone
();
e
[
h
]
=
this
.
vertices
.
length
-
1
}
for
(
var
j
=
0
;
j
<=
this
.
angle
+
0.0010
;
j
+=
f
){
for
(
h
=
0
;
h
<
b
.
length
;
h
++
)
if
(
j
<
this
.
angle
){
b
[
h
]
=
g
.
multiplyVector3
(
b
[
h
].
clone
());
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
b
[
h
]));
c
[
h
]
=
this
.
vertices
.
length
-
1
}
else
c
=
d
;
j
==
0
&&
(
d
=
e
);
for
(
h
=
0
;
h
<
e
.
length
-
1
;
h
++
){
this
.
faces
.
push
(
new
THREE
.
Face4
(
c
[
h
],
c
[
h
+
1
],
e
[
h
+
1
],
e
[
h
]));
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
1
-
j
/
this
.
angle
,
h
/
a
.
length
),
new
THREE
.
UV
(
1
-
j
/
this
.
angle
,(
h
+
1
)
/
a
.
length
),
new
THREE
.
UV
(
1
-
(
j
-
f
)
/
this
.
angle
,(
h
+
1
)
/
a
.
length
),
new
THREE
.
UV
(
1
-
(
j
-
f
)
/
this
.
angle
,
h
/
a
.
length
)])}
e
=
c
;
c
=
[]}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()}
Lathe
.
prototype
=
new
THREE
.
Geometry
;
Lathe
.
prototype
.
constructor
=
Lathe
;
var
Plane
=
function
(
a
,
f
,
b
,
e
){
THREE
.
Geometry
.
call
(
this
);
var
c
,
d
=
a
/
2
,
g
=
f
/
2
;
b
=
b
||
1
;
e
=
e
||
1
;
var
h
=
b
+
1
,
j
=
e
+
1
;
a
/=
b
;
var
m
=
f
/
e
;
for
(
c
=
0
;
c
<
j
;
c
++
)
for
(
f
=
0
;
f
<
h
;
f
++
)
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
f
*
a
-
d
,
-
(
c
*
m
-
g
),
0
)));
for
(
c
=
0
;
c
<
e
;
c
++
)
for
(
f
=
0
;
f
<
b
;
f
++
){
this
.
faces
.
push
(
new
THREE
.
Face4
(
f
+
h
*
c
,
f
+
h
*
(
c
+
1
),
f
+
1
+
h
*
(
c
+
1
),
f
+
1
+
h
*
c
));
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
f
/
b
,
c
/
e
),
new
THREE
.
UV
(
f
/
b
,(
c
+
1
)
/
e
),
new
THREE
.
UV
((
f
+
1
)
/
b
,(
c
+
1
)
/
e
),
new
THREE
.
UV
((
f
+
1
)
/
b
,
c
/
e
)])}
this
.
computeCentroids
();
this
.
computeFaceNormals
()};
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
0
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
var
e
=
Math
.
PI
*
2
,
f
=
Math
.
PI
/
180
;
this
.
update
=
function
(
l
,
k
,
n
){
var
p
,
t
;
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
)
*
f
;
this
.
theta
=
this
.
lon
*
f
;
p
=
this
.
phi
%
e
;
this
.
phi
=
p
>=
0
?
p
:
p
+
e
;
p
=
this
.
verticalAngleMap
.
srcRange
;
t
=
this
.
verticalAngleMap
.
dstRange
;
this
.
phi
=
(
this
.
phi
-
p
[
0
])
*
(
t
[
1
]
-
t
[
0
])
/
(
p
[
1
]
-
p
[
0
])
+
t
[
0
];
p
=
this
.
horizontalAngleMap
.
srcRange
;
t
=
this
.
horizontalAngleMap
.
dstRange
;
this
.
theta
=
(
this
.
theta
-
p
[
0
])
*
(
t
[
1
]
-
t
[
0
])
/
(
p
[
1
]
-
p
[
0
])
+
t
[
0
];
p
=
this
.
target
.
position
;
p
.
x
=
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
cos
(
this
.
theta
);
p
.
y
=
100
*
Math
.
cos
(
this
.
phi
);
p
.
z
=
100
*
Math
.
sin
(
this
.
phi
)
*
Math
.
sin
(
this
.
theta
);
this
.
supr
.
update
.
call
(
this
,
l
,
k
,
n
)};
this
.
onMouseMove
=
function
(
l
){
this
.
mouseX
=
l
.
clientX
-
this
.
windowHalfX
;
this
.
mouseY
=
l
.
clientY
-
this
.
windowHalfY
};
this
.
spline
=
new
THREE
.
Spline
;
this
.
spline
.
initFromArray
(
this
.
waypoints
);
this
.
useConstantSpeed
&&
this
.
spline
.
reparametrizeByArcLength
(
this
.
resamplingCoef
);
if
(
this
.
createDebugDummy
){
a
=
new
THREE
.
MeshLambertMaterial
({
color
:
30719
});
var
h
=
new
THREE
.
MeshLambertMaterial
({
color
:
65280
}),
g
=
new
Cube
(
10
,
10
,
20
),
j
=
new
Cube
(
2
,
2
,
10
);
this
.
animationParent
=
new
THREE
.
Mesh
(
g
,
a
);
a
=
new
THREE
.
Mesh
(
j
,
h
);
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
&&
d
(
this
.
debugPath
,
this
.
spline
);
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
function
(
l
,
k
){
return
function
(){
k
.
apply
(
l
,
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
;
var
Cube
=
function
(
a
,
b
,
c
,
d
,
e
,
f
,
h
,
g
,
j
){
function
l
(
u
,
B
,
z
,
m
,
y
,
C
,
G
,
K
){
var
J
,
I
,
E
=
d
||
1
,
L
=
e
||
1
,
P
=
y
/
2
,
Q
=
C
/
2
,
R
=
k
.
vertices
.
length
;
if
(
u
==
"
x
"
&&
B
==
"
y
"
||
u
==
"
y
"
&&
B
==
"
x
"
)
J
=
"
z
"
;
else
if
(
u
==
"
x
"
&&
B
==
"
z
"
||
u
==
"
z
"
&&
B
==
"
x
"
){
J
=
"
y
"
;
L
=
f
||
1
}
else
if
(
u
==
"
z
"
&&
B
==
"
y
"
||
u
==
"
y
"
&&
B
==
"
z
"
){
J
=
"
x
"
;
E
=
f
||
1
}
var
M
=
E
+
1
,
F
=
L
+
1
;
y
/=
E
;
var
N
=
C
/
L
;
for
(
I
=
0
;
I
<
F
;
I
++
)
for
(
C
=
0
;
C
<
M
;
C
++
){
var
O
=
new
THREE
.
Vector3
;
O
[
u
]
=
(
C
*
y
-
P
)
*
z
;
O
[
B
]
=
(
I
*
N
-
Q
)
*
m
;
O
[
J
]
=
G
;
k
.
vertices
.
push
(
new
THREE
.
Vertex
(
O
))}
for
(
I
=
0
;
I
<
L
;
I
++
)
for
(
C
=
0
;
C
<
E
;
C
++
){
k
.
faces
.
push
(
new
THREE
.
Face4
(
C
+
M
*
I
+
R
,
C
+
M
*
(
I
+
1
)
+
R
,
C
+
1
+
M
*
(
I
+
1
)
+
R
,
C
+
1
+
M
*
I
+
R
,
null
,
null
,
K
));
k
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
C
/
E
,
I
/
L
),
new
THREE
.
UV
(
C
/
E
,(
I
+
1
)
/
L
),
new
THREE
.
UV
((
C
+
1
)
/
E
,(
I
+
1
)
/
L
),
new
THREE
.
UV
((
C
+
1
)
/
E
,
I
/
L
)])}}
THREE
.
Geometry
.
call
(
this
);
var
k
=
this
,
n
=
a
/
2
,
p
=
b
/
2
,
t
=
c
/
2
;
g
=
g
?
-
1
:
1
;
if
(
h
!==
undefined
)
if
(
h
instanceof
Array
)
this
.
materials
=
h
;
else
{
this
.
materials
=
[];
for
(
var
w
=
0
;
w
<
6
;
w
++
)
this
.
materials
.
push
([
h
])}
else
this
.
materials
=
[];
this
.
sides
=
{
px
:
!
0
,
nx
:
!
0
,
py
:
!
0
,
ny
:
!
0
,
pz
:
!
0
,
nz
:
!
0
};
if
(
j
!=
undefined
)
for
(
var
x
in
j
)
this
.
sides
[
x
]
!=
undefined
&&
(
this
.
sides
[
x
]
=
j
[
x
]);
this
.
sides
.
px
&&
l
(
"
z
"
,
"
y
"
,
1
*
g
,
-
1
,
c
,
b
,
-
n
,
this
.
materials
[
0
]);
this
.
sides
.
nx
&&
l
(
"
z
"
,
"
y
"
,
-
1
*
g
,
-
1
,
c
,
b
,
n
,
this
.
materials
[
1
]);
this
.
sides
.
py
&&
l
(
"
x
"
,
"
z
"
,
1
*
g
,
1
,
a
,
c
,
p
,
this
.
materials
[
2
]);
this
.
sides
.
ny
&&
l
(
"
x
"
,
"
z
"
,
1
*
g
,
-
1
,
a
,
c
,
-
p
,
this
.
materials
[
3
]);
this
.
sides
.
pz
&&
l
(
"
x
"
,
"
y
"
,
1
*
g
,
-
1
,
a
,
b
,
t
,
this
.
materials
[
4
]);
this
.
sides
.
nz
&&
l
(
"
x
"
,
"
y
"
,
-
1
*
g
,
-
1
,
a
,
b
,
-
t
,
this
.
materials
[
5
]);(
function
(){
for
(
var
u
=
[],
B
=
[],
z
=
0
,
m
=
k
.
vertices
.
length
;
z
<
m
;
z
++
){
for
(
var
y
=
k
.
vertices
[
z
],
C
=!
1
,
G
=
0
,
K
=
u
.
length
;
G
<
K
;
G
++
){
var
J
=
u
[
G
];
if
(
y
.
position
.
x
==
J
.
position
.
x
&&
y
.
position
.
y
==
J
.
position
.
y
&&
y
.
position
.
z
==
J
.
position
.
z
){
B
[
z
]
=
G
;
C
=!
0
;
break
}}
if
(
!
C
){
B
[
z
]
=
u
.
length
;
u
.
push
(
new
THREE
.
Vertex
(
y
.
position
.
clone
()))}}
z
=
0
;
for
(
m
=
k
.
faces
.
length
;
z
<
m
;
z
++
){
y
=
k
.
faces
[
z
];
y
.
a
=
B
[
y
.
a
];
y
.
b
=
B
[
y
.
b
];
y
.
c
=
B
[
y
.
c
];
y
.
d
=
B
[
y
.
d
]}
k
.
vertices
=
u
})();
this
.
computeCentroids
();
this
.
computeFaceNormals
()};
Cube
.
prototype
=
new
THREE
.
Geometry
;
Cube
.
prototype
.
constructor
=
Cube
;
var
Cylinder
=
function
(
a
,
b
,
c
,
d
,
e
,
f
){
function
h
(
p
,
t
,
w
){
g
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
p
,
t
,
w
)))}
THREE
.
Geometry
.
call
(
this
);
var
g
=
this
,
j
,
l
=
Math
.
PI
*
2
,
k
=
d
/
2
;
for
(
j
=
0
;
j
<
a
;
j
++
)
h
(
Math
.
sin
(
l
*
j
/
a
)
*
b
,
Math
.
cos
(
l
*
j
/
a
)
*
b
,
-
k
);
for
(
j
=
0
;
j
<
a
;
j
++
)
h
(
Math
.
sin
(
l
*
j
/
a
)
*
c
,
Math
.
cos
(
l
*
j
/
a
)
*
c
,
k
);
for
(
j
=
0
;
j
<
a
;
j
++
)
g
.
faces
.
push
(
new
THREE
.
Face4
(
j
,
j
+
a
,
a
+
(
j
+
1
)
%
a
,(
j
+
1
)
%
a
));
if
(
c
>
0
){
h
(
0
,
0
,
-
k
-
(
f
||
0
));
for
(
j
=
a
;
j
<
a
+
a
/
2
;
j
++
)
g
.
faces
.
push
(
new
THREE
.
Face4
(
2
*
a
,(
2
*
j
-
2
*
a
)
%
a
,(
2
*
j
-
2
*
a
+
1
)
%
a
,(
2
*
j
-
2
*
a
+
2
)
%
a
))}
if
(
b
>
0
){
h
(
0
,
0
,
k
+
(
e
||
0
));
for
(
j
=
a
+
a
/
2
;
j
<
2
*
a
;
j
++
)
g
.
faces
.
push
(
new
THREE
.
Face4
(
2
*
a
+
1
,(
2
*
j
-
2
*
a
+
2
)
%
a
+
a
,(
2
*
j
-
2
*
a
+
1
)
%
a
+
a
,(
2
*
j
-
2
*
a
)
%
a
+
a
))}
j
=
0
;
for
(
a
=
this
.
faces
.
length
;
j
<
a
;
j
++
){
b
=
[];
c
=
this
.
faces
[
j
];
e
=
this
.
vertices
[
c
.
a
];
f
=
this
.
vertices
[
c
.
b
];
k
=
this
.
vertices
[
c
.
c
];
var
n
=
this
.
vertices
[
c
.
d
];
b
.
push
(
new
THREE
.
UV
(
0.5
+
Math
.
atan2
(
e
.
position
.
x
,
e
.
position
.
y
)
/
l
,
0.5
+
e
.
position
.
z
/
d
));
b
.
push
(
new
THREE
.
UV
(
0.5
+
Math
.
atan2
(
f
.
position
.
x
,
f
.
position
.
y
)
/
l
,
0.5
+
f
.
position
.
z
/
d
));
b
.
push
(
new
THREE
.
UV
(
0.5
+
Math
.
atan2
(
k
.
position
.
x
,
k
.
position
.
y
)
/
l
,
0.5
+
k
.
position
.
z
/
d
));
c
instanceof
THREE
.
Face4
&&
b
.
push
(
new
THREE
.
UV
(
0.5
+
Math
.
atan2
(
n
.
position
.
x
,
n
.
position
.
y
)
/
l
,
0.5
+
n
.
position
.
z
/
d
));
this
.
faceVertexUvs
[
0
].
push
(
b
)}
this
.
computeCentroids
();
this
.
computeFaceNormals
()};
Cylinder
.
prototype
=
new
THREE
.
Geometry
;
Cylinder
.
prototype
.
constructor
=
Cylinder
;
var
Icosahedron
=
function
(
a
){
function
b
(
n
,
p
,
t
){
var
w
=
Math
.
sqrt
(
n
*
n
+
p
*
p
+
t
*
t
);
return
e
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
n
/
w
,
p
/
w
,
t
/
w
)))
-
1
}
function
c
(
n
,
p
,
t
,
w
){
w
.
faces
.
push
(
new
THREE
.
Face3
(
n
,
p
,
t
))}
function
d
(
n
,
p
){
var
t
=
e
.
vertices
[
n
].
position
,
w
=
e
.
vertices
[
p
].
position
;
return
b
((
t
.
x
+
w
.
x
)
/
2
,(
t
.
y
+
w
.
y
)
/
2
,(
t
.
z
+
w
.
z
)
/
2
)}
var
e
=
this
,
f
=
new
THREE
.
Geometry
,
h
;
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
,
f
);
c
(
0
,
5
,
1
,
f
);
c
(
0
,
1
,
7
,
f
);
c
(
0
,
7
,
10
,
f
);
c
(
0
,
10
,
11
,
f
);
c
(
1
,
5
,
9
,
f
);
c
(
5
,
11
,
4
,
f
);
c
(
11
,
10
,
2
,
f
);
c
(
10
,
7
,
6
,
f
);
c
(
7
,
1
,
8
,
f
);
c
(
3
,
9
,
4
,
f
);
c
(
3
,
4
,
2
,
f
);
c
(
3
,
2
,
6
,
f
);
c
(
3
,
6
,
8
,
f
);
c
(
3
,
8
,
9
,
f
);
c
(
4
,
9
,
5
,
f
);
c
(
2
,
4
,
11
,
f
);
c
(
6
,
2
,
10
,
f
);
c
(
8
,
6
,
7
,
f
);
c
(
9
,
8
,
1
,
f
);
for
(
a
=
0
;
a
<
this
.
subdivisions
;
a
++
){
h
=
new
THREE
.
Geometry
;
for
(
var
g
in
f
.
faces
){
var
j
=
d
(
f
.
faces
[
g
].
a
,
f
.
faces
[
g
].
b
),
l
=
d
(
f
.
faces
[
g
].
b
,
f
.
faces
[
g
].
c
),
k
=
d
(
f
.
faces
[
g
].
c
,
f
.
faces
[
g
].
a
);
c
(
f
.
faces
[
g
].
a
,
j
,
k
,
h
);
c
(
f
.
faces
[
g
].
b
,
l
,
j
,
h
);
c
(
f
.
faces
[
g
].
c
,
k
,
l
,
h
);
c
(
j
,
l
,
k
,
h
)}
f
.
faces
=
h
.
faces
}
e
.
faces
=
f
.
faces
;
delete
f
;
delete
h
;
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
Icosahedron
.
prototype
=
new
THREE
.
Geometry
;
Icosahedron
.
prototype
.
constructor
=
Icosahedron
;
function
Lathe
(
a
,
b
,
c
){
THREE
.
Geometry
.
call
(
this
);
this
.
steps
=
b
||
12
;
this
.
angle
=
c
||
2
*
Math
.
PI
;
b
=
this
.
angle
/
this
.
steps
;
c
=
[];
for
(
var
d
=
[],
e
=
[],
f
=
[],
h
=
(
new
THREE
.
Matrix4
).
setRotationZ
(
b
),
g
=
0
;
g
<
a
.
length
;
g
++
){
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
a
[
g
]));
c
[
g
]
=
a
[
g
].
clone
();
d
[
g
]
=
this
.
vertices
.
length
-
1
}
for
(
var
j
=
0
;
j
<=
this
.
angle
+
0.001
;
j
+=
b
){
for
(
g
=
0
;
g
<
c
.
length
;
g
++
)
if
(
j
<
this
.
angle
){
c
[
g
]
=
h
.
multiplyVector3
(
c
[
g
].
clone
());
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
c
[
g
]));
e
[
g
]
=
this
.
vertices
.
length
-
1
}
else
e
=
f
;
j
==
0
&&
(
f
=
d
);
for
(
g
=
0
;
g
<
d
.
length
-
1
;
g
++
){
this
.
faces
.
push
(
new
THREE
.
Face4
(
e
[
g
],
e
[
g
+
1
],
d
[
g
+
1
],
d
[
g
]));
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
1
-
j
/
this
.
angle
,
g
/
a
.
length
),
new
THREE
.
UV
(
1
-
j
/
this
.
angle
,(
g
+
1
)
/
a
.
length
),
new
THREE
.
UV
(
1
-
(
j
-
b
)
/
this
.
angle
,(
g
+
1
)
/
a
.
length
),
new
THREE
.
UV
(
1
-
(
j
-
b
)
/
this
.
angle
,
g
/
a
.
length
)])}
d
=
e
;
e
=
[]}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()}
Lathe
.
prototype
=
new
THREE
.
Geometry
;
Lathe
.
prototype
.
constructor
=
Lathe
;
var
Plane
=
function
(
a
,
b
,
c
,
d
){
THREE
.
Geometry
.
call
(
this
);
var
e
,
f
=
a
/
2
,
h
=
b
/
2
;
c
=
c
||
1
;
d
=
d
||
1
;
var
g
=
c
+
1
,
j
=
d
+
1
;
a
/=
c
;
var
l
=
b
/
d
;
for
(
e
=
0
;
e
<
j
;
e
++
)
for
(
b
=
0
;
b
<
g
;
b
++
)
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
b
*
a
-
f
,
-
(
e
*
l
-
h
),
0
)));
for
(
e
=
0
;
e
<
d
;
e
++
)
for
(
b
=
0
;
b
<
c
;
b
++
){
this
.
faces
.
push
(
new
THREE
.
Face4
(
b
+
g
*
e
,
b
+
g
*
(
e
+
1
),
b
+
1
+
g
*
(
e
+
1
),
b
+
1
+
g
*
e
));
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
b
/
c
,
e
/
d
),
new
THREE
.
UV
(
b
/
c
,(
e
+
1
)
/
d
),
new
THREE
.
UV
((
b
+
1
)
/
c
,(
e
+
1
)
/
d
),
new
THREE
.
UV
((
b
+
1
)
/
c
,
e
/
d
)])}
this
.
computeCentroids
();
this
.
computeFaceNormals
()};
Plane
.
prototype
=
new
THREE
.
Geometry
;
Plane
.
prototype
.
constructor
=
Plane
;
var
Sphere
=
function
(
a
,
f
,
b
){
THREE
.
Geometry
.
call
(
this
);
var
e
,
c
=
Math
.
PI
,
d
=
Math
.
max
(
3
,
f
||
8
),
g
=
Math
.
max
(
2
,
b
||
6
);
f
=
[];
for
(
b
=
0
;
b
<
g
+
1
;
b
++
){
e
=
b
/
g
;
var
h
=
a
*
Math
.
cos
(
e
*
c
),
j
=
a
*
Math
.
sin
(
e
*
c
),
m
=
[],
k
=
0
;
for
(
e
=
0
;
e
<
d
;
e
++
){
var
n
=
2
*
e
/
d
,
p
=
j
*
Math
.
sin
(
n
*
c
);
n
=
j
*
Math
.
cos
(
n
*
c
);(
b
==
0
||
b
==
g
)
&&
e
>
0
||
(
k
=
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
n
,
h
,
p
)))
-
1
);
m
.
push
(
k
)}
f
.
push
(
m
)}
var
t
,
w
,
x
;
c
=
f
.
length
;
for
(
b
=
0
;
b
<
c
;
b
++
){
d
=
f
[
b
].
length
;
if
(
b
>
0
)
for
(
e
=
0
;
e
<
d
;
e
++
){
m
=
e
==
d
-
1
;
g
=
f
[
b
][
m
?
0
:
e
+
1
];
h
=
f
[
b
][
m
?
d
-
1
:
e
];
j
=
f
[
b
-
1
][
m
?
d
-
1
:
e
];
m
=
f
[
b
-
1
][
m
?
0
:
e
+
1
];
p
=
b
/
(
c
-
1
);
t
=
(
b
-
1
)
/
(
c
-
1
);
w
=
(
e
+
1
)
/
d
;
n
=
e
/
d
;
k
=
new
THREE
.
UV
(
1
-
w
,
p
);
p
=
new
THREE
.
UV
(
1
-
n
,
p
);
n
=
new
THREE
.
UV
(
1
-
n
,
t
);
var
u
=
new
THREE
.
UV
(
1
-
w
,
t
);
if
(
b
<
f
.
length
-
1
){
t
=
this
.
vertices
[
g
].
position
.
clone
();
w
=
this
.
vertices
[
h
].
position
.
clone
();
x
=
this
.
vertices
[
j
].
position
.
clone
();
t
.
normalize
();
w
.
normalize
();
x
.
normalize
();
this
.
faces
.
push
(
new
THREE
.
Face3
(
g
,
h
,
j
,[
new
THREE
.
Vector3
(
t
.
x
,
t
.
y
,
t
.
z
),
new
THREE
.
Vector3
(
w
.
x
,
w
.
y
,
w
.
z
),
new
THREE
.
Vector3
(
x
.
x
,
x
.
y
,
x
.
z
)]));
this
.
faceVertexUvs
[
0
].
push
([
k
,
p
,
n
])}
if
(
b
>
1
){
t
=
this
.
vertices
[
g
].
position
.
clone
();
w
=
this
.
vertices
[
j
].
position
.
clone
();
x
=
this
.
vertices
[
m
].
position
.
clone
();
t
.
normalize
();
w
.
normalize
();
x
.
normalize
();
this
.
faces
.
push
(
new
THREE
.
Face3
(
g
,
j
,
m
,[
new
THREE
.
Vector3
(
t
.
x
,
t
.
y
,
t
.
z
),
new
THREE
.
Vector3
(
w
.
x
,
w
.
y
,
w
.
z
),
new
THREE
.
Vector3
(
x
.
x
,
x
.
y
,
x
.
z
)]));
this
.
faceVertexUvs
[
0
].
push
([
k
,
n
,
u
])}}}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
();
this
.
boundingSphere
=
{
radius
:
a
}};
Sphere
.
prototype
=
new
THREE
.
Geometry
;
Sphere
.
prototype
.
constructor
=
Sphere
;
var
Torus
=
function
(
a
,
f
,
b
,
e
){
this
.
radius
=
a
||
100
;
this
.
tube
=
f
||
40
;
this
.
segmentsR
=
b
||
8
;
this
.
segmentsT
=
e
||
6
;
a
=
[];
THREE
.
Geometry
.
call
(
this
);
for
(
f
=
0
;
f
<=
this
.
segmentsR
;
++
f
)
for
(
b
=
0
;
b
<=
this
.
segmentsT
;
++
b
){
e
=
b
/
this
.
segmentsT
*
2
*
Math
.
PI
;
var
c
=
f
/
this
.
segmentsR
*
2
*
Math
.
PI
;
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
((
this
.
radius
+
this
.
tube
*
Math
.
cos
(
c
))
*
Math
.
cos
(
e
),(
this
.
radius
+
this
.
tube
*
Math
.
cos
(
c
))
*
Math
.
sin
(
e
),
this
.
tube
*
Math
.
sin
(
c
))));
a
.
push
([
b
/
this
.
segmentsT
,
1
-
f
/
this
.
segmentsR
])}
for
(
f
=
1
;
f
<=
this
.
segmentsR
;
++
f
)
for
(
b
=
1
;
b
<=
this
.
segmentsT
;
++
b
){
e
=
(
this
.
segmentsT
+
1
)
*
f
+
b
;
c
=
(
this
.
segmentsT
+
1
)
*
f
+
b
-
1
;
var
d
=
(
this
.
segmentsT
+
1
)
*
(
f
-
1
)
+
b
-
1
,
g
=
(
this
.
segmentsT
+
1
)
*
(
f
-
1
)
+
b
;
this
.
faces
.
push
(
new
THREE
.
Face4
(
e
,
c
,
d
,
g
));
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
a
[
e
][
0
],
a
[
e
][
1
]),
new
THREE
.
UV
(
a
[
c
][
0
],
a
[
c
][
1
]),
new
THREE
.
UV
(
a
[
d
][
0
],
a
[
d
][
1
]),
new
THREE
.
UV
(
a
[
g
][
0
],
a
[
g
][
1
])])}
delete
a
;
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
Torus
.
prototype
=
new
THREE
.
Geometry
;
Torus
.
prototype
.
constructor
=
Torus
;
var
TorusKnot
=
function
(
a
,
f
,
b
,
e
,
c
,
d
,
g
){
function
h
(
n
,
p
,
t
,
w
,
x
,
u
){
p
=
t
/
w
*
n
;
t
=
Math
.
cos
(
p
);
return
new
THREE
.
Vector3
(
x
*
(
2
+
t
)
*
0.5
*
Math
.
cos
(
n
),
x
*
(
2
+
t
)
*
Math
.
sin
(
n
)
*
0.5
,
u
*
x
*
Math
.
sin
(
p
)
*
0.5
)}
THREE
.
Geometry
.
call
(
this
);
this
.
radius
=
a
||
200
;
this
.
tube
=
f
||
40
;
this
.
segmentsR
=
b
||
64
;
this
.
segmentsT
=
e
||
8
;
this
.
p
=
c
||
2
;
this
.
q
=
d
||
3
;
this
.
heightScale
=
g
||
1
;
this
.
grid
=
Array
(
this
.
segmentsR
);
b
=
new
THREE
.
Vector3
;
e
=
new
THREE
.
Vector3
;
d
=
new
THREE
.
Vector3
;
for
(
a
=
0
;
a
<
this
.
segmentsR
;
++
a
){
this
.
grid
[
a
]
=
Array
(
this
.
segmentsT
);
for
(
f
=
0
;
f
<
this
.
segmentsT
;
++
f
){
var
j
=
a
/
this
.
segmentsR
*
2
*
this
.
p
*
Math
.
PI
;
g
=
f
/
this
.
segmentsT
*
2
*
Math
.
PI
;
c
=
h
(
j
,
g
,
this
.
q
,
this
.
p
,
this
.
radius
,
this
.
heightScale
);
j
=
h
(
j
+
0.01
,
g
,
this
.
q
,
this
.
p
,
this
.
radius
,
this
.
heightScale
);
b
.
x
=
j
.
x
-
c
.
x
;
b
.
y
=
j
.
y
-
c
.
y
;
b
.
z
=
j
.
z
-
c
.
z
;
e
.
x
=
j
.
x
+
c
.
x
;
e
.
y
=
j
.
y
+
c
.
y
;
e
.
z
=
j
.
z
+
c
.
z
;
d
.
cross
(
b
,
e
);
e
.
cross
(
d
,
b
);
d
.
normalize
();
e
.
normalize
();
j
=-
this
.
tube
*
Math
.
cos
(
g
);
g
=
this
.
tube
*
Math
.
sin
(
g
);
c
.
x
+=
j
*
e
.
x
+
g
*
d
.
x
;
c
.
y
+=
j
*
e
.
y
+
g
*
d
.
y
;
c
.
z
+=
j
*
e
.
z
+
g
*
d
.
z
;
this
.
grid
[
a
][
f
]
=
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
c
.
x
,
c
.
y
,
c
.
z
)))
-
1
}}
for
(
a
=
0
;
a
<
this
.
segmentsR
;
++
a
)
for
(
f
=
0
;
f
<
this
.
segmentsT
;
++
f
){
e
=
(
a
+
1
)
%
this
.
segmentsR
;
d
=
(
f
+
1
)
%
this
.
segmentsT
;
c
=
this
.
grid
[
a
][
f
];
b
=
this
.
grid
[
e
][
f
];
e
=
this
.
grid
[
e
][
d
];
d
=
this
.
grid
[
a
][
d
];
g
=
new
THREE
.
UV
(
a
/
this
.
segmentsR
,
f
/
this
.
segmentsT
);
j
=
new
THREE
.
UV
((
a
+
1
)
/
this
.
segmentsR
,
f
/
this
.
segmentsT
);
var
m
=
new
THREE
.
UV
((
a
+
1
)
/
this
.
segmentsR
,(
f
+
1
)
/
this
.
segmentsT
),
k
=
new
THREE
.
UV
(
a
/
this
.
segmentsR
,(
f
+
1
)
/
this
.
segmentsT
);
this
.
faces
.
push
(
new
THREE
.
Face4
(
c
,
b
,
e
,
d
));
this
.
faceVertexUvs
[
0
].
push
([
g
,
j
,
m
,
k
])}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
var
Sphere
=
function
(
a
,
b
,
c
){
THREE
.
Geometry
.
call
(
this
);
var
d
,
e
=
Math
.
PI
,
f
=
Math
.
max
(
3
,
b
||
8
),
h
=
Math
.
max
(
2
,
c
||
6
);
b
=
[];
for
(
c
=
0
;
c
<
h
+
1
;
c
++
){
d
=
c
/
h
;
var
g
=
a
*
Math
.
cos
(
d
*
e
),
j
=
a
*
Math
.
sin
(
d
*
e
),
l
=
[],
k
=
0
;
for
(
d
=
0
;
d
<
f
;
d
++
){
var
n
=
2
*
d
/
f
,
p
=
j
*
Math
.
sin
(
n
*
e
);
n
=
j
*
Math
.
cos
(
n
*
e
);(
c
==
0
||
c
==
h
)
&&
d
>
0
||
(
k
=
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
n
,
g
,
p
)))
-
1
);
l
.
push
(
k
)}
b
.
push
(
l
)}
var
t
,
w
,
x
;
e
=
b
.
length
;
for
(
c
=
0
;
c
<
e
;
c
++
){
f
=
b
[
c
].
length
;
if
(
c
>
0
)
for
(
d
=
0
;
d
<
f
;
d
++
){
l
=
d
==
f
-
1
;
h
=
b
[
c
][
l
?
0
:
d
+
1
];
g
=
b
[
c
][
l
?
f
-
1
:
d
];
j
=
b
[
c
-
1
][
l
?
f
-
1
:
d
];
l
=
b
[
c
-
1
][
l
?
0
:
d
+
1
];
p
=
c
/
(
e
-
1
);
t
=
(
c
-
1
)
/
(
e
-
1
);
w
=
(
d
+
1
)
/
f
;
n
=
d
/
f
;
k
=
new
THREE
.
UV
(
1
-
w
,
p
);
p
=
new
THREE
.
UV
(
1
-
n
,
p
);
n
=
new
THREE
.
UV
(
1
-
n
,
t
);
var
u
=
new
THREE
.
UV
(
1
-
w
,
t
);
if
(
c
<
b
.
length
-
1
){
t
=
this
.
vertices
[
h
].
position
.
clone
();
w
=
this
.
vertices
[
g
].
position
.
clone
();
x
=
this
.
vertices
[
j
].
position
.
clone
();
t
.
normalize
();
w
.
normalize
();
x
.
normalize
();
this
.
faces
.
push
(
new
THREE
.
Face3
(
h
,
g
,
j
,[
new
THREE
.
Vector3
(
t
.
x
,
t
.
y
,
t
.
z
),
new
THREE
.
Vector3
(
w
.
x
,
w
.
y
,
w
.
z
),
new
THREE
.
Vector3
(
x
.
x
,
x
.
y
,
x
.
z
)]));
this
.
faceVertexUvs
[
0
].
push
([
k
,
p
,
n
])}
if
(
c
>
1
){
t
=
this
.
vertices
[
h
].
position
.
clone
();
w
=
this
.
vertices
[
j
].
position
.
clone
();
x
=
this
.
vertices
[
l
].
position
.
clone
();
t
.
normalize
();
w
.
normalize
();
x
.
normalize
();
this
.
faces
.
push
(
new
THREE
.
Face3
(
h
,
j
,
l
,[
new
THREE
.
Vector3
(
t
.
x
,
t
.
y
,
t
.
z
),
new
THREE
.
Vector3
(
w
.
x
,
w
.
y
,
w
.
z
),
new
THREE
.
Vector3
(
x
.
x
,
x
.
y
,
x
.
z
)]));
this
.
faceVertexUvs
[
0
].
push
([
k
,
n
,
u
])}}}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
();
this
.
boundingSphere
=
{
radius
:
a
}};
Sphere
.
prototype
=
new
THREE
.
Geometry
;
Sphere
.
prototype
.
constructor
=
Sphere
;
var
Torus
=
function
(
a
,
b
,
c
,
d
){
this
.
radius
=
a
||
100
;
this
.
tube
=
b
||
40
;
this
.
segmentsR
=
c
||
8
;
this
.
segmentsT
=
d
||
6
;
a
=
[];
THREE
.
Geometry
.
call
(
this
);
for
(
b
=
0
;
b
<=
this
.
segmentsR
;
++
b
)
for
(
c
=
0
;
c
<=
this
.
segmentsT
;
++
c
){
d
=
c
/
this
.
segmentsT
*
2
*
Math
.
PI
;
var
e
=
b
/
this
.
segmentsR
*
2
*
Math
.
PI
;
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
((
this
.
radius
+
this
.
tube
*
Math
.
cos
(
e
))
*
Math
.
cos
(
d
),(
this
.
radius
+
this
.
tube
*
Math
.
cos
(
e
))
*
Math
.
sin
(
d
),
this
.
tube
*
Math
.
sin
(
e
))));
a
.
push
([
c
/
this
.
segmentsT
,
1
-
b
/
this
.
segmentsR
])}
for
(
b
=
1
;
b
<=
this
.
segmentsR
;
++
b
)
for
(
c
=
1
;
c
<=
this
.
segmentsT
;
++
c
){
d
=
(
this
.
segmentsT
+
1
)
*
b
+
c
;
e
=
(
this
.
segmentsT
+
1
)
*
b
+
c
-
1
;
var
f
=
(
this
.
segmentsT
+
1
)
*
(
b
-
1
)
+
c
-
1
,
h
=
(
this
.
segmentsT
+
1
)
*
(
b
-
1
)
+
c
;
this
.
faces
.
push
(
new
THREE
.
Face4
(
d
,
e
,
f
,
h
));
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
a
[
d
][
0
],
a
[
d
][
1
]),
new
THREE
.
UV
(
a
[
e
][
0
],
a
[
e
][
1
]),
new
THREE
.
UV
(
a
[
f
][
0
],
a
[
f
][
1
]),
new
THREE
.
UV
(
a
[
h
][
0
],
a
[
h
][
1
])])}
delete
a
;
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
Torus
.
prototype
=
new
THREE
.
Geometry
;
Torus
.
prototype
.
constructor
=
Torus
;
var
TorusKnot
=
function
(
a
,
b
,
c
,
d
,
e
,
f
,
h
){
function
g
(
n
,
p
,
t
,
w
,
x
,
u
){
p
=
t
/
w
*
n
;
t
=
Math
.
cos
(
p
);
return
new
THREE
.
Vector3
(
x
*
(
2
+
t
)
*
0.5
*
Math
.
cos
(
n
),
x
*
(
2
+
t
)
*
Math
.
sin
(
n
)
*
0.5
,
u
*
x
*
Math
.
sin
(
p
)
*
0.5
)}
THREE
.
Geometry
.
call
(
this
);
this
.
radius
=
a
||
200
;
this
.
tube
=
b
||
40
;
this
.
segmentsR
=
c
||
64
;
this
.
segmentsT
=
d
||
8
;
this
.
p
=
e
||
2
;
this
.
q
=
f
||
3
;
this
.
heightScale
=
h
||
1
;
this
.
grid
=
Array
(
this
.
segmentsR
);
c
=
new
THREE
.
Vector3
;
d
=
new
THREE
.
Vector3
;
f
=
new
THREE
.
Vector3
;
for
(
a
=
0
;
a
<
this
.
segmentsR
;
++
a
){
this
.
grid
[
a
]
=
Array
(
this
.
segmentsT
);
for
(
b
=
0
;
b
<
this
.
segmentsT
;
++
b
){
var
j
=
a
/
this
.
segmentsR
*
2
*
this
.
p
*
Math
.
PI
;
h
=
b
/
this
.
segmentsT
*
2
*
Math
.
PI
;
e
=
g
(
j
,
h
,
this
.
q
,
this
.
p
,
this
.
radius
,
this
.
heightScale
);
j
=
g
(
j
+
0.01
,
h
,
this
.
q
,
this
.
p
,
this
.
radius
,
this
.
heightScale
);
c
.
x
=
j
.
x
-
e
.
x
;
c
.
y
=
j
.
y
-
e
.
y
;
c
.
z
=
j
.
z
-
e
.
z
;
d
.
x
=
j
.
x
+
e
.
x
;
d
.
y
=
j
.
y
+
e
.
y
;
d
.
z
=
j
.
z
+
e
.
z
;
f
.
cross
(
c
,
d
);
d
.
cross
(
f
,
c
);
f
.
normalize
();
d
.
normalize
();
j
=-
this
.
tube
*
Math
.
cos
(
h
);
h
=
this
.
tube
*
Math
.
sin
(
h
);
e
.
x
+=
j
*
d
.
x
+
h
*
f
.
x
;
e
.
y
+=
j
*
d
.
y
+
h
*
f
.
y
;
e
.
z
+=
j
*
d
.
z
+
h
*
f
.
z
;
this
.
grid
[
a
][
b
]
=
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
e
.
x
,
e
.
y
,
e
.
z
)))
-
1
}}
for
(
a
=
0
;
a
<
this
.
segmentsR
;
++
a
)
for
(
b
=
0
;
b
<
this
.
segmentsT
;
++
b
){
d
=
(
a
+
1
)
%
this
.
segmentsR
;
f
=
(
b
+
1
)
%
this
.
segmentsT
;
e
=
this
.
grid
[
a
][
b
];
c
=
this
.
grid
[
d
][
b
];
d
=
this
.
grid
[
d
][
f
];
f
=
this
.
grid
[
a
][
f
];
h
=
new
THREE
.
UV
(
a
/
this
.
segmentsR
,
b
/
this
.
segmentsT
);
j
=
new
THREE
.
UV
((
a
+
1
)
/
this
.
segmentsR
,
b
/
this
.
segmentsT
);
var
l
=
new
THREE
.
UV
((
a
+
1
)
/
this
.
segmentsR
,(
b
+
1
)
/
this
.
segmentsT
),
k
=
new
THREE
.
UV
(
a
/
this
.
segmentsR
,(
b
+
1
)
/
this
.
segmentsT
);
this
.
faces
.
push
(
new
THREE
.
Face4
(
e
,
c
,
d
,
f
));
this
.
faceVertexUvs
[
0
].
push
([
h
,
j
,
l
,
k
])}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
TorusKnot
.
prototype
=
new
THREE
.
Geometry
;
TorusKnot
.
prototype
.
constructor
=
TorusKnot
;
THREE
.
Loader
=
function
(
a
){
this
.
statusDomElement
=
(
this
.
showStatus
=
a
)?
THREE
.
Loader
.
prototype
.
addStatusElement
():
null
;
this
.
onLoadStart
=
function
(){};
this
.
onLoadProgress
=
function
(){};
this
.
onLoadComplete
=
function
(){}};
THREE
.
Loader
.
prototype
=
{
addStatusElement
:
function
(){
var
a
=
document
.
createElement
(
"
div
"
);
a
.
style
.
position
=
"
absolute
"
;
a
.
style
.
right
=
"
0px
"
;
a
.
style
.
top
=
"
0px
"
;
a
.
style
.
fontSize
=
"
0.8em
"
;
a
.
style
.
textAlign
=
"
left
"
;
a
.
style
.
background
=
"
rgba(0,0,0,0.25)
"
;
a
.
style
.
color
=
"
#fff
"
;
a
.
style
.
width
=
"
120px
"
;
a
.
style
.
padding
=
"
0.5em 0.5em 0.5em 0.5em
"
;
a
.
style
.
zIndex
=
1
E3
;
a
.
innerHTML
=
"
Loading ...
"
;
return
a
},
updateProgress
:
function
(
a
){
var
f
=
"
Loaded
"
;
f
+=
a
.
total
?(
100
*
a
.
loaded
/
a
.
total
).
toFixed
(
0
)
+
"
%
"
:(
a
.
loaded
/
1
E3
).
toFixed
(
2
)
+
"
KB
"
;
this
.
statusDomElement
.
innerHTML
=
f
},
extractUrlbase
:
function
(
a
){
a
=
a
.
split
(
"
/
"
);
a
.
pop
();
return
a
.
join
(
"
/
"
)},
init_materials
:
function
(
a
,
f
,
b
){
a
.
materials
=
[];
for
(
var
e
=
0
;
e
<
f
.
length
;
++
e
)
a
.
materials
[
e
]
=
[
THREE
.
Loader
.
prototype
.
createMaterial
(
f
[
e
],
b
)]},
createMaterial
:
function
(
a
,
f
){
function
b
(
h
){
h
=
Math
.
log
(
h
)
/
Math
.
LN2
;
return
Math
.
floor
(
h
)
==
h
}
function
e
(
h
,
j
){
var
m
=
new
Image
;
m
.
onload
=
function
(){
if
(
!
b
(
this
.
width
)
||!
b
(
this
.
height
)){
var
k
=
Math
.
pow
(
2
,
Math
.
round
(
Math
.
log
(
this
.
width
)
/
Math
.
LN2
)),
n
=
Math
.
pow
(
2
,
Math
.
round
(
Math
.
log
(
this
.
height
)
/
Math
.
LN2
));
h
.
image
.
width
=
k
;
h
.
image
.
height
=
n
;
h
.
image
.
getContext
(
"
2d
"
).
drawImage
(
this
,
0
,
0
,
k
,
n
)}
else
h
.
image
=
this
;
h
.
needsUpdate
=!
0
};
m
.
src
=
j
}
var
c
,
d
,
g
;
c
=
"
MeshLambertMaterial
"
;
d
=
{
color
:
15658734
,
opacity
:
1
,
map
:
null
,
lightMap
:
null
,
wireframe
:
a
.
wireframe
};
if
(
a
.
shading
)
if
(
a
.
shading
==
"
Phong
"
)
c
=
"
MeshPhongMaterial
"
;
else
a
.
shading
==
"
Basic
"
&&
(
c
=
"
MeshBasicMaterial
"
);
if
(
a
.
blending
)
if
(
a
.
blending
==
"
Additive
"
)
d
.
blending
=
THREE
.
AdditiveBlending
;
else
if
(
a
.
blending
==
"
Subtractive
"
)
d
.
blending
=
THREE
.
SubtractiveBlending
;
else
if
(
a
.
blending
==
"
Multiply
"
)
d
.
blending
=
THREE
.
MultiplyBlending
;
if
(
a
.
transparent
!==
undefined
)
d
.
transparent
=
a
.
transparent
;
if
(
a
.
depthTest
!==
undefined
)
d
.
depthTest
=
a
.
depthTest
;
if
(
a
.
vertexColors
!==
undefined
)
if
(
a
.
vertexColors
==
"
face
"
)
d
.
vertexColors
=
THREE
.
FaceColors
;
else
if
(
a
.
vertexColors
)
d
.
vertexColors
=
THREE
.
VertexColors
;
if
(
a
.
mapDiffuse
&&
f
){
g
=
document
.
createElement
(
"
canvas
"
);
d
.
map
=
new
THREE
.
Texture
(
g
);
d
.
map
.
sourceFile
=
a
.
mapDiffuse
;
e
(
d
.
map
,
f
+
"
/
"
+
a
.
mapDiffuse
)}
else
if
(
a
.
colorDiffuse
){
g
=
(
a
.
colorDiffuse
[
0
]
*
255
<<
16
)
+
(
a
.
colorDiffuse
[
1
]
*
255
<<
8
)
+
a
.
colorDiffuse
[
2
]
*
255
;
d
.
color
=
g
;
d
.
opacity
=
a
.
transparency
}
else
if
(
a
.
DbgColor
)
d
.
color
=
a
.
DbgColor
;
if
(
a
.
mapLightmap
&&
f
){
g
=
document
.
createElement
(
"
canvas
"
);
d
.
lightMap
=
new
THREE
.
Texture
(
g
);
d
.
lightMap
.
sourceFile
=
a
.
mapLightmap
;
e
(
d
.
lightMap
,
f
+
"
/
"
+
a
.
mapLightmap
)}
return
new
THREE
[
c
](
d
)}};
THREE
.
JSONLoader
=
function
(
a
){
THREE
.
Loader
.
call
(
this
,
a
)};
THREE
.
JSONLoader
.
prototype
=
new
THREE
.
Loader
;
THREE
.
JSONLoader
.
prototype
.
constructor
=
THREE
.
JSONLoader
;
THREE
.
JSONLoader
.
prototype
.
supr
=
THREE
.
Loader
.
prototype
;
THREE
.
JSONLoader
.
prototype
.
load
=
function
(
a
){
var
f
=
this
,
b
=
a
.
model
,
e
=
a
.
callback
,
c
=
a
.
texture_path
?
a
.
texture_path
:
this
.
extractUrlbase
(
b
);
a
=
new
Worker
(
b
);
a
.
onmessage
=
function
(
d
){
f
.
createModel
(
d
.
data
,
e
,
c
);
f
.
onLoadComplete
()};
this
.
onLoadStart
();
a
.
postMessage
((
new
Date
).
getTime
())};
THREE
.
JSONLoader
.
prototype
.
createModel
=
function
(
a
,
f
,
b
){
var
e
=
new
THREE
.
Geometry
;
this
.
init_materials
(
e
,
a
.
materials
,
b
);(
function
(){
if
(
a
.
version
===
undefined
||
a
.
version
!=
2
)
console
.
error
(
"
Deprecated file format.
"
);
else
{
var
c
,
d
,
g
,
h
,
j
,
m
,
k
,
n
,
p
,
t
,
w
,
x
,
u
,
B
,
z
,
l
=
a
.
faces
;
t
=
a
.
vertices
;
var
y
=
a
.
normals
,
C
=
a
.
colors
;
m
=
a
.
scale
!==
undefined
?
a
.
scale
:
1
;
var
G
=
0
;
for
(
c
=
0
;
c
<
a
.
uvs
.
length
;
c
++
)
a
.
uvs
[
c
].
length
&&
G
++
;
for
(
c
=
0
;
c
<
G
;
c
++
){
e
.
faceUvs
[
c
]
=
[];
e
.
faceVertexUvs
[
c
]
=
[]}
h
=
0
;
for
(
j
=
t
.
length
;
h
<
j
;){
k
=
new
THREE
.
Vertex
;
k
.
position
.
x
=
t
[
h
++
]
/
m
;
k
.
position
.
y
=
t
[
h
++
]
/
m
;
k
.
position
.
z
=
t
[
h
++
]
/
m
;
e
.
vertices
.
push
(
k
)}
h
=
0
;
for
(
j
=
l
.
length
;
h
<
j
;){
t
=
l
[
h
++
];
m
=
t
&
1
;
g
=
t
&
2
;
c
=
t
&
4
;
d
=
t
&
8
;
n
=
t
&
16
;
k
=
t
&
32
;
w
=
t
&
64
;
t
&=
128
;
if
(
m
){
x
=
new
THREE
.
Face4
;
x
.
a
=
l
[
h
++
];
x
.
b
=
l
[
h
++
];
x
.
c
=
l
[
h
++
];
x
.
d
=
l
[
h
++
];
m
=
4
}
else
{
x
=
new
THREE
.
Face3
;
x
.
a
=
l
[
h
++
];
x
.
b
=
l
[
h
++
];
x
.
c
=
l
[
h
++
];
m
=
3
}
if
(
g
){
g
=
l
[
h
++
];
x
.
materials
=
e
.
materials
[
g
]}
g
=
e
.
faces
.
length
;
if
(
c
)
for
(
c
=
0
;
c
<
G
;
c
++
){
u
=
a
.
uvs
[
c
];
p
=
l
[
h
++
];
z
=
u
[
p
*
2
];
p
=
u
[
p
*
2
+
1
];
e
.
faceUvs
[
c
][
g
]
=
new
THREE
.
UV
(
z
,
p
)}
if
(
d
)
for
(
c
=
0
;
c
<
G
;
c
++
){
u
=
a
.
uvs
[
c
];
B
=
[];
for
(
d
=
0
;
d
<
m
;
d
++
){
p
=
l
[
h
++
];
z
=
u
[
p
*
2
];
p
=
u
[
p
*
2
+
1
];
B
[
d
]
=
new
THREE
.
UV
(
z
,
p
)}
e
.
faceVertexUvs
[
c
][
g
]
=
B
}
if
(
n
){
n
=
l
[
h
++
]
*
3
;
d
=
new
THREE
.
Vector3
;
d
.
x
=
y
[
n
++
];
d
.
y
=
y
[
n
++
];
d
.
z
=
y
[
n
];
x
.
normal
=
d
}
if
(
k
)
for
(
c
=
0
;
c
<
m
;
c
++
){
n
=
l
[
h
++
]
*
3
;
d
=
new
THREE
.
Vector3
;
d
.
x
=
y
[
n
++
];
d
.
y
=
y
[
n
++
];
d
.
z
=
y
[
n
];
x
.
vertexNormals
.
push
(
d
)}
if
(
w
){
k
=
l
[
h
++
];
k
=
new
THREE
.
Color
(
C
[
k
]);
x
.
color
=
k
}
if
(
t
)
for
(
c
=
0
;
c
<
m
;
c
++
){
k
=
l
[
h
++
];
k
=
new
THREE
.
Color
(
C
[
k
]);
x
.
vertexColors
.
push
(
k
)}
e
.
faces
.
push
(
x
)}}})();(
function
(){
var
c
,
d
,
g
,
h
;
if
(
a
.
skinWeights
){
c
=
0
;
for
(
d
=
a
.
skinWeights
.
length
;
c
<
d
;
c
+=
2
){
g
=
a
.
skinWeights
[
c
];
h
=
a
.
skinWeights
[
c
+
1
];
e
.
skinWeights
.
push
(
new
THREE
.
Vector4
(
g
,
h
,
0
,
0
))}}
if
(
a
.
skinIndices
){
c
=
0
;
for
(
d
=
a
.
skinIndices
.
length
;
c
<
d
;
c
+=
2
){
g
=
a
.
skinIndices
[
c
];
h
=
a
.
skinIndices
[
c
+
1
];
e
.
skinIndices
.
push
(
new
THREE
.
Vector4
(
g
,
h
,
0
,
0
))}}
e
.
bones
=
a
.
bones
;
e
.
animation
=
a
.
animation
})();(
function
(){
if
(
a
.
morphTargets
!==
undefined
){
var
c
,
d
,
g
,
h
,
j
,
m
;
c
=
0
;
for
(
d
=
a
.
morphTargets
.
length
;
c
<
d
;
c
++
){
e
.
morphTargets
[
c
]
=
{};
e
.
morphTargets
[
c
].
name
=
a
.
morphTargets
[
c
].
name
;
e
.
morphTargets
[
c
].
vertices
=
[];
j
=
e
.
morphTargets
[
c
].
vertices
;
m
=
a
.
morphTargets
[
c
].
vertices
;
g
=
0
;
for
(
h
=
m
.
length
;
g
<
h
;
g
+=
3
)
j
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
m
[
g
],
m
[
g
+
1
],
m
[
g
+
2
])))}}
if
(
a
.
morphColors
!==
undefined
){
var
k
,
n
;
c
=
0
;
for
(
d
=
a
.
morphColors
.
length
;
c
<
d
;
c
++
){
e
.
morphColors
[
c
]
=
{};
e
.
morphColors
[
c
].
name
=
a
.
morphColors
[
c
].
name
;
e
.
morphColors
[
c
].
colors
=
[];
m
=
e
.
morphColors
[
c
].
colors
;
k
=
a
.
morphColors
[
c
].
colors
;
h
=
0
;
for
(
j
=
k
.
length
;
h
<
j
;
h
+=
3
){
n
=
new
THREE
.
Color
(
16755200
);
n
.
setRGB
(
k
[
g
],
k
[
g
+
1
],
k
[
g
+
2
]);
m
.
push
(
n
)}}}})();(
function
(){
if
(
a
.
edges
!==
undefined
){
var
c
,
d
,
g
;
for
(
c
=
0
;
c
<
a
.
edges
.
length
;
c
+=
2
){
d
=
a
.
edges
[
c
];
g
=
a
.
edges
[
c
+
1
];
e
.
edges
.
push
(
new
THREE
.
Edge
(
e
.
vertices
[
d
],
e
.
vertices
[
g
],
d
,
g
))}}})();
e
.
computeCentroids
();
e
.
computeFaceNormals
();
e
.
computeEdgeFaces
();
f
(
e
)};
THREE
.
BinaryLoader
=
function
(
a
){
THREE
.
Loader
.
call
(
this
,
a
)};
THREE
.
BinaryLoader
.
prototype
=
new
THREE
.
Loader
;
THREE
.
BinaryLoader
.
prototype
.
constructor
=
THREE
.
BinaryLoader
;
THREE
.
BinaryLoader
.
prototype
.
supr
=
THREE
.
Loader
.
prototype
;
THREE
.
BinaryLoader
.
prototype
=
{
load
:
function
(
a
){
var
f
=
a
.
model
,
b
=
a
.
callback
,
e
=
a
.
texture_path
?
a
.
texture_path
:
THREE
.
Loader
.
prototype
.
extractUrlbase
(
f
),
c
=
a
.
bin_path
?
a
.
bin_path
:
THREE
.
Loader
.
prototype
.
extractUrlbase
(
f
);
a
=
(
new
Date
).
getTime
();
f
=
new
Worker
(
f
);
var
d
=
this
.
showProgress
?
THREE
.
Loader
.
prototype
.
updateProgress
:
null
;
f
.
onmessage
=
function
(
g
){
THREE
.
BinaryLoader
.
prototype
.
loadAjaxBuffers
(
g
.
data
.
buffers
,
g
.
data
.
materials
,
b
,
c
,
e
,
d
)};
f
.
onerror
=
function
(
g
){
alert
(
"
worker.onerror:
"
+
g
.
message
+
"
\n
"
+
g
.
data
);
g
.
preventDefault
()};
f
.
postMessage
(
a
)},
loadAjaxBuffers
:
function
(
a
,
f
,
b
,
e
,
c
,
d
){
var
g
=
new
XMLHttpRequest
,
h
=
e
+
"
/
"
+
a
,
j
=
0
;
g
.
onreadystatechange
=
function
(){
if
(
g
.
readyState
==
4
)
g
.
status
==
200
||
g
.
status
==
0
?
THREE
.
BinaryLoader
.
prototype
.
createBinModel
(
g
.
responseText
,
b
,
c
,
f
):
alert
(
"
Couldn't load [
"
+
h
+
"
] [
"
+
g
.
status
+
"
]
"
);
else
if
(
g
.
readyState
==
3
){
if
(
d
){
j
==
0
&&
(
j
=
g
.
getResponseHeader
(
"
Content-Length
"
));
d
({
total
:
j
,
loaded
:
g
.
responseText
.
length
})}}
else
g
.
readyState
==
2
&&
(
j
=
g
.
getResponseHeader
(
"
Content-Length
"
))};
g
.
open
(
"
GET
"
,
h
,
!
0
);
g
.
overrideMimeType
(
"
text/plain; charset=x-user-defined
"
);
g
.
setRequestHeader
(
"
Content-Type
"
,
"
text/plain
"
);
g
.
send
(
null
)},
createBinModel
:
function
(
a
,
f
,
b
,
e
){
var
c
=
function
(
d
){
function
g
(
o
,
v
){
var
A
=
k
(
o
,
v
),
D
=
k
(
o
,
v
+
1
),
H
=
k
(
o
,
v
+
2
),
S
=
k
(
o
,
v
+
3
),
V
=
(
S
<<
1
&
255
|
H
>>
7
)
-
127
;
A
|=
(
H
&
127
)
<<
16
|
D
<<
8
;
if
(
A
==
0
&&
V
==-
127
)
return
0
;
return
(
1
-
2
*
(
S
>>
7
))
*
(
1
+
A
*
Math
.
pow
(
2
,
-
23
))
*
Math
.
pow
(
2
,
V
)}
function
h
(
o
,
v
){
var
A
=
k
(
o
,
v
),
D
=
k
(
o
,
v
+
1
),
H
=
k
(
o
,
v
+
2
);
return
(
k
(
o
,
v
+
3
)
<<
24
)
+
(
H
<<
16
)
+
(
D
<<
8
)
+
A
}
function
j
(
o
,
v
){
var
A
=
k
(
o
,
v
);
return
(
k
(
o
,
v
+
1
)
<<
8
)
+
A
}
function
m
(
o
,
v
){
var
A
=
k
(
o
,
v
);
return
A
>
127
?
A
-
256
:
A
}
function
k
(
o
,
v
){
return
o
.
charCodeAt
(
v
)
&
255
}
function
n
(
o
){
var
v
,
A
,
D
;
v
=
h
(
a
,
o
);
A
=
h
(
a
,
o
+
G
);
D
=
h
(
a
,
o
+
K
);
o
=
j
(
a
,
o
+
J
);
THREE
.
BinaryLoader
.
prototype
.
f3
(
B
,
v
,
A
,
D
,
o
)}
function
p
(
o
){
var
v
,
A
,
D
,
H
,
S
,
V
;
v
=
h
(
a
,
o
);
A
=
h
(
a
,
o
+
G
);
D
=
h
(
a
,
o
+
K
);
H
=
j
(
a
,
o
+
J
);
S
=
h
(
a
,
o
+
I
);
V
=
h
(
a
,
o
+
E
);
o
=
h
(
a
,
o
+
L
);
THREE
.
BinaryLoader
.
prototype
.
f3n
(
B
,
y
,
v
,
A
,
D
,
H
,
S
,
V
,
o
)}
function
t
(
o
){
var
v
,
A
,
D
,
H
;
v
=
h
(
a
,
o
);
A
=
h
(
a
,
o
+
P
);
D
=
h
(
a
,
o
+
Q
);
H
=
h
(
a
,
o
+
R
);
o
=
j
(
a
,
o
+
M
);
THREE
.
BinaryLoader
.
prototype
.
f4
(
B
,
v
,
A
,
D
,
H
,
o
)}
function
w
(
o
){
var
v
,
A
,
D
,
H
,
S
,
V
,
ca
,
da
;
v
=
h
(
a
,
o
);
A
=
h
(
a
,
o
+
P
);
D
=
h
(
a
,
o
+
Q
);
H
=
h
(
a
,
o
+
R
);
S
=
j
(
a
,
o
+
M
);
V
=
h
(
a
,
o
+
F
);
ca
=
h
(
a
,
o
+
N
);
da
=
h
(
a
,
o
+
O
);
o
=
h
(
a
,
o
+
T
);
THREE
.
BinaryLoader
.
prototype
.
f4n
(
B
,
y
,
v
,
A
,
D
,
H
,
S
,
V
,
ca
,
da
,
o
)}
function
x
(
o
){
var
v
,
A
;
v
=
h
(
a
,
o
);
A
=
h
(
a
,
o
+
U
);
o
=
h
(
a
,
o
+
X
);
THREE
.
BinaryLoader
.
prototype
.
uv3
(
B
.
faceVertexUvs
[
0
],
C
[
v
*
2
],
C
[
v
*
2
+
1
],
C
[
A
*
2
],
C
[
A
*
2
+
1
],
C
[
o
*
2
],
C
[
o
*
2
+
1
])}
function
u
(
o
){
var
v
,
A
,
D
;
v
=
h
(
a
,
o
);
A
=
h
(
a
,
o
+
ea
);
D
=
h
(
a
,
o
+
fa
);
o
=
h
(
a
,
o
+
ga
);
THREE
.
BinaryLoader
.
prototype
.
uv4
(
B
.
faceVertexUvs
[
0
],
C
[
v
*
2
],
C
[
v
*
2
+
1
],
C
[
A
*
2
],
C
[
A
*
2
+
1
],
C
[
D
*
2
],
C
[
D
*
2
+
1
],
C
[
o
*
2
],
C
[
o
*
2
+
1
])}
var
B
=
this
,
z
=
0
,
l
,
y
=
[],
C
=
[],
G
,
K
,
J
,
I
,
E
,
L
,
P
,
Q
,
R
,
M
,
F
,
N
,
O
,
T
,
U
,
X
,
ea
,
fa
,
ga
,
Y
,
Z
,
$
,
aa
,
ba
,
W
;
THREE
.
Geometry
.
call
(
this
);
THREE
.
Loader
.
prototype
.
init_materials
(
B
,
e
,
d
);
l
=
{
signature
:
a
.
substr
(
z
,
8
),
header_bytes
:
k
(
a
,
z
+
8
),
vertex_coordinate_bytes
:
k
(
a
,
z
+
9
),
normal_coordinate_bytes
:
k
(
a
,
z
+
10
),
uv_coordinate_bytes
:
k
(
a
,
z
+
11
),
vertex_index_bytes
:
k
(
a
,
z
+
12
),
normal_index_bytes
:
k
(
a
,
z
+
13
),
uv_index_bytes
:
k
(
a
,
z
+
14
),
material_index_bytes
:
k
(
a
,
z
+
15
),
nvertices
:
h
(
a
,
z
+
16
),
nnormals
:
h
(
a
,
z
+
16
+
4
),
nuvs
:
h
(
a
,
z
+
16
+
8
),
ntri_flat
:
h
(
a
,
z
+
16
+
12
),
ntri_smooth
:
h
(
a
,
z
+
16
+
16
),
ntri_flat_uv
:
h
(
a
,
z
+
16
+
20
),
ntri_smooth_uv
:
h
(
a
,
z
+
16
+
24
),
nquad_flat
:
h
(
a
,
z
+
16
+
28
),
nquad_smooth
:
h
(
a
,
z
+
16
+
32
),
nquad_flat_uv
:
h
(
a
,
z
+
16
+
36
),
nquad_smooth_uv
:
h
(
a
,
z
+
16
+
40
)};
z
+=
l
.
header_bytes
;
G
=
l
.
vertex_index_bytes
;
K
=
l
.
vertex_index_bytes
*
2
;
J
=
l
.
vertex_index_bytes
*
3
;
I
=
l
.
vertex_index_bytes
*
3
+
l
.
material_index_bytes
;
E
=
l
.
vertex_index_bytes
*
3
+
l
.
material_index_bytes
+
l
.
normal_index_bytes
;
L
=
l
.
vertex_index_bytes
*
3
+
l
.
material_index_bytes
+
l
.
normal_index_bytes
*
2
;
P
=
l
.
vertex_index_bytes
;
Q
=
l
.
vertex_index_bytes
*
2
;
R
=
l
.
vertex_index_bytes
*
3
;
M
=
l
.
vertex_index_bytes
*
4
;
F
=
l
.
vertex_index_bytes
*
4
+
l
.
material_index_bytes
;
N
=
l
.
vertex_index_bytes
*
4
+
l
.
material_index_bytes
+
l
.
normal_index_bytes
;
O
=
l
.
vertex_index_bytes
*
4
+
l
.
material_index_bytes
+
l
.
normal_index_bytes
*
2
;
T
=
l
.
vertex_index_bytes
*
4
+
l
.
material_index_bytes
+
l
.
normal_index_bytes
*
3
;
U
=
l
.
uv_index_bytes
;
X
=
l
.
uv_index_bytes
*
2
;
ea
=
l
.
uv_index_bytes
;
fa
=
l
.
uv_index_bytes
*
2
;
ga
=
l
.
uv_index_bytes
*
3
;
d
=
l
.
vertex_index_bytes
*
3
+
l
.
material_index_bytes
;
W
=
l
.
vertex_index_bytes
*
4
+
l
.
material_index_bytes
;
Y
=
l
.
ntri_flat
*
d
;
Z
=
l
.
ntri_smooth
*
(
d
+
l
.
normal_index_bytes
*
3
);
$
=
l
.
ntri_flat_uv
*
(
d
+
l
.
uv_index_bytes
*
3
);
aa
=
l
.
ntri_smooth_uv
*
(
d
+
l
.
normal_index_bytes
*
3
+
l
.
uv_index_bytes
*
3
);
ba
=
l
.
nquad_flat
*
W
;
d
=
l
.
nquad_smooth
*
(
W
+
l
.
normal_index_bytes
*
4
);
W
=
l
.
nquad_flat_uv
*
(
W
+
l
.
uv_index_bytes
*
4
);
z
+=
function
(
o
){
for
(
var
v
,
A
,
D
,
H
=
l
.
vertex_coordinate_bytes
*
3
,
S
=
o
+
l
.
nvertices
*
H
;
o
<
S
;
o
+=
H
){
v
=
g
(
a
,
o
);
A
=
g
(
a
,
o
+
l
.
vertex_coordinate_bytes
);
D
=
g
(
a
,
o
+
l
.
vertex_coordinate_bytes
*
2
);
THREE
.
BinaryLoader
.
prototype
.
v
(
B
,
v
,
A
,
D
)}
return
l
.
nvertices
*
H
}(
z
);
z
+=
function
(
o
){
for
(
var
v
,
A
,
D
,
H
=
l
.
normal_coordinate_bytes
*
3
,
S
=
o
+
l
.
nnormals
*
H
;
o
<
S
;
o
+=
H
){
v
=
m
(
a
,
o
);
A
=
m
(
a
,
o
+
l
.
normal_coordinate_bytes
);
D
=
m
(
a
,
o
+
l
.
normal_coordinate_bytes
*
2
);
y
.
push
(
v
/
127
,
A
/
127
,
D
/
127
)}
return
l
.
nnormals
*
H
}(
z
);
z
+=
function
(
o
){
for
(
var
v
,
A
,
D
=
l
.
uv_coordinate_bytes
*
2
,
H
=
o
+
l
.
nuvs
*
D
;
o
<
H
;
o
+=
D
){
v
=
g
(
a
,
o
);
A
=
g
(
a
,
o
+
l
.
uv_coordinate_bytes
);
C
.
push
(
v
,
A
)}
return
l
.
nuvs
*
D
}(
z
);
Y
=
z
+
Y
;
Z
=
Y
+
Z
;
$
=
Z
+
$
;
aa
=
$
+
aa
;
ba
=
aa
+
ba
;
d
=
ba
+
d
;
W
=
d
+
W
;(
function
(
o
){
var
v
,
A
=
l
.
vertex_index_bytes
*
3
+
l
.
material_index_bytes
,
D
=
A
+
l
.
uv_index_bytes
*
3
,
H
=
o
+
l
.
ntri_flat_uv
*
D
;
for
(
v
=
o
;
v
<
H
;
v
+=
D
){
n
(
v
);
x
(
v
+
A
)}
return
H
-
o
})(
Z
);(
function
(
o
){
var
v
,
A
=
l
.
vertex_index_bytes
*
3
+
l
.
material_index_bytes
+
l
.
normal_index_bytes
*
3
,
D
=
A
+
l
.
uv_index_bytes
*
3
,
H
=
o
+
l
.
ntri_smooth_uv
*
D
;
for
(
v
=
o
;
v
<
H
;
v
+=
D
){
p
(
v
);
x
(
v
+
A
)}
return
H
-
o
})(
$
);(
function
(
o
){
var
v
,
A
=
l
.
vertex_index_bytes
*
4
+
l
.
material_index_bytes
,
D
=
A
+
l
.
uv_index_bytes
*
4
,
H
=
o
+
l
.
nquad_flat_uv
*
D
;
for
(
v
=
o
;
v
<
H
;
v
+=
D
){
t
(
v
);
u
(
v
+
A
)}
return
H
-
o
})(
d
);(
function
(
o
){
var
v
,
A
=
l
.
vertex_index_bytes
*
4
+
l
.
material_index_bytes
+
l
.
normal_index_bytes
*
4
,
D
=
A
+
l
.
uv_index_bytes
*
4
,
H
=
o
+
l
.
nquad_smooth_uv
*
D
;
for
(
v
=
o
;
v
<
H
;
v
+=
D
){
w
(
v
);
u
(
v
+
A
)}
return
H
-
o
})(
W
);
(
function
(
o
){
var
v
,
A
=
l
.
vertex_index_bytes
*
3
+
l
.
material_index_bytes
,
D
=
o
+
l
.
ntri_flat
*
A
;
for
(
v
=
o
;
v
<
D
;
v
+=
A
)
n
(
v
);
return
D
-
o
})(
z
);(
function
(
o
){
var
v
,
A
=
l
.
vertex_index_bytes
*
3
+
l
.
material_index_bytes
+
l
.
normal_index_bytes
*
3
,
D
=
o
+
l
.
ntri_smooth
*
A
;
for
(
v
=
o
;
v
<
D
;
v
+=
A
)
p
(
v
);
return
D
-
o
})(
Y
);(
function
(
o
){
var
v
,
A
=
l
.
vertex_index_bytes
*
4
+
l
.
material_index_bytes
,
D
=
o
+
l
.
nquad_flat
*
A
;
for
(
v
=
o
;
v
<
D
;
v
+=
A
)
t
(
v
);
return
D
-
o
})(
aa
);(
function
(
o
){
var
v
,
A
=
l
.
vertex_index_bytes
*
4
+
l
.
material_index_bytes
+
l
.
normal_index_bytes
*
4
,
D
=
o
+
l
.
nquad_smooth
*
A
;
for
(
v
=
o
;
v
<
D
;
v
+=
A
)
w
(
v
);
return
D
-
o
})(
ba
);
this
.
computeCentroids
();
this
.
computeFaceNormals
()};
c
.
prototype
=
new
THREE
.
Geometry
;
c
.
prototype
.
constructor
=
c
;
f
(
new
c
(
b
))},
v
:
function
(
a
,
f
,
b
,
e
){
a
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
f
,
b
,
e
)))},
f3
:
function
(
a
,
f
,
b
,
e
,
c
){
a
.
faces
.
push
(
new
THREE
.
Face3
(
f
,
b
,
e
,
null
,
null
,
a
.
materials
[
c
]))},
f4
:
function
(
a
,
f
,
b
,
e
,
c
,
d
){
a
.
faces
.
push
(
new
THREE
.
Face4
(
f
,
b
,
e
,
c
,
null
,
null
,
a
.
materials
[
d
]))},
f3n
:
function
(
a
,
f
,
b
,
e
,
c
,
d
,
g
,
h
,
j
){
d
=
a
.
materials
[
d
];
var
m
=
f
[
h
*
3
],
k
=
f
[
h
*
3
+
1
];
h
=
f
[
h
*
3
+
2
];
var
n
=
f
[
j
*
3
],
p
=
f
[
j
*
3
+
1
];
j
=
f
[
j
*
3
+
2
];
a
.
faces
.
push
(
new
THREE
.
Face3
(
b
,
e
,
c
,[
new
THREE
.
Vector3
(
f
[
g
*
3
],
f
[
g
*
3
+
1
],
f
[
g
*
3
+
2
]),
new
THREE
.
Vector3
(
m
,
k
,
h
),
new
THREE
.
Vector3
(
n
,
p
,
j
)],
null
,
d
))},
f4n
:
function
(
a
,
f
,
b
,
e
,
c
,
d
,
g
,
h
,
j
,
m
,
k
){
g
=
a
.
materials
[
g
];
var
n
=
f
[
j
*
3
],
p
=
f
[
j
*
3
+
1
];
j
=
f
[
j
*
3
+
2
];
var
t
=
f
[
m
*
3
],
w
=
f
[
m
*
3
+
1
];
m
=
f
[
m
*
3
+
2
];
var
x
=
f
[
k
*
3
],
u
=
f
[
k
*
3
+
1
];
k
=
f
[
k
*
3
+
2
];
a
.
faces
.
push
(
new
THREE
.
Face4
(
b
,
e
,
c
,
d
,[
new
THREE
.
Vector3
(
f
[
h
*
3
],
f
[
h
*
3
+
1
],
f
[
h
*
3
+
2
]),
new
THREE
.
Vector3
(
n
,
p
,
j
),
new
THREE
.
Vector3
(
t
,
w
,
m
),
new
THREE
.
Vector3
(
x
,
u
,
k
)],
null
,
g
))},
uv3
:
function
(
a
,
f
,
b
,
e
,
c
,
d
,
g
){
var
h
=
[];
h
.
push
(
new
THREE
.
UV
(
f
,
b
));
h
.
push
(
new
THREE
.
UV
(
e
,
c
));
h
.
push
(
new
THREE
.
UV
(
d
,
g
));
a
.
push
(
h
)},
uv4
:
function
(
a
,
f
,
b
,
e
,
c
,
d
,
g
,
h
,
j
){
var
m
=
[];
m
.
push
(
new
THREE
.
UV
(
f
,
b
));
m
.
push
(
new
THREE
.
UV
(
e
,
c
));
m
.
push
(
new
THREE
.
UV
(
d
,
g
));
m
.
push
(
new
THREE
.
UV
(
h
,
j
));
a
.
push
(
m
)}};
THREE
.
SceneLoader
=
function
(){};
THREE
.
SceneLoader
.
prototype
=
{
load
:
function
(
a
,
f
,
b
,
e
){
var
c
=
new
Worker
(
a
);
c
.
postMessage
(
0
);
var
d
=
THREE
.
Loader
.
prototype
.
extractUrlbase
(
a
);
c
.
onmessage
=
function
(
g
){
function
h
(
U
,
X
){
return
X
==
"
relativeToHTML
"
?
U
:
d
+
"
/
"
+
U
}
function
j
(){
for
(
t
in
E
.
objects
)
if
(
!
F
.
objects
[
t
]){
z
=
E
.
objects
[
t
];
if
(
G
=
F
.
geometries
[
z
.
geometry
]){
I
=
[];
for
(
T
=
0
;
T
<
z
.
materials
.
length
;
T
++
)
I
[
T
]
=
F
.
materials
[
z
.
materials
[
T
]];
l
=
z
.
position
;
r
=
z
.
rotation
;
q
=
z
.
quaternion
;
s
=
z
.
scale
;
q
=
0
;
I
.
length
==
0
&&
(
I
[
0
]
=
new
THREE
.
MeshFaceMaterial
);
object
=
new
THREE
.
Mesh
(
G
,
I
);
object
.
position
.
set
(
l
[
0
],
l
[
1
],
l
[
2
]);
if
(
q
){
object
.
quaternion
.
set
(
q
[
0
],
q
[
1
],
q
[
2
],
q
[
3
]);
object
.
useQuaternion
=!
0
}
else
object
.
rotation
.
set
(
r
[
0
],
r
[
1
],
r
[
2
]);
object
.
scale
.
set
(
s
[
0
],
s
[
1
],
s
[
2
]);
object
.
visible
=
z
.
visible
;
F
.
scene
.
addObject
(
object
);
F
.
objects
[
t
]
=
object
;
if
(
z
.
meshCollider
){
var
U
=
THREE
.
CollisionUtils
.
MeshColliderWBox
(
object
);
THREE
.
Collisions
.
colliders
.
push
(
U
)}}}}
function
m
(
U
){
return
function
(
X
){
F
.
geometries
[
U
]
=
X
;
j
();
P
-=
1
;
k
()}}
function
k
(){
e
({
total_models
:
R
,
total_textures
:
M
,
loaded_models
:
R
-
P
,
loaded_textures
:
M
-
Q
},
F
);
P
==
0
&&
Q
==
0
&&
b
(
F
)}
var
n
,
p
,
t
,
w
,
x
,
u
,
B
,
z
,
l
,
y
,
C
,
G
,
K
,
J
,
I
,
E
,
L
,
P
,
Q
,
R
,
M
,
F
;
E
=
g
.
data
;
g
=
new
THREE
.
BinaryLoader
;
L
=
new
THREE
.
JSONLoader
;
Q
=
P
=
0
;
F
=
{
scene
:
new
THREE
.
Scene
,
geometries
:{},
materials
:{},
textures
:{},
objects
:{},
cameras
:{},
lights
:{},
fogs
:{}};
if
(
E
.
transform
){
var
N
=
E
.
transform
.
position
;
y
=
E
.
transform
.
rotation
;
var
O
=
E
.
transform
.
scale
;
N
&&
F
.
scene
.
position
.
set
(
N
[
0
],
N
[
1
],
N
[
2
]);
y
&&
F
.
scene
.
rotation
.
set
(
y
[
0
],
y
[
1
],
y
[
2
]);
O
&&
F
.
scene
.
scale
.
set
(
O
[
0
],
O
[
1
],
O
[
2
]);(
N
||
y
||
O
)
&&
F
.
scene
.
updateMatrix
()}
N
=
function
(){
Q
-=
1
;
k
()};
for
(
x
in
E
.
cameras
){
y
=
E
.
cameras
[
x
];
if
(
y
.
type
==
"
perspective
"
)
K
=
new
THREE
.
Camera
(
y
.
fov
,
y
.
aspect
,
y
.
near
,
y
.
far
);
else
if
(
y
.
type
==
"
ortho
"
){
K
=
new
THREE
.
Camera
;
K
.
projectionMatrix
=
THREE
.
Matrix4
.
makeOrtho
(
y
.
left
,
y
.
right
,
y
.
top
,
y
.
bottom
,
y
.
near
,
y
.
far
)}
l
=
y
.
position
;
y
=
y
.
target
;
K
.
position
.
set
(
l
[
0
],
l
[
1
],
l
[
2
]);
K
.
target
.
position
.
set
(
y
[
0
],
y
[
1
],
y
[
2
]);
F
.
cameras
[
x
]
=
K
}
for
(
w
in
E
.
lights
){
x
=
E
.
lights
[
w
];
K
=
x
.
color
!==
undefined
?
x
.
color
:
16777215
;
y
=
x
.
intensity
!==
undefined
?
x
.
intensity
:
1
;
if
(
x
.
type
==
"
directional
"
){
l
=
x
.
direction
;
light
=
new
THREE
.
DirectionalLight
(
K
,
y
);
light
.
position
.
set
(
l
[
0
],
l
[
1
],
l
[
2
]);
light
.
position
.
normalize
()}
else
if
(
x
.
type
==
"
point
"
){
l
=
x
.
position
;
light
=
new
THREE
.
PointLight
(
K
,
y
);
light
.
position
.
set
(
l
[
0
],
l
[
1
],
l
[
2
])}
F
.
scene
.
addLight
(
light
);
F
.
lights
[
w
]
=
light
}
for
(
u
in
E
.
fogs
){
w
=
E
.
fogs
[
u
];
if
(
w
.
type
==
"
linear
"
)
J
=
new
THREE
.
Fog
(
0
,
w
.
near
,
w
.
far
);
else
w
.
type
==
"
exp2
"
&&
(
J
=
new
THREE
.
FogExp2
(
0
,
w
.
density
));
y
=
w
.
color
;
J
.
color
.
setRGB
(
y
[
0
],
y
[
1
],
y
[
2
]);
F
.
fogs
[
u
]
=
J
}
if
(
F
.
cameras
&&
E
.
defaults
.
camera
)
F
.
currentCamera
=
F
.
cameras
[
E
.
defaults
.
camera
];
THREE
.
Loader
.
prototype
=
{
addStatusElement
:
function
(){
var
a
=
document
.
createElement
(
"
div
"
);
a
.
style
.
position
=
"
absolute
"
;
a
.
style
.
right
=
"
0px
"
;
a
.
style
.
top
=
"
0px
"
;
a
.
style
.
fontSize
=
"
0.8em
"
;
a
.
style
.
textAlign
=
"
left
"
;
a
.
style
.
background
=
"
rgba(0,0,0,0.25)
"
;
a
.
style
.
color
=
"
#fff
"
;
a
.
style
.
width
=
"
120px
"
;
a
.
style
.
padding
=
"
0.5em 0.5em 0.5em 0.5em
"
;
a
.
style
.
zIndex
=
1
E3
;
a
.
innerHTML
=
"
Loading ...
"
;
return
a
},
updateProgress
:
function
(
a
){
var
b
=
"
Loaded
"
;
b
+=
a
.
total
?(
100
*
a
.
loaded
/
a
.
total
).
toFixed
(
0
)
+
"
%
"
:(
a
.
loaded
/
1
E3
).
toFixed
(
2
)
+
"
KB
"
;
this
.
statusDomElement
.
innerHTML
=
b
},
extractUrlbase
:
function
(
a
){
a
=
a
.
split
(
"
/
"
);
a
.
pop
();
return
a
.
join
(
"
/
"
)},
init_materials
:
function
(
a
,
b
,
c
){
a
.
materials
=
[];
for
(
var
d
=
0
;
d
<
b
.
length
;
++
d
)
a
.
materials
[
d
]
=
[
THREE
.
Loader
.
prototype
.
createMaterial
(
b
[
d
],
c
)]},
createMaterial
:
function
(
a
,
b
){
function
c
(
g
){
g
=
Math
.
log
(
g
)
/
Math
.
LN2
;
return
Math
.
floor
(
g
)
==
g
}
function
d
(
g
,
j
){
var
l
=
new
Image
;
l
.
onload
=
function
(){
if
(
!
c
(
this
.
width
)
||!
c
(
this
.
height
)){
var
k
=
Math
.
pow
(
2
,
Math
.
round
(
Math
.
log
(
this
.
width
)
/
Math
.
LN2
)),
n
=
Math
.
pow
(
2
,
Math
.
round
(
Math
.
log
(
this
.
height
)
/
Math
.
LN2
));
g
.
image
.
width
=
k
;
g
.
image
.
height
=
n
;
g
.
image
.
getContext
(
"
2d
"
).
drawImage
(
this
,
0
,
0
,
k
,
n
)}
else
g
.
image
=
this
;
g
.
needsUpdate
=!
0
};
l
.
src
=
j
}
var
e
,
f
,
h
;
e
=
"
MeshLambertMaterial
"
;
f
=
{
color
:
15658734
,
opacity
:
1
,
map
:
null
,
lightMap
:
null
,
wireframe
:
a
.
wireframe
};
if
(
a
.
shading
)
if
(
a
.
shading
==
"
Phong
"
)
e
=
"
MeshPhongMaterial
"
;
else
a
.
shading
==
"
Basic
"
&&
(
e
=
"
MeshBasicMaterial
"
);
if
(
a
.
blending
)
if
(
a
.
blending
==
"
Additive
"
)
f
.
blending
=
THREE
.
AdditiveBlending
;
else
if
(
a
.
blending
==
"
Subtractive
"
)
f
.
blending
=
THREE
.
SubtractiveBlending
;
else
if
(
a
.
blending
==
"
Multiply
"
)
f
.
blending
=
THREE
.
MultiplyBlending
;
if
(
a
.
transparent
!==
undefined
)
f
.
transparent
=
a
.
transparent
;
if
(
a
.
depthTest
!==
undefined
)
f
.
depthTest
=
a
.
depthTest
;
if
(
a
.
vertexColors
!==
undefined
)
if
(
a
.
vertexColors
==
"
face
"
)
f
.
vertexColors
=
THREE
.
FaceColors
;
else
if
(
a
.
vertexColors
)
f
.
vertexColors
=
THREE
.
VertexColors
;
if
(
a
.
mapDiffuse
&&
b
){
h
=
document
.
createElement
(
"
canvas
"
);
f
.
map
=
new
THREE
.
Texture
(
h
);
f
.
map
.
sourceFile
=
a
.
mapDiffuse
;
d
(
f
.
map
,
b
+
"
/
"
+
a
.
mapDiffuse
)}
else
if
(
a
.
colorDiffuse
){
h
=
(
a
.
colorDiffuse
[
0
]
*
255
<<
16
)
+
(
a
.
colorDiffuse
[
1
]
*
255
<<
8
)
+
a
.
colorDiffuse
[
2
]
*
255
;
f
.
color
=
h
;
f
.
opacity
=
a
.
transparency
}
else
if
(
a
.
DbgColor
)
f
.
color
=
a
.
DbgColor
;
if
(
a
.
mapLightmap
&&
b
){
h
=
document
.
createElement
(
"
canvas
"
);
f
.
lightMap
=
new
THREE
.
Texture
(
h
);
f
.
lightMap
.
sourceFile
=
a
.
mapLightmap
;
d
(
f
.
lightMap
,
b
+
"
/
"
+
a
.
mapLightmap
)}
return
new
THREE
[
e
](
f
)}};
THREE
.
JSONLoader
=
function
(
a
){
THREE
.
Loader
.
call
(
this
,
a
)};
THREE
.
JSONLoader
.
prototype
=
new
THREE
.
Loader
;
THREE
.
JSONLoader
.
prototype
.
constructor
=
THREE
.
JSONLoader
;
THREE
.
JSONLoader
.
prototype
.
supr
=
THREE
.
Loader
.
prototype
;
THREE
.
JSONLoader
.
prototype
.
load
=
function
(
a
){
var
b
=
this
,
c
=
a
.
model
,
d
=
a
.
callback
,
e
=
a
.
texture_path
?
a
.
texture_path
:
this
.
extractUrlbase
(
c
);
a
=
new
Worker
(
c
);
a
.
onmessage
=
function
(
f
){
b
.
createModel
(
f
.
data
,
d
,
e
);
b
.
onLoadComplete
()};
this
.
onLoadStart
();
a
.
postMessage
((
new
Date
).
getTime
())};
THREE
.
JSONLoader
.
prototype
.
createModel
=
function
(
a
,
b
,
c
){
var
d
=
new
THREE
.
Geometry
;
this
.
init_materials
(
d
,
a
.
materials
,
c
);(
function
(){
if
(
a
.
version
===
undefined
||
a
.
version
!=
2
)
console
.
error
(
"
Deprecated file format.
"
);
else
{
var
e
,
f
,
h
,
g
,
j
,
l
,
k
,
n
,
p
,
t
,
w
,
x
,
u
,
B
,
z
,
m
=
a
.
faces
;
t
=
a
.
vertices
;
var
y
=
a
.
normals
,
C
=
a
.
colors
;
l
=
a
.
scale
!==
undefined
?
a
.
scale
:
1
;
var
G
=
0
;
for
(
e
=
0
;
e
<
a
.
uvs
.
length
;
e
++
)
a
.
uvs
[
e
].
length
&&
G
++
;
for
(
e
=
0
;
e
<
G
;
e
++
){
d
.
faceUvs
[
e
]
=
[];
d
.
faceVertexUvs
[
e
]
=
[]}
g
=
0
;
for
(
j
=
t
.
length
;
g
<
j
;){
k
=
new
THREE
.
Vertex
;
k
.
position
.
x
=
t
[
g
++
]
/
l
;
k
.
position
.
y
=
t
[
g
++
]
/
l
;
k
.
position
.
z
=
t
[
g
++
]
/
l
;
d
.
vertices
.
push
(
k
)}
g
=
0
;
for
(
j
=
m
.
length
;
g
<
j
;){
t
=
m
[
g
++
];
l
=
t
&
1
;
h
=
t
&
2
;
e
=
t
&
4
;
f
=
t
&
8
;
n
=
t
&
16
;
k
=
t
&
32
;
w
=
t
&
64
;
t
&=
128
;
if
(
l
){
x
=
new
THREE
.
Face4
;
x
.
a
=
m
[
g
++
];
x
.
b
=
m
[
g
++
];
x
.
c
=
m
[
g
++
];
x
.
d
=
m
[
g
++
];
l
=
4
}
else
{
x
=
new
THREE
.
Face3
;
x
.
a
=
m
[
g
++
];
x
.
b
=
m
[
g
++
];
x
.
c
=
m
[
g
++
];
l
=
3
}
if
(
h
){
h
=
m
[
g
++
];
x
.
materials
=
d
.
materials
[
h
]}
h
=
d
.
faces
.
length
;
if
(
e
)
for
(
e
=
0
;
e
<
G
;
e
++
){
u
=
a
.
uvs
[
e
];
p
=
m
[
g
++
];
z
=
u
[
p
*
2
];
p
=
u
[
p
*
2
+
1
];
d
.
faceUvs
[
e
][
h
]
=
new
THREE
.
UV
(
z
,
p
)}
if
(
f
)
for
(
e
=
0
;
e
<
G
;
e
++
){
u
=
a
.
uvs
[
e
];
B
=
[];
for
(
f
=
0
;
f
<
l
;
f
++
){
p
=
m
[
g
++
];
z
=
u
[
p
*
2
];
p
=
u
[
p
*
2
+
1
];
B
[
f
]
=
new
THREE
.
UV
(
z
,
p
)}
d
.
faceVertexUvs
[
e
][
h
]
=
B
}
if
(
n
){
n
=
m
[
g
++
]
*
3
;
f
=
new
THREE
.
Vector3
;
f
.
x
=
y
[
n
++
];
f
.
y
=
y
[
n
++
];
f
.
z
=
y
[
n
];
x
.
normal
=
f
}
if
(
k
)
for
(
e
=
0
;
e
<
l
;
e
++
){
n
=
m
[
g
++
]
*
3
;
f
=
new
THREE
.
Vector3
;
f
.
x
=
y
[
n
++
];
f
.
y
=
y
[
n
++
];
f
.
z
=
y
[
n
];
x
.
vertexNormals
.
push
(
f
)}
if
(
w
){
k
=
m
[
g
++
];
k
=
new
THREE
.
Color
(
C
[
k
]);
x
.
color
=
k
}
if
(
t
)
for
(
e
=
0
;
e
<
l
;
e
++
){
k
=
m
[
g
++
];
k
=
new
THREE
.
Color
(
C
[
k
]);
x
.
vertexColors
.
push
(
k
)}
d
.
faces
.
push
(
x
)}}})();(
function
(){
var
e
,
f
,
h
,
g
;
if
(
a
.
skinWeights
){
e
=
0
;
for
(
f
=
a
.
skinWeights
.
length
;
e
<
f
;
e
+=
2
){
h
=
a
.
skinWeights
[
e
];
g
=
a
.
skinWeights
[
e
+
1
];
d
.
skinWeights
.
push
(
new
THREE
.
Vector4
(
h
,
g
,
0
,
0
))}}
if
(
a
.
skinIndices
){
e
=
0
;
for
(
f
=
a
.
skinIndices
.
length
;
e
<
f
;
e
+=
2
){
h
=
a
.
skinIndices
[
e
];
g
=
a
.
skinIndices
[
e
+
1
];
d
.
skinIndices
.
push
(
new
THREE
.
Vector4
(
h
,
g
,
0
,
0
))}}
d
.
bones
=
a
.
bones
;
d
.
animation
=
a
.
animation
})();(
function
(){
if
(
a
.
morphTargets
!==
undefined
){
var
e
,
f
,
h
,
g
,
j
,
l
;
e
=
0
;
for
(
f
=
a
.
morphTargets
.
length
;
e
<
f
;
e
++
){
d
.
morphTargets
[
e
]
=
{};
d
.
morphTargets
[
e
].
name
=
a
.
morphTargets
[
e
].
name
;
d
.
morphTargets
[
e
].
vertices
=
[];
j
=
d
.
morphTargets
[
e
].
vertices
;
l
=
a
.
morphTargets
[
e
].
vertices
;
h
=
0
;
for
(
g
=
l
.
length
;
h
<
g
;
h
+=
3
)
j
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
l
[
h
],
l
[
h
+
1
],
l
[
h
+
2
])))}}
if
(
a
.
morphColors
!==
undefined
){
var
k
,
n
;
e
=
0
;
for
(
f
=
a
.
morphColors
.
length
;
e
<
f
;
e
++
){
d
.
morphColors
[
e
]
=
{};
d
.
morphColors
[
e
].
name
=
a
.
morphColors
[
e
].
name
;
d
.
morphColors
[
e
].
colors
=
[];
l
=
d
.
morphColors
[
e
].
colors
;
k
=
a
.
morphColors
[
e
].
colors
;
g
=
0
;
for
(
j
=
k
.
length
;
g
<
j
;
g
+=
3
){
n
=
new
THREE
.
Color
(
16755200
);
n
.
setRGB
(
k
[
h
],
k
[
h
+
1
],
k
[
h
+
2
]);
l
.
push
(
n
)}}}})();(
function
(){
if
(
a
.
edges
!==
undefined
){
var
e
,
f
,
h
;
for
(
e
=
0
;
e
<
a
.
edges
.
length
;
e
+=
2
){
f
=
a
.
edges
[
e
];
h
=
a
.
edges
[
e
+
1
];
d
.
edges
.
push
(
new
THREE
.
Edge
(
d
.
vertices
[
f
],
d
.
vertices
[
h
],
f
,
h
))}}})();
d
.
computeCentroids
();
d
.
computeFaceNormals
();
d
.
computeEdgeFaces
();
b
(
d
)};
THREE
.
BinaryLoader
=
function
(
a
){
THREE
.
Loader
.
call
(
this
,
a
)};
THREE
.
BinaryLoader
.
prototype
=
new
THREE
.
Loader
;
THREE
.
BinaryLoader
.
prototype
.
constructor
=
THREE
.
BinaryLoader
;
THREE
.
BinaryLoader
.
prototype
.
supr
=
THREE
.
Loader
.
prototype
;
THREE
.
BinaryLoader
.
prototype
=
{
load
:
function
(
a
){
var
b
=
a
.
model
,
c
=
a
.
callback
,
d
=
a
.
texture_path
?
a
.
texture_path
:
THREE
.
Loader
.
prototype
.
extractUrlbase
(
b
),
e
=
a
.
bin_path
?
a
.
bin_path
:
THREE
.
Loader
.
prototype
.
extractUrlbase
(
b
);
a
=
(
new
Date
).
getTime
();
b
=
new
Worker
(
b
);
var
f
=
this
.
showProgress
?
THREE
.
Loader
.
prototype
.
updateProgress
:
null
;
b
.
onmessage
=
function
(
h
){
THREE
.
BinaryLoader
.
prototype
.
loadAjaxBuffers
(
h
.
data
.
buffers
,
h
.
data
.
materials
,
c
,
e
,
d
,
f
)};
b
.
onerror
=
function
(
h
){
alert
(
"
worker.onerror:
"
+
h
.
message
+
"
\n
"
+
h
.
data
);
h
.
preventDefault
()};
b
.
postMessage
(
a
)},
loadAjaxBuffers
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
var
h
=
new
XMLHttpRequest
,
g
=
d
+
"
/
"
+
a
,
j
=
0
;
h
.
onreadystatechange
=
function
(){
if
(
h
.
readyState
==
4
)
h
.
status
==
200
||
h
.
status
==
0
?
THREE
.
BinaryLoader
.
prototype
.
createBinModel
(
h
.
responseText
,
c
,
e
,
b
):
alert
(
"
Couldn't load [
"
+
g
+
"
] [
"
+
h
.
status
+
"
]
"
);
else
if
(
h
.
readyState
==
3
){
if
(
f
){
j
==
0
&&
(
j
=
h
.
getResponseHeader
(
"
Content-Length
"
));
f
({
total
:
j
,
loaded
:
h
.
responseText
.
length
})}}
else
h
.
readyState
==
2
&&
(
j
=
h
.
getResponseHeader
(
"
Content-Length
"
))};
h
.
open
(
"
GET
"
,
g
,
!
0
);
h
.
overrideMimeType
(
"
text/plain; charset=x-user-defined
"
);
h
.
setRequestHeader
(
"
Content-Type
"
,
"
text/plain
"
);
h
.
send
(
null
)},
createBinModel
:
function
(
a
,
b
,
c
,
d
){
var
e
=
function
(
f
){
function
h
(
o
,
v
){
var
A
=
k
(
o
,
v
),
D
=
k
(
o
,
v
+
1
),
H
=
k
(
o
,
v
+
2
),
S
=
k
(
o
,
v
+
3
),
V
=
(
S
<<
1
&
255
|
H
>>
7
)
-
127
;
A
|=
(
H
&
127
)
<<
16
|
D
<<
8
;
if
(
A
==
0
&&
V
==-
127
)
return
0
;
return
(
1
-
2
*
(
S
>>
7
))
*
(
1
+
A
*
Math
.
pow
(
2
,
-
23
))
*
Math
.
pow
(
2
,
V
)}
function
g
(
o
,
v
){
var
A
=
k
(
o
,
v
),
D
=
k
(
o
,
v
+
1
),
H
=
k
(
o
,
v
+
2
);
return
(
k
(
o
,
v
+
3
)
<<
24
)
+
(
H
<<
16
)
+
(
D
<<
8
)
+
A
}
function
j
(
o
,
v
){
var
A
=
k
(
o
,
v
);
return
(
k
(
o
,
v
+
1
)
<<
8
)
+
A
}
function
l
(
o
,
v
){
var
A
=
k
(
o
,
v
);
return
A
>
127
?
A
-
256
:
A
}
function
k
(
o
,
v
){
return
o
.
charCodeAt
(
v
)
&
255
}
function
n
(
o
){
var
v
,
A
,
D
;
v
=
g
(
a
,
o
);
A
=
g
(
a
,
o
+
G
);
D
=
g
(
a
,
o
+
K
);
o
=
j
(
a
,
o
+
J
);
THREE
.
BinaryLoader
.
prototype
.
f3
(
B
,
v
,
A
,
D
,
o
)}
function
p
(
o
){
var
v
,
A
,
D
,
H
,
S
,
V
;
v
=
g
(
a
,
o
);
A
=
g
(
a
,
o
+
G
);
D
=
g
(
a
,
o
+
K
);
H
=
j
(
a
,
o
+
J
);
S
=
g
(
a
,
o
+
I
);
V
=
g
(
a
,
o
+
E
);
o
=
g
(
a
,
o
+
L
);
THREE
.
BinaryLoader
.
prototype
.
f3n
(
B
,
y
,
v
,
A
,
D
,
H
,
S
,
V
,
o
)}
function
t
(
o
){
var
v
,
A
,
D
,
H
;
v
=
g
(
a
,
o
);
A
=
g
(
a
,
o
+
P
);
D
=
g
(
a
,
o
+
Q
);
H
=
g
(
a
,
o
+
R
);
o
=
j
(
a
,
o
+
M
);
THREE
.
BinaryLoader
.
prototype
.
f4
(
B
,
v
,
A
,
D
,
H
,
o
)}
function
w
(
o
){
var
v
,
A
,
D
,
H
,
S
,
V
,
ca
,
da
;
v
=
g
(
a
,
o
);
A
=
g
(
a
,
o
+
P
);
D
=
g
(
a
,
o
+
Q
);
H
=
g
(
a
,
o
+
R
);
S
=
j
(
a
,
o
+
M
);
V
=
g
(
a
,
o
+
F
);
ca
=
g
(
a
,
o
+
N
);
da
=
g
(
a
,
o
+
O
);
o
=
g
(
a
,
o
+
T
);
THREE
.
BinaryLoader
.
prototype
.
f4n
(
B
,
y
,
v
,
A
,
D
,
H
,
S
,
V
,
ca
,
da
,
o
)}
function
x
(
o
){
var
v
,
A
;
v
=
g
(
a
,
o
);
A
=
g
(
a
,
o
+
U
);
o
=
g
(
a
,
o
+
X
);
THREE
.
BinaryLoader
.
prototype
.
uv3
(
B
.
faceVertexUvs
[
0
],
C
[
v
*
2
],
C
[
v
*
2
+
1
],
C
[
A
*
2
],
C
[
A
*
2
+
1
],
C
[
o
*
2
],
C
[
o
*
2
+
1
])}
function
u
(
o
){
var
v
,
A
,
D
;
v
=
g
(
a
,
o
);
A
=
g
(
a
,
o
+
ea
);
D
=
g
(
a
,
o
+
fa
);
o
=
g
(
a
,
o
+
ga
);
THREE
.
BinaryLoader
.
prototype
.
uv4
(
B
.
faceVertexUvs
[
0
],
C
[
v
*
2
],
C
[
v
*
2
+
1
],
C
[
A
*
2
],
C
[
A
*
2
+
1
],
C
[
D
*
2
],
C
[
D
*
2
+
1
],
C
[
o
*
2
],
C
[
o
*
2
+
1
])}
var
B
=
this
,
z
=
0
,
m
,
y
=
[],
C
=
[],
G
,
K
,
J
,
I
,
E
,
L
,
P
,
Q
,
R
,
M
,
F
,
N
,
O
,
T
,
U
,
X
,
ea
,
fa
,
ga
,
Y
,
Z
,
$
,
aa
,
ba
,
W
;
THREE
.
Geometry
.
call
(
this
);
THREE
.
Loader
.
prototype
.
init_materials
(
B
,
d
,
f
);
m
=
{
signature
:
a
.
substr
(
z
,
8
),
header_bytes
:
k
(
a
,
z
+
8
),
vertex_coordinate_bytes
:
k
(
a
,
z
+
9
),
normal_coordinate_bytes
:
k
(
a
,
z
+
10
),
uv_coordinate_bytes
:
k
(
a
,
z
+
11
),
vertex_index_bytes
:
k
(
a
,
z
+
12
),
normal_index_bytes
:
k
(
a
,
z
+
13
),
uv_index_bytes
:
k
(
a
,
z
+
14
),
material_index_bytes
:
k
(
a
,
z
+
15
),
nvertices
:
g
(
a
,
z
+
16
),
nnormals
:
g
(
a
,
z
+
16
+
4
),
nuvs
:
g
(
a
,
z
+
16
+
8
),
ntri_flat
:
g
(
a
,
z
+
16
+
12
),
ntri_smooth
:
g
(
a
,
z
+
16
+
16
),
ntri_flat_uv
:
g
(
a
,
z
+
16
+
20
),
ntri_smooth_uv
:
g
(
a
,
z
+
16
+
24
),
nquad_flat
:
g
(
a
,
z
+
16
+
28
),
nquad_smooth
:
g
(
a
,
z
+
16
+
32
),
nquad_flat_uv
:
g
(
a
,
z
+
16
+
36
),
nquad_smooth_uv
:
g
(
a
,
z
+
16
+
40
)};
z
+=
m
.
header_bytes
;
G
=
m
.
vertex_index_bytes
;
K
=
m
.
vertex_index_bytes
*
2
;
J
=
m
.
vertex_index_bytes
*
3
;
I
=
m
.
vertex_index_bytes
*
3
+
m
.
material_index_bytes
;
E
=
m
.
vertex_index_bytes
*
3
+
m
.
material_index_bytes
+
m
.
normal_index_bytes
;
L
=
m
.
vertex_index_bytes
*
3
+
m
.
material_index_bytes
+
m
.
normal_index_bytes
*
2
;
P
=
m
.
vertex_index_bytes
;
Q
=
m
.
vertex_index_bytes
*
2
;
R
=
m
.
vertex_index_bytes
*
3
;
M
=
m
.
vertex_index_bytes
*
4
;
F
=
m
.
vertex_index_bytes
*
4
+
m
.
material_index_bytes
;
N
=
m
.
vertex_index_bytes
*
4
+
m
.
material_index_bytes
+
m
.
normal_index_bytes
;
O
=
m
.
vertex_index_bytes
*
4
+
m
.
material_index_bytes
+
m
.
normal_index_bytes
*
2
;
T
=
m
.
vertex_index_bytes
*
4
+
m
.
material_index_bytes
+
m
.
normal_index_bytes
*
3
;
U
=
m
.
uv_index_bytes
;
X
=
m
.
uv_index_bytes
*
2
;
ea
=
m
.
uv_index_bytes
;
fa
=
m
.
uv_index_bytes
*
2
;
ga
=
m
.
uv_index_bytes
*
3
;
f
=
m
.
vertex_index_bytes
*
3
+
m
.
material_index_bytes
;
W
=
m
.
vertex_index_bytes
*
4
+
m
.
material_index_bytes
;
Y
=
m
.
ntri_flat
*
f
;
Z
=
m
.
ntri_smooth
*
(
f
+
m
.
normal_index_bytes
*
3
);
$
=
m
.
ntri_flat_uv
*
(
f
+
m
.
uv_index_bytes
*
3
);
aa
=
m
.
ntri_smooth_uv
*
(
f
+
m
.
normal_index_bytes
*
3
+
m
.
uv_index_bytes
*
3
);
ba
=
m
.
nquad_flat
*
W
;
f
=
m
.
nquad_smooth
*
(
W
+
m
.
normal_index_bytes
*
4
);
W
=
m
.
nquad_flat_uv
*
(
W
+
m
.
uv_index_bytes
*
4
);
z
+=
function
(
o
){
for
(
var
v
,
A
,
D
,
H
=
m
.
vertex_coordinate_bytes
*
3
,
S
=
o
+
m
.
nvertices
*
H
;
o
<
S
;
o
+=
H
){
v
=
h
(
a
,
o
);
A
=
h
(
a
,
o
+
m
.
vertex_coordinate_bytes
);
D
=
h
(
a
,
o
+
m
.
vertex_coordinate_bytes
*
2
);
THREE
.
BinaryLoader
.
prototype
.
v
(
B
,
v
,
A
,
D
)}
return
m
.
nvertices
*
H
}(
z
);
z
+=
function
(
o
){
for
(
var
v
,
A
,
D
,
H
=
m
.
normal_coordinate_bytes
*
3
,
S
=
o
+
m
.
nnormals
*
H
;
o
<
S
;
o
+=
H
){
v
=
l
(
a
,
o
);
A
=
l
(
a
,
o
+
m
.
normal_coordinate_bytes
);
D
=
l
(
a
,
o
+
m
.
normal_coordinate_bytes
*
2
);
y
.
push
(
v
/
127
,
A
/
127
,
D
/
127
)}
return
m
.
nnormals
*
H
}(
z
);
z
+=
function
(
o
){
for
(
var
v
,
A
,
D
=
m
.
uv_coordinate_bytes
*
2
,
H
=
o
+
m
.
nuvs
*
D
;
o
<
H
;
o
+=
D
){
v
=
h
(
a
,
o
);
A
=
h
(
a
,
o
+
m
.
uv_coordinate_bytes
);
C
.
push
(
v
,
A
)}
return
m
.
nuvs
*
D
}(
z
);
Y
=
z
+
Y
;
Z
=
Y
+
Z
;
$
=
Z
+
$
;
aa
=
$
+
aa
;
ba
=
aa
+
ba
;
f
=
ba
+
f
;
W
=
f
+
W
;(
function
(
o
){
var
v
,
A
=
m
.
vertex_index_bytes
*
3
+
m
.
material_index_bytes
,
D
=
A
+
m
.
uv_index_bytes
*
3
,
H
=
o
+
m
.
ntri_flat_uv
*
D
;
for
(
v
=
o
;
v
<
H
;
v
+=
D
){
n
(
v
);
x
(
v
+
A
)}
return
H
-
o
})(
Z
);(
function
(
o
){
var
v
,
A
=
m
.
vertex_index_bytes
*
3
+
m
.
material_index_bytes
+
m
.
normal_index_bytes
*
3
,
D
=
A
+
m
.
uv_index_bytes
*
3
,
H
=
o
+
m
.
ntri_smooth_uv
*
D
;
for
(
v
=
o
;
v
<
H
;
v
+=
D
){
p
(
v
);
x
(
v
+
A
)}
return
H
-
o
})(
$
);(
function
(
o
){
var
v
,
A
=
m
.
vertex_index_bytes
*
4
+
m
.
material_index_bytes
,
D
=
A
+
m
.
uv_index_bytes
*
4
,
H
=
o
+
m
.
nquad_flat_uv
*
D
;
for
(
v
=
o
;
v
<
H
;
v
+=
D
){
t
(
v
);
u
(
v
+
A
)}
return
H
-
o
})(
f
);(
function
(
o
){
var
v
,
A
=
m
.
vertex_index_bytes
*
4
+
m
.
material_index_bytes
+
m
.
normal_index_bytes
*
4
,
D
=
A
+
m
.
uv_index_bytes
*
4
,
H
=
o
+
m
.
nquad_smooth_uv
*
D
;
for
(
v
=
o
;
v
<
H
;
v
+=
D
){
w
(
v
);
u
(
v
+
A
)}
return
H
-
o
})(
W
);
(
function
(
o
){
var
v
,
A
=
m
.
vertex_index_bytes
*
3
+
m
.
material_index_bytes
,
D
=
o
+
m
.
ntri_flat
*
A
;
for
(
v
=
o
;
v
<
D
;
v
+=
A
)
n
(
v
);
return
D
-
o
})(
z
);(
function
(
o
){
var
v
,
A
=
m
.
vertex_index_bytes
*
3
+
m
.
material_index_bytes
+
m
.
normal_index_bytes
*
3
,
D
=
o
+
m
.
ntri_smooth
*
A
;
for
(
v
=
o
;
v
<
D
;
v
+=
A
)
p
(
v
);
return
D
-
o
})(
Y
);(
function
(
o
){
var
v
,
A
=
m
.
vertex_index_bytes
*
4
+
m
.
material_index_bytes
,
D
=
o
+
m
.
nquad_flat
*
A
;
for
(
v
=
o
;
v
<
D
;
v
+=
A
)
t
(
v
);
return
D
-
o
})(
aa
);(
function
(
o
){
var
v
,
A
=
m
.
vertex_index_bytes
*
4
+
m
.
material_index_bytes
+
m
.
normal_index_bytes
*
4
,
D
=
o
+
m
.
nquad_smooth
*
A
;
for
(
v
=
o
;
v
<
D
;
v
+=
A
)
w
(
v
);
return
D
-
o
})(
ba
);
this
.
computeCentroids
();
this
.
computeFaceNormals
()};
e
.
prototype
=
new
THREE
.
Geometry
;
e
.
prototype
.
constructor
=
e
;
b
(
new
e
(
c
))},
v
:
function
(
a
,
b
,
c
,
d
){
a
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
b
,
c
,
d
)))},
f3
:
function
(
a
,
b
,
c
,
d
,
e
){
a
.
faces
.
push
(
new
THREE
.
Face3
(
b
,
c
,
d
,
null
,
null
,
a
.
materials
[
e
]))},
f4
:
function
(
a
,
b
,
c
,
d
,
e
,
f
){
a
.
faces
.
push
(
new
THREE
.
Face4
(
b
,
c
,
d
,
e
,
null
,
null
,
a
.
materials
[
f
]))},
f3n
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
h
,
g
,
j
){
f
=
a
.
materials
[
f
];
var
l
=
b
[
g
*
3
],
k
=
b
[
g
*
3
+
1
];
g
=
b
[
g
*
3
+
2
];
var
n
=
b
[
j
*
3
],
p
=
b
[
j
*
3
+
1
];
j
=
b
[
j
*
3
+
2
];
a
.
faces
.
push
(
new
THREE
.
Face3
(
c
,
d
,
e
,[
new
THREE
.
Vector3
(
b
[
h
*
3
],
b
[
h
*
3
+
1
],
b
[
h
*
3
+
2
]),
new
THREE
.
Vector3
(
l
,
k
,
g
),
new
THREE
.
Vector3
(
n
,
p
,
j
)],
null
,
f
))},
f4n
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
h
,
g
,
j
,
l
,
k
){
h
=
a
.
materials
[
h
];
var
n
=
b
[
j
*
3
],
p
=
b
[
j
*
3
+
1
];
j
=
b
[
j
*
3
+
2
];
var
t
=
b
[
l
*
3
],
w
=
b
[
l
*
3
+
1
];
l
=
b
[
l
*
3
+
2
];
var
x
=
b
[
k
*
3
],
u
=
b
[
k
*
3
+
1
];
k
=
b
[
k
*
3
+
2
];
a
.
faces
.
push
(
new
THREE
.
Face4
(
c
,
d
,
e
,
f
,[
new
THREE
.
Vector3
(
b
[
g
*
3
],
b
[
g
*
3
+
1
],
b
[
g
*
3
+
2
]),
new
THREE
.
Vector3
(
n
,
p
,
j
),
new
THREE
.
Vector3
(
t
,
w
,
l
),
new
THREE
.
Vector3
(
x
,
u
,
k
)],
null
,
h
))},
uv3
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
h
){
var
g
=
[];
g
.
push
(
new
THREE
.
UV
(
b
,
c
));
g
.
push
(
new
THREE
.
UV
(
d
,
e
));
g
.
push
(
new
THREE
.
UV
(
f
,
h
));
a
.
push
(
g
)},
uv4
:
function
(
a
,
b
,
c
,
d
,
e
,
f
,
h
,
g
,
j
){
var
l
=
[];
l
.
push
(
new
THREE
.
UV
(
b
,
c
));
l
.
push
(
new
THREE
.
UV
(
d
,
e
));
l
.
push
(
new
THREE
.
UV
(
f
,
h
));
l
.
push
(
new
THREE
.
UV
(
g
,
j
));
a
.
push
(
l
)}};
THREE
.
SceneLoader
=
function
(){};
THREE
.
SceneLoader
.
prototype
=
{
load
:
function
(
a
,
b
,
c
,
d
){
var
e
=
new
Worker
(
a
);
e
.
postMessage
(
0
);
var
f
=
THREE
.
Loader
.
prototype
.
extractUrlbase
(
a
);
e
.
onmessage
=
function
(
h
){
function
g
(
U
,
X
){
return
X
==
"
relativeToHTML
"
?
U
:
f
+
"
/
"
+
U
}
function
j
(){
for
(
t
in
E
.
objects
)
if
(
!
F
.
objects
[
t
]){
z
=
E
.
objects
[
t
];
if
(
G
=
F
.
geometries
[
z
.
geometry
]){
I
=
[];
for
(
T
=
0
;
T
<
z
.
materials
.
length
;
T
++
)
I
[
T
]
=
F
.
materials
[
z
.
materials
[
T
]];
m
=
z
.
position
;
r
=
z
.
rotation
;
q
=
z
.
quaternion
;
s
=
z
.
scale
;
q
=
0
;
I
.
length
==
0
&&
(
I
[
0
]
=
new
THREE
.
MeshFaceMaterial
);
object
=
new
THREE
.
Mesh
(
G
,
I
);
object
.
position
.
set
(
m
[
0
],
m
[
1
],
m
[
2
]);
if
(
q
){
object
.
quaternion
.
set
(
q
[
0
],
q
[
1
],
q
[
2
],
q
[
3
]);
object
.
useQuaternion
=!
0
}
else
object
.
rotation
.
set
(
r
[
0
],
r
[
1
],
r
[
2
]);
object
.
scale
.
set
(
s
[
0
],
s
[
1
],
s
[
2
]);
object
.
visible
=
z
.
visible
;
F
.
scene
.
addObject
(
object
);
F
.
objects
[
t
]
=
object
;
if
(
z
.
meshCollider
){
var
U
=
THREE
.
CollisionUtils
.
MeshColliderWBox
(
object
);
THREE
.
Collisions
.
colliders
.
push
(
U
)}}}}
function
l
(
U
){
return
function
(
X
){
F
.
geometries
[
U
]
=
X
;
j
();
P
-=
1
;
k
()}}
function
k
(){
d
({
total_models
:
R
,
total_textures
:
M
,
loaded_models
:
R
-
P
,
loaded_textures
:
M
-
Q
},
F
);
P
==
0
&&
Q
==
0
&&
c
(
F
)}
var
n
,
p
,
t
,
w
,
x
,
u
,
B
,
z
,
m
,
y
,
C
,
G
,
K
,
J
,
I
,
E
,
L
,
P
,
Q
,
R
,
M
,
F
;
E
=
h
.
data
;
h
=
new
THREE
.
BinaryLoader
;
L
=
new
THREE
.
JSONLoader
;
Q
=
P
=
0
;
F
=
{
scene
:
new
THREE
.
Scene
,
geometries
:{},
materials
:{},
textures
:{},
objects
:{},
cameras
:{},
lights
:{},
fogs
:{}};
if
(
E
.
transform
){
var
N
=
E
.
transform
.
position
;
y
=
E
.
transform
.
rotation
;
var
O
=
E
.
transform
.
scale
;
N
&&
F
.
scene
.
position
.
set
(
N
[
0
],
N
[
1
],
N
[
2
]);
y
&&
F
.
scene
.
rotation
.
set
(
y
[
0
],
y
[
1
],
y
[
2
]);
O
&&
F
.
scene
.
scale
.
set
(
O
[
0
],
O
[
1
],
O
[
2
]);(
N
||
y
||
O
)
&&
F
.
scene
.
updateMatrix
()}
N
=
function
(){
Q
-=
1
;
k
()};
for
(
x
in
E
.
cameras
){
y
=
E
.
cameras
[
x
];
if
(
y
.
type
==
"
perspective
"
)
K
=
new
THREE
.
Camera
(
y
.
fov
,
y
.
aspect
,
y
.
near
,
y
.
far
);
else
if
(
y
.
type
==
"
ortho
"
){
K
=
new
THREE
.
Camera
;
K
.
projectionMatrix
=
THREE
.
Matrix4
.
makeOrtho
(
y
.
left
,
y
.
right
,
y
.
top
,
y
.
bottom
,
y
.
near
,
y
.
far
)}
m
=
y
.
position
;
y
=
y
.
target
;
K
.
position
.
set
(
m
[
0
],
m
[
1
],
m
[
2
]);
K
.
target
.
position
.
set
(
y
[
0
],
y
[
1
],
y
[
2
]);
F
.
cameras
[
x
]
=
K
}
for
(
w
in
E
.
lights
){
x
=
E
.
lights
[
w
];
K
=
x
.
color
!==
undefined
?
x
.
color
:
16777215
;
y
=
x
.
intensity
!==
undefined
?
x
.
intensity
:
1
;
if
(
x
.
type
==
"
directional
"
){
m
=
x
.
direction
;
light
=
new
THREE
.
DirectionalLight
(
K
,
y
);
light
.
position
.
set
(
m
[
0
],
m
[
1
],
m
[
2
]);
light
.
position
.
normalize
()}
else
if
(
x
.
type
==
"
point
"
){
m
=
x
.
position
;
light
=
new
THREE
.
PointLight
(
K
,
y
);
light
.
position
.
set
(
m
[
0
],
m
[
1
],
m
[
2
])}
F
.
scene
.
addLight
(
light
);
F
.
lights
[
w
]
=
light
}
for
(
u
in
E
.
fogs
){
w
=
E
.
fogs
[
u
];
if
(
w
.
type
==
"
linear
"
)
J
=
new
THREE
.
Fog
(
0
,
w
.
near
,
w
.
far
);
else
w
.
type
==
"
exp2
"
&&
(
J
=
new
THREE
.
FogExp2
(
0
,
w
.
density
));
y
=
w
.
color
;
J
.
color
.
setRGB
(
y
[
0
],
y
[
1
],
y
[
2
]);
F
.
fogs
[
u
]
=
J
}
if
(
F
.
cameras
&&
E
.
defaults
.
camera
)
F
.
currentCamera
=
F
.
cameras
[
E
.
defaults
.
camera
];
if
(
F
.
fogs
&&
E
.
defaults
.
fog
)
F
.
scene
.
fog
=
F
.
fogs
[
E
.
defaults
.
fog
];
y
=
E
.
defaults
.
bgcolor
;
F
.
bgColor
=
new
THREE
.
Color
;
F
.
bgColor
.
setRGB
(
y
[
0
],
y
[
1
],
y
[
2
]);
F
.
bgColorAlpha
=
E
.
defaults
.
bgalpha
;
for
(
n
in
E
.
geometries
){
u
=
E
.
geometries
[
n
];
if
(
u
.
type
==
"
bin_mesh
"
||
u
.
type
==
"
ascii_mesh
"
)
P
+=
1
}
R
=
P
;
for
(
n
in
E
.
geometries
){
u
=
E
.
geometries
[
n
];
if
(
u
.
type
==
"
cube
"
){
G
=
new
Cube
(
u
.
width
,
u
.
height
,
u
.
depth
,
u
.
segmentsWidth
,
u
.
segmentsHeight
,
u
.
segmentsDepth
,
null
,
u
.
flipped
,
u
.
sides
);
F
.
geometries
[
n
]
=
G
}
else
if
(
u
.
type
==
"
plane
"
){
G
=
new
Plane
(
u
.
width
,
u
.
height
,
u
.
segmentsWidth
,
u
.
segmentsHeight
);
F
.
geometries
[
n
]
=
G
}
else
if
(
u
.
type
==
"
sphere
"
){
G
=
new
Sphere
(
u
.
radius
,
u
.
segmentsWidth
,
u
.
segmentsHeight
);
F
.
geometries
[
n
]
=
G
}
else
if
(
u
.
type
==
"
cylinder
"
){
G
=
new
Cylinder
(
u
.
numSegs
,
u
.
topRad
,
u
.
botRad
,
u
.
height
,
u
.
topOffset
,
u
.
botOffset
);
F
.
geometries
[
n
]
=
G
}
else
if
(
u
.
type
==
"
torus
"
){
G
=
new
Torus
(
u
.
radius
,
u
.
tube
,
u
.
segmentsR
,
u
.
segmentsT
);
F
.
geometries
[
n
]
=
G
}
else
if
(
u
.
type
==
"
icosahedron
"
){
G
=
new
Icosahedron
(
u
.
subdivisions
);
F
.
geometries
[
n
]
=
G
}
else
if
(
u
.
type
==
"
bin_mesh
"
)
g
.
load
({
model
:
h
(
u
.
url
,
E
.
urlBaseType
),
callback
:
m
(
n
)});
else
u
.
type
==
"
ascii_mesh
"
&&
L
.
load
({
model
:
h
(
u
.
url
,
E
.
urlBaseType
),
callback
:
m
(
n
)})}
for
(
B
in
E
.
textures
){
n
=
E
.
textures
[
B
];
Q
+=
n
.
url
instanceof
Array
?
n
.
url
.
length
:
1
}
M
=
Q
;
for
(
B
in
E
.
textures
){
n
=
E
.
textures
[
B
];
if
(
n
.
mapping
!=
undefined
&&
THREE
[
n
.
mapping
]
!=
undefined
)
n
.
mapping
=
new
THREE
[
n
.
mapping
];
if
(
n
.
url
instanceof
Array
){
u
=
[];
for
(
var
T
=
0
;
T
<
n
.
url
.
length
;
T
++
)
u
[
T
]
=
h
(
n
.
url
[
T
],
E
.
urlBaseType
);
u
=
ImageUtils
.
loadTextureCube
(
u
,
n
.
mapping
,
N
)}
else
{
u
=
ImageUtils
.
loadTexture
(
h
(
n
.
url
,
E
.
urlBaseType
),
u
.
height
,
u
.
segmentsWidth
,
u
.
segmentsHeight
);
F
.
geometries
[
n
]
=
G
}
else
if
(
u
.
type
==
"
sphere
"
){
G
=
new
Sphere
(
u
.
radius
,
u
.
segmentsWidth
,
u
.
segmentsHeight
);
F
.
geometries
[
n
]
=
G
}
else
if
(
u
.
type
==
"
cylinder
"
){
G
=
new
Cylinder
(
u
.
numSegs
,
u
.
topRad
,
u
.
botRad
,
u
.
height
,
u
.
topOffset
,
u
.
botOffset
);
F
.
geometries
[
n
]
=
G
}
else
if
(
u
.
type
==
"
torus
"
){
G
=
new
Torus
(
u
.
radius
,
u
.
tube
,
u
.
segmentsR
,
u
.
segmentsT
);
F
.
geometries
[
n
]
=
G
}
else
if
(
u
.
type
==
"
icosahedron
"
){
G
=
new
Icosahedron
(
u
.
subdivisions
);
F
.
geometries
[
n
]
=
G
}
else
if
(
u
.
type
==
"
bin_mesh
"
)
h
.
load
({
model
:
g
(
u
.
url
,
E
.
urlBaseType
),
callback
:
l
(
n
)});
else
u
.
type
==
"
ascii_mesh
"
&&
L
.
load
({
model
:
g
(
u
.
url
,
E
.
urlBaseType
),
callback
:
l
(
n
)})}
for
(
B
in
E
.
textures
){
n
=
E
.
textures
[
B
];
Q
+=
n
.
url
instanceof
Array
?
n
.
url
.
length
:
1
}
M
=
Q
;
for
(
B
in
E
.
textures
){
n
=
E
.
textures
[
B
];
if
(
n
.
mapping
!=
undefined
&&
THREE
[
n
.
mapping
]
!=
undefined
)
n
.
mapping
=
new
THREE
[
n
.
mapping
];
if
(
n
.
url
instanceof
Array
){
u
=
[];
for
(
var
T
=
0
;
T
<
n
.
url
.
length
;
T
++
)
u
[
T
]
=
g
(
n
.
url
[
T
],
E
.
urlBaseType
);
u
=
ImageUtils
.
loadTextureCube
(
u
,
n
.
mapping
,
N
)}
else
{
u
=
ImageUtils
.
loadTexture
(
g
(
n
.
url
,
E
.
urlBaseType
),
n
.
mapping
,
N
);
if
(
THREE
[
n
.
minFilter
]
!=
undefined
)
u
.
minFilter
=
THREE
[
n
.
minFilter
];
if
(
THREE
[
n
.
magFilter
]
!=
undefined
)
u
.
magFilter
=
THREE
[
n
.
magFilter
]}
F
.
textures
[
B
]
=
u
}
for
(
p
in
E
.
materials
){
B
=
E
.
materials
[
p
];
for
(
C
in
B
.
parameters
)
if
(
C
==
"
envMap
"
||
C
==
"
map
"
||
C
==
"
lightMap
"
)
B
.
parameters
[
C
]
=
F
.
textures
[
B
.
parameters
[
C
]];
else
if
(
C
==
"
shading
"
)
B
.
parameters
[
C
]
=
B
.
parameters
[
C
]
==
"
flat
"
?
THREE
.
FlatShading
:
THREE
.
SmoothShading
;
else
if
(
C
==
"
blending
"
)
B
.
parameters
[
C
]
=
THREE
[
B
.
parameters
[
C
]]?
THREE
[
B
.
parameters
[
C
]]:
THREE
.
NormalBlending
;
else
C
==
"
combine
"
&&
(
B
.
parameters
[
C
]
=
B
.
parameters
[
C
]
==
"
MixOperation
"
?
THREE
.
MixOperation
:
THREE
.
MultiplyOperation
);
B
=
new
THREE
[
B
.
type
](
B
.
parameters
);
F
.
materials
[
p
]
=
B
}
j
();
f
(
F
)}}};
if
(
!
window
.
Int32Array
){
window
.
Int32Array
=
Array
;
window
.
Float32Array
=
Array
}
THREE
.
MarchingCubes
=
function
(
a
,
f
){
THREE
.
Object3D
.
call
(
this
);
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
init
=
function
(
b
){
this
.
isolation
=
80
;
this
.
size
=
b
;
this
.
size2
=
this
.
size
*
this
.
size
;
this
.
size3
=
this
.
size2
*
this
.
size
;
this
.
halfsize
=
this
.
size
/
2
;
this
.
delta
=
2
/
this
.
size
;
this
.
yd
=
this
.
size
;
this
.
zd
=
this
.
size2
;
this
.
field
=
new
Float32Array
(
this
.
size3
);
this
.
normal_cache
=
new
Float32Array
(
this
.
size3
*
3
);
this
.
vlist
=
new
Float32Array
(
36
);
this
.
nlist
=
new
Float32Array
(
36
);
this
.
firstDraw
=!
0
;
this
.
maxCount
=
4096
;
this
.
count
=
0
;
this
.
hasPos
=!
1
;
this
.
hasNormal
=!
1
;
this
.
positionArray
=
new
Float32Array
(
this
.
maxCount
*
3
);
this
.
normalArray
=
new
Float32Array
(
this
.
maxCount
*
3
)};
this
.
lerp
=
function
(
b
,
e
,
c
){
return
b
+
(
e
-
b
)
*
c
};
this
.
VIntX
=
function
(
b
,
e
,
c
,
d
,
g
,
h
,
j
,
m
,
k
,
n
){
g
=
(
g
-
k
)
/
(
n
-
k
);
k
=
this
.
normal_cache
;
e
[
d
]
=
h
+
g
*
this
.
delta
;
e
[
d
+
1
]
=
j
;
e
[
d
+
2
]
=
m
;
c
[
d
]
=
this
.
lerp
(
k
[
b
],
k
[
b
+
3
],
g
);
c
[
d
+
1
]
=
this
.
lerp
(
k
[
b
+
1
],
k
[
b
+
4
],
g
);
c
[
d
+
2
]
=
this
.
lerp
(
k
[
b
+
2
],
k
[
b
+
5
],
g
)};
this
.
VIntY
=
function
(
b
,
e
,
c
,
d
,
g
,
h
,
j
,
m
,
k
,
n
){
g
=
(
g
-
k
)
/
(
n
-
k
);
k
=
this
.
normal_cache
;
e
[
d
]
=
h
;
e
[
d
+
1
]
=
j
+
g
*
this
.
delta
;
e
[
d
+
2
]
=
m
;
e
=
b
+
this
.
yd
*
3
;
c
[
d
]
=
this
.
lerp
(
k
[
b
],
k
[
e
],
g
);
c
[
d
+
1
]
=
this
.
lerp
(
k
[
b
+
1
],
k
[
e
+
1
],
g
);
c
[
d
+
2
]
=
this
.
lerp
(
k
[
b
+
2
],
k
[
e
+
2
],
g
)};
this
.
VIntZ
=
function
(
b
,
e
,
c
,
d
,
g
,
h
,
j
,
m
,
k
,
n
){
g
=
(
g
-
k
)
/
(
n
-
k
);
k
=
this
.
normal_cache
;
e
[
d
]
=
h
;
e
[
d
+
1
]
=
j
;
e
[
d
+
2
]
=
m
+
g
*
this
.
delta
;
e
=
b
+
this
.
zd
*
3
;
c
[
d
]
=
this
.
lerp
(
k
[
b
],
k
[
e
],
g
);
c
[
d
+
1
]
=
this
.
lerp
(
k
[
b
+
1
],
k
[
e
+
1
],
g
);
c
[
d
+
2
]
=
this
.
lerp
(
k
[
b
+
2
],
k
[
e
+
2
],
g
)};
this
.
compNorm
=
function
(
b
){
var
e
=
b
*
3
;
if
(
this
.
normal_cache
[
e
]
==
0
){
this
.
normal_cache
[
e
]
=
this
.
field
[
b
-
1
]
-
this
.
field
[
b
+
1
];
this
.
normal_cache
[
e
+
1
]
=
this
.
field
[
b
-
this
.
yd
]
-
this
.
field
[
b
+
this
.
yd
];
this
.
normal_cache
[
e
+
2
]
=
this
.
field
[
b
-
this
.
zd
]
-
this
.
field
[
b
+
this
.
zd
]}};
this
.
polygonize
=
function
(
b
,
e
,
c
,
d
,
g
,
h
){
var
j
=
d
+
1
,
m
=
d
+
this
.
yd
,
k
=
d
+
this
.
zd
,
n
=
j
+
this
.
yd
,
p
=
j
+
this
.
zd
,
t
=
d
+
this
.
yd
+
this
.
zd
,
w
=
j
+
this
.
yd
+
this
.
zd
,
x
=
0
,
u
=
this
.
field
[
d
],
B
=
this
.
field
[
j
],
z
=
this
.
field
[
m
],
l
=
this
.
field
[
n
],
y
=
this
.
field
[
k
],
C
=
this
.
field
[
p
],
G
=
this
.
field
[
t
],
K
=
this
.
field
[
w
];
u
<
g
&&
(
x
|=
1
);
B
<
g
&&
(
x
|=
2
);
z
<
g
&&
(
x
|=
8
);
l
<
g
&&
(
x
|=
4
);
y
<
g
&&
(
x
|=
16
);
C
<
g
&&
(
x
|=
32
);
G
<
g
&&
(
x
|=
128
);
K
<
g
&&
(
x
|=
64
);
var
J
=
THREE
.
edgeTable
[
x
];
if
(
J
==
0
)
return
0
;
var
I
=
this
.
delta
,
E
=
b
+
I
,
L
=
e
+
I
;
I
=
c
+
I
;
if
(
J
&
1
){
this
.
compNorm
(
d
);
this
.
compNorm
(
j
);
this
.
VIntX
(
d
*
3
,
this
.
vlist
,
this
.
nlist
,
0
,
g
,
b
,
e
,
c
,
u
,
B
)}
if
(
J
&
2
){
this
.
compNorm
(
j
);
this
.
compNorm
(
n
);
this
.
VIntY
(
j
*
3
,
this
.
vlist
,
this
.
nlist
,
3
,
g
,
E
,
e
,
c
,
B
,
l
)}
if
(
J
&
4
){
this
.
compNorm
(
m
);
this
.
compNorm
(
n
);
this
.
VIntX
(
m
*
3
,
this
.
vlist
,
this
.
nlist
,
6
,
g
,
b
,
L
,
c
,
z
,
l
)}
if
(
J
&
8
){
this
.
compNorm
(
d
);
this
.
compNorm
(
m
);
this
.
VIntY
(
d
*
3
,
this
.
vlist
,
this
.
nlist
,
9
,
g
,
b
,
e
,
c
,
u
,
z
)}
if
(
J
&
16
){
this
.
compNorm
(
k
);
this
.
compNorm
(
p
);
this
.
VIntX
(
k
*
3
,
this
.
vlist
,
this
.
nlist
,
12
,
g
,
b
,
e
,
I
,
y
,
C
)}
if
(
J
&
32
){
this
.
compNorm
(
p
);
this
.
compNorm
(
w
);
this
.
VIntY
(
p
*
3
,
this
.
vlist
,
this
.
nlist
,
15
,
g
,
E
,
e
,
I
,
C
,
K
)}
if
(
J
&
64
){
this
.
compNorm
(
t
);
this
.
compNorm
(
w
);
this
.
VIntX
(
t
*
3
,
this
.
vlist
,
this
.
nlist
,
18
,
g
,
b
,
L
,
I
,
G
,
K
)}
if
(
J
&
128
){
this
.
compNorm
(
k
);
this
.
compNorm
(
t
);
this
.
VIntY
(
k
*
3
,
this
.
vlist
,
this
.
nlist
,
21
,
g
,
b
,
e
,
I
,
y
,
G
)}
if
(
J
&
256
){
this
.
compNorm
(
d
);
this
.
compNorm
(
k
);
this
.
VIntZ
(
d
*
3
,
this
.
vlist
,
this
.
nlist
,
24
,
g
,
b
,
e
,
c
,
u
,
y
)}
if
(
J
&
512
){
this
.
compNorm
(
j
);
this
.
compNorm
(
p
);
this
.
VIntZ
(
j
*
3
,
this
.
vlist
,
this
.
nlist
,
27
,
g
,
E
,
e
,
c
,
B
,
C
)}
if
(
J
&
1024
){
this
.
compNorm
(
n
);
this
.
compNorm
(
w
);
this
.
VIntZ
(
n
*
3
,
this
.
vlist
,
this
.
nlist
,
30
,
g
,
E
,
L
,
c
,
l
,
K
)}
if
(
J
&
2048
){
this
.
compNorm
(
m
);
this
.
compNorm
(
t
);
this
.
VIntZ
(
m
*
3
,
this
.
vlist
,
this
.
nlist
,
33
,
g
,
b
,
L
,
c
,
z
,
G
)}
x
<<=
4
;
for
(
g
=
d
=
0
;
THREE
.
triTable
[
x
+
g
]
!=-
1
;){
b
=
x
+
g
;
e
=
b
+
1
;
c
=
b
+
2
;
this
.
posnormtriv
(
this
.
vlist
,
this
.
nlist
,
3
*
THREE
.
triTable
[
b
],
3
*
THREE
.
triTable
[
e
],
3
*
THREE
.
triTable
[
c
],
h
);
g
+=
3
;
d
++
}
return
d
};
this
.
posnormtriv
=
function
(
b
,
e
,
c
,
d
,
g
,
h
){
var
j
=
this
.
count
*
3
;
this
.
positionArray
[
j
]
=
b
[
c
];
this
.
positionArray
[
j
+
1
]
=
b
[
c
+
1
];
this
.
positionArray
[
j
+
2
]
=
b
[
c
+
2
];
this
.
positionArray
[
j
+
3
]
=
b
[
d
];
this
.
positionArray
[
j
+
4
]
=
b
[
d
+
1
];
this
.
positionArray
[
j
+
5
]
=
b
[
d
+
2
];
this
.
positionArray
[
j
+
6
]
=
b
[
g
];
this
.
positionArray
[
j
+
7
]
=
b
[
g
+
1
];
this
.
positionArray
[
j
+
8
]
=
b
[
g
+
2
];
this
.
normalArray
[
j
]
=
e
[
c
];
this
.
normalArray
[
j
+
1
]
=
e
[
c
+
1
];
this
.
normalArray
[
j
+
2
]
=
e
[
c
+
2
];
this
.
normalArray
[
j
+
3
]
=
e
[
d
];
this
.
normalArray
[
j
+
4
]
=
e
[
d
+
1
];
this
.
normalArray
[
j
+
5
]
=
e
[
d
+
2
];
this
.
normalArray
[
j
+
6
]
=
e
[
g
];
this
.
normalArray
[
j
+
7
]
=
e
[
g
+
1
];
this
.
normalArray
[
j
+
8
]
=
e
[
g
+
2
];
this
.
hasPos
=!
0
;
this
.
hasNormal
=!
0
;
this
.
count
+=
3
;
this
.
count
>=
this
.
maxCount
-
3
&&
h
(
this
)};
this
.
begin
=
function
(){
this
.
count
=
0
;
this
.
hasPos
=!
1
;
this
.
hasNormal
=!
1
};
this
.
end
=
function
(
b
){
if
(
this
.
count
!=
0
){
for
(
var
e
=
this
.
count
*
3
;
e
<
this
.
positionArray
.
length
;
e
++
)
this
.
positionArray
[
e
]
=
0
;
b
(
this
)}};
this
.
addBall
=
function
(
b
,
e
,
c
,
d
,
g
){
var
h
=
this
.
size
*
Math
.
sqrt
(
d
/
g
),
j
=
c
*
this
.
size
,
m
=
e
*
this
.
size
,
k
=
b
*
this
.
size
,
n
=
Math
.
floor
(
j
-
h
);
n
<
1
&&
(
n
=
1
);
j
=
Math
.
floor
(
j
+
h
);
j
>
this
.
size
-
1
&&
(
j
=
this
.
size
-
1
);
var
p
=
Math
.
floor
(
m
-
h
);
p
<
1
&&
(
p
=
1
);
m
=
Math
.
floor
(
m
+
h
);
m
>
this
.
size
-
1
&&
(
m
=
this
.
size
-
1
);
var
t
=
Math
.
floor
(
k
-
h
);
t
<
1
&&
(
t
=
1
);
h
=
Math
.
floor
(
k
+
h
);
h
>
this
.
size
-
1
&&
(
h
=
this
.
size
-
1
);
for
(
var
w
,
x
,
u
,
B
,
z
,
l
;
n
<
j
;
n
++
){
k
=
this
.
size2
*
n
;
x
=
n
/
this
.
size
-
c
;
z
=
x
*
x
;
for
(
x
=
p
;
x
<
m
;
x
++
){
u
=
k
+
this
.
size
*
x
;
w
=
x
/
this
.
size
-
e
;
l
=
w
*
w
;
for
(
w
=
t
;
w
<
h
;
w
++
){
B
=
w
/
this
.
size
-
b
;
B
=
d
/
(
1.0
E
-
6
+
B
*
B
+
l
+
z
)
-
g
;
B
>
0
&&
(
this
.
field
[
u
+
w
]
+=
B
)}}}};
this
.
addPlaneX
=
function
(
b
,
e
){
var
c
,
d
,
g
,
h
,
j
,
m
=
this
.
size
,
k
=
this
.
yd
,
n
=
this
.
zd
,
p
=
this
.
field
,
t
=
m
*
Math
.
sqrt
(
b
/
e
);
t
>
m
&&
(
t
=
m
);
for
(
c
=
0
;
c
<
t
;
c
++
){
d
=
c
/
m
;
d
*=
d
;
h
=
b
/
(
1.0
E
-
4
+
d
)
-
e
;
if
(
h
>
0
)
for
(
d
=
0
;
d
<
m
;
d
++
){
j
=
c
+
d
*
k
;
for
(
g
=
0
;
g
<
m
;
g
++
)
p
[
n
*
g
+
j
]
+=
h
}}};
this
.
addPlaneY
=
function
(
b
,
e
){
var
c
,
d
,
g
,
h
,
j
,
m
,
k
=
this
.
size
,
n
=
this
.
yd
,
p
=
this
.
zd
,
t
=
this
.
field
,
w
=
k
*
Math
.
sqrt
(
b
/
e
);
w
>
k
&&
(
w
=
k
);
for
(
d
=
0
;
d
<
w
;
d
++
){
c
=
d
/
k
;
c
*=
c
;
h
=
b
/
(
1.0
E
-
4
+
c
)
-
e
;
if
(
h
>
0
){
j
=
d
*
n
;
for
(
c
=
0
;
c
<
k
;
c
++
){
m
=
j
+
c
;
for
(
g
=
0
;
g
<
k
;
g
++
)
t
[
p
*
g
+
m
]
+=
h
}}}};
this
.
addPlaneZ
=
function
(
b
,
e
){
var
c
,
d
,
g
,
h
,
j
,
m
;
size
=
this
.
size
;
yd
=
this
.
yd
;
zd
=
this
.
zd
;
field
=
this
.
field
;
dist
=
size
*
Math
.
sqrt
(
b
/
e
);
dist
>
size
&&
(
dist
=
size
);
for
(
g
=
0
;
g
<
dist
;
g
++
){
c
=
g
/
size
;
c
*=
c
;
h
=
b
/
(
1.0
E
-
4
+
c
)
-
e
;
if
(
h
>
0
){
j
=
zd
*
g
;
for
(
d
=
0
;
d
<
size
;
d
++
){
m
=
j
+
d
*
yd
;
for
(
c
=
0
;
c
<
size
;
c
++
)
field
[
m
+
c
]
+=
h
}}}};
this
.
reset
=
function
(){
var
b
;
for
(
b
=
0
;
b
<
this
.
size3
;
b
++
){
this
.
normal_cache
[
b
*
3
]
=
0
;
this
.
field
[
b
]
=
0
}};
this
.
render
=
function
(
b
){
this
.
begin
();
var
e
,
c
,
d
,
g
,
h
,
j
,
m
,
k
,
n
,
p
=
this
.
size
-
2
;
for
(
g
=
1
;
g
<
p
;
g
++
){
n
=
this
.
size2
*
g
;
m
=
(
g
-
this
.
halfsize
)
/
this
.
halfsize
;
for
(
d
=
1
;
d
<
p
;
d
++
){
k
=
n
+
this
.
size
*
d
;
j
=
(
d
-
this
.
halfsize
)
/
this
.
halfsize
;
for
(
c
=
1
;
c
<
p
;
c
++
){
h
=
(
c
-
this
.
halfsize
)
/
this
.
halfsize
;
e
=
k
+
c
;
this
.
polygonize
(
h
,
j
,
m
,
e
,
this
.
isolation
,
b
)}}}
this
.
end
(
b
)};
this
.
generateGeometry
=
function
(){
var
b
=
0
,
e
=
new
THREE
.
Geometry
,
c
=
[];
this
.
render
(
function
(
d
){
var
g
,
h
,
j
,
m
,
k
,
n
,
p
,
t
;
for
(
g
=
0
;
g
<
d
.
count
;
g
++
){
p
=
g
*
3
;
k
=
p
+
1
;
t
=
p
+
2
;
h
=
d
.
positionArray
[
p
];
j
=
d
.
positionArray
[
k
];
m
=
d
.
positionArray
[
t
];
n
=
new
THREE
.
Vector3
(
h
,
j
,
m
);
h
=
d
.
normalArray
[
p
];
j
=
d
.
normalArray
[
k
];
m
=
d
.
normalArray
[
t
];
p
=
new
THREE
.
Vector3
(
h
,
j
,
m
);
p
.
normalize
();
k
=
new
THREE
.
Vertex
(
n
);
e
.
vertices
.
push
(
k
);
c
.
push
(
p
)}
nfaces
=
d
.
count
/
3
;
for
(
g
=
0
;
g
<
nfaces
;
g
++
){
p
=
(
b
+
g
)
*
3
;
k
=
p
+
1
;
t
=
p
+
2
;
n
=
c
[
p
];
h
=
c
[
k
];
j
=
c
[
t
];
p
=
new
THREE
.
Face3
(
p
,
k
,
t
,[
n
,
h
,
j
]);
e
.
faces
.
push
(
p
)}
b
+=
nfaces
;
d
.
count
=
0
});
return
e
};
this
.
init
(
a
)};
THREE
.
MarchingCubes
.
prototype
=
new
THREE
.
Object3D
;
else
C
==
"
combine
"
&&
(
B
.
parameters
[
C
]
=
B
.
parameters
[
C
]
==
"
MixOperation
"
?
THREE
.
MixOperation
:
THREE
.
MultiplyOperation
);
B
=
new
THREE
[
B
.
type
](
B
.
parameters
);
F
.
materials
[
p
]
=
B
}
j
();
b
(
F
)}}};
if
(
!
window
.
Int32Array
){
window
.
Int32Array
=
Array
;
window
.
Float32Array
=
Array
}
THREE
.
MarchingCubes
=
function
(
a
,
b
){
THREE
.
Object3D
.
call
(
this
);
this
.
materials
=
b
instanceof
Array
?
b
:[
b
];
this
.
init
=
function
(
c
){
this
.
isolation
=
80
;
this
.
size
=
c
;
this
.
size2
=
this
.
size
*
this
.
size
;
this
.
size3
=
this
.
size2
*
this
.
size
;
this
.
halfsize
=
this
.
size
/
2
;
this
.
delta
=
2
/
this
.
size
;
this
.
yd
=
this
.
size
;
this
.
zd
=
this
.
size2
;
this
.
field
=
new
Float32Array
(
this
.
size3
);
this
.
normal_cache
=
new
Float32Array
(
this
.
size3
*
3
);
this
.
vlist
=
new
Float32Array
(
36
);
this
.
nlist
=
new
Float32Array
(
36
);
this
.
firstDraw
=!
0
;
this
.
maxCount
=
4096
;
this
.
count
=
0
;
this
.
hasPos
=!
1
;
this
.
hasNormal
=!
1
;
this
.
positionArray
=
new
Float32Array
(
this
.
maxCount
*
3
);
this
.
normalArray
=
new
Float32Array
(
this
.
maxCount
*
3
)};
this
.
lerp
=
function
(
c
,
d
,
e
){
return
c
+
(
d
-
c
)
*
e
};
this
.
VIntX
=
function
(
c
,
d
,
e
,
f
,
h
,
g
,
j
,
l
,
k
,
n
){
h
=
(
h
-
k
)
/
(
n
-
k
);
k
=
this
.
normal_cache
;
d
[
f
]
=
g
+
h
*
this
.
delta
;
d
[
f
+
1
]
=
j
;
d
[
f
+
2
]
=
l
;
e
[
f
]
=
this
.
lerp
(
k
[
c
],
k
[
c
+
3
],
h
);
e
[
f
+
1
]
=
this
.
lerp
(
k
[
c
+
1
],
k
[
c
+
4
],
h
);
e
[
f
+
2
]
=
this
.
lerp
(
k
[
c
+
2
],
k
[
c
+
5
],
h
)};
this
.
VIntY
=
function
(
c
,
d
,
e
,
f
,
h
,
g
,
j
,
l
,
k
,
n
){
h
=
(
h
-
k
)
/
(
n
-
k
);
k
=
this
.
normal_cache
;
d
[
f
]
=
g
;
d
[
f
+
1
]
=
j
+
h
*
this
.
delta
;
d
[
f
+
2
]
=
l
;
d
=
c
+
this
.
yd
*
3
;
e
[
f
]
=
this
.
lerp
(
k
[
c
],
k
[
d
],
h
);
e
[
f
+
1
]
=
this
.
lerp
(
k
[
c
+
1
],
k
[
d
+
1
],
h
);
e
[
f
+
2
]
=
this
.
lerp
(
k
[
c
+
2
],
k
[
d
+
2
],
h
)};
this
.
VIntZ
=
function
(
c
,
d
,
e
,
f
,
h
,
g
,
j
,
l
,
k
,
n
){
h
=
(
h
-
k
)
/
(
n
-
k
);
k
=
this
.
normal_cache
;
d
[
f
]
=
g
;
d
[
f
+
1
]
=
j
;
d
[
f
+
2
]
=
l
+
h
*
this
.
delta
;
d
=
c
+
this
.
zd
*
3
;
e
[
f
]
=
this
.
lerp
(
k
[
c
],
k
[
d
],
h
);
e
[
f
+
1
]
=
this
.
lerp
(
k
[
c
+
1
],
k
[
d
+
1
],
h
);
e
[
f
+
2
]
=
this
.
lerp
(
k
[
c
+
2
],
k
[
d
+
2
],
h
)};
this
.
compNorm
=
function
(
c
){
var
d
=
c
*
3
;
if
(
this
.
normal_cache
[
d
]
==
0
){
this
.
normal_cache
[
d
]
=
this
.
field
[
c
-
1
]
-
this
.
field
[
c
+
1
];
this
.
normal_cache
[
d
+
1
]
=
this
.
field
[
c
-
this
.
yd
]
-
this
.
field
[
c
+
this
.
yd
];
this
.
normal_cache
[
d
+
2
]
=
this
.
field
[
c
-
this
.
zd
]
-
this
.
field
[
c
+
this
.
zd
]}};
this
.
polygonize
=
function
(
c
,
d
,
e
,
f
,
h
,
g
){
var
j
=
f
+
1
,
l
=
f
+
this
.
yd
,
k
=
f
+
this
.
zd
,
n
=
j
+
this
.
yd
,
p
=
j
+
this
.
zd
,
t
=
f
+
this
.
yd
+
this
.
zd
,
w
=
j
+
this
.
yd
+
this
.
zd
,
x
=
0
,
u
=
this
.
field
[
f
],
B
=
this
.
field
[
j
],
z
=
this
.
field
[
l
],
m
=
this
.
field
[
n
],
y
=
this
.
field
[
k
],
C
=
this
.
field
[
p
],
G
=
this
.
field
[
t
],
K
=
this
.
field
[
w
];
u
<
h
&&
(
x
|=
1
);
B
<
h
&&
(
x
|=
2
);
z
<
h
&&
(
x
|=
8
);
m
<
h
&&
(
x
|=
4
);
y
<
h
&&
(
x
|=
16
);
C
<
h
&&
(
x
|=
32
);
G
<
h
&&
(
x
|=
128
);
K
<
h
&&
(
x
|=
64
);
var
J
=
THREE
.
edgeTable
[
x
];
if
(
J
==
0
)
return
0
;
var
I
=
this
.
delta
,
E
=
c
+
I
,
L
=
d
+
I
;
I
=
e
+
I
;
if
(
J
&
1
){
this
.
compNorm
(
f
);
this
.
compNorm
(
j
);
this
.
VIntX
(
f
*
3
,
this
.
vlist
,
this
.
nlist
,
0
,
h
,
c
,
d
,
e
,
u
,
B
)}
if
(
J
&
2
){
this
.
compNorm
(
j
);
this
.
compNorm
(
n
);
this
.
VIntY
(
j
*
3
,
this
.
vlist
,
this
.
nlist
,
3
,
h
,
E
,
d
,
e
,
B
,
m
)}
if
(
J
&
4
){
this
.
compNorm
(
l
);
this
.
compNorm
(
n
);
this
.
VIntX
(
l
*
3
,
this
.
vlist
,
this
.
nlist
,
6
,
h
,
c
,
L
,
e
,
z
,
m
)}
if
(
J
&
8
){
this
.
compNorm
(
f
);
this
.
compNorm
(
l
);
this
.
VIntY
(
f
*
3
,
this
.
vlist
,
this
.
nlist
,
9
,
h
,
c
,
d
,
e
,
u
,
z
)}
if
(
J
&
16
){
this
.
compNorm
(
k
);
this
.
compNorm
(
p
);
this
.
VIntX
(
k
*
3
,
this
.
vlist
,
this
.
nlist
,
12
,
h
,
c
,
d
,
I
,
y
,
C
)}
if
(
J
&
32
){
this
.
compNorm
(
p
);
this
.
compNorm
(
w
);
this
.
VIntY
(
p
*
3
,
this
.
vlist
,
this
.
nlist
,
15
,
h
,
E
,
d
,
I
,
C
,
K
)}
if
(
J
&
64
){
this
.
compNorm
(
t
);
this
.
compNorm
(
w
);
this
.
VIntX
(
t
*
3
,
this
.
vlist
,
this
.
nlist
,
18
,
h
,
c
,
L
,
I
,
G
,
K
)}
if
(
J
&
128
){
this
.
compNorm
(
k
);
this
.
compNorm
(
t
);
this
.
VIntY
(
k
*
3
,
this
.
vlist
,
this
.
nlist
,
21
,
h
,
c
,
d
,
I
,
y
,
G
)}
if
(
J
&
256
){
this
.
compNorm
(
f
);
this
.
compNorm
(
k
);
this
.
VIntZ
(
f
*
3
,
this
.
vlist
,
this
.
nlist
,
24
,
h
,
c
,
d
,
e
,
u
,
y
)}
if
(
J
&
512
){
this
.
compNorm
(
j
);
this
.
compNorm
(
p
);
this
.
VIntZ
(
j
*
3
,
this
.
vlist
,
this
.
nlist
,
27
,
h
,
E
,
d
,
e
,
B
,
C
)}
if
(
J
&
1024
){
this
.
compNorm
(
n
);
this
.
compNorm
(
w
);
this
.
VIntZ
(
n
*
3
,
this
.
vlist
,
this
.
nlist
,
30
,
h
,
E
,
L
,
e
,
m
,
K
)}
if
(
J
&
2048
){
this
.
compNorm
(
l
);
this
.
compNorm
(
t
);
this
.
VIntZ
(
l
*
3
,
this
.
vlist
,
this
.
nlist
,
33
,
h
,
c
,
L
,
e
,
z
,
G
)}
x
<<=
4
;
for
(
h
=
f
=
0
;
THREE
.
triTable
[
x
+
h
]
!=-
1
;){
c
=
x
+
h
;
d
=
c
+
1
;
e
=
c
+
2
;
this
.
posnormtriv
(
this
.
vlist
,
this
.
nlist
,
3
*
THREE
.
triTable
[
c
],
3
*
THREE
.
triTable
[
d
],
3
*
THREE
.
triTable
[
e
],
g
);
h
+=
3
;
f
++
}
return
f
};
this
.
posnormtriv
=
function
(
c
,
d
,
e
,
f
,
h
,
g
){
var
j
=
this
.
count
*
3
;
this
.
positionArray
[
j
]
=
c
[
e
];
this
.
positionArray
[
j
+
1
]
=
c
[
e
+
1
];
this
.
positionArray
[
j
+
2
]
=
c
[
e
+
2
];
this
.
positionArray
[
j
+
3
]
=
c
[
f
];
this
.
positionArray
[
j
+
4
]
=
c
[
f
+
1
];
this
.
positionArray
[
j
+
5
]
=
c
[
f
+
2
];
this
.
positionArray
[
j
+
6
]
=
c
[
h
];
this
.
positionArray
[
j
+
7
]
=
c
[
h
+
1
];
this
.
positionArray
[
j
+
8
]
=
c
[
h
+
2
];
this
.
normalArray
[
j
]
=
d
[
e
];
this
.
normalArray
[
j
+
1
]
=
d
[
e
+
1
];
this
.
normalArray
[
j
+
2
]
=
d
[
e
+
2
];
this
.
normalArray
[
j
+
3
]
=
d
[
f
];
this
.
normalArray
[
j
+
4
]
=
d
[
f
+
1
];
this
.
normalArray
[
j
+
5
]
=
d
[
f
+
2
];
this
.
normalArray
[
j
+
6
]
=
d
[
h
];
this
.
normalArray
[
j
+
7
]
=
d
[
h
+
1
];
this
.
normalArray
[
j
+
8
]
=
d
[
h
+
2
];
this
.
hasPos
=!
0
;
this
.
hasNormal
=!
0
;
this
.
count
+=
3
;
this
.
count
>=
this
.
maxCount
-
3
&&
g
(
this
)};
this
.
begin
=
function
(){
this
.
count
=
0
;
this
.
hasPos
=!
1
;
this
.
hasNormal
=!
1
};
this
.
end
=
function
(
c
){
if
(
this
.
count
!=
0
){
for
(
var
d
=
this
.
count
*
3
;
d
<
this
.
positionArray
.
length
;
d
++
)
this
.
positionArray
[
d
]
=
0
;
c
(
this
)}};
this
.
addBall
=
function
(
c
,
d
,
e
,
f
,
h
){
var
g
=
this
.
size
*
Math
.
sqrt
(
f
/
h
),
j
=
e
*
this
.
size
,
l
=
d
*
this
.
size
,
k
=
c
*
this
.
size
,
n
=
Math
.
floor
(
j
-
g
);
n
<
1
&&
(
n
=
1
);
j
=
Math
.
floor
(
j
+
g
);
j
>
this
.
size
-
1
&&
(
j
=
this
.
size
-
1
);
var
p
=
Math
.
floor
(
l
-
g
);
p
<
1
&&
(
p
=
1
);
l
=
Math
.
floor
(
l
+
g
);
l
>
this
.
size
-
1
&&
(
l
=
this
.
size
-
1
);
var
t
=
Math
.
floor
(
k
-
g
);
t
<
1
&&
(
t
=
1
);
g
=
Math
.
floor
(
k
+
g
);
g
>
this
.
size
-
1
&&
(
g
=
this
.
size
-
1
);
for
(
var
w
,
x
,
u
,
B
,
z
,
m
;
n
<
j
;
n
++
){
k
=
this
.
size2
*
n
;
x
=
n
/
this
.
size
-
e
;
z
=
x
*
x
;
for
(
x
=
p
;
x
<
l
;
x
++
){
u
=
k
+
this
.
size
*
x
;
w
=
x
/
this
.
size
-
d
;
m
=
w
*
w
;
for
(
w
=
t
;
w
<
g
;
w
++
){
B
=
w
/
this
.
size
-
c
;
B
=
f
/
(
1.0
E
-
6
+
B
*
B
+
m
+
z
)
-
h
;
B
>
0
&&
(
this
.
field
[
u
+
w
]
+=
B
)}}}};
this
.
addPlaneX
=
function
(
c
,
d
){
var
e
,
f
,
h
,
g
,
j
,
l
=
this
.
size
,
k
=
this
.
yd
,
n
=
this
.
zd
,
p
=
this
.
field
,
t
=
l
*
Math
.
sqrt
(
c
/
d
);
t
>
l
&&
(
t
=
l
);
for
(
e
=
0
;
e
<
t
;
e
++
){
f
=
e
/
l
;
f
*=
f
;
g
=
c
/
(
1.0
E
-
4
+
f
)
-
d
;
if
(
g
>
0
)
for
(
f
=
0
;
f
<
l
;
f
++
){
j
=
e
+
f
*
k
;
for
(
h
=
0
;
h
<
l
;
h
++
)
p
[
n
*
h
+
j
]
+=
g
}}};
this
.
addPlaneY
=
function
(
c
,
d
){
var
e
,
f
,
h
,
g
,
j
,
l
,
k
=
this
.
size
,
n
=
this
.
yd
,
p
=
this
.
zd
,
t
=
this
.
field
,
w
=
k
*
Math
.
sqrt
(
c
/
d
);
w
>
k
&&
(
w
=
k
);
for
(
f
=
0
;
f
<
w
;
f
++
){
e
=
f
/
k
;
e
*=
e
;
g
=
c
/
(
1.0
E
-
4
+
e
)
-
d
;
if
(
g
>
0
){
j
=
f
*
n
;
for
(
e
=
0
;
e
<
k
;
e
++
){
l
=
j
+
e
;
for
(
h
=
0
;
h
<
k
;
h
++
)
t
[
p
*
h
+
l
]
+=
g
}}}};
this
.
addPlaneZ
=
function
(
c
,
d
){
var
e
,
f
,
h
,
g
,
j
,
l
;
size
=
this
.
size
;
yd
=
this
.
yd
;
zd
=
this
.
zd
;
field
=
this
.
field
;
dist
=
size
*
Math
.
sqrt
(
c
/
d
);
dist
>
size
&&
(
dist
=
size
);
for
(
h
=
0
;
h
<
dist
;
h
++
){
e
=
h
/
size
;
e
*=
e
;
g
=
c
/
(
1.0
E
-
4
+
e
)
-
d
;
if
(
g
>
0
){
j
=
zd
*
h
;
for
(
f
=
0
;
f
<
size
;
f
++
){
l
=
j
+
f
*
yd
;
for
(
e
=
0
;
e
<
size
;
e
++
)
field
[
l
+
e
]
+=
g
}}}};
this
.
reset
=
function
(){
var
c
;
for
(
c
=
0
;
c
<
this
.
size3
;
c
++
){
this
.
normal_cache
[
c
*
3
]
=
0
;
this
.
field
[
c
]
=
0
}};
this
.
render
=
function
(
c
){
this
.
begin
();
var
d
,
e
,
f
,
h
,
g
,
j
,
l
,
k
,
n
,
p
=
this
.
size
-
2
;
for
(
h
=
1
;
h
<
p
;
h
++
){
n
=
this
.
size2
*
h
;
l
=
(
h
-
this
.
halfsize
)
/
this
.
halfsize
;
for
(
f
=
1
;
f
<
p
;
f
++
){
k
=
n
+
this
.
size
*
f
;
j
=
(
f
-
this
.
halfsize
)
/
this
.
halfsize
;
for
(
e
=
1
;
e
<
p
;
e
++
){
g
=
(
e
-
this
.
halfsize
)
/
this
.
halfsize
;
d
=
k
+
e
;
this
.
polygonize
(
g
,
j
,
l
,
d
,
this
.
isolation
,
c
)}}}
this
.
end
(
c
)};
this
.
generateGeometry
=
function
(){
var
c
=
0
,
d
=
new
THREE
.
Geometry
,
e
=
[];
this
.
render
(
function
(
f
){
var
h
,
g
,
j
,
l
,
k
,
n
,
p
,
t
;
for
(
h
=
0
;
h
<
f
.
count
;
h
++
){
p
=
h
*
3
;
k
=
p
+
1
;
t
=
p
+
2
;
g
=
f
.
positionArray
[
p
];
j
=
f
.
positionArray
[
k
];
l
=
f
.
positionArray
[
t
];
n
=
new
THREE
.
Vector3
(
g
,
j
,
l
);
g
=
f
.
normalArray
[
p
];
j
=
f
.
normalArray
[
k
];
l
=
f
.
normalArray
[
t
];
p
=
new
THREE
.
Vector3
(
g
,
j
,
l
);
p
.
normalize
();
k
=
new
THREE
.
Vertex
(
n
);
d
.
vertices
.
push
(
k
);
e
.
push
(
p
)}
nfaces
=
f
.
count
/
3
;
for
(
h
=
0
;
h
<
nfaces
;
h
++
){
p
=
(
c
+
h
)
*
3
;
k
=
p
+
1
;
t
=
p
+
2
;
n
=
e
[
p
];
g
=
e
[
k
];
j
=
e
[
t
];
p
=
new
THREE
.
Face3
(
p
,
k
,
t
,[
n
,
g
,
j
]);
d
.
faces
.
push
(
p
)}
c
+=
nfaces
;
f
.
count
=
0
});
return
d
};
this
.
init
(
a
)};
THREE
.
MarchingCubes
.
prototype
=
new
THREE
.
Object3D
;
THREE
.
MarchingCubes
.
prototype
.
constructor
=
THREE
.
MarchingCubes
;
THREE
.
edgeTable
=
new
Int32Array
([
0
,
265
,
515
,
778
,
1030
,
1295
,
1541
,
1804
,
2060
,
2309
,
2575
,
2822
,
3082
,
3331
,
3593
,
3840
,
400
,
153
,
915
,
666
,
1430
,
1183
,
1941
,
1692
,
2460
,
2197
,
2975
,
2710
,
3482
,
3219
,
3993
,
3728
,
560
,
825
,
51
,
314
,
1590
,
1855
,
1077
,
1340
,
2620
,
2869
,
2111
,
2358
,
3642
,
3891
,
3129
,
3376
,
928
,
681
,
419
,
170
,
1958
,
1711
,
1445
,
1196
,
2988
,
2725
,
2479
,
2214
,
4010
,
3747
,
3497
,
3232
,
1120
,
1385
,
1635
,
1898
,
102
,
367
,
613
,
876
,
3180
,
3429
,
3695
,
3942
,
2154
,
2403
,
2665
,
2912
,
1520
,
1273
,
2035
,
1786
,
502
,
255
,
1013
,
764
,
3580
,
3317
,
4095
,
3830
,
2554
,
2291
,
3065
,
2800
,
1616
,
1881
,
1107
,
1370
,
598
,
863
,
85
,
348
,
3676
,
3925
,
3167
,
3414
,
2650
,
2899
,
2137
,
2384
,
1984
,
1737
,
1475
,
1226
,
966
,
719
,
453
,
204
,
4044
,
3781
,
3535
,
3270
,
3018
,
2755
,
2505
,
2240
,
2240
,
2505
,
2755
,
3018
,
3270
,
3535
,
3781
,
4044
,
204
,
453
,
719
,
966
,
1226
,
1475
,
1737
,
1984
,
2384
,
2137
,
2899
,
2650
,
3414
,
3167
,
3925
,
3676
,
348
,
85
,
863
,
598
,
1370
,
1107
,
1881
,
1616
,
2800
,
3065
,
2291
,
2554
,
3830
,
4095
,
3317
,
3580
,
764
,
1013
,
255
,
502
,
1786
,
2035
,
1273
,
1520
,
2912
,
2665
,
2403
,
2154
,
3942
,
3695
,
3429
,
3180
,
876
,
613
,
367
,
102
,
1898
,
1635
,
1385
,
1120
,
3232
,
3497
,
3747
,
4010
,
2214
,
2479
,
2725
,
2988
,
1196
,
1445
,
1711
,
1958
,
170
,
...
...
@@ -130,4 +130,18 @@ THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0
2
,
11
,
1
,
5
,
1
,
11
,
-
1
,
0
,
2
,
5
,
0
,
5
,
9
,
2
,
11
,
5
,
4
,
5
,
8
,
11
,
8
,
5
,
-
1
,
9
,
4
,
5
,
2
,
11
,
3
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
2
,
5
,
10
,
3
,
5
,
2
,
3
,
4
,
5
,
3
,
8
,
4
,
-
1
,
-
1
,
-
1
,
-
1
,
5
,
10
,
2
,
5
,
2
,
4
,
4
,
2
,
0
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
3
,
10
,
2
,
3
,
5
,
10
,
3
,
8
,
5
,
4
,
5
,
8
,
0
,
1
,
9
,
-
1
,
5
,
10
,
2
,
5
,
2
,
4
,
1
,
9
,
2
,
9
,
4
,
2
,
-
1
,
-
1
,
-
1
,
-
1
,
8
,
4
,
5
,
8
,
5
,
3
,
3
,
5
,
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
4
,
5
,
1
,
0
,
5
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
8
,
4
,
5
,
8
,
5
,
3
,
9
,
0
,
5
,
0
,
3
,
5
,
-
1
,
-
1
,
-
1
,
-
1
,
9
,
4
,
5
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
4
,
11
,
7
,
4
,
9
,
11
,
9
,
10
,
11
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
8
,
3
,
4
,
9
,
7
,
9
,
11
,
7
,
9
,
10
,
11
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
10
,
11
,
1
,
11
,
4
,
1
,
4
,
0
,
7
,
4
,
11
,
-
1
,
-
1
,
-
1
,
-
1
,
3
,
1
,
4
,
3
,
4
,
8
,
1
,
10
,
4
,
7
,
4
,
11
,
10
,
11
,
4
,
-
1
,
4
,
11
,
7
,
9
,
11
,
4
,
9
,
2
,
11
,
9
,
1
,
2
,
-
1
,
-
1
,
-
1
,
-
1
,
9
,
7
,
4
,
9
,
11
,
7
,
9
,
1
,
11
,
2
,
11
,
1
,
0
,
8
,
3
,
-
1
,
11
,
7
,
4
,
11
,
4
,
2
,
2
,
4
,
0
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
11
,
7
,
4
,
11
,
4
,
2
,
8
,
3
,
4
,
3
,
2
,
4
,
-
1
,
-
1
,
-
1
,
-
1
,
2
,
9
,
10
,
2
,
7
,
9
,
2
,
3
,
7
,
7
,
4
,
9
,
-
1
,
-
1
,
-
1
,
-
1
,
9
,
10
,
7
,
9
,
7
,
4
,
10
,
2
,
7
,
8
,
7
,
0
,
2
,
0
,
7
,
-
1
,
3
,
7
,
10
,
3
,
10
,
2
,
7
,
4
,
10
,
1
,
10
,
0
,
4
,
0
,
10
,
-
1
,
1
,
10
,
2
,
8
,
7
,
4
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
4
,
9
,
1
,
4
,
1
,
7
,
7
,
1
,
3
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
4
,
9
,
1
,
4
,
1
,
7
,
0
,
8
,
1
,
8
,
7
,
1
,
-
1
,
-
1
,
-
1
,
-
1
,
4
,
0
,
3
,
7
,
4
,
3
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
4
,
8
,
7
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
9
,
10
,
8
,
10
,
11
,
8
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
3
,
0
,
9
,
3
,
9
,
11
,
11
,
9
,
10
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
1
,
10
,
0
,
10
,
8
,
8
,
10
,
11
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
3
,
1
,
10
,
11
,
3
,
10
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
2
,
11
,
1
,
11
,
9
,
9
,
11
,
8
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
3
,
0
,
9
,
3
,
9
,
11
,
1
,
2
,
9
,
2
,
11
,
9
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
2
,
11
,
8
,
0
,
11
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
3
,
2
,
11
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
2
,
3
,
8
,
2
,
8
,
10
,
10
,
8
,
9
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
9
,
10
,
2
,
0
,
9
,
2
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
2
,
3
,
8
,
2
,
8
,
10
,
0
,
1
,
8
,
1
,
10
,
8
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
10
,
2
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
3
,
8
,
9
,
1
,
8
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
9
,
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
3
,
8
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
]);
2
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
1
,
3
,
8
,
9
,
1
,
8
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
9
,
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
0
,
3
,
8
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
]);
THREE
.
PlaneCollider
=
function
(
a
,
b
){
this
.
point
=
a
;
this
.
normal
=
b
};
THREE
.
SphereCollider
=
function
(
a
,
b
){
this
.
center
=
a
;
this
.
radius
=
b
;
this
.
radiusSq
=
b
*
b
};
THREE
.
BoxCollider
=
function
(
a
,
b
){
this
.
min
=
a
;
this
.
max
=
b
;
this
.
dynamic
=!
0
};
THREE
.
MeshCollider
=
function
(
a
,
b
,
c
,
d
){
this
.
vertices
=
a
;
this
.
faces
=
b
;
this
.
normals
=
c
;
this
.
box
=
d
;
this
.
numFaces
=
this
.
faces
.
length
};
THREE
.
CollisionSystem
=
function
(){
this
.
colliders
=
[];
this
.
hits
=
[]};
THREE
.
Collisions
=
new
THREE
.
CollisionSystem
;
THREE
.
CollisionSystem
.
prototype
.
rayCastAll
=
function
(
a
){
a
.
direction
.
normalize
();
this
.
hits
.
length
=
0
;
var
b
,
c
,
d
,
e
,
f
=
0
;
b
=
0
;
for
(
c
=
this
.
colliders
.
length
;
b
<
c
;
b
++
){
e
=
this
.
colliders
[
b
];
d
=
this
.
rayCast
(
a
,
e
);
if
(
d
<
Number
.
MAX_VALUE
){
e
.
distance
=
d
;
d
>
f
?
this
.
hits
.
push
(
e
):
this
.
hits
.
unshift
(
e
);
f
=
d
}}
return
this
.
hits
};
THREE
.
CollisionSystem
.
prototype
.
rayCastNearest
=
function
(
a
){
var
b
=
this
.
rayCastAll
(
a
);
if
(
b
.
length
==
0
)
return
null
;
for
(
var
c
=
0
;
b
[
c
]
instanceof
THREE
.
MeshCollider
;){
var
d
=
this
.
rayMesh
(
a
,
b
[
c
]);
if
(
d
<
Number
.
MAX_VALUE
){
b
[
c
].
distance
=
d
;
break
}
c
++
}
if
(
c
>
b
.
length
)
return
null
;
return
b
[
c
]};
THREE
.
CollisionSystem
.
prototype
.
rayCast
=
function
(
a
,
b
){
if
(
b
instanceof
THREE
.
PlaneCollider
)
return
this
.
rayPlane
(
a
,
b
);
else
if
(
b
instanceof
THREE
.
SphereCollider
)
return
this
.
raySphere
(
a
,
b
);
else
if
(
b
instanceof
THREE
.
BoxCollider
)
return
this
.
rayBox
(
a
,
b
);
else
if
(
b
instanceof
THREE
.
MeshCollider
&&
b
.
box
)
return
this
.
rayBox
(
a
,
b
.
box
)};
THREE
.
CollisionSystem
.
prototype
.
rayMesh
=
function
(
a
,
b
){
for
(
var
c
=
this
.
makeRayLocal
(
a
,
b
.
mesh
),
d
=
Number
.
MAX_VALUE
,
e
=
0
;
e
<
b
.
numFaces
/
3
;
e
++
){
var
f
=
e
*
3
;
d
=
Math
.
min
(
d
,
this
.
rayTriangle
(
c
,
b
.
vertices
[
b
.
faces
[
f
+
0
]],
b
.
vertices
[
b
.
faces
[
f
+
1
]],
b
.
vertices
[
b
.
faces
[
f
+
2
]],
b
.
normals
[
b
.
faces
[
e
]],
d
))}
return
d
};
THREE
.
CollisionSystem
.
prototype
.
rayTriangle
=
function
(
a
,
b
,
c
,
d
,
e
,
f
){
var
h
=
THREE
.
CollisionSystem
.
__v1
,
g
=
THREE
.
CollisionSystem
.
__v2
;
h
.
sub
(
c
,
b
);
g
.
sub
(
d
,
c
);
e
.
cross
(
h
,
g
);
g
=
e
.
dot
(
a
.
direction
);
if
(
!
(
g
<
0
))
return
Number
.
MAX_VALUE
;
h
=
e
.
dot
(
b
)
-
e
.
dot
(
a
.
origin
);
if
(
!
(
h
<=
0
))
return
Number
.
MAX_VALUE
;
if
(
!
(
h
>=
g
*
f
))
return
Number
.
MAX_VALUE
;
h
/=
g
;
g
=
THREE
.
CollisionSystem
.
__v3
;
g
.
copy
(
a
.
direction
);
g
.
multiplyScalar
(
h
);
g
.
addSelf
(
a
.
origin
);
if
(
Math
.
abs
(
e
.
x
)
>
Math
.
abs
(
e
.
y
))
if
(
Math
.
abs
(
e
.
x
)
>
Math
.
abs
(
e
.
z
)){
a
=
g
.
y
-
b
.
y
;
e
=
c
.
y
-
b
.
y
;
f
=
d
.
y
-
b
.
y
;
g
=
g
.
z
-
b
.
z
;
c
=
c
.
z
-
b
.
z
;
d
=
d
.
z
-
b
.
z
}
else
{
a
=
g
.
x
-
b
.
x
;
e
=
c
.
x
-
b
.
x
;
f
=
d
.
x
-
b
.
x
;
g
=
g
.
y
-
b
.
y
;
c
=
c
.
y
-
b
.
y
;
d
=
d
.
y
-
b
.
y
}
else
if
(
Math
.
abs
(
e
.
y
)
>
Math
.
abs
(
e
.
z
)){
a
=
g
.
x
-
b
.
x
;
e
=
c
.
x
-
b
.
x
;
f
=
d
.
x
-
b
.
x
;
g
=
g
.
z
-
b
.
z
;
c
=
c
.
z
-
b
.
z
;
d
=
d
.
z
-
b
.
z
}
else
{
a
=
g
.
x
-
b
.
x
;
e
=
c
.
x
-
b
.
x
;
f
=
d
.
x
-
b
.
x
;
g
=
g
.
y
-
b
.
y
;
c
=
c
.
y
-
b
.
y
;
d
=
d
.
y
-
b
.
y
}
b
=
e
*
d
-
c
*
f
;
if
(
b
==
0
)
return
Number
.
MAX_VALUE
;
b
=
1
/
b
;
d
=
(
a
*
d
-
g
*
f
)
*
b
;
if
(
!
(
d
>=
0
))
return
Number
.
MAX_VALUE
;
b
*=
e
*
g
-
c
*
a
;
if
(
!
(
b
>=
0
))
return
Number
.
MAX_VALUE
;
if
(
!
(
1
-
d
-
b
>=
0
))
return
Number
.
MAX_VALUE
;
return
h
};
THREE
.
CollisionSystem
.
prototype
.
makeRayLocal
=
function
(
a
,
b
){
var
c
=
new
THREE
.
Ray
(
a
.
origin
.
clone
(),
a
.
direction
.
clone
()),
d
=
THREE
.
Matrix4
.
makeInvert
(
b
.
matrixWorld
);
d
.
multiplyVector3
(
c
.
origin
);
d
.
rotateAxis
(
c
.
direction
);
c
.
direction
.
normalize
();
return
c
};
THREE
.
CollisionSystem
.
prototype
.
rayBox
=
function
(
a
,
b
){
var
c
;
c
=
b
.
dynamic
&&
b
.
mesh
&&
b
.
mesh
.
matrixWorld
?
this
.
makeRayLocal
(
a
,
b
.
mesh
):
new
THREE
.
Ray
(
a
.
origin
.
clone
(),
a
.
direction
.
clone
());
var
d
=
0
,
e
=
0
,
f
=
0
,
h
=
0
,
g
=
0
,
j
=
0
,
l
=!
0
;
if
(
c
.
origin
.
x
<
b
.
min
.
x
){
d
=
b
.
min
.
x
-
c
.
origin
.
x
;
d
/=
c
.
direction
.
x
;
l
=!
1
;
h
=-
1
}
else
if
(
c
.
origin
.
x
>
b
.
max
.
x
){
d
=
b
.
max
.
x
-
c
.
origin
.
x
;
d
/=
c
.
direction
.
x
;
l
=!
1
;
h
=
1
}
if
(
c
.
origin
.
y
<
b
.
min
.
y
){
e
=
b
.
min
.
y
-
c
.
origin
.
y
;
e
/=
c
.
direction
.
y
;
l
=!
1
;
g
=-
1
}
else
if
(
c
.
origin
.
y
>
b
.
max
.
y
){
e
=
b
.
max
.
y
-
c
.
origin
.
y
;
e
/=
c
.
direction
.
y
;
l
=!
1
;
g
=
1
}
if
(
c
.
origin
.
z
<
b
.
min
.
z
){
f
=
b
.
min
.
z
-
c
.
origin
.
z
;
f
/=
c
.
direction
.
z
;
l
=!
1
;
j
=-
1
}
else
if
(
c
.
origin
.
z
>
b
.
max
.
z
){
f
=
b
.
max
.
z
-
c
.
origin
.
z
;
f
/=
c
.
direction
.
z
;
l
=!
1
;
j
=
1
}
if
(
l
)
return
-
1
;
l
=
0
;
if
(
e
>
d
){
l
=
1
;
d
=
e
}
if
(
f
>
d
){
l
=
2
;
d
=
f
}
switch
(
l
){
case
0
:
g
=
c
.
origin
.
y
+
c
.
direction
.
y
*
d
;
if
(
g
<
b
.
min
.
y
||
g
>
b
.
max
.
y
)
return
Number
.
MAX_VALUE
;
c
=
c
.
origin
.
z
+
c
.
direction
.
z
*
d
;
if
(
c
<
b
.
min
.
z
||
c
>
b
.
max
.
z
)
return
Number
.
MAX_VALUE
;
b
.
normal
=
new
THREE
.
Vector3
(
h
,
0
,
0
);
break
;
case
1
:
h
=
c
.
origin
.
x
+
c
.
direction
.
x
*
d
;
if
(
h
<
b
.
min
.
x
||
h
>
b
.
max
.
x
)
return
Number
.
MAX_VALUE
;
c
=
c
.
origin
.
z
+
c
.
direction
.
z
*
d
;
if
(
c
<
b
.
min
.
z
||
c
>
b
.
max
.
z
)
return
Number
.
MAX_VALUE
;
b
.
normal
=
new
THREE
.
Vector3
(
0
,
g
,
0
);
break
;
case
2
:
h
=
c
.
origin
.
x
+
c
.
direction
.
x
*
d
;
if
(
h
<
b
.
min
.
x
||
h
>
b
.
max
.
x
)
return
Number
.
MAX_VALUE
;
g
=
c
.
origin
.
y
+
c
.
direction
.
y
*
d
;
if
(
g
<
b
.
min
.
y
||
g
>
b
.
max
.
y
)
return
Number
.
MAX_VALUE
;
b
.
normal
=
new
THREE
.
Vector3
(
0
,
0
,
j
)}
return
d
};
THREE
.
CollisionSystem
.
prototype
.
rayPlane
=
function
(
a
,
b
){
var
c
=
a
.
direction
.
dot
(
b
.
normal
),
d
=
b
.
point
.
dot
(
b
.
normal
);
if
(
c
<
0
)
c
=
(
d
-
a
.
origin
.
dot
(
b
.
normal
))
/
c
;
else
return
Number
.
MAX_VALUE
;
return
c
>
0
?
c
:
Number
.
MAX_VALUE
};
THREE
.
CollisionSystem
.
prototype
.
raySphere
=
function
(
a
,
b
){
var
c
=
b
.
center
.
clone
().
subSelf
(
a
.
origin
);
if
(
c
.
lengthSq
<
b
.
radiusSq
)
return
-
1
;
var
d
=
c
.
dot
(
a
.
direction
.
clone
());
if
(
d
<=
0
)
return
Number
.
MAX_VALUE
;
c
=
b
.
radiusSq
-
(
c
.
lengthSq
()
-
d
*
d
);
if
(
c
>=
0
)
return
Math
.
abs
(
d
)
-
Math
.
sqrt
(
c
);
return
Number
.
MAX_VALUE
};
THREE
.
CollisionSystem
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
CollisionSystem
.
__v2
=
new
THREE
.
Vector3
;
THREE
.
CollisionSystem
.
__v3
=
new
THREE
.
Vector3
;
THREE
.
CollisionUtils
=
{};
THREE
.
CollisionUtils
.
MeshOBB
=
function
(
a
){
a
.
geometry
.
computeBoundingBox
();
var
b
=
a
.
geometry
.
boundingBox
,
c
=
new
THREE
.
Vector3
(
b
.
x
[
0
],
b
.
y
[
0
],
b
.
z
[
0
]);
b
=
new
THREE
.
Vector3
(
b
.
x
[
1
],
b
.
y
[
1
],
b
.
z
[
1
]);
c
=
new
THREE
.
BoxCollider
(
c
,
b
);
c
.
mesh
=
a
;
return
c
};
THREE
.
CollisionUtils
.
MeshAABB
=
function
(
a
){
var
b
=
THREE
.
CollisionUtils
.
MeshOBB
(
a
);
b
.
min
.
addSelf
(
a
.
position
);
b
.
max
.
addSelf
(
a
.
position
);
b
.
dynamic
=!
1
;
return
b
};
THREE
.
CollisionUtils
.
MeshColliderWBox
=
function
(
a
){
for
(
var
b
=
a
.
geometry
.
vertices
,
c
=
b
.
length
,
d
=
a
.
geometry
.
faces
,
e
=
d
.
length
,
f
=
[],
h
=
[],
g
=
[],
j
=
0
;
j
<
c
;
j
++
)
f
.
push
(
new
THREE
.
Vector3
(
b
[
j
].
position
.
x
,
b
[
j
].
position
.
y
,
b
[
j
].
position
.
z
));
for
(
j
=
0
;
j
<
e
;
j
++
){
h
.
push
(
d
[
j
].
a
,
d
[
j
].
b
,
d
[
j
].
c
);
g
.
push
(
new
THREE
.
Vector3
(
d
[
j
].
normal
.
x
,
d
[
j
].
normal
.
y
,
d
[
j
].
normal
.
z
))}
b
=
new
THREE
.
MeshCollider
(
f
,
h
,
g
,
THREE
.
CollisionUtils
.
MeshOBB
(
a
));
b
.
mesh
=
a
;
return
b
};
build/custom/ThreeSVG.js
浏览文件 @
d1ae3fb4
...
...
@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
e
;
return
this
},
setFromEuler
:
function
(
a
){
var
b
=
0.5
*
Math
.
PI
/
360
,
c
=
a
.
x
*
b
,
e
=
a
.
y
*
b
,
d
=
a
.
z
*
b
;
a
=
Math
.
cos
(
e
);
e
=
Math
.
sin
(
e
);
b
=
Math
.
cos
(
-
d
);
d
=
Math
.
sin
(
-
d
);
var
g
=
Math
.
cos
(
c
);
c
=
Math
.
sin
(
c
);
var
f
=
a
*
b
,
i
=
e
*
d
;
this
.
w
=
f
*
g
-
i
*
c
;
this
.
x
=
f
*
c
+
i
*
g
;
this
.
y
=
e
*
b
*
g
+
a
*
d
*
c
;
this
.
z
=
a
*
d
*
g
-
e
*
b
*
c
;
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
);
if
(
a
==
0
)
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
;
else
{
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
,
e
=
this
.
z
,
d
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
i
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
b
*
a
+
d
*
g
+
c
*
i
-
e
*
f
;
this
.
y
=
c
*
a
+
d
*
f
+
e
*
g
-
b
*
i
;
this
.
z
=
e
*
a
+
d
*
i
+
b
*
f
-
c
*
g
;
this
.
w
=
d
*
a
-
b
*
g
-
c
*
f
-
e
*
i
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
e
=
a
.
y
,
d
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
i
=
this
.
z
,
h
=
this
.
w
,
j
=
h
*
c
+
f
*
d
-
i
*
e
,
l
=
h
*
e
+
i
*
c
-
g
*
d
,
m
=
h
*
d
+
g
*
e
-
f
*
c
;
c
=-
g
*
c
-
f
*
e
-
i
*
d
;
b
.
x
=
j
*
h
+
c
*-
g
+
l
*-
i
-
m
*-
f
;
b
.
y
=
l
*
h
+
c
*-
f
+
m
*-
g
-
j
*-
i
;
b
.
z
=
m
*
h
+
c
*-
i
+
j
*-
f
-
l
*-
g
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
0
){
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
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
){
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
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
e
,
d
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
d
instanceof
THREE
.
Color
?
d
:
new
THREE
.
Color
;
this
.
vertexColors
=
d
instanceof
Array
?
d
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
e
,
d
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
e
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
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
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
edges
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
morphColors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
...
...
build/custom/ThreeWebGL.js
浏览文件 @
d1ae3fb4
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录