Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
48a9714e
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,发现更多精彩内容 >>
提交
48a9714e
编写于
3月 23, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Also removed Blender 2.49 exporter for the time being.
上级
0dc51e56
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
150 addition
and
2457 deletion
+150
-2457
build/Three.js
build/Three.js
+94
-94
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+4
-4
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+4
-4
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+40
-40
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+4
-4
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+4
-4
utils/exporters/blender/2.49/convert_obj_threejs_slim.py
utils/exporters/blender/2.49/convert_obj_threejs_slim.py
+0
-1211
utils/exporters/blender/2.49/slim_threejs_export.py
utils/exporters/blender/2.49/slim_threejs_export.py
+0
-946
utils/exporters/blender/2.49/threejs_export.py
utils/exporters/blender/2.49/threejs_export.py
+0
-150
未找到文件。
build/Three.js
浏览文件 @
48a9714e
此差异已折叠。
点击以展开。
build/custom/ThreeCanvas.js
浏览文件 @
48a9714e
// ThreeCanvas.js r37 - http://github.com/mrdoob/three.js
var
THREE
=
THREE
||
{};
THREE
.
Color
=
function
(
a
){
this
.
setHex
(
a
)};
THREE
.
Color
.
prototype
=
{
autoUpdate
:
!
0
,
copy
:
function
(
a
){
this
.
r
=
a
.
r
;
this
.
g
=
a
.
g
;
this
.
b
=
a
.
b
;
this
.
hex
=
a
.
hex
;
this
.
__styleString
=
a
.
__styleString
},
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHSV
:
function
(
a
,
b
,
c
){
var
e
,
d
,
f
,
g
,
j
,
h
;
if
(
c
==
0
)
e
=
d
=
f
=
0
;
else
{
g
=
Math
.
floor
(
a
*
6
);
j
=
a
*
6
-
g
;
a
=
c
*
(
1
-
b
);
h
=
c
*
(
1
-
b
*
j
);
b
=
c
*
(
1
-
b
*
(
1
-
j
));
switch
(
g
){
case
1
:
e
=
h
;
d
=
c
;
f
=
a
;
break
;
case
2
:
e
=
a
;
d
=
c
;
f
=
b
;
break
;
case
3
:
e
=
a
;
d
=
h
;
f
=
c
;
break
;
case
4
:
e
=
b
;
d
=
a
;
f
=
c
;
break
;
case
5
:
e
=
c
;
d
=
a
;
f
=
h
;
break
;
case
6
:
case
0
:
e
=
c
;
d
=
b
;
f
=
a
}}
this
.
r
=
e
;
this
.
g
=
d
;
this
.
b
=
f
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHex
:
function
(
a
){
this
.
hex
=~~
a
&
16777215
;
if
(
this
.
autoUpdate
){
this
.
updateRGB
();
this
.
updateStyleString
()}},
updateHex
:
function
(){
this
.
hex
=~~
(
this
.
r
*
255
)
<<
16
^~~
(
this
.
g
*
255
)
<<
8
^~~
(
this
.
b
*
255
)},
updateRGB
:
function
(){
this
.
r
=
(
this
.
hex
>>
16
&
255
)
/
255
;
this
.
g
=
(
this
.
hex
>>
8
&
255
)
/
255
;
this
.
b
=
(
this
.
hex
&
255
)
/
255
},
updateStyleString
:
function
(){
this
.
__styleString
=
"
rgb(
"
+~~
(
this
.
r
*
255
)
+
"
,
"
+~~
(
this
.
g
*
255
)
+
"
,
"
+~~
(
this
.
b
*
255
)
+
"
)
"
},
clone
:
function
(){
return
new
THREE
.
Color
(
this
.
hex
)}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
Color
.
prototype
=
{
autoUpdate
:
!
0
,
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHSV
:
function
(
a
,
b
,
c
){
var
e
,
d
,
f
,
g
,
j
,
h
;
if
(
c
==
0
)
e
=
d
=
f
=
0
;
else
{
g
=
Math
.
floor
(
a
*
6
);
j
=
a
*
6
-
g
;
a
=
c
*
(
1
-
b
);
h
=
c
*
(
1
-
b
*
j
);
b
=
c
*
(
1
-
b
*
(
1
-
j
));
switch
(
g
){
case
1
:
e
=
h
;
d
=
c
;
f
=
a
;
break
;
case
2
:
e
=
a
;
d
=
c
;
f
=
b
;
break
;
case
3
:
e
=
a
;
d
=
h
;
f
=
c
;
break
;
case
4
:
e
=
b
;
d
=
a
;
f
=
c
;
break
;
case
5
:
e
=
c
;
d
=
a
;
f
=
h
;
break
;
case
6
:
case
0
:
e
=
c
;
d
=
b
;
f
=
a
}}
this
.
r
=
e
;
this
.
g
=
d
;
this
.
b
=
f
;
if
(
this
.
autoUpdate
){
this
.
updateHex
()
;
this
.
updateStyleString
()}},
setHex
:
function
(
a
){
this
.
hex
=~~
a
&
16777215
;
if
(
this
.
autoUpdate
){
this
.
updateRGB
();
this
.
updateStyleString
()}},
updateHex
:
function
(){
this
.
hex
=~~
(
this
.
r
*
255
)
<<
16
^~~
(
this
.
g
*
255
)
<<
8
^~~
(
this
.
b
*
255
)},
updateRGB
:
function
(){
this
.
r
=
(
this
.
hex
>>
16
&
255
)
/
255
;
this
.
g
=
(
this
.
hex
>>
8
&
255
)
/
255
;
this
.
b
=
(
this
.
hex
&
255
)
/
255
},
updateStyleString
:
function
(){
this
.
__styleString
=
"
rgb(
"
+~~
(
this
.
r
*
255
)
+
"
,
"
+~~
(
this
.
g
*
255
)
+
"
,
"
+~~
(
this
.
b
*
255
)
+
"
)
"
},
clone
:
function
(){
return
new
THREE
.
Color
(
this
.
hex
)}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
Vector2
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
x
=
a
;
this
.
y
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
x
,
a
.
y
);
return
this
},
addSelf
:
function
(
a
){
this
.
set
(
this
.
x
+
a
.
x
,
this
.
y
+
a
.
y
);
return
this
},
add
:
function
(
a
,
b
){
this
.
set
(
a
.
x
+
b
.
x
,
a
.
y
+
b
.
y
);
return
this
},
subSelf
:
function
(
a
){
this
.
set
(
this
.
x
-
a
.
x
,
this
.
y
-
a
.
y
);
return
this
},
sub
:
function
(
a
,
b
){
this
.
set
(
a
.
x
-
b
.
x
,
a
.
y
-
b
.
y
);
return
this
},
multiplyScalar
:
function
(
a
){
this
.
set
(
this
.
x
*
a
,
this
.
y
*
a
);
return
this
},
negate
:
function
(){
this
.
set
(
-
this
.
x
,
-
this
.
y
);
return
this
},
unit
:
function
(){
this
.
multiplyScalar
(
1
/
this
.
length
());
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
},
clone
:
function
(){
return
new
THREE
.
Vector2
(
this
.
x
,
this
.
y
)}};
THREE
.
Vector3
=
function
(
a
,
b
,
c
){
this
.
set
(
a
||
0
,
b
||
0
,
c
||
0
)};
THREE
.
Vector3
.
prototype
=
{
set
:
function
(
a
,
b
,
c
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
x
,
a
.
y
,
a
.
z
);
return
this
},
add
:
function
(
a
,
b
){
this
.
set
(
a
.
x
+
b
.
x
,
a
.
y
+
b
.
y
,
a
.
z
+
b
.
z
);
return
this
},
addSelf
:
function
(
a
){
this
.
set
(
this
.
x
+
a
.
x
,
this
.
y
+
a
.
y
,
this
.
z
+
a
.
z
);
return
this
},
addScalar
:
function
(
a
){
this
.
set
(
this
.
x
+
a
,
this
.
y
+
a
,
this
.
z
+
a
);
return
this
},
sub
:
function
(
a
,
b
){
this
.
set
(
a
.
x
-
b
.
x
,
a
.
y
-
b
.
y
,
a
.
z
-
b
.
z
);
return
this
},
subSelf
:
function
(
a
){
this
.
set
(
this
.
x
-
a
.
x
,
this
.
y
-
a
.
y
,
this
.
z
-
a
.
z
);
return
this
},
cross
:
function
(
a
,
...
...
@@ -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
f
=
Math
.
cos
(
c
);
c
=
Math
.
sin
(
c
);
var
g
=
a
*
b
,
j
=
e
*
d
;
this
.
w
=
g
*
f
-
j
*
c
;
this
.
x
=
g
*
c
+
j
*
f
;
this
.
y
=
e
*
b
*
f
+
a
*
d
*
c
;
this
.
z
=
a
*
d
*
f
-
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
,
f
=
a
.
x
,
g
=
a
.
y
,
j
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
b
*
a
+
d
*
f
+
c
*
j
-
e
*
g
;
this
.
y
=
c
*
a
+
d
*
g
+
e
*
f
-
b
*
j
;
this
.
z
=
e
*
a
+
d
*
j
+
b
*
g
-
c
*
f
;
this
.
w
=
d
*
a
-
b
*
f
-
c
*
g
-
e
*
j
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
e
=
a
.
y
,
d
=
a
.
z
,
f
=
this
.
x
,
g
=
this
.
y
,
j
=
this
.
z
,
h
=
this
.
w
,
i
=
h
*
c
+
g
*
d
-
j
*
e
,
l
=
h
*
e
+
j
*
c
-
f
*
d
,
m
=
h
*
d
+
f
*
e
-
g
*
c
;
c
=-
f
*
c
-
g
*
e
-
j
*
d
;
b
.
x
=
i
*
h
+
c
*-
f
+
l
*-
j
-
m
*-
g
;
b
.
y
=
l
*
h
+
c
*-
g
+
m
*-
f
-
i
*-
j
;
b
.
z
=
m
*
h
+
c
*-
j
+
i
*-
g
-
l
*-
f
;
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
f
=
Math
.
acos
(
d
),
g
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
g
)
<
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
)
*
f
)
/
g
;
e
=
Math
.
sin
(
e
*
f
)
/
g
;
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
f
=
Math
.
acos
(
d
),
g
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
g
)
<
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
)
*
f
)
/
g
;
e
=
Math
.
sin
(
e
*
f
)
/
g
;
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
,
f
){
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
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
e
,
d
,
f
,
g
){
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
=
f
instanceof
THREE
.
Color
?
f
:
new
THREE
.
Color
;
this
.
vertexColors
=
f
instanceof
Array
?
f
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
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
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
...
...
build/custom/ThreeDOM.js
浏览文件 @
48a9714e
// ThreeDOM.js r37 - http://github.com/mrdoob/three.js
var
THREE
=
THREE
||
{};
THREE
.
Color
=
function
(
a
){
this
.
setHex
(
a
)};
THREE
.
Color
.
prototype
=
{
autoUpdate
:
!
0
,
copy
:
function
(
a
){
this
.
r
=
a
.
r
;
this
.
g
=
a
.
g
;
this
.
b
=
a
.
b
;
this
.
hex
=
a
.
hex
;
this
.
__styleString
=
a
.
__styleString
},
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHSV
:
function
(
a
,
b
,
c
){
var
e
,
d
,
g
,
f
,
i
,
h
;
if
(
c
==
0
)
e
=
d
=
g
=
0
;
else
{
f
=
Math
.
floor
(
a
*
6
);
i
=
a
*
6
-
f
;
a
=
c
*
(
1
-
b
);
h
=
c
*
(
1
-
b
*
i
);
b
=
c
*
(
1
-
b
*
(
1
-
i
));
switch
(
f
){
case
1
:
e
=
h
;
d
=
c
;
g
=
a
;
break
;
case
2
:
e
=
a
;
d
=
c
;
g
=
b
;
break
;
case
3
:
e
=
a
;
d
=
h
;
g
=
c
;
break
;
case
4
:
e
=
b
;
d
=
a
;
g
=
c
;
break
;
case
5
:
e
=
c
;
d
=
a
;
g
=
h
;
break
;
case
6
:
case
0
:
e
=
c
;
d
=
b
;
g
=
a
}}
this
.
r
=
e
;
this
.
g
=
d
;
this
.
b
=
g
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHex
:
function
(
a
){
this
.
hex
=~~
a
&
16777215
;
if
(
this
.
autoUpdate
){
this
.
updateRGB
();
this
.
updateStyleString
()}},
updateHex
:
function
(){
this
.
hex
=~~
(
this
.
r
*
255
)
<<
16
^~~
(
this
.
g
*
255
)
<<
8
^~~
(
this
.
b
*
255
)},
updateRGB
:
function
(){
this
.
r
=
(
this
.
hex
>>
16
&
255
)
/
255
;
this
.
g
=
(
this
.
hex
>>
8
&
255
)
/
255
;
this
.
b
=
(
this
.
hex
&
255
)
/
255
},
updateStyleString
:
function
(){
this
.
__styleString
=
"
rgb(
"
+~~
(
this
.
r
*
255
)
+
"
,
"
+~~
(
this
.
g
*
255
)
+
"
,
"
+~~
(
this
.
b
*
255
)
+
"
)
"
},
clone
:
function
(){
return
new
THREE
.
Color
(
this
.
hex
)}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
Color
.
prototype
=
{
autoUpdate
:
!
0
,
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHSV
:
function
(
a
,
b
,
c
){
var
e
,
d
,
g
,
f
,
i
,
h
;
if
(
c
==
0
)
e
=
d
=
g
=
0
;
else
{
f
=
Math
.
floor
(
a
*
6
);
i
=
a
*
6
-
f
;
a
=
c
*
(
1
-
b
);
h
=
c
*
(
1
-
b
*
i
);
b
=
c
*
(
1
-
b
*
(
1
-
i
));
switch
(
f
){
case
1
:
e
=
h
;
d
=
c
;
g
=
a
;
break
;
case
2
:
e
=
a
;
d
=
c
;
g
=
b
;
break
;
case
3
:
e
=
a
;
d
=
h
;
g
=
c
;
break
;
case
4
:
e
=
b
;
d
=
a
;
g
=
c
;
break
;
case
5
:
e
=
c
;
d
=
a
;
g
=
h
;
break
;
case
6
:
case
0
:
e
=
c
;
d
=
b
;
g
=
a
}}
this
.
r
=
e
;
this
.
g
=
d
;
this
.
b
=
g
;
if
(
this
.
autoUpdate
){
this
.
updateHex
()
;
this
.
updateStyleString
()}},
setHex
:
function
(
a
){
this
.
hex
=~~
a
&
16777215
;
if
(
this
.
autoUpdate
){
this
.
updateRGB
();
this
.
updateStyleString
()}},
updateHex
:
function
(){
this
.
hex
=~~
(
this
.
r
*
255
)
<<
16
^~~
(
this
.
g
*
255
)
<<
8
^~~
(
this
.
b
*
255
)},
updateRGB
:
function
(){
this
.
r
=
(
this
.
hex
>>
16
&
255
)
/
255
;
this
.
g
=
(
this
.
hex
>>
8
&
255
)
/
255
;
this
.
b
=
(
this
.
hex
&
255
)
/
255
},
updateStyleString
:
function
(){
this
.
__styleString
=
"
rgb(
"
+~~
(
this
.
r
*
255
)
+
"
,
"
+~~
(
this
.
g
*
255
)
+
"
,
"
+~~
(
this
.
b
*
255
)
+
"
)
"
},
clone
:
function
(){
return
new
THREE
.
Color
(
this
.
hex
)}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
Vector2
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
x
=
a
;
this
.
y
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
x
,
a
.
y
);
return
this
},
addSelf
:
function
(
a
){
this
.
set
(
this
.
x
+
a
.
x
,
this
.
y
+
a
.
y
);
return
this
},
add
:
function
(
a
,
b
){
this
.
set
(
a
.
x
+
b
.
x
,
a
.
y
+
b
.
y
);
return
this
},
subSelf
:
function
(
a
){
this
.
set
(
this
.
x
-
a
.
x
,
this
.
y
-
a
.
y
);
return
this
},
sub
:
function
(
a
,
b
){
this
.
set
(
a
.
x
-
b
.
x
,
a
.
y
-
b
.
y
);
return
this
},
multiplyScalar
:
function
(
a
){
this
.
set
(
this
.
x
*
a
,
this
.
y
*
a
);
return
this
},
negate
:
function
(){
this
.
set
(
-
this
.
x
,
-
this
.
y
);
return
this
},
unit
:
function
(){
this
.
multiplyScalar
(
1
/
this
.
length
());
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
},
clone
:
function
(){
return
new
THREE
.
Vector2
(
this
.
x
,
this
.
y
)}};
THREE
.
Vector3
=
function
(
a
,
b
,
c
){
this
.
set
(
a
||
0
,
b
||
0
,
c
||
0
)};
THREE
.
Vector3
.
prototype
=
{
set
:
function
(
a
,
b
,
c
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
x
,
a
.
y
,
a
.
z
);
return
this
},
add
:
function
(
a
,
b
){
this
.
set
(
a
.
x
+
b
.
x
,
a
.
y
+
b
.
y
,
a
.
z
+
b
.
z
);
return
this
},
addSelf
:
function
(
a
){
this
.
set
(
this
.
x
+
a
.
x
,
this
.
y
+
a
.
y
,
this
.
z
+
a
.
z
);
return
this
},
addScalar
:
function
(
a
){
this
.
set
(
this
.
x
+
a
,
this
.
y
+
a
,
this
.
z
+
a
);
return
this
},
sub
:
function
(
a
,
b
){
this
.
set
(
a
.
x
-
b
.
x
,
a
.
y
-
b
.
y
,
a
.
z
-
b
.
z
);
return
this
},
subSelf
:
function
(
a
){
this
.
set
(
this
.
x
-
a
.
x
,
this
.
y
-
a
.
y
,
this
.
z
-
a
.
z
);
return
this
},
cross
:
function
(
a
,
...
...
@@ -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
,
m
=
h
*
e
+
i
*
c
-
g
*
d
,
l
=
h
*
d
+
g
*
e
-
f
*
c
;
c
=-
g
*
c
-
f
*
e
-
i
*
d
;
b
.
x
=
j
*
h
+
c
*-
g
+
m
*-
i
-
l
*-
f
;
b
.
y
=
m
*
h
+
c
*-
f
+
l
*-
g
-
j
*-
i
;
b
.
z
=
l
*
h
+
c
*-
i
+
j
*-
f
-
m
*-
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
浏览文件 @
48a9714e
此差异已折叠。
点击以展开。
build/custom/ThreeSVG.js
浏览文件 @
48a9714e
// ThreeSVG.js r37 - http://github.com/mrdoob/three.js
var
THREE
=
THREE
||
{};
THREE
.
Color
=
function
(
a
){
this
.
setHex
(
a
)};
THREE
.
Color
.
prototype
=
{
autoUpdate
:
!
0
,
copy
:
function
(
a
){
this
.
r
=
a
.
r
;
this
.
g
=
a
.
g
;
this
.
b
=
a
.
b
;
this
.
hex
=
a
.
hex
;
this
.
__styleString
=
a
.
__styleString
},
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHSV
:
function
(
a
,
b
,
c
){
var
e
,
d
,
f
,
g
,
i
,
h
;
if
(
c
==
0
)
e
=
d
=
f
=
0
;
else
{
g
=
Math
.
floor
(
a
*
6
);
i
=
a
*
6
-
g
;
a
=
c
*
(
1
-
b
);
h
=
c
*
(
1
-
b
*
i
);
b
=
c
*
(
1
-
b
*
(
1
-
i
));
switch
(
g
){
case
1
:
e
=
h
;
d
=
c
;
f
=
a
;
break
;
case
2
:
e
=
a
;
d
=
c
;
f
=
b
;
break
;
case
3
:
e
=
a
;
d
=
h
;
f
=
c
;
break
;
case
4
:
e
=
b
;
d
=
a
;
f
=
c
;
break
;
case
5
:
e
=
c
;
d
=
a
;
f
=
h
;
break
;
case
6
:
case
0
:
e
=
c
;
d
=
b
;
f
=
a
}}
this
.
r
=
e
;
this
.
g
=
d
;
this
.
b
=
f
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHex
:
function
(
a
){
this
.
hex
=~~
a
&
16777215
;
if
(
this
.
autoUpdate
){
this
.
updateRGB
();
this
.
updateStyleString
()}},
updateHex
:
function
(){
this
.
hex
=~~
(
this
.
r
*
255
)
<<
16
^~~
(
this
.
g
*
255
)
<<
8
^~~
(
this
.
b
*
255
)},
updateRGB
:
function
(){
this
.
r
=
(
this
.
hex
>>
16
&
255
)
/
255
;
this
.
g
=
(
this
.
hex
>>
8
&
255
)
/
255
;
this
.
b
=
(
this
.
hex
&
255
)
/
255
},
updateStyleString
:
function
(){
this
.
__styleString
=
"
rgb(
"
+~~
(
this
.
r
*
255
)
+
"
,
"
+~~
(
this
.
g
*
255
)
+
"
,
"
+~~
(
this
.
b
*
255
)
+
"
)
"
},
clone
:
function
(){
return
new
THREE
.
Color
(
this
.
hex
)}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
Color
.
prototype
=
{
autoUpdate
:
!
0
,
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHSV
:
function
(
a
,
b
,
c
){
var
e
,
d
,
f
,
g
,
i
,
h
;
if
(
c
==
0
)
e
=
d
=
f
=
0
;
else
{
g
=
Math
.
floor
(
a
*
6
);
i
=
a
*
6
-
g
;
a
=
c
*
(
1
-
b
);
h
=
c
*
(
1
-
b
*
i
);
b
=
c
*
(
1
-
b
*
(
1
-
i
));
switch
(
g
){
case
1
:
e
=
h
;
d
=
c
;
f
=
a
;
break
;
case
2
:
e
=
a
;
d
=
c
;
f
=
b
;
break
;
case
3
:
e
=
a
;
d
=
h
;
f
=
c
;
break
;
case
4
:
e
=
b
;
d
=
a
;
f
=
c
;
break
;
case
5
:
e
=
c
;
d
=
a
;
f
=
h
;
break
;
case
6
:
case
0
:
e
=
c
;
d
=
b
;
f
=
a
}}
this
.
r
=
e
;
this
.
g
=
d
;
this
.
b
=
f
;
if
(
this
.
autoUpdate
){
this
.
updateHex
()
;
this
.
updateStyleString
()}},
setHex
:
function
(
a
){
this
.
hex
=~~
a
&
16777215
;
if
(
this
.
autoUpdate
){
this
.
updateRGB
();
this
.
updateStyleString
()}},
updateHex
:
function
(){
this
.
hex
=~~
(
this
.
r
*
255
)
<<
16
^~~
(
this
.
g
*
255
)
<<
8
^~~
(
this
.
b
*
255
)},
updateRGB
:
function
(){
this
.
r
=
(
this
.
hex
>>
16
&
255
)
/
255
;
this
.
g
=
(
this
.
hex
>>
8
&
255
)
/
255
;
this
.
b
=
(
this
.
hex
&
255
)
/
255
},
updateStyleString
:
function
(){
this
.
__styleString
=
"
rgb(
"
+~~
(
this
.
r
*
255
)
+
"
,
"
+~~
(
this
.
g
*
255
)
+
"
,
"
+~~
(
this
.
b
*
255
)
+
"
)
"
},
clone
:
function
(){
return
new
THREE
.
Color
(
this
.
hex
)}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
Vector2
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
x
=
a
;
this
.
y
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
x
,
a
.
y
);
return
this
},
addSelf
:
function
(
a
){
this
.
set
(
this
.
x
+
a
.
x
,
this
.
y
+
a
.
y
);
return
this
},
add
:
function
(
a
,
b
){
this
.
set
(
a
.
x
+
b
.
x
,
a
.
y
+
b
.
y
);
return
this
},
subSelf
:
function
(
a
){
this
.
set
(
this
.
x
-
a
.
x
,
this
.
y
-
a
.
y
);
return
this
},
sub
:
function
(
a
,
b
){
this
.
set
(
a
.
x
-
b
.
x
,
a
.
y
-
b
.
y
);
return
this
},
multiplyScalar
:
function
(
a
){
this
.
set
(
this
.
x
*
a
,
this
.
y
*
a
);
return
this
},
negate
:
function
(){
this
.
set
(
-
this
.
x
,
-
this
.
y
);
return
this
},
unit
:
function
(){
this
.
multiplyScalar
(
1
/
this
.
length
());
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
},
clone
:
function
(){
return
new
THREE
.
Vector2
(
this
.
x
,
this
.
y
)}};
THREE
.
Vector3
=
function
(
a
,
b
,
c
){
this
.
set
(
a
||
0
,
b
||
0
,
c
||
0
)};
THREE
.
Vector3
.
prototype
=
{
set
:
function
(
a
,
b
,
c
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
x
,
a
.
y
,
a
.
z
);
return
this
},
add
:
function
(
a
,
b
){
this
.
set
(
a
.
x
+
b
.
x
,
a
.
y
+
b
.
y
,
a
.
z
+
b
.
z
);
return
this
},
addSelf
:
function
(
a
){
this
.
set
(
this
.
x
+
a
.
x
,
this
.
y
+
a
.
y
,
this
.
z
+
a
.
z
);
return
this
},
addScalar
:
function
(
a
){
this
.
set
(
this
.
x
+
a
,
this
.
y
+
a
,
this
.
z
+
a
);
return
this
},
sub
:
function
(
a
,
b
){
this
.
set
(
a
.
x
-
b
.
x
,
a
.
y
-
b
.
y
,
a
.
z
-
b
.
z
);
return
this
},
subSelf
:
function
(
a
){
this
.
set
(
this
.
x
-
a
.
x
,
this
.
y
-
a
.
y
,
this
.
z
-
a
.
z
);
return
this
},
cross
:
function
(
a
,
...
...
@@ -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
f
=
Math
.
cos
(
c
);
c
=
Math
.
sin
(
c
);
var
g
=
a
*
b
,
i
=
e
*
d
;
this
.
w
=
g
*
f
-
i
*
c
;
this
.
x
=
g
*
c
+
i
*
f
;
this
.
y
=
e
*
b
*
f
+
a
*
d
*
c
;
this
.
z
=
a
*
d
*
f
-
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
,
f
=
a
.
x
,
g
=
a
.
y
,
i
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
b
*
a
+
d
*
f
+
c
*
i
-
e
*
g
;
this
.
y
=
c
*
a
+
d
*
g
+
e
*
f
-
b
*
i
;
this
.
z
=
e
*
a
+
d
*
i
+
b
*
g
-
c
*
f
;
this
.
w
=
d
*
a
-
b
*
f
-
c
*
g
-
e
*
i
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
e
=
a
.
y
,
d
=
a
.
z
,
f
=
this
.
x
,
g
=
this
.
y
,
i
=
this
.
z
,
h
=
this
.
w
,
j
=
h
*
c
+
g
*
d
-
i
*
e
,
m
=
h
*
e
+
i
*
c
-
f
*
d
,
l
=
h
*
d
+
f
*
e
-
g
*
c
;
c
=-
f
*
c
-
g
*
e
-
i
*
d
;
b
.
x
=
j
*
h
+
c
*-
f
+
m
*-
i
-
l
*-
g
;
b
.
y
=
m
*
h
+
c
*-
g
+
l
*-
f
-
j
*-
i
;
b
.
z
=
l
*
h
+
c
*-
i
+
j
*-
g
-
m
*-
f
;
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
f
=
Math
.
acos
(
d
),
g
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
g
)
<
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
)
*
f
)
/
g
;
e
=
Math
.
sin
(
e
*
f
)
/
g
;
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
f
=
Math
.
acos
(
d
),
g
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
g
)
<
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
)
*
f
)
/
g
;
e
=
Math
.
sin
(
e
*
f
)
/
g
;
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
,
f
){
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
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
e
,
d
,
f
,
g
){
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
=
f
instanceof
THREE
.
Color
?
f
:
new
THREE
.
Color
;
this
.
vertexColors
=
f
instanceof
Array
?
f
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
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
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
...
...
build/custom/ThreeWebGL.js
浏览文件 @
48a9714e
// ThreeWebGL.js r37 - http://github.com/mrdoob/three.js
var
THREE
=
THREE
||
{};
THREE
.
Color
=
function
(
a
){
this
.
setHex
(
a
)};
THREE
.
Color
.
prototype
=
{
autoUpdate
:
!
0
,
copy
:
function
(
a
){
this
.
r
=
a
.
r
;
this
.
g
=
a
.
g
;
this
.
b
=
a
.
b
;
this
.
hex
=
a
.
hex
;
this
.
__styleString
=
a
.
__styleString
},
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHSV
:
function
(
a
,
b
,
c
){
var
f
,
e
,
h
,
j
,
p
,
n
;
if
(
c
==
0
)
f
=
e
=
h
=
0
;
else
{
j
=
Math
.
floor
(
a
*
6
);
p
=
a
*
6
-
j
;
a
=
c
*
(
1
-
b
);
n
=
c
*
(
1
-
b
*
p
);
b
=
c
*
(
1
-
b
*
(
1
-
p
));
switch
(
j
){
case
1
:
f
=
n
;
e
=
c
;
h
=
a
;
break
;
case
2
:
f
=
a
;
e
=
c
;
h
=
b
;
break
;
case
3
:
f
=
a
;
e
=
n
;
h
=
c
;
break
;
case
4
:
f
=
b
;
e
=
a
;
h
=
c
;
break
;
case
5
:
f
=
c
;
e
=
a
;
h
=
n
;
break
;
case
6
:
case
0
:
f
=
c
;
e
=
b
;
h
=
a
}}
this
.
r
=
f
;
this
.
g
=
e
;
this
.
b
=
h
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHex
:
function
(
a
){
this
.
hex
=~~
a
&
16777215
;
if
(
this
.
autoUpdate
){
this
.
updateRGB
();
this
.
updateStyleString
()}},
updateHex
:
function
(){
this
.
hex
=~~
(
this
.
r
*
255
)
<<
16
^~~
(
this
.
g
*
255
)
<<
8
^~~
(
this
.
b
*
255
)},
updateRGB
:
function
(){
this
.
r
=
(
this
.
hex
>>
16
&
255
)
/
255
;
this
.
g
=
(
this
.
hex
>>
8
&
255
)
/
255
;
this
.
b
=
(
this
.
hex
&
255
)
/
255
},
updateStyleString
:
function
(){
this
.
__styleString
=
"
rgb(
"
+~~
(
this
.
r
*
255
)
+
"
,
"
+~~
(
this
.
g
*
255
)
+
"
,
"
+~~
(
this
.
b
*
255
)
+
"
)
"
},
clone
:
function
(){
return
new
THREE
.
Color
(
this
.
hex
)}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
Color
.
prototype
=
{
autoUpdate
:
!
0
,
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHSV
:
function
(
a
,
b
,
c
){
var
f
,
e
,
h
,
j
,
p
,
n
;
if
(
c
==
0
)
f
=
e
=
h
=
0
;
else
{
j
=
Math
.
floor
(
a
*
6
);
p
=
a
*
6
-
j
;
a
=
c
*
(
1
-
b
);
n
=
c
*
(
1
-
b
*
p
);
b
=
c
*
(
1
-
b
*
(
1
-
p
));
switch
(
j
){
case
1
:
f
=
n
;
e
=
c
;
h
=
a
;
break
;
case
2
:
f
=
a
;
e
=
c
;
h
=
b
;
break
;
case
3
:
f
=
a
;
e
=
n
;
h
=
c
;
break
;
case
4
:
f
=
b
;
e
=
a
;
h
=
c
;
break
;
case
5
:
f
=
c
;
e
=
a
;
h
=
n
;
break
;
case
6
:
case
0
:
f
=
c
;
e
=
b
;
h
=
a
}}
this
.
r
=
f
;
this
.
g
=
e
;
this
.
b
=
h
;
if
(
this
.
autoUpdate
){
this
.
updateHex
()
;
this
.
updateStyleString
()}},
setHex
:
function
(
a
){
this
.
hex
=~~
a
&
16777215
;
if
(
this
.
autoUpdate
){
this
.
updateRGB
();
this
.
updateStyleString
()}},
updateHex
:
function
(){
this
.
hex
=~~
(
this
.
r
*
255
)
<<
16
^~~
(
this
.
g
*
255
)
<<
8
^~~
(
this
.
b
*
255
)},
updateRGB
:
function
(){
this
.
r
=
(
this
.
hex
>>
16
&
255
)
/
255
;
this
.
g
=
(
this
.
hex
>>
8
&
255
)
/
255
;
this
.
b
=
(
this
.
hex
&
255
)
/
255
},
updateStyleString
:
function
(){
this
.
__styleString
=
"
rgb(
"
+~~
(
this
.
r
*
255
)
+
"
,
"
+~~
(
this
.
g
*
255
)
+
"
,
"
+~~
(
this
.
b
*
255
)
+
"
)
"
},
clone
:
function
(){
return
new
THREE
.
Color
(
this
.
hex
)}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
Vector2
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
x
=
a
;
this
.
y
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
x
,
a
.
y
);
return
this
},
addSelf
:
function
(
a
){
this
.
set
(
this
.
x
+
a
.
x
,
this
.
y
+
a
.
y
);
return
this
},
add
:
function
(
a
,
b
){
this
.
set
(
a
.
x
+
b
.
x
,
a
.
y
+
b
.
y
);
return
this
},
subSelf
:
function
(
a
){
this
.
set
(
this
.
x
-
a
.
x
,
this
.
y
-
a
.
y
);
return
this
},
sub
:
function
(
a
,
b
){
this
.
set
(
a
.
x
-
b
.
x
,
a
.
y
-
b
.
y
);
return
this
},
multiplyScalar
:
function
(
a
){
this
.
set
(
this
.
x
*
a
,
this
.
y
*
a
);
return
this
},
negate
:
function
(){
this
.
set
(
-
this
.
x
,
-
this
.
y
);
return
this
},
unit
:
function
(){
this
.
multiplyScalar
(
1
/
this
.
length
());
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
},
clone
:
function
(){
return
new
THREE
.
Vector2
(
this
.
x
,
this
.
y
)}};
THREE
.
Vector3
=
function
(
a
,
b
,
c
){
this
.
set
(
a
||
0
,
b
||
0
,
c
||
0
)};
THREE
.
Vector3
.
prototype
=
{
set
:
function
(
a
,
b
,
c
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
x
,
a
.
y
,
a
.
z
);
return
this
},
add
:
function
(
a
,
b
){
this
.
set
(
a
.
x
+
b
.
x
,
a
.
y
+
b
.
y
,
a
.
z
+
b
.
z
);
return
this
},
addSelf
:
function
(
a
){
this
.
set
(
this
.
x
+
a
.
x
,
this
.
y
+
a
.
y
,
this
.
z
+
a
.
z
);
return
this
},
addScalar
:
function
(
a
){
this
.
set
(
this
.
x
+
a
,
this
.
y
+
a
,
this
.
z
+
a
);
return
this
},
sub
:
function
(
a
,
b
){
this
.
set
(
a
.
x
-
b
.
x
,
a
.
y
-
b
.
y
,
a
.
z
-
b
.
z
);
return
this
},
subSelf
:
function
(
a
){
this
.
set
(
this
.
x
-
a
.
x
,
this
.
y
-
a
.
y
,
this
.
z
-
a
.
z
);
return
this
},
cross
:
function
(
a
,
...
...
@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,f){this.set(a||0,b||0,c||0,f!==undefined?
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
f
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
f
;
return
this
},
setFromEuler
:
function
(
a
){
var
b
=
0.5
*
Math
.
PI
/
360
,
c
=
a
.
x
*
b
,
f
=
a
.
y
*
b
,
e
=
a
.
z
*
b
;
a
=
Math
.
cos
(
f
);
f
=
Math
.
sin
(
f
);
b
=
Math
.
cos
(
-
e
);
e
=
Math
.
sin
(
-
e
);
var
h
=
Math
.
cos
(
c
);
c
=
Math
.
sin
(
c
);
var
j
=
a
*
b
,
p
=
f
*
e
;
this
.
w
=
j
*
h
-
p
*
c
;
this
.
x
=
j
*
c
+
p
*
h
;
this
.
y
=
f
*
b
*
h
+
a
*
e
*
c
;
this
.
z
=
a
*
e
*
h
-
f
*
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
,
f
=
this
.
z
,
e
=
this
.
w
,
h
=
a
.
x
,
j
=
a
.
y
,
p
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
h
+
c
*
p
-
f
*
j
;
this
.
y
=
c
*
a
+
e
*
j
+
f
*
h
-
b
*
p
;
this
.
z
=
f
*
a
+
e
*
p
+
b
*
j
-
c
*
h
;
this
.
w
=
e
*
a
-
b
*
h
-
c
*
j
-
f
*
p
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
f
=
a
.
y
,
e
=
a
.
z
,
h
=
this
.
x
,
j
=
this
.
y
,
p
=
this
.
z
,
n
=
this
.
w
,
s
=
n
*
c
+
j
*
e
-
p
*
f
,
x
=
n
*
f
+
p
*
c
-
h
*
e
,
z
=
n
*
e
+
h
*
f
-
j
*
c
;
c
=-
h
*
c
-
j
*
f
-
p
*
e
;
b
.
x
=
s
*
n
+
c
*-
h
+
x
*-
p
-
z
*-
j
;
b
.
y
=
x
*
n
+
c
*-
j
+
z
*-
h
-
s
*-
p
;
b
.
z
=
z
*
n
+
c
*-
p
+
s
*-
j
-
x
*-
h
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
f
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
h
=
Math
.
acos
(
e
),
j
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
j
)
<
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
}
e
=
Math
.
sin
((
1
-
f
)
*
h
)
/
j
;
f
=
Math
.
sin
(
f
*
h
)
/
j
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
f
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
f
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
f
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
f
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
f
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
h
=
Math
.
acos
(
e
),
j
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
j
)
<
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
}
e
=
Math
.
sin
((
1
-
f
)
*
h
)
/
j
;
f
=
Math
.
sin
(
f
*
h
)
/
j
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
f
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
f
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
f
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
f
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
f
,
e
,
h
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
f
instanceof
THREE
.
Vector3
?
f
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
f
instanceof
Array
?
f
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
h
instanceof
Array
?
h
:[
h
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
f
,
e
,
h
,
j
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
f
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
h
instanceof
THREE
.
Color
?
h
:
new
THREE
.
Color
;
this
.
vertexColors
=
h
instanceof
Array
?
h
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
j
instanceof
Array
?
j
:[
j
];
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
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
...
...
utils/exporters/blender/2.49/convert_obj_threejs_slim.py
已删除
100644 → 0
浏览文件 @
0dc51e56
此差异已折叠。
点击以展开。
utils/exporters/blender/2.49/slim_threejs_export.py
已删除
100644 → 0
浏览文件 @
0dc51e56
此差异已折叠。
点击以展开。
utils/exporters/blender/2.49/threejs_export.py
已删除
100755 → 0
浏览文件 @
0dc51e56
#!BPY
# Based on Anthony D'Agostino (Scorpius)'s Raw Exported provided with Blender
# and on Mr.doob's and Kikko's Blender 2.5a2 exporter
# 'http://mrdoob.com', 'http://github.com/kikko'
"""
Name: 'three.js (.js)...'
Blender: 245
Group: 'Export'
Tooltip: 'Export selected mesh to three.js (.js)'
"""
__author__
=
"George Profenza"
__url__
=
(
"disturb"
,
"disturbmedia.com/blog"
,
"My blog, http://tomaterial.blogspot.com"
)
__version__
=
"First File Exporter"
__bpydoc__
=
"""
\
Export meshes to mr.doob's three.js 3D Engine.
Currently supports UVs. If the model doesn't display correctly
you might need to reverse some normals/do some cleanup.
More details on the engine here:
https://github.com/mrdoob/three.js
Have fun!
Usage:<br>
Select a mesh to be exported and go to "File->Export->three.js" .
"""
# $Id: raw_export.py 14597 2008-04-28 16:09:17Z campbellbarton $
#
# +---------------------------------------------------------+
# | Copyright (c) 2002 Anthony D'Agostino |
# | http://www.redrival.com/scorpius |
# | scorpius@netzero.com |
# | April 28, 2002 |
# | Read and write RAW Triangle File Format (*.raw) |
# +---------------------------------------------------------+
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
import
Blender
import
BPyMesh
import
re
clean
=
lambda
varStr
:
re
.
sub
(
'\W|^(?=\d)'
,
'_'
,
varStr
)
def
write
(
filename
):
start
=
Blender
.
sys
.
time
()
if
not
filename
.
lower
().
endswith
(
'.js'
):
filename
+=
'.js'
scn
=
Blender
.
Scene
.
GetCurrent
()
ob
=
scn
.
objects
.
active
if
not
ob
:
Blender
.
Draw
.
PupMenu
(
'Error%t|Select 1 active object'
)
return
file
=
open
(
filename
,
'wb'
)
mesh
=
BPyMesh
.
getMeshFromObject
(
ob
,
None
,
True
,
False
,
scn
)
if
not
mesh
:
Blender
.
Draw
.
PupMenu
(
'Error%t|Could not get mesh data from active object'
)
return
mesh
.
transform
(
ob
.
matrixWorld
)
#classname = clean(ob.name)
classname
=
filename
.
split
(
'/'
)[
-
1
].
replace
(
'.js'
,
''
)
file
=
open
(
filename
,
"wb"
)
file
.
write
(
'var %s = function () {
\n\n
'
%
classname
)
file
.
write
(
'
\t
var scope = this;
\n\n
'
)
file
.
write
(
'
\t
THREE.Geometry.call(this);
\n\n
'
)
for
v
in
mesh
.
verts
:
file
.
write
(
'
\t
v( %.6f, %.6f, %.6f );
\n
'
%
(
v
.
co
.
x
,
v
.
co
.
z
,
-
v
.
co
.
y
))
# co
file
.
write
(
'
\n
'
)
for
f
in
mesh
.
faces
:
if
len
(
f
.
verts
)
==
3
:
file
.
write
(
'
\t
f3( %d, %d, %d, %.6f, %.6f, %.6f );
\n
'
%
(
f
.
verts
[
0
].
index
,
f
.
verts
[
1
].
index
,
f
.
verts
[
2
].
index
,
f
.
verts
[
0
].
no
.
x
,
f
.
verts
[
0
].
no
.
z
,
-
f
.
verts
[
0
].
no
.
y
))
else
:
file
.
write
(
'
\t
f4( %d, %d, %d, %d, %.6f, %.6f, %.6f );
\n
'
%
(
f
.
verts
[
0
].
index
,
f
.
verts
[
1
].
index
,
f
.
verts
[
2
].
index
,
f
.
verts
[
3
].
index
,
f
.
verts
[
0
].
no
.
x
,
f
.
verts
[
0
].
no
.
z
,
-
f
.
verts
[
0
].
no
.
y
))
face_index_pairs
=
[
(
face
,
index
)
for
index
,
face
in
enumerate
(
mesh
.
faces
)]
file
.
write
(
'
\n
'
)
'''
for f in me.faces:
if me.faceUV:
if len(f.verts) == 3:
file.write('
\t
uv( %.6f, %.6f, %.6f, %.6f, %.6f, %.6f );
\n
' % (f.uv[0][0], 1.0-f.uv[0][1], f.uv[1][0], 1.0-f.uv[1][1], f.uv[2][0], 1.0-f.uv[2][1])
'''
for
f
in
mesh
.
faces
:
if
mesh
.
faceUV
:
if
len
(
f
.
verts
)
==
3
:
file
.
write
(
'
\t
uv( %.6f, %.6f, %.6f, %.6f, %.6f, %.6f );
\n
'
%
(
f
.
uv
[
0
].
x
,
1.0
-
f
.
uv
[
0
].
y
,
f
.
uv
[
1
].
x
,
1.0
-
f
.
uv
[
1
].
y
,
f
.
uv
[
2
].
x
,
1.0
-
f
.
uv
[
2
].
y
))
else
:
file
.
write
(
'
\t
uv( %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f, %.6f);
\n
'
%
(
f
.
uv
[
0
].
x
,
1.0
-
f
.
uv
[
0
].
y
,
f
.
uv
[
1
].
x
,
1.0
-
f
.
uv
[
1
].
y
,
f
.
uv
[
2
].
x
,
1.0
-
f
.
uv
[
2
].
y
,
f
.
uv
[
3
].
x
,
1.0
-
f
.
uv
[
3
].
y
))
file
.
write
(
'
\n
'
)
file
.
write
(
'
\t
function v( x, y, z ) {
\n\n
'
)
file
.
write
(
'
\t\t
scope.vertices.push( new THREE.Vertex( new THREE.Vector3( x, y, z ) ) );
\n\n
'
)
file
.
write
(
'
\t
}
\n\n
'
)
file
.
write
(
'
\t
function f3( a, b, c, nx, ny, nz ) {
\n\n
'
)
file
.
write
(
'
\t\t
scope.faces.push( new THREE.Face3( a, b, c, nx && ny && nz ? new THREE.Vector3( nx, ny, nz ) : null ) );
\n\n
'
)
file
.
write
(
'
\t
}
\n\n
'
)
file
.
write
(
'
\t
function f4( a, b, c, d, nx, ny, nz ) {
\n\n
'
)
file
.
write
(
'
\t\t
scope.faces.push( new THREE.Face4( a, b, c, d, nx && ny && nz ? new THREE.Vector3( nx, ny, nz ) : null ) );
\n\n
'
)
file
.
write
(
'
\t
}
\n\n
'
)
file
.
write
(
'
\t
function uv( u1, v1, u2, v2, u3, v3, u4, v4 ) {
\n\n
'
)
file
.
write
(
'
\t\t
var uv = [];
\n
'
)
file
.
write
(
'
\t\t
uv.push( new THREE.UV( u1, v1 ) );
\n
'
)
file
.
write
(
'
\t\t
uv.push( new THREE.UV( u2, v2 ) );
\n
'
)
file
.
write
(
'
\t\t
uv.push( new THREE.UV( u3, v3 ) );
\n
'
)
file
.
write
(
'
\t\t
if ( u4 && v4 ) uv.push( new THREE.UV( u4, v4 ) );
\n
'
)
file
.
write
(
'
\t\t
scope.uvs.push( uv );
\n
'
)
file
.
write
(
'
\t
}
\n\n
'
)
file
.
write
(
'}
\n\n
'
)
file
.
write
(
'%s.prototype = new THREE.Geometry();
\n
'
%
classname
)
file
.
write
(
'%s.prototype.constructor = %s;'
%
(
classname
,
classname
))
file
.
close
()
end
=
Blender
.
sys
.
time
()
def
main
():
Blender
.
Window
.
FileSelector
(
write
,
'three.js Export'
,
Blender
.
sys
.
makename
(
ext
=
'.js'
))
if
__name__
==
'__main__'
:
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录