Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
a318d875
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,发现更多精彩内容 >>
提交
a318d875
编写于
4月 09, 2011
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added forgotten THREE namespace to SceneUtils.traverseHierarchy
上级
aa3b1e06
变更
7
展开全部
显示空白变更内容
内联
并排
Showing
7 changed file
with
16 addition
and
16 deletion
+16
-16
build/Three.js
build/Three.js
+6
-6
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+1
-1
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+1
-1
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+4
-4
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+1
-1
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+2
-2
src/extras/SceneUtils.js
src/extras/SceneUtils.js
+1
-1
未找到文件。
build/Three.js
浏览文件 @
a318d875
此差异已折叠。
点击以展开。
build/custom/ThreeCanvas.js
浏览文件 @
a318d875
...
...
@@ -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
){
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
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
.
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
浏览文件 @
a318d875
...
...
@@ -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
){
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
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
.
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
浏览文件 @
a318d875
...
...
@@ -5,7 +5,7 @@ THREE.ImageUtils={loadTexture:function(a,b,c){var d=new Image,e=new THREE.Textur
THREE
.
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
=
THREE
.
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
THREE
.
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
THREE
.
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
THREE
.
Plane
(
b
,
b
);
var
e
=
Math
.
PI
,
f
=
Math
.
PI
/
2
;
THREE
.
SceneUtils
.
addMesh
(
a
,
b
,
1
,
0
,
0
,
-
d
,
0
,
0
,
0
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
5
])}));
THREE
.
SceneUtils
.
addMesh
(
a
,
b
,
1
,
-
d
,
0
,
0
,
0
,
f
,
0
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
0
])}));
THREE
.
SceneUtils
.
addMesh
(
a
,
b
,
1
,
d
,
0
,
0
,
0
,
-
f
,
0
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
1
])}));
THREE
.
SceneUtils
.
addMesh
(
a
,
b
,
1
,
0
,
d
,
0
,
f
,
0
,
e
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
2
])}));
THREE
.
SceneUtils
.
addMesh
(
a
,
b
,
1
,
0
,
-
d
,
0
,
-
f
,
0
,
e
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
3
])}))},
showHierarchy
:
function
(
a
,
b
){
THREE
.
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
)}}};
0
,
e
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
2
])}));
THREE
.
SceneUtils
.
addMesh
(
a
,
b
,
1
,
0
,
-
d
,
0
,
-
f
,
0
,
e
,
new
THREE
.
MeshBasicMaterial
({
map
:
new
THREE
.
Texture
(
c
[
3
])}))},
showHierarchy
:
function
(
a
,
b
){
THREE
.
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
);
THREE
.
SceneUtils
.
traverseHierarchy
(
c
,
b
)}}};
THREE
.
ShaderUtils
=
{
lib
:{
fresnel
:{
uniforms
:{
mRefractionRatio
:{
type
:
"
f
"
,
value
:
1.02
},
mFresnelBias
:{
type
:
"
f
"
,
value
:
0.1
},
mFresnelPower
:{
type
:
"
f
"
,
value
:
2
},
mFresnelScale
:{
type
:
"
f
"
,
value
:
1
},
tCube
:{
type
:
"
t
"
,
value
:
1
,
texture
:
null
}},
fragmentShader
:
"
uniform samplerCube tCube;
\n
varying vec3 vReflect;
\n
varying vec3 vRefract[3];
\n
varying float vReflectionFactor;
\n
void main() {
\n
vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );
\n
vec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );
\n
refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;
\n
refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;
\n
refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;
\n
refractedColor.a = 1.0;
\n
gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );
\n
}
"
,
vertexShader
:
"
uniform float mRefractionRatio;
\n
uniform float mFresnelBias;
\n
uniform float mFresnelScale;
\n
uniform float mFresnelPower;
\n
varying vec3 vReflect;
\n
varying vec3 vRefract[3];
\n
varying float vReflectionFactor;
\n
void main() {
\n
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
\n
vec4 mPosition = objectMatrix * vec4( position, 1.0 );
\n
vec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );
\n
vec3 I = mPosition.xyz - cameraPosition;
\n
vReflect = reflect( I, nWorld );
\n
vRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );
\n
vRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );
\n
vRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );
\n
vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );
\n
gl_Position = projectionMatrix * mvPosition;
\n
}
"
},
normal
:{
uniforms
:{
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
},
...
...
@@ -16,7 +16,7 @@ value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.00195
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
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
=
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
0
;
this
.
noFly
=!
1
;
this
.
lookVertical
=!
0
;
this
.
autoForward
=!
1
;
this
.
activeLook
=!
0
;
this
.
heightSpeed
=!
1
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
constrainVertical
=!
1
;
this
.
verticalMin
=
0
;
this
.
verticalMax
=
3.14
;
this
.
domElement
=
document
;
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
(
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
=
...
...
@@ -27,7 +27,7 @@ this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0
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
=
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
0
;
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
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
;
...
...
@@ -44,7 +44,7 @@ d));c instanceof THREE.Face4&&b.push(new THREE.UV(0.5+Math.atan2(n.position.x,n.
THREE
.
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
()};
THREE
.
Icosahedron
.
prototype
=
new
THREE
.
Geometry
;
THREE
.
Icosahedron
.
prototype
.
constructor
=
THREE
.
Icosahedron
;
THREE
.
Lathe
=
function
(
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
);
THREE
.
Lathe
=
function
(
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
0
;
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
()};
THREE
.
Lathe
.
prototype
=
new
THREE
.
Geometry
;
THREE
.
Lathe
.
prototype
.
constructor
=
THREE
.
Lathe
;
THREE
.
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
()};
THREE
.
Plane
.
prototype
=
new
THREE
.
Geometry
;
THREE
.
Plane
.
prototype
.
constructor
=
THREE
.
Plane
;
...
...
build/custom/ThreeSVG.js
浏览文件 @
a318d875
...
...
@@ -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
){
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
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
.
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
浏览文件 @
a318d875
...
...
@@ -48,7 +48,7 @@ e,d)}};THREE.Quaternion=function(b,e,d,h){this.set(b||0,e||0,d||0,h!==undefined?
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
b
,
e
,
d
,
h
){
this
.
x
=
b
;
this
.
y
=
e
;
this
.
z
=
d
;
this
.
w
=
h
;
return
this
},
setFromEuler
:
function
(
b
){
var
e
=
0.5
*
Math
.
PI
/
360
,
d
=
b
.
x
*
e
,
h
=
b
.
y
*
e
,
g
=
b
.
z
*
e
;
b
=
Math
.
cos
(
h
);
h
=
Math
.
sin
(
h
);
e
=
Math
.
cos
(
-
g
);
g
=
Math
.
sin
(
-
g
);
var
k
=
Math
.
cos
(
d
);
d
=
Math
.
sin
(
d
);
var
i
=
b
*
e
,
p
=
h
*
g
;
this
.
w
=
i
*
k
-
p
*
d
;
this
.
x
=
i
*
d
+
p
*
k
;
this
.
y
=
h
*
e
*
k
+
b
*
g
*
d
;
this
.
z
=
b
*
g
*
k
-
h
*
e
*
d
;
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=
-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
b
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
if
(
b
==
0
)
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
;
else
{
b
=
1
/
b
;
this
.
x
*=
b
;
this
.
y
*=
b
;
this
.
z
*=
b
;
this
.
w
*=
b
}
return
this
},
multiplySelf
:
function
(
b
){
var
e
=
this
.
x
,
d
=
this
.
y
,
h
=
this
.
z
,
g
=
this
.
w
,
k
=
b
.
x
,
i
=
b
.
y
,
p
=
b
.
z
;
b
=
b
.
w
;
this
.
x
=
e
*
b
+
g
*
k
+
d
*
p
-
h
*
i
;
this
.
y
=
d
*
b
+
g
*
i
+
h
*
k
-
e
*
p
;
this
.
z
=
h
*
b
+
g
*
p
+
e
*
i
-
d
*
k
;
this
.
w
=
g
*
b
-
e
*
k
-
d
*
i
-
h
*
p
;
return
this
},
multiplyVector3
:
function
(
b
,
e
){
e
||
(
e
=
b
);
var
d
=
b
.
x
,
h
=
b
.
y
,
g
=
b
.
z
,
k
=
this
.
x
,
i
=
this
.
y
,
p
=
this
.
z
,
q
=
this
.
w
,
u
=
q
*
d
+
i
*
g
-
p
*
h
,
D
=
q
*
h
+
p
*
d
-
k
*
g
,
E
=
q
*
g
+
k
*
h
-
i
*
d
;
d
=-
k
*
d
-
i
*
h
-
p
*
g
;
e
.
x
=
u
*
q
+
d
*-
k
+
D
*-
p
-
E
*-
i
;
e
.
y
=
D
*
q
+
d
*-
i
+
E
*-
k
-
u
*-
p
;
e
.
z
=
E
*
q
+
d
*-
p
+
u
*-
i
-
D
*-
k
;
return
e
}};
THREE
.
Quaternion
.
slerp
=
function
(
b
,
e
,
d
,
h
){
var
g
=
b
.
w
*
e
.
w
+
b
.
x
*
e
.
x
+
b
.
y
*
e
.
y
+
b
.
z
*
e
.
z
;
if
(
Math
.
abs
(
g
)
>=
1
){
d
.
w
=
b
.
w
;
d
.
x
=
b
.
x
;
d
.
y
=
b
.
y
;
d
.
z
=
b
.
z
;
return
d
}
var
k
=
Math
.
acos
(
g
),
i
=
Math
.
sqrt
(
1
-
g
*
g
);
if
(
Math
.
abs
(
i
)
<
0.001
){
d
.
w
=
0.5
*
(
b
.
w
+
e
.
w
);
d
.
x
=
0.5
*
(
b
.
x
+
e
.
x
);
d
.
y
=
0.5
*
(
b
.
y
+
e
.
y
);
d
.
z
=
0.5
*
(
b
.
z
+
e
.
z
);
return
d
}
g
=
Math
.
sin
((
1
-
h
)
*
k
)
/
i
;
h
=
Math
.
sin
(
h
*
k
)
/
i
;
d
.
w
=
b
.
w
*
g
+
e
.
w
*
h
;
d
.
x
=
b
.
x
*
g
+
e
.
x
*
h
;
d
.
y
=
b
.
y
*
g
+
e
.
y
*
h
;
d
.
z
=
b
.
z
*
g
+
e
.
z
*
h
;
return
d
};
THREE
.
Vertex
=
function
(
b
){
this
.
position
=
b
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
b
,
e
,
d
,
h
){
var
g
=
b
.
w
*
e
.
w
+
b
.
x
*
e
.
x
+
b
.
y
*
e
.
y
+
b
.
z
*
e
.
z
;
if
(
Math
.
abs
(
g
)
>=
1
){
d
.
w
=
b
.
w
;
d
.
x
=
b
.
x
;
d
.
y
=
b
.
y
;
d
.
z
=
b
.
z
;
return
d
}
var
k
=
Math
.
acos
(
g
),
i
=
Math
.
sqrt
(
1
-
g
*
g
);
if
(
Math
.
abs
(
i
)
<
0.001
0
){
d
.
w
=
0.5
*
(
b
.
w
+
e
.
w
);
d
.
x
=
0.5
*
(
b
.
x
+
e
.
x
);
d
.
y
=
0.5
*
(
b
.
y
+
e
.
y
);
d
.
z
=
0.5
*
(
b
.
z
+
e
.
z
);
return
d
}
g
=
Math
.
sin
((
1
-
h
)
*
k
)
/
i
;
h
=
Math
.
sin
(
h
*
k
)
/
i
;
d
.
w
=
b
.
w
*
g
+
e
.
w
*
h
;
d
.
x
=
b
.
x
*
g
+
e
.
x
*
h
;
d
.
y
=
b
.
y
*
g
+
e
.
y
*
h
;
d
.
z
=
b
.
z
*
g
+
e
.
z
*
h
;
return
d
};
THREE
.
Vertex
=
function
(
b
){
this
.
position
=
b
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
b
,
e
,
d
,
h
,
g
,
k
){
this
.
a
=
b
;
this
.
b
=
e
;
this
.
c
=
d
;
this
.
normal
=
h
instanceof
THREE
.
Vector3
?
h
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
h
instanceof
Array
?
h
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
k
instanceof
Array
?
k
:[
k
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
b
,
e
,
d
,
h
,
g
,
k
,
i
){
this
.
a
=
b
;
this
.
b
=
e
;
this
.
c
=
d
;
this
.
d
=
h
;
this
.
normal
=
g
instanceof
THREE
.
Vector3
?
g
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
g
instanceof
Array
?
g
:[];
this
.
color
=
k
instanceof
THREE
.
Color
?
k
:
new
THREE
.
Color
;
this
.
vertexColors
=
k
instanceof
Array
?
k
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
i
instanceof
Array
?
i
:[
i
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
b
,
e
){
this
.
set
(
b
||
0
,
e
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
b
,
e
){
this
.
u
=
b
;
this
.
v
=
e
;
return
this
},
copy
:
function
(
b
){
this
.
set
(
b
.
u
,
b
.
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
};
...
...
@@ -216,7 +216,7 @@ o.uvScale.y);c.uniform2f(w.uvOffset,o.uvOffset.x,o.uvOffset.y);c.uniform2f(w.ali
w
,
x
,
v
,
A
=
new
THREE
.
Vector3
,
t
=
za
/
ya
,
y
=
ya
*
0.5
,
z
=
za
*
0.5
,
G
=
16
/
za
,
B
=
[
G
*
t
,
G
],
O
=
[
1
,
1
,
0
],
W
=
[
1
,
1
],
P
=
J
.
uniforms
;
m
=
J
.
attributes
;
c
.
useProgram
(
J
.
program
);
ra
=
J
.
program
;
ga
=
""
;
if
(
!
pb
){
c
.
enableVertexAttribArray
(
J
.
attributes
.
vertex
);
c
.
enableVertexAttribArray
(
J
.
attributes
.
uv
);
pb
=!
0
}
c
.
uniform1i
(
P
.
occlusionMap
,
0
);
c
.
uniform1i
(
P
.
map
,
1
);
c
.
bindBuffer
(
c
.
ARRAY_BUFFER
,
J
.
vertexBuffer
);
c
.
vertexAttribPointer
(
m
.
vertex
,
2
,
c
.
FLOAT
,
!
1
,
16
,
0
);
c
.
vertexAttribPointer
(
m
.
uv
,
2
,
c
.
FLOAT
,
!
1
,
16
,
8
);
c
.
bindBuffer
(
c
.
ELEMENT_ARRAY_BUFFER
,
J
.
elementBuffer
);
c
.
disable
(
c
.
CULL_FACE
);
c
.
depthMask
(
!
1
);
c
.
activeTexture
(
c
.
TEXTURE0
);
c
.
bindTexture
(
c
.
TEXTURE_2D
,
J
.
occlusionTexture
);
c
.
activeTexture
(
c
.
TEXTURE1
);
for
(
n
=
0
;
n
<
o
;
n
++
){
m
=
f
.
__webglLensFlares
[
n
].
object
;
A
.
set
(
m
.
matrixWorld
.
n14
,
m
.
matrixWorld
.
n24
,
m
.
matrixWorld
.
n34
);
s
.
matrixWorldInverse
.
multiplyVector3
(
A
);
s
.
projectionMatrix
.
multiplyVector3
(
A
);
O
[
0
]
=
A
.
x
;
O
[
1
]
=
A
.
y
;
O
[
2
]
=
A
.
z
;
W
[
0
]
=
O
[
0
]
*
y
+
y
;
W
[
1
]
=
O
[
1
]
*
z
+
z
;
if
(
J
.
hasVertexTexture
||
W
[
0
]
>
0
&&
W
[
0
]
<
ya
&&
W
[
1
]
>
0
&&
W
[
1
]
<
za
){
c
.
bindTexture
(
c
.
TEXTURE_2D
,
J
.
tempTexture
);
c
.
copyTexImage2D
(
c
.
TEXTURE_2D
,
0
,
c
.
RGB
,
W
[
0
]
-
8
,
W
[
1
]
-
8
,
16
,
16
,
0
);
c
.
uniform1i
(
P
.
renderType
,
0
);
c
.
uniform2fv
(
P
.
scale
,
B
);
c
.
uniform3fv
(
P
.
screenPosition
,
O
);
c
.
disable
(
c
.
BLEND
);
c
.
enable
(
c
.
DEPTH_TEST
);
c
.
drawElements
(
c
.
TRIANGLES
,
6
,
c
.
UNSIGNED_SHORT
,
0
);
c
.
bindTexture
(
c
.
TEXTURE_2D
,
J
.
occlusionTexture
);
c
.
copyTexImage2D
(
c
.
TEXTURE_2D
,
0
,
c
.
RGBA
,
W
[
0
]
-
8
,
W
[
1
]
-
8
,
16
,
16
,
0
);
c
.
uniform1i
(
P
.
renderType
,
1
);
c
.
disable
(
c
.
DEPTH_TEST
);
c
.
bindTexture
(
c
.
TEXTURE_2D
,
J
.
tempTexture
);
c
.
drawElements
(
c
.
TRIANGLES
,
6
,
c
.
UNSIGNED_SHORT
,
0
);
m
.
positionScreen
.
x
=
O
[
0
];
m
.
positionScreen
.
y
=
O
[
1
];
m
.
positionScreen
.
z
=
O
[
2
];
m
.
customUpdateCallback
?
m
.
customUpdateCallback
(
m
):
m
.
updateLensFlares
();
c
.
uniform1i
(
P
.
renderType
,
2
);
c
.
enable
(
c
.
BLEND
);
w
=
0
;
for
(
x
=
m
.
lensFlares
.
length
;
w
<
x
;
w
++
){
v
=
m
.
lensFlares
[
w
];
if
(
v
.
opacity
>
0.001
&&
v
.
scale
>
0.001
){
O
[
0
]
=
v
.
x
;
O
[
1
]
=
v
.
y
;
O
[
2
]
=
v
.
z
;
G
=
v
.
size
*
v
.
scale
/
za
;
B
[
0
]
=
G
*
t
;
B
[
1
]
=
G
;
c
.
uniform3fv
(
P
.
screenPosition
,
O
);
c
.
uniform2fv
(
P
.
scale
,
B
);
c
.
uniform1f
(
P
.
rotation
,
v
.
rotation
);
c
.
uniform1f
(
P
.
opacity
,
v
.
opacity
);
oa
(
v
.
blending
);
K
(
v
.
texture
,
1
);
c
.
drawElements
(
c
.
TRIANGLES
,
6
,
c
.
UNSIGNED_SHORT
,
O
[
1
];
m
.
positionScreen
.
z
=
O
[
2
];
m
.
customUpdateCallback
?
m
.
customUpdateCallback
(
m
):
m
.
updateLensFlares
();
c
.
uniform1i
(
P
.
renderType
,
2
);
c
.
enable
(
c
.
BLEND
);
w
=
0
;
for
(
x
=
m
.
lensFlares
.
length
;
w
<
x
;
w
++
){
v
=
m
.
lensFlares
[
w
];
if
(
v
.
opacity
>
0.001
0
&&
v
.
scale
>
0.0010
){
O
[
0
]
=
v
.
x
;
O
[
1
]
=
v
.
y
;
O
[
2
]
=
v
.
z
;
G
=
v
.
size
*
v
.
scale
/
za
;
B
[
0
]
=
G
*
t
;
B
[
1
]
=
G
;
c
.
uniform3fv
(
P
.
screenPosition
,
O
);
c
.
uniform2fv
(
P
.
scale
,
B
);
c
.
uniform1f
(
P
.
rotation
,
v
.
rotation
);
c
.
uniform1f
(
P
.
opacity
,
v
.
opacity
);
oa
(
v
.
blending
);
K
(
v
.
texture
,
1
);
c
.
drawElements
(
c
.
TRIANGLES
,
6
,
c
.
UNSIGNED_SHORT
,
0
)}}}}
c
.
enable
(
c
.
CULL_FACE
);
c
.
enable
(
c
.
DEPTH_TEST
);
c
.
depthMask
(
ta
)}
function
V
(
f
,
s
){
f
.
_modelViewMatrix
.
multiplyToArray
(
s
.
matrixWorldInverse
,
f
.
matrixWorld
,
f
.
_modelViewMatrixArray
);
THREE
.
Matrix4
.
makeInvert3x3
(
f
.
_modelViewMatrix
).
transposeIntoArray
(
f
.
_normalMatrixArray
)}
function
L
(
f
){
var
s
,
m
,
n
,
o
,
w
;
if
(
f
instanceof
THREE
.
Mesh
){
m
=
f
.
geometry
;
for
(
s
in
m
.
geometryGroups
){
n
=
m
.
geometryGroups
[
s
];
w
=!
1
;
for
(
o
in
n
.
__webglCustomAttributes
)
if
(
n
.
__webglCustomAttributes
[
o
].
needsUpdate
){
w
=!
0
;
break
}
if
(
m
.
__dirtyVertices
||
m
.
__dirtyMorphTargets
||
m
.
__dirtyElements
||
m
.
__dirtyUvs
||
m
.
__dirtyNormals
||
m
.
__dirtyColors
||
m
.
__dirtyTangents
||
w
){
w
=
c
.
DYNAMIC_DRAW
;
var
x
=
void
0
,
v
=
void
0
,
A
=
void
0
,
t
=
void
0
;
A
=
void
0
;
var
y
=
void
0
,
z
=
void
0
,
G
=
void
0
,
B
=
void
0
,
O
=
void
0
,
W
=
void
0
,
P
=
void
0
,
X
=
void
0
,
Ga
=
void
0
,
T
=
void
0
,
Q
=
void
0
,
U
=
void
0
,
ua
=
void
0
;
z
=
void
0
;
G
=
void
0
;
t
=
void
0
;
B
=
void
0
;
t
=
void
0
;
var
r
=
void
0
,
H
=
void
0
;
z
=
void
0
;
r
=
void
0
;
H
=
void
0
;
var
j
=
void
0
,
Ka
=
void
0
;
r
=
void
0
;
H
=
void
0
;
j
=
void
0
;
Ka
=
void
0
;
r
=
void
0
;
H
=
void
0
;
j
=
void
0
;
Ka
=
void
0
;
r
=
void
0
;
H
=
void
0
;
j
=
void
0
;
t
=
void
0
;
B
=
void
0
;
y
=
void
0
;
A
=
void
0
;
A
=
void
0
;
r
=
void
0
;
H
=
void
0
;
j
=
void
0
;
var
Va
=
void
0
,
va
=
0
,
Aa
=
0
,
Za
=
0
,
$a
=
0
,
Ja
=
0
,
La
=
0
,
ea
=
0
,
Ma
=
0
,
xa
=
0
,
C
=
0
,
Ba
=
0
;
H
=
r
=
0
;
var
Ca
=
n
.
__vertexArray
,
fb
=
n
.
__uvArray
,
gb
=
n
.
__uv2Array
,
Qa
=
n
.
__normalArray
,
ha
=
n
.
__tangentArray
,
Da
=
n
.
__colorArray
,
ia
=
n
.
__skinVertexAArray
,
ja
=
n
.
__skinVertexBArray
,
ka
=
n
.
__skinIndexArray
,
la
=
n
.
__skinWeightArray
,
hb
=
n
.
__morphTargetsArrays
,
Ra
=
n
.
__webglCustomAttributes
;
j
=
void
0
;
var
Na
=
n
.
__faceArray
,
Oa
=
n
.
__lineArray
,
qb
=
n
.
__needsSmoothNormals
;
W
=
n
.
__vertexColorType
;
...
...
src/extras/SceneUtils.js
浏览文件 @
a318d875
...
...
@@ -87,7 +87,7 @@ THREE.SceneUtils = {
callback
(
n
);
SceneUtils
.
traverseHierarchy
(
n
,
callback
);
THREE
.
SceneUtils
.
traverseHierarchy
(
n
,
callback
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录