Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
d3f12bbf
T
three.js
项目概览
车家大少爷
/
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,发现更多精彩内容 >>
提交
d3f12bbf
编写于
6月 15, 2011
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
https://github.com/mrdoob/three.js
上级
c4977093
57f08733
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
59 addition
and
60 deletion
+59
-60
build/Three.js
build/Three.js
+12
-12
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+2
-2
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+2
-2
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+4
-4
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+2
-2
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+31
-31
src/core/Ray.js
src/core/Ray.js
+2
-1
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+4
-6
未找到文件。
build/Three.js
浏览文件 @
d3f12bbf
此差异已折叠。
点击以展开。
build/custom/ThreeCanvas.js
浏览文件 @
d3f12bbf
...
...
@@ -13,7 +13,7 @@ THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
THREE
.
Vector4
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
return
this
.
set
(
a
.
x
,
a
.
y
,
a
.
z
,
a
.
w
||
1
)},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
,
this
.
w
/=
a
):
this
.
set
(
0
,
0
,
0
,
1
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
+
this
.
w
*
a
.
w
},
lengthSq
:
function
(){
return
this
.
dot
(
this
)},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
lerpSelf
:
function
(
a
,
b
){
this
.
x
+=
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
+=
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
+=
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
+=
(
a
.
w
-
this
.
w
)
*
b
;
return
this
}};
THREE
.
Ray
=
function
(
a
,
b
){
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
};
THREE
.
Ray
.
prototype
=
{
intersectScene
:
function
(
a
){
return
this
.
intersectObjects
(
a
.
objects
)},
intersectObjects
:
function
(
a
){
var
b
,
c
,
d
=
[];
b
=
0
;
for
(
c
=
a
.
length
;
b
<
c
;
b
++
)
d
=
d
.
concat
(
this
.
intersectObject
(
a
[
b
]));
d
.
sort
(
function
(
a
,
b
){
return
a
.
distance
-
b
.
distance
});
return
d
},
intersectObject
:
function
(
a
){
function
b
(
a
,
b
,
c
){
var
d
;
d
=
c
.
position
.
clone
().
subSelf
(
a
).
dot
(
b
);
if
(
d
<
0
)
return
!
1
;
a
=
a
.
clone
().
addSelf
(
b
.
clone
().
multiplyScalar
(
d
));
return
c
.
position
.
distanceTo
(
a
)}
function
c
(
a
,
b
,
c
,
d
){
var
d
=
d
.
clone
().
subSelf
(
b
),
c
=
c
.
clone
().
subSelf
(
b
),
THREE
.
Ray
.
prototype
=
{
intersectScene
:
function
(
a
){
return
this
.
intersectObjects
(
a
.
objects
)},
intersectObjects
:
function
(
a
){
var
b
,
c
,
d
=
[];
b
=
0
;
for
(
c
=
a
.
length
;
b
<
c
;
b
++
)
d
=
d
.
concat
(
this
.
intersectObject
(
a
[
b
]));
d
.
sort
(
function
(
a
,
b
){
return
a
.
distance
-
b
.
distance
});
return
d
},
intersectObject
:
function
(
a
){
function
b
(
a
,
b
,
c
){
var
d
;
d
=
c
.
position
.
clone
().
subSelf
(
a
).
dot
(
b
);
a
=
a
.
clone
().
addSelf
(
b
.
clone
().
multiplyScalar
(
d
));
return
c
.
position
.
distanceTo
(
a
)}
function
c
(
a
,
b
,
c
,
d
){
var
d
=
d
.
clone
().
subSelf
(
b
),
c
=
c
.
clone
().
subSelf
(
b
),
e
=
a
.
clone
().
subSelf
(
b
),
a
=
d
.
dot
(
d
),
b
=
d
.
dot
(
c
),
d
=
d
.
dot
(
e
),
f
=
c
.
dot
(
c
),
c
=
c
.
dot
(
e
),
e
=
1
/
(
a
*
f
-
b
*
b
),
f
=
(
f
*
d
-
b
*
c
)
*
e
,
a
=
(
a
*
c
-
b
*
d
)
*
e
;
return
f
>
0
&&
a
>
0
&&
f
+
a
<
1
}
if
(
a
instanceof
THREE
.
Particle
){
var
d
=
b
(
this
.
origin
,
this
.
direction
,
a
);
if
(
!
d
||
d
>
a
.
scale
.
x
)
return
[];
return
[{
distance
:
d
,
point
:
a
.
position
,
face
:
null
,
object
:
a
}]}
else
if
(
a
instanceof
THREE
.
Mesh
){
d
=
b
(
this
.
origin
,
this
.
direction
,
a
);
if
(
!
d
||
d
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
a
.
scale
.
x
,
Math
.
max
(
a
.
scale
.
y
,
a
.
scale
.
z
)))
return
[];
var
e
,
g
,
f
,
h
,
j
,
k
,
m
,
p
,
l
,
n
,
i
=
a
.
geometry
,
q
=
i
.
vertices
,
v
=
[],
d
=
0
;
for
(
e
=
i
.
faces
.
length
;
d
<
e
;
d
++
)
if
(
g
=
i
.
faces
[
d
],
l
=
this
.
origin
.
clone
(),
n
=
this
.
direction
.
clone
(),
k
=
a
.
matrixWorld
,
f
=
k
.
multiplyVector3
(
q
[
g
.
a
].
position
.
clone
()),
h
=
k
.
multiplyVector3
(
q
[
g
.
b
].
position
.
clone
()),
j
=
k
.
multiplyVector3
(
q
[
g
.
c
].
position
.
clone
()),
k
=
g
instanceof
THREE
.
Face4
?
k
.
multiplyVector3
(
q
[
g
.
d
].
position
.
clone
()):
null
,
m
=
a
.
matrixRotationWorld
.
multiplyVector3
(
g
.
normal
.
clone
()),
p
=
n
.
dot
(
m
),
a
.
doubleSided
||
(
a
.
flipSided
?
p
>
0
:
p
<
0
))
if
(
m
=
m
.
dot
((
new
THREE
.
Vector3
).
sub
(
f
,
l
))
/
p
,
l
=
l
.
addSelf
(
n
.
multiplyScalar
(
m
)),
g
instanceof
THREE
.
Face3
)
c
(
l
,
f
,
h
,
j
)
&&
(
g
=
{
distance
:
this
.
origin
.
distanceTo
(
l
),
point
:
l
,
face
:
g
,
object
:
a
},
v
.
push
(
g
));
else
if
(
g
instanceof
THREE
.
Face4
&&
(
c
(
l
,
f
,
h
,
k
)
||
c
(
l
,
h
,
j
,
k
)))
g
=
{
distance
:
this
.
origin
.
distanceTo
(
l
),
point
:
l
,
face
:
g
,
object
:
a
},
v
.
push
(
g
);
return
v
}
else
return
[]}};
...
...
@@ -51,7 +51,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
d
;
this
.
z
=
a
.
z
*
d
;
this
.
w
=
Math
.
cos
(
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
);
a
==
0
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
a
=
1
/
a
,
this
.
x
*=
a
,
this
.
y
*=
a
,
this
.
z
*=
a
,
this
.
w
*=
a
);
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
g
+
c
*
h
-
d
*
f
;
this
.
y
=
c
*
a
+
e
*
f
+
d
*
g
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
f
-
c
*
g
;
this
.
w
=
e
*
a
-
b
*
g
-
c
*
f
-
d
*
h
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
w
+
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
+
a
.
w
*
b
.
x
;
this
.
y
=-
a
.
x
*
b
.
z
+
a
.
y
*
b
.
w
+
a
.
z
*
b
.
x
+
a
.
w
*
b
.
y
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
+
a
.
z
*
b
.
w
+
a
.
w
*
b
.
z
;
this
.
w
=-
a
.
x
*
b
.
x
-
a
.
y
*
b
.
y
-
a
.
z
*
b
.
z
+
a
.
w
*
b
.
w
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
h
=
this
.
z
,
j
=
this
.
w
,
k
=
j
*
c
+
f
*
e
-
h
*
d
,
m
=
j
*
d
+
h
*
c
-
g
*
e
,
p
=
j
*
e
+
g
*
d
-
f
*
c
,
c
=-
g
*
c
-
f
*
d
-
h
*
e
;
b
.
x
=
k
*
j
+
c
*-
g
+
m
*-
h
-
p
*-
f
;
b
.
y
=
m
*
j
+
c
*-
f
+
p
*-
g
-
k
*-
h
;
b
.
z
=
p
*
j
+
c
*-
h
+
k
*-
f
-
m
*-
g
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
0
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
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
浏览文件 @
d3f12bbf
...
...
@@ -13,7 +13,7 @@ THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
THREE
.
Vector4
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
return
this
.
set
(
a
.
x
,
a
.
y
,
a
.
z
,
a
.
w
||
1
)},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
,
this
.
w
/=
a
):
this
.
set
(
0
,
0
,
0
,
1
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
+
this
.
w
*
a
.
w
},
lengthSq
:
function
(){
return
this
.
dot
(
this
)},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
lerpSelf
:
function
(
a
,
b
){
this
.
x
+=
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
+=
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
+=
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
+=
(
a
.
w
-
this
.
w
)
*
b
;
return
this
}};
THREE
.
Ray
=
function
(
a
,
b
){
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
};
THREE
.
Ray
.
prototype
=
{
intersectScene
:
function
(
a
){
return
this
.
intersectObjects
(
a
.
objects
)},
intersectObjects
:
function
(
a
){
var
b
,
c
,
d
=
[];
b
=
0
;
for
(
c
=
a
.
length
;
b
<
c
;
b
++
)
d
=
d
.
concat
(
this
.
intersectObject
(
a
[
b
]));
d
.
sort
(
function
(
a
,
b
){
return
a
.
distance
-
b
.
distance
});
return
d
},
intersectObject
:
function
(
a
){
function
b
(
a
,
b
,
c
){
var
d
;
d
=
c
.
position
.
clone
().
subSelf
(
a
).
dot
(
b
);
if
(
d
<
0
)
return
!
1
;
a
=
a
.
clone
().
addSelf
(
b
.
clone
().
multiplyScalar
(
d
));
return
c
.
position
.
distanceTo
(
a
)}
function
c
(
a
,
b
,
c
,
d
){
var
d
=
d
.
clone
().
subSelf
(
b
),
c
=
c
.
clone
().
subSelf
(
b
),
THREE
.
Ray
.
prototype
=
{
intersectScene
:
function
(
a
){
return
this
.
intersectObjects
(
a
.
objects
)},
intersectObjects
:
function
(
a
){
var
b
,
c
,
d
=
[];
b
=
0
;
for
(
c
=
a
.
length
;
b
<
c
;
b
++
)
d
=
d
.
concat
(
this
.
intersectObject
(
a
[
b
]));
d
.
sort
(
function
(
a
,
b
){
return
a
.
distance
-
b
.
distance
});
return
d
},
intersectObject
:
function
(
a
){
function
b
(
a
,
b
,
c
){
var
d
;
d
=
c
.
position
.
clone
().
subSelf
(
a
).
dot
(
b
);
a
=
a
.
clone
().
addSelf
(
b
.
clone
().
multiplyScalar
(
d
));
return
c
.
position
.
distanceTo
(
a
)}
function
c
(
a
,
b
,
c
,
d
){
var
d
=
d
.
clone
().
subSelf
(
b
),
c
=
c
.
clone
().
subSelf
(
b
),
e
=
a
.
clone
().
subSelf
(
b
),
a
=
d
.
dot
(
d
),
b
=
d
.
dot
(
c
),
d
=
d
.
dot
(
e
),
f
=
c
.
dot
(
c
),
c
=
c
.
dot
(
e
),
e
=
1
/
(
a
*
f
-
b
*
b
),
f
=
(
f
*
d
-
b
*
c
)
*
e
,
a
=
(
a
*
c
-
b
*
d
)
*
e
;
return
f
>
0
&&
a
>
0
&&
f
+
a
<
1
}
if
(
a
instanceof
THREE
.
Particle
){
var
d
=
b
(
this
.
origin
,
this
.
direction
,
a
);
if
(
!
d
||
d
>
a
.
scale
.
x
)
return
[];
return
[{
distance
:
d
,
point
:
a
.
position
,
face
:
null
,
object
:
a
}]}
else
if
(
a
instanceof
THREE
.
Mesh
){
d
=
b
(
this
.
origin
,
this
.
direction
,
a
);
if
(
!
d
||
d
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
a
.
scale
.
x
,
Math
.
max
(
a
.
scale
.
y
,
a
.
scale
.
z
)))
return
[];
var
e
,
g
,
f
,
h
,
i
,
k
,
l
,
n
,
j
,
m
,
p
=
a
.
geometry
,
q
=
p
.
vertices
,
t
=
[],
d
=
0
;
for
(
e
=
p
.
faces
.
length
;
d
<
e
;
d
++
)
if
(
g
=
p
.
faces
[
d
],
j
=
this
.
origin
.
clone
(),
m
=
this
.
direction
.
clone
(),
k
=
a
.
matrixWorld
,
f
=
k
.
multiplyVector3
(
q
[
g
.
a
].
position
.
clone
()),
h
=
k
.
multiplyVector3
(
q
[
g
.
b
].
position
.
clone
()),
i
=
k
.
multiplyVector3
(
q
[
g
.
c
].
position
.
clone
()),
k
=
g
instanceof
THREE
.
Face4
?
k
.
multiplyVector3
(
q
[
g
.
d
].
position
.
clone
()):
null
,
l
=
a
.
matrixRotationWorld
.
multiplyVector3
(
g
.
normal
.
clone
()),
n
=
m
.
dot
(
l
),
a
.
doubleSided
||
(
a
.
flipSided
?
n
>
0
:
n
<
0
))
if
(
l
=
l
.
dot
((
new
THREE
.
Vector3
).
sub
(
f
,
j
))
/
n
,
j
=
j
.
addSelf
(
m
.
multiplyScalar
(
l
)),
g
instanceof
THREE
.
Face3
)
c
(
j
,
f
,
h
,
i
)
&&
(
g
=
{
distance
:
this
.
origin
.
distanceTo
(
j
),
point
:
j
,
face
:
g
,
object
:
a
},
t
.
push
(
g
));
else
if
(
g
instanceof
THREE
.
Face4
&&
(
c
(
j
,
f
,
h
,
k
)
||
c
(
j
,
h
,
i
,
k
)))
g
=
{
distance
:
this
.
origin
.
distanceTo
(
j
),
point
:
j
,
face
:
g
,
object
:
a
},
t
.
push
(
g
);
return
t
}
else
return
[]}};
...
...
@@ -51,7 +51,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
d
;
this
.
z
=
a
.
z
*
d
;
this
.
w
=
Math
.
cos
(
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
);
a
==
0
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
a
=
1
/
a
,
this
.
x
*=
a
,
this
.
y
*=
a
,
this
.
z
*=
a
,
this
.
w
*=
a
);
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
g
+
c
*
h
-
d
*
f
;
this
.
y
=
c
*
a
+
e
*
f
+
d
*
g
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
f
-
c
*
g
;
this
.
w
=
e
*
a
-
b
*
g
-
c
*
f
-
d
*
h
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
w
+
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
+
a
.
w
*
b
.
x
;
this
.
y
=-
a
.
x
*
b
.
z
+
a
.
y
*
b
.
w
+
a
.
z
*
b
.
x
+
a
.
w
*
b
.
y
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
+
a
.
z
*
b
.
w
+
a
.
w
*
b
.
z
;
this
.
w
=-
a
.
x
*
b
.
x
-
a
.
y
*
b
.
y
-
a
.
z
*
b
.
z
+
a
.
w
*
b
.
w
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
h
=
this
.
z
,
i
=
this
.
w
,
k
=
i
*
c
+
f
*
e
-
h
*
d
,
l
=
i
*
d
+
h
*
c
-
g
*
e
,
n
=
i
*
e
+
g
*
d
-
f
*
c
,
c
=-
g
*
c
-
f
*
d
-
h
*
e
;
b
.
x
=
k
*
i
+
c
*-
g
+
l
*-
h
-
n
*-
f
;
b
.
y
=
l
*
i
+
c
*-
f
+
n
*-
g
-
k
*-
h
;
b
.
z
=
n
*
i
+
c
*-
h
+
k
*-
f
-
l
*-
g
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
0
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
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
.
Camera
=
function
(
a
,
b
,
c
,
d
,
e
){
THREE
.
Object3D
.
call
(
this
);
this
.
fov
=
a
||
50
;
this
.
aspect
=
b
||
1
;
this
.
near
=
c
||
0.1
;
this
.
far
=
d
||
2
E3
;
this
.
target
=
e
||
new
THREE
.
Object3D
;
this
.
useTarget
=!
0
;
this
.
matrixWorldInverse
=
new
THREE
.
Matrix4
;
this
.
projectionMatrix
=
null
;
this
.
updateProjectionMatrix
()};
THREE
.
Camera
.
prototype
=
new
THREE
.
Object3D
;
THREE
.
Camera
.
prototype
.
constructor
=
THREE
.
Camera
;
...
...
build/custom/ThreeExtras.js
浏览文件 @
d3f12bbf
...
...
@@ -35,7 +35,7 @@ this.getPrevKeyWith("pos",o,g.index-1).pos,this.points[1]=e,this.points[2]=f,thi
THREE
.
Animation
.
prototype
.
interpolateCatmullRom
=
function
(
a
,
b
){
var
c
=
[],
d
=
[],
e
,
f
,
g
,
j
,
h
,
k
;
e
=
(
a
.
length
-
1
)
*
b
;
f
=
Math
.
floor
(
e
);
e
-=
f
;
c
[
0
]
=
f
==
0
?
f
:
f
-
1
;
c
[
1
]
=
f
;
c
[
2
]
=
f
>
a
.
length
-
2
?
f
:
f
+
1
;
c
[
3
]
=
f
>
a
.
length
-
3
?
f
:
f
+
2
;
f
=
a
[
c
[
0
]];
j
=
a
[
c
[
1
]];
h
=
a
[
c
[
2
]];
k
=
a
[
c
[
3
]];
c
=
e
*
e
;
g
=
e
*
c
;
d
[
0
]
=
this
.
interpolate
(
f
[
0
],
j
[
0
],
h
[
0
],
k
[
0
],
e
,
c
,
g
);
d
[
1
]
=
this
.
interpolate
(
f
[
1
],
j
[
1
],
h
[
1
],
k
[
1
],
e
,
c
,
g
);
d
[
2
]
=
this
.
interpolate
(
f
[
2
],
j
[
2
],
h
[
2
],
k
[
2
],
e
,
c
,
g
);
return
d
};
THREE
.
Animation
.
prototype
.
interpolate
=
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
a
=
(
c
-
a
)
*
0.5
;
d
=
(
d
-
b
)
*
0.5
;
return
(
2
*
(
b
-
c
)
+
a
+
d
)
*
g
+
(
-
3
*
(
b
-
c
)
-
2
*
a
-
d
)
*
f
+
a
*
e
+
b
};
THREE
.
Animation
.
prototype
.
getNextKeyWith
=
function
(
a
,
b
,
c
){
var
d
=
this
.
data
.
hierarchy
[
b
].
keys
;
for
(
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM
||
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
?
c
=
c
<
d
.
length
-
1
?
c
:
d
.
length
-
1
:
c
%=
d
.
length
;
c
<
d
.
length
;
c
++
)
if
(
d
[
c
][
a
]
!==
void
0
)
return
d
[
c
];
return
this
.
data
.
hierarchy
[
b
].
keys
[
0
]};
THREE
.
Animation
.
prototype
.
getPrevKeyWith
=
function
(
a
,
b
,
c
){
for
(
var
d
=
this
.
data
.
hierarchy
[
b
].
keys
,
c
=
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM
||
this
.
interpolationType
===
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
?
c
>
0
?
c
:
0
:
c
>=
0
?
c
:
c
+
d
.
length
;
c
>=
0
;
c
--
)
if
(
d
[
c
][
a
]
!==
void
0
)
return
d
[
c
];
return
this
.
data
.
hierarchy
[
b
].
keys
[
d
.
length
-
1
]};
THREE
.
QuakeCamera
=
function
(
a
){
function
b
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.005
0
;
this
.
noFly
=!
1
;
this
.
lookVertical
=!
0
;
this
.
autoForward
=!
1
;
this
.
activeLook
=!
0
;
this
.
heightSpeed
=!
1
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
constrainVertical
=!
1
;
this
.
verticalMin
=
0
;
this
.
verticalMax
=
3.14
;
this
.
domElement
=
document
;
this
.
lastUpdate
=
(
new
Date
).
getTime
();
this
.
tdiff
=
0
;
if
(
a
){
if
(
a
.
movementSpeed
!==
void
0
)
this
.
movementSpeed
=
THREE
.
QuakeCamera
=
function
(
a
){
function
b
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
movementSpeed
=
1
;
this
.
lookSpeed
=
0.005
;
this
.
noFly
=!
1
;
this
.
lookVertical
=!
0
;
this
.
autoForward
=!
1
;
this
.
activeLook
=!
0
;
this
.
heightSpeed
=!
1
;
this
.
heightCoef
=
1
;
this
.
heightMin
=
0
;
this
.
constrainVertical
=!
1
;
this
.
verticalMin
=
0
;
this
.
verticalMax
=
3.14
;
this
.
domElement
=
document
;
this
.
lastUpdate
=
(
new
Date
).
getTime
();
this
.
tdiff
=
0
;
if
(
a
){
if
(
a
.
movementSpeed
!==
void
0
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
lookSpeed
!==
void
0
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
noFly
!==
void
0
)
this
.
noFly
=
a
.
noFly
;
if
(
a
.
lookVertical
!==
void
0
)
this
.
lookVertical
=
a
.
lookVertical
;
if
(
a
.
autoForward
!==
void
0
)
this
.
autoForward
=
a
.
autoForward
;
if
(
a
.
activeLook
!==
void
0
)
this
.
activeLook
=
a
.
activeLook
;
if
(
a
.
heightSpeed
!==
void
0
)
this
.
heightSpeed
=
a
.
heightSpeed
;
if
(
a
.
heightCoef
!==
void
0
)
this
.
heightCoef
=
a
.
heightCoef
;
if
(
a
.
heightMin
!==
void
0
)
this
.
heightMin
=
a
.
heightMin
;
if
(
a
.
heightMax
!==
void
0
)
this
.
heightMax
=
a
.
heightMax
;
if
(
a
.
constrainVertical
!==
void
0
)
this
.
constrainVertical
=
a
.
constrainVertical
;
if
(
a
.
verticalMin
!==
void
0
)
this
.
verticalMin
=
a
.
verticalMin
;
if
(
a
.
verticalMax
!==
void
0
)
this
.
verticalMax
=
a
.
verticalMax
;
if
(
a
.
domElement
!==
void
0
)
this
.
domElement
=
a
.
domElement
}
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
this
.
autoSpeedFactor
=
0
;
this
.
mouseDragOn
=
this
.
freeze
=
this
.
moveRight
=
this
.
moveLeft
=
this
.
moveBackward
=
this
.
moveForward
=!
1
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
this
.
onMouseDown
=
function
(
a
){
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
a
.
button
){
case
0
:
this
.
moveForward
=!
0
;
break
;
case
2
:
this
.
moveBackward
=!
0
}
this
.
mouseDragOn
=!
0
};
this
.
onMouseUp
=
function
(
a
){
a
.
preventDefault
();
a
.
stopPropagation
();
if
(
this
.
activeLook
)
switch
(
a
.
button
){
case
0
:
this
.
moveForward
=!
1
;
break
;
case
2
:
this
.
moveBackward
=!
1
}
this
.
mouseDragOn
=!
1
};
this
.
onMouseMove
=
function
(
a
){
this
.
mouseX
=
a
.
clientX
-
this
.
windowHalfX
;
this
.
mouseY
=
a
.
clientY
-
this
.
windowHalfY
};
this
.
onKeyDown
=
function
(
a
){
switch
(
a
.
keyCode
){
case
38
:
case
87
:
this
.
moveForward
=
...
...
@@ -47,7 +47,7 @@ this.heightSpeed?this.tdiff*((this.position.y<this.heightMin?this.heightMin:this
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
(
a
,
c
,
b
,
d
){
var
f
=
{
name
:
b
,
fps
:
0.6
,
length
:
d
,
hierarchy
:[]},
e
,
g
=
c
.
getControlPointsArray
(),
j
=
c
.
getLength
(),
h
=
g
.
length
,
w
=
0
;
e
=
h
-
1
;
c
=
{
parent
:
-
1
,
keys
:[]};
c
.
keys
[
0
]
=
{
time
:
0
,
pos
:
g
[
0
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
c
.
keys
[
e
]
=
{
time
:
d
,
pos
:
g
[
e
],
rot
:[
0
,
0
,
0
,
1
],
scl
:[
1
,
1
,
1
]};
for
(
e
=
1
;
e
<
h
-
1
;
e
++
)
w
=
d
*
j
.
chunks
[
e
]
/
j
.
total
,
c
.
keys
[
e
]
=
{
time
:
w
,
pos
:
g
[
e
]};
f
.
hierarchy
[
0
]
=
c
;
THREE
.
AnimationHandler
.
add
(
f
);
return
new
THREE
.
Animation
(
a
,
b
,
THREE
.
AnimationHandler
.
CATMULLROM_FORWARD
,
!
1
)}
function
c
(
a
,
c
){
var
b
,
d
,
f
=
new
THREE
.
Geometry
;
for
(
b
=
0
;
b
<
a
.
points
.
length
*
c
;
b
++
)
d
=
b
/
(
a
.
points
.
length
*
c
),
d
=
a
.
getPoint
(
d
),
f
.
vertices
[
b
]
=
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
d
.
x
,
d
.
y
,
d
.
z
));
return
f
}
function
d
(
a
,
b
){
var
d
=
c
(
b
,
10
),
f
=
c
(
b
,
10
),
e
=
new
THREE
.
LineBasicMaterial
({
color
:
16711680
,
linewidth
:
3
});
lineObj
=
new
THREE
.
Line
(
d
,
e
);
particleObj
=
new
THREE
.
ParticleSystem
(
f
,
new
THREE
.
ParticleBasicMaterial
({
color
:
16755200
,
size
:
3
}));
lineObj
.
scale
.
set
(
1
,
1
,
1
);
a
.
addChild
(
lineObj
);
particleObj
.
scale
.
set
(
1
,
1
,
1
);
a
.
addChild
(
particleObj
);
f
=
new
THREE
.
SphereGeometry
(
1
,
16
,
8
);
e
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
});
for
(
i
=
0
;
i
<
b
.
points
.
length
;
i
++
)
d
=
new
THREE
.
Mesh
(
f
,
e
),
d
.
position
.
copy
(
b
.
points
[
i
]),
d
.
updateMatrix
(),
a
.
addChild
(
d
)}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
id
=
"
PathCamera
"
+
THREE
.
PathCameraIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=!
0
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.005
0
;
this
.
lookHorizontal
=
16
,
8
);
e
=
new
THREE
.
MeshBasicMaterial
({
color
:
65280
});
for
(
i
=
0
;
i
<
b
.
points
.
length
;
i
++
)
d
=
new
THREE
.
Mesh
(
f
,
e
),
d
.
position
.
copy
(
b
.
points
[
i
]),
d
.
updateMatrix
(),
a
.
addChild
(
d
)}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
id
=
"
PathCamera
"
+
THREE
.
PathCameraIdCounter
++
;
this
.
duration
=
1
E4
;
this
.
waypoints
=
[];
this
.
useConstantSpeed
=!
0
;
this
.
resamplingCoef
=
50
;
this
.
debugPath
=
new
THREE
.
Object3D
;
this
.
debugDummy
=
new
THREE
.
Object3D
;
this
.
animationParent
=
new
THREE
.
Object3D
;
this
.
lookSpeed
=
0.005
;
this
.
lookHorizontal
=
this
.
lookVertical
=!
0
;
this
.
verticalAngleMap
=
{
srcRange
:[
0
,
6.28
],
dstRange
:[
0
,
6.28
]};
this
.
horizontalAngleMap
=
{
srcRange
:[
0
,
6.28
],
dstRange
:[
0
,
6.28
]};
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
duration
!==
void
0
)
this
.
duration
=
a
.
duration
*
1
E3
;
if
(
a
.
waypoints
!==
void
0
)
this
.
waypoints
=
a
.
waypoints
;
if
(
a
.
useConstantSpeed
!==
void
0
)
this
.
useConstantSpeed
=
a
.
useConstantSpeed
;
if
(
a
.
resamplingCoef
!==
void
0
)
this
.
resamplingCoef
=
a
.
resamplingCoef
;
if
(
a
.
createDebugPath
!==
void
0
)
this
.
createDebugPath
=
a
.
createDebugPath
;
if
(
a
.
createDebugDummy
!==
void
0
)
this
.
createDebugDummy
=
a
.
createDebugDummy
;
if
(
a
.
lookSpeed
!==
void
0
)
this
.
lookSpeed
=
a
.
lookSpeed
;
if
(
a
.
lookVertical
!==
void
0
)
this
.
lookVertical
=
a
.
lookVertical
;
if
(
a
.
lookHorizontal
!==
void
0
)
this
.
lookHorizontal
=
a
.
lookHorizontal
;
if
(
a
.
verticalAngleMap
!==
void
0
)
this
.
verticalAngleMap
=
a
.
verticalAngleMap
;
if
(
a
.
horizontalAngleMap
!==
void
0
)
this
.
horizontalAngleMap
=
a
.
horizontalAngleMap
;
if
(
a
.
domElement
!==
void
0
)
this
.
domElement
=
a
.
domElement
}
this
.
theta
=
this
.
phi
=
this
.
lon
=
this
.
lat
=
this
.
mouseY
=
this
.
mouseX
=
0
;
this
.
windowHalfX
=
window
.
innerWidth
/
2
;
this
.
windowHalfY
=
window
.
innerHeight
/
2
;
var
e
=
Math
.
PI
*
2
,
f
=
Math
.
PI
/
180
;
this
.
update
=
function
(
a
,
c
,
b
){
var
d
,
g
;
this
.
lookHorizontal
&&
(
this
.
lon
+=
this
.
mouseX
*
this
.
lookSpeed
);
this
.
lookVertical
&&
(
this
.
lat
-=
this
.
mouseY
*
this
.
lookSpeed
);
this
.
lon
=
Math
.
max
(
0
,
Math
.
min
(
360
,
this
.
lon
));
this
.
lat
=
Math
.
max
(
-
85
,
Math
.
min
(
85
,
this
.
lat
));
this
.
phi
=
(
90
-
this
.
lat
)
*
f
;
this
.
theta
=
this
.
lon
*
f
;
d
=
this
.
phi
%
e
;
this
.
phi
=
d
>=
0
?
d
:
d
+
e
;
d
=
this
.
verticalAngleMap
.
srcRange
;
g
=
this
.
verticalAngleMap
.
dstRange
;
var
j
=
g
[
1
]
-
g
[
0
];
this
.
phi
=
...
...
@@ -55,7 +55,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-d[0])*(g[1]-g[0])/(d[1]-d[0])+g[0]-g
a
.
clientX
-
this
.
windowHalfX
;
this
.
mouseY
=
a
.
clientY
-
this
.
windowHalfY
};
this
.
spline
=
new
THREE
.
Spline
;
this
.
spline
.
initFromArray
(
this
.
waypoints
);
this
.
useConstantSpeed
&&
this
.
spline
.
reparametrizeByArcLength
(
this
.
resamplingCoef
);
if
(
this
.
createDebugDummy
){
var
a
=
new
THREE
.
MeshLambertMaterial
({
color
:
30719
}),
g
=
new
THREE
.
MeshLambertMaterial
({
color
:
65280
}),
j
=
new
THREE
.
CubeGeometry
(
10
,
10
,
20
),
h
=
new
THREE
.
CubeGeometry
(
2
,
2
,
10
);
this
.
animationParent
=
new
THREE
.
Mesh
(
j
,
a
);
a
=
new
THREE
.
Mesh
(
h
,
g
);
a
.
position
.
set
(
0
,
10
,
0
);
this
.
animation
=
b
(
this
.
animationParent
,
this
.
spline
,
this
.
id
,
this
.
duration
);
this
.
animationParent
.
addChild
(
this
);
this
.
animationParent
.
addChild
(
this
.
target
);
this
.
animationParent
.
addChild
(
a
)}
else
this
.
animation
=
b
(
this
.
animationParent
,
this
.
spline
,
this
.
id
,
this
.
duration
),
this
.
animationParent
.
addChild
(
this
.
target
),
this
.
animationParent
.
addChild
(
this
);
this
.
createDebugPath
&&
d
(
this
.
debugPath
,
this
.
spline
);
this
.
domElement
.
addEventListener
(
"
mousemove
"
,
function
(
a
,
c
){
return
function
(){
c
.
apply
(
a
,
arguments
)}}(
this
,
this
.
onMouseMove
),
!
1
)};
THREE
.
PathCamera
.
prototype
=
new
THREE
.
Camera
;
THREE
.
PathCamera
.
prototype
.
constructor
=
THREE
.
PathCamera
;
THREE
.
PathCamera
.
prototype
.
supr
=
THREE
.
Camera
.
prototype
;
THREE
.
PathCameraIdCounter
=
0
;
THREE
.
FlyCamera
=
function
(
a
){
function
b
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
tmpQuaternion
=
new
THREE
.
Quaternion
;
this
.
movementSpeed
=
1
;
this
.
rollSpeed
=
0.005
0
;
this
.
autoForward
=
this
.
dragToLook
=!
1
;
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
movementSpeed
!==
void
0
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
rollSpeed
!==
void
0
)
this
.
rollSpeed
=
a
.
rollSpeed
;
if
(
a
.
dragToLook
!==
void
0
)
this
.
dragToLook
=
a
.
dragToLook
;
if
(
a
.
autoForward
!==
void
0
)
this
.
autoForward
=
THREE
.
FlyCamera
=
function
(
a
){
function
b
(
a
,
b
){
return
function
(){
b
.
apply
(
a
,
arguments
)}}
THREE
.
Camera
.
call
(
this
,
a
.
fov
,
a
.
aspect
,
a
.
near
,
a
.
far
,
a
.
target
);
this
.
tmpQuaternion
=
new
THREE
.
Quaternion
;
this
.
movementSpeed
=
1
;
this
.
rollSpeed
=
0.005
;
this
.
autoForward
=
this
.
dragToLook
=!
1
;
this
.
domElement
=
document
;
if
(
a
){
if
(
a
.
movementSpeed
!==
void
0
)
this
.
movementSpeed
=
a
.
movementSpeed
;
if
(
a
.
rollSpeed
!==
void
0
)
this
.
rollSpeed
=
a
.
rollSpeed
;
if
(
a
.
dragToLook
!==
void
0
)
this
.
dragToLook
=
a
.
dragToLook
;
if
(
a
.
autoForward
!==
void
0
)
this
.
autoForward
=
a
.
autoForward
;
if
(
a
.
domElement
!==
void
0
)
this
.
domElement
=
a
.
domElement
}
this
.
useTarget
=!
1
;
this
.
useQuaternion
=!
0
;
this
.
mouseStatus
=
0
;
this
.
moveState
=
{
up
:
0
,
down
:
0
,
left
:
0
,
right
:
0
,
forward
:
0
,
back
:
0
,
pitchUp
:
0
,
pitchDown
:
0
,
yawLeft
:
0
,
yawRight
:
0
,
rollLeft
:
0
,
rollRight
:
0
};
this
.
moveVector
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
rotationVector
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
lastUpdate
=-
1
;
this
.
tdiff
=
0
;
this
.
handleEvent
=
function
(
a
){
if
(
typeof
this
[
a
.
type
]
==
"
function
"
)
this
[
a
.
type
](
a
)};
this
.
keydown
=
function
(
a
){
if
(
!
a
.
altKey
){
switch
(
a
.
keyCode
){
case
16
:
this
.
movementSpeedMultiplier
=
0.1
;
break
;
case
87
:
this
.
moveState
.
forward
=
1
;
break
;
case
83
:
this
.
moveState
.
back
=
1
;
break
;
case
65
:
this
.
moveState
.
left
=
1
;
break
;
case
68
:
this
.
moveState
.
right
=
1
;
break
;
case
82
:
this
.
moveState
.
up
=
1
;
break
;
case
70
:
this
.
moveState
.
down
=
1
;
break
;
case
38
:
this
.
moveState
.
pitchUp
=
1
;
break
;
case
40
:
this
.
moveState
.
pitchDown
=
1
;
break
;
case
37
:
this
.
moveState
.
yawLeft
=
1
;
break
;
case
39
:
this
.
moveState
.
yawRight
=
1
;
break
;
case
81
:
this
.
moveState
.
rollLeft
=
1
;
break
;
case
69
:
this
.
moveState
.
rollRight
=
1
}
this
.
updateMovementVector
();
this
.
updateRotationVector
()}};
this
.
keyup
=
function
(
a
){
switch
(
a
.
keyCode
){
case
16
:
this
.
movementSpeedMultiplier
=
1
;
break
;
case
87
:
this
.
moveState
.
forward
=
0
;
break
;
case
83
:
this
.
moveState
.
back
=
0
;
break
;
case
65
:
this
.
moveState
.
left
=
0
;
break
;
case
68
:
this
.
moveState
.
right
=
0
;
break
;
case
82
:
this
.
moveState
.
up
=
0
;
break
;
case
70
:
this
.
moveState
.
down
=
0
;
break
;
case
38
:
this
.
moveState
.
pitchUp
=
0
;
break
;
case
40
:
this
.
moveState
.
pitchDown
=
0
;
break
;
case
37
:
this
.
moveState
.
yawLeft
=
0
;
break
;
case
39
:
this
.
moveState
.
yawRight
=
0
;
break
;
case
81
:
this
.
moveState
.
rollLeft
=
0
;
break
;
...
...
@@ -93,7 +93,7 @@ d));c instanceof THREE.Face4&&b.push(new THREE.UV(0.5+Math.atan2(m.position.x,m.
THREE
.
IcosahedronGeometry
=
function
(
a
){
function
b
(
a
,
c
,
b
){
var
d
=
Math
.
sqrt
(
a
*
a
+
c
*
c
+
b
*
b
);
return
e
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
a
/
d
,
c
/
d
,
b
/
d
)))
-
1
}
function
c
(
a
,
c
,
b
,
d
){
d
.
faces
.
push
(
new
THREE
.
Face3
(
a
,
c
,
b
))}
function
d
(
a
,
c
){
var
d
=
e
.
vertices
[
a
].
position
,
f
=
e
.
vertices
[
c
].
position
;
return
b
((
d
.
x
+
f
.
x
)
/
2
,(
d
.
y
+
f
.
y
)
/
2
,(
d
.
z
+
f
.
z
)
/
2
)}
var
e
=
this
,
f
=
new
THREE
.
Geometry
,
g
;
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
++
){
g
=
new
THREE
.
Geometry
;
for
(
var
j
in
f
.
faces
){
var
h
=
d
(
f
.
faces
[
j
].
a
,
f
.
faces
[
j
].
b
),
k
=
d
(
f
.
faces
[
j
].
b
,
f
.
faces
[
j
].
c
),
l
=
d
(
f
.
faces
[
j
].
c
,
f
.
faces
[
j
].
a
);
c
(
f
.
faces
[
j
].
a
,
h
,
l
,
g
);
c
(
f
.
faces
[
j
].
b
,
k
,
h
,
g
);
c
(
f
.
faces
[
j
].
c
,
l
,
k
,
g
);
c
(
h
,
k
,
l
,
g
)}
f
.
faces
=
g
.
faces
}
e
.
faces
=
f
.
faces
;
delete
f
;
delete
g
;
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
THREE
.
IcosahedronGeometry
.
prototype
=
new
THREE
.
Geometry
;
THREE
.
IcosahedronGeometry
.
prototype
.
constructor
=
THREE
.
IcosahedronGeometry
;
THREE
.
LatheGeometry
=
function
(
a
,
b
,
c
){
THREE
.
Geometry
.
call
(
this
);
this
.
steps
=
b
||
12
;
this
.
angle
=
c
||
2
*
Math
.
PI
;
for
(
var
b
=
this
.
angle
/
this
.
steps
,
c
=
[],
d
=
[],
e
=
[],
f
=
[],
g
=
(
new
THREE
.
Matrix4
).
setRotationZ
(
b
),
j
=
0
;
j
<
a
.
length
;
j
++
)
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
a
[
j
])),
c
[
j
]
=
a
[
j
].
clone
(),
d
[
j
]
=
this
.
vertices
.
length
-
1
;
for
(
var
h
=
0
;
h
<=
this
.
angle
+
0.001
0
;
h
+=
b
){
for
(
j
=
0
;
j
<
c
.
length
;
j
++
)
h
<
this
.
angle
?(
c
[
j
]
=
g
.
multiplyVector3
(
c
[
j
].
clone
()),
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
c
[
j
])),
e
[
j
]
=
this
.
vertices
.
length
-
1
):
e
=
f
;
h
==
0
&&
(
f
=
d
);
THREE
.
LatheGeometry
=
function
(
a
,
b
,
c
){
THREE
.
Geometry
.
call
(
this
);
this
.
steps
=
b
||
12
;
this
.
angle
=
c
||
2
*
Math
.
PI
;
for
(
var
b
=
this
.
angle
/
this
.
steps
,
c
=
[],
d
=
[],
e
=
[],
f
=
[],
g
=
(
new
THREE
.
Matrix4
).
setRotationZ
(
b
),
j
=
0
;
j
<
a
.
length
;
j
++
)
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
a
[
j
])),
c
[
j
]
=
a
[
j
].
clone
(),
d
[
j
]
=
this
.
vertices
.
length
-
1
;
for
(
var
h
=
0
;
h
<=
this
.
angle
+
0.001
;
h
+=
b
){
for
(
j
=
0
;
j
<
c
.
length
;
j
++
)
h
<
this
.
angle
?(
c
[
j
]
=
g
.
multiplyVector3
(
c
[
j
].
clone
()),
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
c
[
j
])),
e
[
j
]
=
this
.
vertices
.
length
-
1
):
e
=
f
;
h
==
0
&&
(
f
=
d
);
for
(
j
=
0
;
j
<
d
.
length
-
1
;
j
++
)
this
.
faces
.
push
(
new
THREE
.
Face4
(
e
[
j
],
e
[
j
+
1
],
d
[
j
+
1
],
d
[
j
])),
this
.
faceVertexUvs
[
0
].
push
([
new
THREE
.
UV
(
1
-
h
/
this
.
angle
,
j
/
a
.
length
),
new
THREE
.
UV
(
1
-
h
/
this
.
angle
,(
j
+
1
)
/
a
.
length
),
new
THREE
.
UV
(
1
-
(
h
-
b
)
/
this
.
angle
,(
j
+
1
)
/
a
.
length
),
new
THREE
.
UV
(
1
-
(
h
-
b
)
/
this
.
angle
,
j
/
a
.
length
)]);
d
=
e
;
e
=
[]}
this
.
computeCentroids
();
this
.
computeFaceNormals
();
this
.
computeVertexNormals
()};
THREE
.
LatheGeometry
.
prototype
=
new
THREE
.
Geometry
;
THREE
.
LatheGeometry
.
prototype
.
constructor
=
THREE
.
LatheGeometry
;
THREE
.
PlaneGeometry
=
function
(
a
,
b
,
c
,
d
){
THREE
.
Geometry
.
call
(
this
);
var
e
,
f
=
a
/
2
,
g
=
b
/
2
,
c
=
c
||
1
,
d
=
d
||
1
,
j
=
c
+
1
,
h
=
d
+
1
;
a
/=
c
;
var
k
=
b
/
d
;
for
(
e
=
0
;
e
<
h
;
e
++
)
for
(
b
=
0
;
b
<
j
;
b
++
)
this
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
b
*
a
-
f
,
-
(
e
*
k
-
g
),
0
)));
for
(
e
=
0
;
e
<
d
;
e
++
)
for
(
b
=
0
;
b
<
c
;
b
++
)
this
.
faces
.
push
(
new
THREE
.
Face4
(
b
+
j
*
e
,
b
+
j
*
(
e
+
1
),
b
+
1
+
j
*
(
e
+
1
),
b
+
1
+
j
*
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
.
PlaneGeometry
.
prototype
=
new
THREE
.
Geometry
;
THREE
.
PlaneGeometry
.
prototype
.
constructor
=
THREE
.
PlaneGeometry
;
...
...
build/custom/ThreeSVG.js
浏览文件 @
d3f12bbf
...
...
@@ -13,7 +13,7 @@ THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
THREE
.
Vector4
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
d
;
return
this
},
copy
:
function
(
a
){
return
this
.
set
(
a
.
x
,
a
.
y
,
a
.
z
,
a
.
w
||
1
)},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
,
this
.
z
/=
a
,
this
.
w
/=
a
):
this
.
set
(
0
,
0
,
0
,
1
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
+
this
.
w
*
a
.
w
},
lengthSq
:
function
(){
return
this
.
dot
(
this
)},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
lerpSelf
:
function
(
a
,
b
){
this
.
x
+=
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
+=
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
+=
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
+=
(
a
.
w
-
this
.
w
)
*
b
;
return
this
}};
THREE
.
Ray
=
function
(
a
,
b
){
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
};
THREE
.
Ray
.
prototype
=
{
intersectScene
:
function
(
a
){
return
this
.
intersectObjects
(
a
.
objects
)},
intersectObjects
:
function
(
a
){
var
b
,
c
,
d
=
[];
b
=
0
;
for
(
c
=
a
.
length
;
b
<
c
;
b
++
)
d
=
d
.
concat
(
this
.
intersectObject
(
a
[
b
]));
d
.
sort
(
function
(
a
,
b
){
return
a
.
distance
-
b
.
distance
});
return
d
},
intersectObject
:
function
(
a
){
function
b
(
a
,
b
,
c
){
var
d
;
d
=
c
.
position
.
clone
().
subSelf
(
a
).
dot
(
b
);
if
(
d
<
0
)
return
!
1
;
a
=
a
.
clone
().
addSelf
(
b
.
clone
().
multiplyScalar
(
d
));
return
c
.
position
.
distanceTo
(
a
)}
function
c
(
a
,
b
,
c
,
d
){
var
d
=
d
.
clone
().
subSelf
(
b
),
c
=
c
.
clone
().
subSelf
(
b
),
THREE
.
Ray
.
prototype
=
{
intersectScene
:
function
(
a
){
return
this
.
intersectObjects
(
a
.
objects
)},
intersectObjects
:
function
(
a
){
var
b
,
c
,
d
=
[];
b
=
0
;
for
(
c
=
a
.
length
;
b
<
c
;
b
++
)
d
=
d
.
concat
(
this
.
intersectObject
(
a
[
b
]));
d
.
sort
(
function
(
a
,
b
){
return
a
.
distance
-
b
.
distance
});
return
d
},
intersectObject
:
function
(
a
){
function
b
(
a
,
b
,
c
){
var
d
;
d
=
c
.
position
.
clone
().
subSelf
(
a
).
dot
(
b
);
a
=
a
.
clone
().
addSelf
(
b
.
clone
().
multiplyScalar
(
d
));
return
c
.
position
.
distanceTo
(
a
)}
function
c
(
a
,
b
,
c
,
d
){
var
d
=
d
.
clone
().
subSelf
(
b
),
c
=
c
.
clone
().
subSelf
(
b
),
e
=
a
.
clone
().
subSelf
(
b
),
a
=
d
.
dot
(
d
),
b
=
d
.
dot
(
c
),
d
=
d
.
dot
(
e
),
f
=
c
.
dot
(
c
),
c
=
c
.
dot
(
e
),
e
=
1
/
(
a
*
f
-
b
*
b
),
f
=
(
f
*
d
-
b
*
c
)
*
e
,
a
=
(
a
*
c
-
b
*
d
)
*
e
;
return
f
>
0
&&
a
>
0
&&
f
+
a
<
1
}
if
(
a
instanceof
THREE
.
Particle
){
var
d
=
b
(
this
.
origin
,
this
.
direction
,
a
);
if
(
!
d
||
d
>
a
.
scale
.
x
)
return
[];
return
[{
distance
:
d
,
point
:
a
.
position
,
face
:
null
,
object
:
a
}]}
else
if
(
a
instanceof
THREE
.
Mesh
){
d
=
b
(
this
.
origin
,
this
.
direction
,
a
);
if
(
!
d
||
d
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
a
.
scale
.
x
,
Math
.
max
(
a
.
scale
.
y
,
a
.
scale
.
z
)))
return
[];
var
e
,
g
,
f
,
h
,
i
,
l
,
k
,
n
,
j
,
o
,
p
=
a
.
geometry
,
q
=
p
.
vertices
,
t
=
[],
d
=
0
;
for
(
e
=
p
.
faces
.
length
;
d
<
e
;
d
++
)
if
(
g
=
p
.
faces
[
d
],
j
=
this
.
origin
.
clone
(),
o
=
this
.
direction
.
clone
(),
l
=
a
.
matrixWorld
,
f
=
l
.
multiplyVector3
(
q
[
g
.
a
].
position
.
clone
()),
h
=
l
.
multiplyVector3
(
q
[
g
.
b
].
position
.
clone
()),
i
=
l
.
multiplyVector3
(
q
[
g
.
c
].
position
.
clone
()),
l
=
g
instanceof
THREE
.
Face4
?
l
.
multiplyVector3
(
q
[
g
.
d
].
position
.
clone
()):
null
,
k
=
a
.
matrixRotationWorld
.
multiplyVector3
(
g
.
normal
.
clone
()),
n
=
o
.
dot
(
k
),
a
.
doubleSided
||
(
a
.
flipSided
?
n
>
0
:
n
<
0
))
if
(
k
=
k
.
dot
((
new
THREE
.
Vector3
).
sub
(
f
,
j
))
/
n
,
j
=
j
.
addSelf
(
o
.
multiplyScalar
(
k
)),
g
instanceof
THREE
.
Face3
)
c
(
j
,
f
,
h
,
i
)
&&
(
g
=
{
distance
:
this
.
origin
.
distanceTo
(
j
),
point
:
j
,
face
:
g
,
object
:
a
},
t
.
push
(
g
));
else
if
(
g
instanceof
THREE
.
Face4
&&
(
c
(
j
,
f
,
h
,
l
)
||
c
(
j
,
h
,
i
,
l
)))
g
=
{
distance
:
this
.
origin
.
distanceTo
(
j
),
point
:
j
,
face
:
g
,
object
:
a
},
t
.
push
(
g
);
return
t
}
else
return
[]}};
...
...
@@ -51,7 +51,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
d
;
this
.
z
=
a
.
z
*
d
;
this
.
w
=
Math
.
cos
(
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
);
a
==
0
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
a
=
1
/
a
,
this
.
x
*=
a
,
this
.
y
*=
a
,
this
.
z
*=
a
,
this
.
w
*=
a
);
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
g
+
c
*
h
-
d
*
f
;
this
.
y
=
c
*
a
+
e
*
f
+
d
*
g
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
f
-
c
*
g
;
this
.
w
=
e
*
a
-
b
*
g
-
c
*
f
-
d
*
h
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
w
+
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
+
a
.
w
*
b
.
x
;
this
.
y
=-
a
.
x
*
b
.
z
+
a
.
y
*
b
.
w
+
a
.
z
*
b
.
x
+
a
.
w
*
b
.
y
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
+
a
.
z
*
b
.
w
+
a
.
w
*
b
.
z
;
this
.
w
=-
a
.
x
*
b
.
x
-
a
.
y
*
b
.
y
-
a
.
z
*
b
.
z
+
a
.
w
*
b
.
w
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
h
=
this
.
z
,
i
=
this
.
w
,
l
=
i
*
c
+
f
*
e
-
h
*
d
,
k
=
i
*
d
+
h
*
c
-
g
*
e
,
n
=
i
*
e
+
g
*
d
-
f
*
c
,
c
=-
g
*
c
-
f
*
d
-
h
*
e
;
b
.
x
=
l
*
i
+
c
*-
g
+
k
*-
h
-
n
*-
f
;
b
.
y
=
k
*
i
+
c
*-
f
+
n
*-
g
-
l
*-
h
;
b
.
z
=
n
*
i
+
c
*-
h
+
l
*-
f
-
k
*-
g
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
0
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
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
浏览文件 @
d3f12bbf
此差异已折叠。
点击以展开。
src/core/Ray.js
浏览文件 @
d3f12bbf
...
...
@@ -155,7 +155,8 @@ THREE.Ray.prototype = {
vector
=
object
.
position
.
clone
().
subSelf
(
origin
);
dot
=
vector
.
dot
(
direction
);
if
(
dot
<
0
)
return
false
;
// Object is behind origin
// TODO: Double check this
// if ( dot < 0 ) return false; // Object is behind origin
intersect
=
origin
.
clone
().
addSelf
(
direction
.
clone
().
multiplyScalar
(
dot
)
);
distance
=
object
.
position
.
distanceTo
(
intersect
);
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
d3f12bbf
...
...
@@ -4663,7 +4663,6 @@ THREE.WebGLRenderer = function ( parameters ) {
function
setTexture
(
texture
,
slot
)
{
/*
if
(
texture
.
needsUpdate
)
{
if
(
!
texture
.
__webglInit
)
{
...
...
@@ -4690,10 +4689,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
_gl.activeTexture( _gl.TEXTURE0 + slot );
_gl.bindTexture( _gl.TEXTURE_2D, texture.__webglTexture );
*/
/*
if ( texture.needsUpdate ) {
if ( texture.__webglTexture ) {
...
...
@@ -4714,10 +4710,12 @@ THREE.WebGLRenderer = function ( parameters ) {
texture.needsUpdate = false;
}
*/
_gl
.
activeTexture
(
_gl
.
TEXTURE0
+
slot
);
_gl
.
bindTexture
(
_gl
.
TEXTURE_2D
,
texture
.
__webglTexture
);
};
function
setCubeTexture
(
texture
,
slot
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录