Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
e7e47b1f
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,发现更多精彩内容 >>
提交
e7e47b1f
编写于
2月 26, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More reformating and clean up.
上级
04172c6c
变更
31
展开全部
隐藏空白更改
内联
并排
Showing
31 changed file
with
392 addition
and
473 deletion
+392
-473
build/Three.js
build/Three.js
+19
-22
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+11
-13
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+8
-9
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+8
-9
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+12
-14
examples/canvas_performance.html
examples/canvas_performance.html
+1
-7
examples/canvas_sandbox.html
examples/canvas_sandbox.html
+2
-7
examples/misc_uqbiquity_test.html
examples/misc_uqbiquity_test.html
+2
-7
src/core/Color.js
src/core/Color.js
+11
-11
src/core/Face3.js
src/core/Face3.js
+1
-1
src/core/Face4.js
src/core/Face4.js
+1
-1
src/core/Quaternion.js
src/core/Quaternion.js
+103
-190
src/core/Ray.js
src/core/Ray.js
+2
-2
src/core/UV.js
src/core/UV.js
+25
-6
src/core/Vector2.js
src/core/Vector2.js
+66
-34
src/core/Vector4.js
src/core/Vector4.js
+83
-48
src/core/Vertex.js
src/core/Vertex.js
+2
-1
src/lights/AmbientLight.js
src/lights/AmbientLight.js
+4
-0
src/lights/DirectionalLight.js
src/lights/DirectionalLight.js
+4
-0
src/lights/Light.js
src/lights/Light.js
+3
-4
src/lights/PointLight.js
src/lights/PointLight.js
+4
-0
src/materials/Mappings.js
src/materials/Mappings.js
+14
-0
src/materials/mappings/CubeReflectionMapping.js
src/materials/mappings/CubeReflectionMapping.js
+0
-9
src/materials/mappings/CubeRefractionMapping.js
src/materials/mappings/CubeRefractionMapping.js
+0
-9
src/materials/mappings/LatitudeReflectionMapping.js
src/materials/mappings/LatitudeReflectionMapping.js
+0
-9
src/materials/mappings/LatitudeRefractionMapping.js
src/materials/mappings/LatitudeRefractionMapping.js
+0
-9
src/materials/mappings/SphericalReflectionMapping.js
src/materials/mappings/SphericalReflectionMapping.js
+0
-9
src/materials/mappings/SphericalRefractionMapping.js
src/materials/mappings/SphericalRefractionMapping.js
+0
-9
src/materials/mappings/UVMapping.js
src/materials/mappings/UVMapping.js
+0
-9
src/scenes/Scene.js
src/scenes/Scene.js
+3
-3
utils/build.py
utils/build.py
+3
-21
未找到文件。
build/Three.js
浏览文件 @
e7e47b1f
此差异已折叠。
点击以展开。
build/custom/ThreeCanvas.js
浏览文件 @
e7e47b1f
此差异已折叠。
点击以展开。
build/custom/ThreeDOM.js
浏览文件 @
e7e47b1f
...
...
@@ -2,16 +2,15 @@
var
THREE
=
THREE
||
{};
THREE
.
Color
=
function
(
a
){
this
.
setHex
(
a
)};
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
.
updateRGBA
();
this
.
updateStyleString
()}},
updateHex
:
function
(){
this
.
hex
=~~
(
this
.
r
*
255
)
<<
16
^~~
(
this
.
g
*
255
)
<<
8
^~~
(
this
.
b
*
255
)},
updateRGBA
:
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
)},
toString
:
function
(){
return
"
THREE.Color ( r:
"
+
this
.
r
+
"
, g:
"
+
this
.
g
+
"
, b:
"
+
this
.
b
+
"
, hex:
"
+
this
.
hex
+
"
)
"
}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
};
THREE
.
Vector2
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
x
=
a
;
this
.
y
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
return
this
},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
return
this
},
unit
:
function
(){
this
.
multiplyScalar
(
1
/
this
.
length
());
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
)},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
},
negate
:
function
(){
this
.
x
=-
this
.
x
;
this
.
y
=-
this
.
y
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector2
(
this
.
x
,
this
.
y
)},
toString
:
function
(){
return
"
THREE.Vector2 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
)
"
}};
THREE
.
Vector3
=
function
(
a
,
b
,
c
){
this
.
set
(
a
||
0
,
b
||
0
,
c
||
0
)};
this
.
r
+
"
, g:
"
+
this
.
g
+
"
, b:
"
+
this
.
b
+
"
, hex:
"
+
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
)},
toString
:
function
(){
return
"
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
,
b
){
this
.
set
(
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
,
a
.
z
*
b
.
x
-
a
.
x
*
b
.
z
,
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
);
return
this
},
crossSelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
e
=
this
.
z
;
this
.
set
(
c
*
a
.
z
-
e
*
a
.
y
,
e
*
a
.
x
-
b
*
a
.
z
,
b
*
a
.
y
-
c
*
a
.
x
);
return
this
},
multiply
:
function
(
a
,
b
){
this
.
set
(
a
.
x
*
b
.
x
,
a
.
y
*
b
.
y
,
a
.
z
*
b
.
z
);
return
this
},
multiplySelf
:
function
(
a
){
this
.
set
(
this
.
x
*
a
.
x
,
this
.
y
*
a
.
y
,
this
.
z
*
a
.
z
);
return
this
},
multiplyScalar
:
function
(
a
){
this
.
set
(
this
.
x
*
a
,
this
.
y
*
a
,
this
.
z
*
a
);
return
this
},
divideSelf
:
function
(
a
){
this
.
set
(
this
.
x
/
a
.
x
,
this
.
y
/
a
.
y
,
this
.
z
/
a
.
z
);
return
this
},
divideScalar
:
function
(
a
){
this
.
set
(
this
.
x
/
a
,
this
.
y
/
a
,
this
.
z
/
a
);
return
this
},
negate
:
function
(){
this
.
set
(
-
this
.
x
,
-
this
.
y
,
-
this
.
z
);
return
this
},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
},
distanceTo
:
function
(
a
){
return
Math
.
sqrt
(
this
.
distanceToSquared
(
a
))},
distanceToSquared
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
c
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
b
*
b
+
c
*
c
+
a
*
a
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
},
lengthManhattan
:
function
(){
return
this
.
x
+
this
.
y
+
this
.
z
},
normalize
:
function
(){
var
a
=
this
.
length
();
a
>
0
?
this
.
multiplyScalar
(
1
/
a
):
this
.
set
(
0
,
0
,
0
);
return
this
},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
isZero
:
function
(){
return
Math
.
abs
(
this
.
x
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
y
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
z
)
<
1.0
E
-
4
},
clone
:
function
(){
return
new
THREE
.
Vector3
(
this
.
x
,
this
.
y
,
this
.
z
)},
toString
:
function
(){
return
"
THREE.Vector3 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
)
"
}};
THREE
.
Vector4
=
function
(
a
,
b
,
c
,
e
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
c
||
0
;
this
.
w
=
e
||
1
};
THREE
.
Vector4
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
e
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
a
.
w
||
1
;
return
this
},
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
){
this
.
x
/=
a
;
this
.
y
/=
a
;
this
.
z
/=
a
;
this
.
w
/=
a
;
return
this
},
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
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
toString
:
function
(){
return
"
THREE.Vector4 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
,
"
+
this
.
w
+
"
)
"
}};
THREE
.
Ray
=
function
(
a
,
b
){
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
};
this
.
length
();
a
>
0
?
this
.
multiplyScalar
(
1
/
a
):
this
.
set
(
0
,
0
,
0
);
return
this
},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
isZero
:
function
(){
return
Math
.
abs
(
this
.
x
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
y
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
z
)
<
1.0
E
-
4
},
clone
:
function
(){
return
new
THREE
.
Vector3
(
this
.
x
,
this
.
y
,
this
.
z
)},
toString
:
function
(){
return
"
THREE.Vector3 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
)
"
}};
THREE
.
Vector4
=
function
(
a
,
b
,
c
,
e
){
this
.
set
(
a
||
0
,
b
||
0
,
c
||
0
,
e
||
1
)};
THREE
.
Vector4
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
e
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
x
,
a
.
y
,
a
.
z
,
a
.
w
||
1
);
return
this
},
add
:
function
(
a
,
b
){
this
.
set
(
a
.
x
+
b
.
x
,
a
.
y
+
b
.
y
,
a
.
z
+
b
.
z
,
a
.
w
+
b
.
w
);
return
this
},
addSelf
:
function
(
a
){
this
.
set
(
this
.
x
+
a
.
x
,
this
.
y
+
a
.
y
,
this
.
z
+
a
.
z
,
this
.
w
+
a
.
w
);
return
this
},
sub
:
function
(
a
,
b
){
this
.
set
(
a
.
x
-
b
.
x
,
a
.
y
-
b
.
y
,
a
.
z
-
b
.
z
,
a
.
w
-
b
.
w
);
return
this
},
subSelf
:
function
(
a
){
this
.
set
(
this
.
x
-
a
.
x
,
this
.
y
-
a
.
y
,
this
.
z
-
a
.
z
,
this
.
w
-
a
.
w
);
return
this
},
multiplyScalar
:
function
(
a
){
this
.
set
(
this
.
x
*
a
,
this
.
y
*
a
,
this
.
z
*
a
,
this
.
w
*
a
);
return
this
},
divideScalar
:
function
(
a
){
this
.
set
(
this
.
x
/
a
,
this
.
y
/
a
,
this
.
z
/
a
,
this
.
w
/
a
);
return
this
},
lerpSelf
:
function
(
a
,
b
){
this
.
set
(
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
)},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
toString
:
function
(){
return
"
THREE.Vector4 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
,
"
+
this
.
w
+
"
)
"
}};
THREE
.
Ray
=
function
(
a
,
b
){
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
};
THREE
.
Ray
.
prototype
=
{
intersectScene
:
function
(
a
){
var
b
,
c
,
e
=
a
.
objects
,
d
=
[];
a
=
0
;
for
(
b
=
e
.
length
;
a
<
b
;
a
++
){
c
=
e
[
a
];
c
instanceof
THREE
.
Mesh
&&
(
d
=
d
.
concat
(
this
.
intersectObject
(
c
)))}
d
.
sort
(
function
(
f
,
g
){
return
f
.
distance
-
g
.
distance
});
return
d
},
intersectObject
:
function
(
a
){
function
b
(
r
,
k
,
B
,
x
){
x
=
x
.
clone
().
subSelf
(
k
);
B
=
B
.
clone
().
subSelf
(
k
);
var
F
=
r
.
clone
().
subSelf
(
k
);
r
=
x
.
dot
(
x
);
k
=
x
.
dot
(
B
);
x
=
x
.
dot
(
F
);
var
G
=
B
.
dot
(
B
);
B
=
B
.
dot
(
F
);
F
=
1
/
(
r
*
G
-
k
*
k
);
G
=
(
G
*
x
-
k
*
B
)
*
F
;
r
=
(
r
*
B
-
k
*
x
)
*
F
;
return
G
>
0
&&
r
>
0
&&
G
+
r
<
1
}
var
c
,
e
,
d
,
f
,
g
,
i
,
h
,
j
,
m
,
n
,
l
,
o
=
a
.
geometry
,
p
=
o
.
vertices
,
q
=
[];
c
=
0
;
for
(
e
=
o
.
faces
.
length
;
c
<
e
;
c
++
){
d
=
o
.
faces
[
c
];
n
=
this
.
origin
.
clone
();
l
=
this
.
direction
.
clone
();
h
=
a
.
globalMatrix
;
f
=
h
.
multiplyVector3
(
p
[
d
.
a
].
position
.
clone
());
g
=
h
.
multiplyVector3
(
p
[
d
.
b
].
position
.
clone
());
i
=
h
.
multiplyVector3
(
p
[
d
.
c
].
position
.
clone
());
h
=
d
instanceof
THREE
.
Face4
?
h
.
multiplyVector3
(
p
[
d
.
d
].
position
.
clone
()):
null
;
j
=
a
.
matrixRotation
.
multiplyVector3
(
d
.
normal
.
clone
());
m
=
l
.
dot
(
j
);
if
(
m
<
0
){
j
=
j
.
dot
((
new
THREE
.
Vector3
).
sub
(
f
,
n
))
/
m
;
n
=
n
.
addSelf
(
l
.
multiplyScalar
(
j
));
if
(
d
instanceof
THREE
.
Face3
){
if
(
b
(
n
,
f
,
g
,
i
)){
d
=
{
distance
:
this
.
origin
.
distanceTo
(
n
),
point
:
n
,
face
:
d
,
object
:
a
};
q
.
push
(
d
)}}
else
if
(
d
instanceof
THREE
.
Face4
&&
(
b
(
n
,
f
,
g
,
h
)
||
b
(
n
,
g
,
i
,
h
))){
d
=
{
distance
:
this
.
origin
.
distanceTo
(
n
),
point
:
n
,
face
:
d
,
object
:
a
};
q
.
push
(
d
)}}}
return
q
}};
...
...
@@ -49,8 +48,8 @@ this.localMatrix.n11=this.matrixRotation.n11;this.localMatrix.n12=this.matrixRot
Math
.
max
(
this
.
scale
.
x
,
Math
.
max
(
this
.
scale
.
y
,
this
.
scale
.
z
))}
return
!
0
},
addChild
:
function
(
a
){
if
(
this
.
children
.
indexOf
(
a
)
===-
1
){
a
.
parent
!==
undefined
&&
a
.
parent
.
removeChild
(
a
);
a
.
parent
=
this
;
this
.
children
.
push
(
a
)}},
removeChild
:
function
(
a
){
var
b
=
this
.
children
.
indexOf
(
a
);
if
(
b
!==-
1
){
this
.
children
.
splice
(
b
,
1
);
a
.
parent
=
undefined
}}};
THREE
.
Object3DCounter
=
{
value
:
0
};
THREE
.
Vertex
=
function
(
a
,
b
){
this
.
position
=
a
||
new
THREE
.
Vector3
;
this
.
positionWorld
=
new
THREE
.
Vector3
;
this
.
positionScreen
=
new
THREE
.
Vector4
;
this
.
normal
=
b
||
new
THREE
.
Vector3
;
this
.
normalWorld
=
new
THREE
.
Vector3
;
this
.
normalScreen
=
new
THREE
.
Vector3
;
this
.
tangent
=
new
THREE
.
Vector4
;
this
.
__visible
=!
0
};
THREE
.
Vertex
.
prototype
=
{
toString
:
function
(){
return
"
THREE.Vertex ( position:
"
+
this
.
position
+
"
, normal:
"
+
this
.
normal
+
"
)
"
}};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
e
,
d
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
centroid
=
new
THREE
.
Vector3
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
materials
=
d
instanceof
Array
?
d
:[
d
]};
THREE
.
Face3
.
prototype
=
{
toString
:
function
(){
return
"
THREE.Face3 (
"
+
this
.
a
+
"
,
"
+
this
.
b
+
"
,
"
+
this
.
c
+
"
)
"
}};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
e
,
d
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
e
;
this
.
centroid
=
new
THREE
.
Vector3
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
]};
THREE
.
Face4
.
prototype
=
{
toString
:
function
(){
return
"
THREE.Face4 (
"
+
this
.
a
+
"
,
"
+
this
.
b
+
"
,
"
+
this
.
c
+
"
"
+
this
.
d
+
"
)
"
}};
THREE
.
UV
=
function
(
a
,
b
){
this
.
u
=
a
||
0
;
this
.
v
=
b
||
0
};
THREE
.
UV
.
prototype
=
{
copy
:
function
(
a
){
this
.
u
=
a
.
u
;
this
.
v
=
a
.
v
},
toString
:
function
(){
return
"
THREE.UV (
"
+
this
.
u
+
"
,
"
+
this
.
v
+
"
)
"
}};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
e
,
d
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
e
;
this
.
centroid
=
new
THREE
.
Vector3
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
]};
THREE
.
Face4
.
prototype
=
{
toString
:
function
(){
return
"
THREE.Face4 (
"
+
this
.
a
+
"
,
"
+
this
.
b
+
"
,
"
+
this
.
c
+
"
"
+
this
.
d
+
"
)
"
}};
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
},
toString
:
function
(){
return
"
THREE.UV (
"
+
this
.
u
+
"
,
"
+
this
.
v
+
"
)
"
}};
THREE
.
Camera
=
function
(
a
,
b
,
c
,
e
,
d
){
THREE
.
Object3D
.
call
(
this
);
this
.
fov
=
a
||
50
;
this
.
aspect
=
b
||
1
;
this
.
near
=
c
||
0.1
;
this
.
far
=
e
||
2
E3
;
this
.
screenCenterY
=
this
.
screenCenterX
=
0
;
this
.
target
=
d
||
new
THREE
.
Object3D
;
this
.
useTarget
=!
0
;
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
inverseMatrix
=
new
THREE
.
Matrix4
;
this
.
projectionMatrix
=
null
;
this
.
tmpVec
=
new
THREE
.
Vector3
;
this
.
translateX
=
function
(
f
,
g
){
this
.
tmpVec
.
sub
(
this
.
target
.
position
,
this
.
position
).
normalize
().
multiplyScalar
(
f
);
this
.
tmpVec
.
crossSelf
(
this
.
up
);
if
(
g
)
this
.
tmpVec
.
y
=
0
;
this
.
position
.
addSelf
(
this
.
tmpVec
);
this
.
target
.
position
.
addSelf
(
this
.
tmpVec
)};
this
.
translateZ
=
function
(
f
,
g
){
this
.
tmpVec
.
sub
(
this
.
target
.
position
,
this
.
position
).
normalize
().
multiplyScalar
(
f
);
if
(
g
)
this
.
tmpVec
.
y
=
0
;
this
.
position
.
subSelf
(
this
.
tmpVec
);
this
.
target
.
position
.
subSelf
(
this
.
tmpVec
)};
this
.
updateProjectionMatrix
()};
THREE
.
Camera
.
prototype
=
new
THREE
.
Object3D
;
THREE
.
Camera
.
prototype
.
constructor
=
THREE
.
Camera
;
THREE
.
Camera
.
prototype
.
supr
=
THREE
.
Object3D
.
prototype
;
THREE
.
Camera
.
prototype
.
updateProjectionMatrix
=
function
(){
this
.
projectionMatrix
=
THREE
.
Matrix4
.
makePerspective
(
this
.
fov
,
this
.
aspect
,
this
.
near
,
this
.
far
)};
...
...
build/custom/ThreeSVG.js
浏览文件 @
e7e47b1f
...
...
@@ -2,16 +2,15 @@
var
THREE
=
THREE
||
{};
THREE
.
Color
=
function
(
a
){
this
.
setHex
(
a
)};
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
d
,
e
,
f
,
g
,
i
,
h
;
if
(
c
==
0
)
d
=
e
=
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
:
d
=
h
;
e
=
c
;
f
=
a
;
break
;
case
2
:
d
=
a
;
e
=
c
;
f
=
b
;
break
;
case
3
:
d
=
a
;
e
=
h
;
f
=
c
;
break
;
case
4
:
d
=
b
;
e
=
a
;
f
=
c
;
break
;
case
5
:
d
=
c
;
e
=
a
;
f
=
h
;
break
;
case
6
:
case
0
:
d
=
c
;
e
=
b
;
f
=
a
}}
this
.
r
=
d
;
this
.
g
=
e
;
this
.
b
=
f
;
if
(
this
.
autoUpdate
){
this
.
updateHex
();
this
.
updateStyleString
()}},
setHex
:
function
(
a
){
this
.
hex
=~~
a
&
16777215
;
if
(
this
.
autoUpdate
){
this
.
updateRGBA
();
this
.
updateStyleString
()}},
updateHex
:
function
(){
this
.
hex
=~~
(
this
.
r
*
255
)
<<
16
^~~
(
this
.
g
*
255
)
<<
8
^~~
(
this
.
b
*
255
)},
updateRGBA
:
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
)},
toString
:
function
(){
return
"
THREE.Color ( r:
"
+
this
.
r
+
"
, g:
"
+
this
.
g
+
"
, b:
"
+
this
.
b
+
"
, hex:
"
+
this
.
hex
+
"
)
"
}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
};
THREE
.
Vector2
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
x
=
a
;
this
.
y
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
return
this
},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
return
this
},
unit
:
function
(){
this
.
multiplyScalar
(
1
/
this
.
length
());
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
)},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
},
negate
:
function
(){
this
.
x
=-
this
.
x
;
this
.
y
=-
this
.
y
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector2
(
this
.
x
,
this
.
y
)},
toString
:
function
(){
return
"
THREE.Vector2 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
)
"
}};
THREE
.
Vector3
=
function
(
a
,
b
,
c
){
this
.
set
(
a
||
0
,
b
||
0
,
c
||
0
)};
this
.
r
+
"
, g:
"
+
this
.
g
+
"
, b:
"
+
this
.
b
+
"
, hex:
"
+
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
)},
toString
:
function
(){
return
"
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
,
b
){
this
.
set
(
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
,
a
.
z
*
b
.
x
-
a
.
x
*
b
.
z
,
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
);
return
this
},
crossSelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
;
this
.
set
(
c
*
a
.
z
-
d
*
a
.
y
,
d
*
a
.
x
-
b
*
a
.
z
,
b
*
a
.
y
-
c
*
a
.
x
);
return
this
},
multiply
:
function
(
a
,
b
){
this
.
set
(
a
.
x
*
b
.
x
,
a
.
y
*
b
.
y
,
a
.
z
*
b
.
z
);
return
this
},
multiplySelf
:
function
(
a
){
this
.
set
(
this
.
x
*
a
.
x
,
this
.
y
*
a
.
y
,
this
.
z
*
a
.
z
);
return
this
},
multiplyScalar
:
function
(
a
){
this
.
set
(
this
.
x
*
a
,
this
.
y
*
a
,
this
.
z
*
a
);
return
this
},
divideSelf
:
function
(
a
){
this
.
set
(
this
.
x
/
a
.
x
,
this
.
y
/
a
.
y
,
this
.
z
/
a
.
z
);
return
this
},
divideScalar
:
function
(
a
){
this
.
set
(
this
.
x
/
a
,
this
.
y
/
a
,
this
.
z
/
a
);
return
this
},
negate
:
function
(){
this
.
set
(
-
this
.
x
,
-
this
.
y
,
-
this
.
z
);
return
this
},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
},
distanceTo
:
function
(
a
){
return
Math
.
sqrt
(
this
.
distanceToSquared
(
a
))},
distanceToSquared
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
c
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
b
*
b
+
c
*
c
+
a
*
a
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
},
lengthManhattan
:
function
(){
return
this
.
x
+
this
.
y
+
this
.
z
},
normalize
:
function
(){
var
a
=
this
.
length
();
a
>
0
?
this
.
multiplyScalar
(
1
/
a
):
this
.
set
(
0
,
0
,
0
);
return
this
},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
isZero
:
function
(){
return
Math
.
abs
(
this
.
x
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
y
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
z
)
<
1.0
E
-
4
},
clone
:
function
(){
return
new
THREE
.
Vector3
(
this
.
x
,
this
.
y
,
this
.
z
)},
toString
:
function
(){
return
"
THREE.Vector3 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
)
"
}};
THREE
.
Vector4
=
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
c
||
0
;
this
.
w
=
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
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
a
.
w
||
1
;
return
this
},
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
){
this
.
x
/=
a
;
this
.
y
/=
a
;
this
.
z
/=
a
;
this
.
w
/=
a
;
return
this
},
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
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
toString
:
function
(){
return
"
THREE.Vector4 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
,
"
+
this
.
w
+
"
)
"
}};
THREE
.
Ray
=
function
(
a
,
b
){
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
};
this
.
length
();
a
>
0
?
this
.
multiplyScalar
(
1
/
a
):
this
.
set
(
0
,
0
,
0
);
return
this
},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
isZero
:
function
(){
return
Math
.
abs
(
this
.
x
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
y
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
z
)
<
1.0
E
-
4
},
clone
:
function
(){
return
new
THREE
.
Vector3
(
this
.
x
,
this
.
y
,
this
.
z
)},
toString
:
function
(){
return
"
THREE.Vector3 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
)
"
}};
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
){
this
.
set
(
a
.
x
,
a
.
y
,
a
.
z
,
a
.
w
||
1
);
return
this
},
add
:
function
(
a
,
b
){
this
.
set
(
a
.
x
+
b
.
x
,
a
.
y
+
b
.
y
,
a
.
z
+
b
.
z
,
a
.
w
+
b
.
w
);
return
this
},
addSelf
:
function
(
a
){
this
.
set
(
this
.
x
+
a
.
x
,
this
.
y
+
a
.
y
,
this
.
z
+
a
.
z
,
this
.
w
+
a
.
w
);
return
this
},
sub
:
function
(
a
,
b
){
this
.
set
(
a
.
x
-
b
.
x
,
a
.
y
-
b
.
y
,
a
.
z
-
b
.
z
,
a
.
w
-
b
.
w
);
return
this
},
subSelf
:
function
(
a
){
this
.
set
(
this
.
x
-
a
.
x
,
this
.
y
-
a
.
y
,
this
.
z
-
a
.
z
,
this
.
w
-
a
.
w
);
return
this
},
multiplyScalar
:
function
(
a
){
this
.
set
(
this
.
x
*
a
,
this
.
y
*
a
,
this
.
z
*
a
,
this
.
w
*
a
);
return
this
},
divideScalar
:
function
(
a
){
this
.
set
(
this
.
x
/
a
,
this
.
y
/
a
,
this
.
z
/
a
,
this
.
w
/
a
);
return
this
},
lerpSelf
:
function
(
a
,
b
){
this
.
set
(
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
)},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
toString
:
function
(){
return
"
THREE.Vector4 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
,
"
+
this
.
w
+
"
)
"
}};
THREE
.
Ray
=
function
(
a
,
b
){
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
};
THREE
.
Ray
.
prototype
=
{
intersectScene
:
function
(
a
){
var
b
,
c
,
d
=
a
.
objects
,
e
=
[];
a
=
0
;
for
(
b
=
d
.
length
;
a
<
b
;
a
++
){
c
=
d
[
a
];
c
instanceof
THREE
.
Mesh
&&
(
e
=
e
.
concat
(
this
.
intersectObject
(
c
)))}
e
.
sort
(
function
(
f
,
g
){
return
f
.
distance
-
g
.
distance
});
return
e
},
intersectObject
:
function
(
a
){
function
b
(
t
,
j
,
H
,
p
){
p
=
p
.
clone
().
subSelf
(
j
);
H
=
H
.
clone
().
subSelf
(
j
);
var
y
=
t
.
clone
().
subSelf
(
j
);
t
=
p
.
dot
(
p
);
j
=
p
.
dot
(
H
);
p
=
p
.
dot
(
y
);
var
C
=
H
.
dot
(
H
);
H
=
H
.
dot
(
y
);
y
=
1
/
(
t
*
C
-
j
*
j
);
C
=
(
C
*
p
-
j
*
H
)
*
y
;
t
=
(
t
*
H
-
j
*
p
)
*
y
;
return
C
>
0
&&
t
>
0
&&
C
+
t
<
1
}
var
c
,
d
,
e
,
f
,
g
,
i
,
h
,
k
,
n
,
m
,
l
,
o
=
a
.
geometry
,
q
=
o
.
vertices
,
s
=
[];
c
=
0
;
for
(
d
=
o
.
faces
.
length
;
c
<
d
;
c
++
){
e
=
o
.
faces
[
c
];
m
=
this
.
origin
.
clone
();
l
=
this
.
direction
.
clone
();
h
=
a
.
globalMatrix
;
f
=
h
.
multiplyVector3
(
q
[
e
.
a
].
position
.
clone
());
g
=
h
.
multiplyVector3
(
q
[
e
.
b
].
position
.
clone
());
i
=
h
.
multiplyVector3
(
q
[
e
.
c
].
position
.
clone
());
h
=
e
instanceof
THREE
.
Face4
?
h
.
multiplyVector3
(
q
[
e
.
d
].
position
.
clone
()):
null
;
k
=
a
.
matrixRotation
.
multiplyVector3
(
e
.
normal
.
clone
());
n
=
l
.
dot
(
k
);
if
(
n
<
0
){
k
=
k
.
dot
((
new
THREE
.
Vector3
).
sub
(
f
,
m
))
/
n
;
m
=
m
.
addSelf
(
l
.
multiplyScalar
(
k
));
if
(
e
instanceof
THREE
.
Face3
){
if
(
b
(
m
,
f
,
g
,
i
)){
e
=
{
distance
:
this
.
origin
.
distanceTo
(
m
),
point
:
m
,
face
:
e
,
object
:
a
};
s
.
push
(
e
)}}
else
if
(
e
instanceof
THREE
.
Face4
&&
(
b
(
m
,
f
,
g
,
h
)
||
b
(
m
,
g
,
i
,
h
))){
e
=
{
distance
:
this
.
origin
.
distanceTo
(
m
),
point
:
m
,
face
:
e
,
object
:
a
};
s
.
push
(
e
)}}}
return
s
}};
...
...
@@ -49,8 +48,8 @@ this.localMatrix.n11=this.matrixRotation.n11;this.localMatrix.n12=this.matrixRot
Math
.
max
(
this
.
scale
.
x
,
Math
.
max
(
this
.
scale
.
y
,
this
.
scale
.
z
))}
return
!
0
},
addChild
:
function
(
a
){
if
(
this
.
children
.
indexOf
(
a
)
===-
1
){
a
.
parent
!==
undefined
&&
a
.
parent
.
removeChild
(
a
);
a
.
parent
=
this
;
this
.
children
.
push
(
a
)}},
removeChild
:
function
(
a
){
var
b
=
this
.
children
.
indexOf
(
a
);
if
(
b
!==-
1
){
this
.
children
.
splice
(
b
,
1
);
a
.
parent
=
undefined
}}};
THREE
.
Object3DCounter
=
{
value
:
0
};
THREE
.
Vertex
=
function
(
a
,
b
){
this
.
position
=
a
||
new
THREE
.
Vector3
;
this
.
positionWorld
=
new
THREE
.
Vector3
;
this
.
positionScreen
=
new
THREE
.
Vector4
;
this
.
normal
=
b
||
new
THREE
.
Vector3
;
this
.
normalWorld
=
new
THREE
.
Vector3
;
this
.
normalScreen
=
new
THREE
.
Vector3
;
this
.
tangent
=
new
THREE
.
Vector4
;
this
.
__visible
=!
0
};
THREE
.
Vertex
.
prototype
=
{
toString
:
function
(){
return
"
THREE.Vertex ( position:
"
+
this
.
position
+
"
, normal:
"
+
this
.
normal
+
"
)
"
}};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
centroid
=
new
THREE
.
Vector3
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
materials
=
e
instanceof
Array
?
e
:[
e
]};
THREE
.
Face3
.
prototype
=
{
toString
:
function
(){
return
"
THREE.Face3 (
"
+
this
.
a
+
"
,
"
+
this
.
b
+
"
,
"
+
this
.
c
+
"
)
"
}};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
centroid
=
new
THREE
.
Vector3
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
]};
THREE
.
Face4
.
prototype
=
{
toString
:
function
(){
return
"
THREE.Face4 (
"
+
this
.
a
+
"
,
"
+
this
.
b
+
"
,
"
+
this
.
c
+
"
"
+
this
.
d
+
"
)
"
}};
THREE
.
UV
=
function
(
a
,
b
){
this
.
u
=
a
||
0
;
this
.
v
=
b
||
0
};
THREE
.
UV
.
prototype
=
{
copy
:
function
(
a
){
this
.
u
=
a
.
u
;
this
.
v
=
a
.
v
},
toString
:
function
(){
return
"
THREE.UV (
"
+
this
.
u
+
"
,
"
+
this
.
v
+
"
)
"
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
faces
=
[];
this
.
uvs
=
[];
this
.
uvs2
=
[];
this
.
colors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
geometryChunks
=
{};
this
.
hasTangents
=!
1
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
centroid
=
new
THREE
.
Vector3
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
]};
THREE
.
Face4
.
prototype
=
{
toString
:
function
(){
return
"
THREE.Face4 (
"
+
this
.
a
+
"
,
"
+
this
.
b
+
"
,
"
+
this
.
c
+
"
"
+
this
.
d
+
"
)
"
}};
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
},
toString
:
function
(){
return
"
THREE.UV (
"
+
this
.
u
+
"
,
"
+
this
.
v
+
"
)
"
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
faces
=
[];
this
.
uvs
=
[];
this
.
uvs2
=
[];
this
.
colors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
geometryChunks
=
{};
this
.
hasTangents
=!
1
};
THREE
.
Geometry
.
prototype
=
{
computeCentroids
:
function
(){
var
a
,
b
,
c
;
a
=
0
;
for
(
b
=
this
.
faces
.
length
;
a
<
b
;
a
++
){
c
=
this
.
faces
[
a
];
c
.
centroid
.
set
(
0
,
0
,
0
);
if
(
c
instanceof
THREE
.
Face3
){
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
a
].
position
);
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
b
].
position
);
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
c
].
position
);
c
.
centroid
.
divideScalar
(
3
)}
else
if
(
c
instanceof
THREE
.
Face4
){
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
a
].
position
);
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
b
].
position
);
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
c
].
position
);
c
.
centroid
.
addSelf
(
this
.
vertices
[
c
.
d
].
position
);
c
.
centroid
.
divideScalar
(
4
)}}},
computeFaceNormals
:
function
(
a
){
var
b
,
c
,
d
,
e
,
f
,
g
,
i
=
new
THREE
.
Vector3
,
h
=
new
THREE
.
Vector3
;
d
=
0
;
for
(
e
=
this
.
vertices
.
length
;
d
<
e
;
d
++
){
f
=
this
.
vertices
[
d
];
f
.
normal
.
set
(
0
,
0
,
0
)}
d
=
0
;
for
(
e
=
this
.
faces
.
length
;
d
<
e
;
d
++
){
f
=
this
.
faces
[
d
];
if
(
a
&&
f
.
vertexNormals
.
length
){
i
.
set
(
0
,
0
,
0
);
b
=
0
;
for
(
c
=
f
.
normal
.
length
;
b
<
c
;
b
++
)
i
.
addSelf
(
f
.
vertexNormals
[
b
]);
i
.
divideScalar
(
3
)}
else
{
b
=
this
.
vertices
[
f
.
a
];
c
=
this
.
vertices
[
f
.
b
];
g
=
this
.
vertices
[
f
.
c
];
i
.
sub
(
g
.
position
,
c
.
position
);
h
.
sub
(
b
.
position
,
c
.
position
);
i
.
crossSelf
(
h
)}
i
.
isZero
()
||
i
.
normalize
();
f
.
normal
.
copy
(
i
)}},
computeVertexNormals
:
function
(){
var
a
,
b
,
c
,
d
;
if
(
this
.
__tmpVertices
==
undefined
){
d
=
this
.
__tmpVertices
=
Array
(
this
.
vertices
.
length
);
a
=
0
;
for
(
b
=
this
.
vertices
.
length
;
a
<
b
;
a
++
)
d
[
a
]
=
new
THREE
.
Vector3
;
a
=
0
;
for
(
b
=
this
.
faces
.
length
;
a
<
b
;
a
++
){
c
=
this
.
faces
[
a
];
if
(
c
instanceof
THREE
.
Face3
)
c
.
vertexNormals
=
[
new
THREE
.
Vector3
,
new
THREE
.
Vector3
,
new
THREE
.
Vector3
];
else
if
(
c
instanceof
THREE
.
Face4
)
c
.
vertexNormals
=
[
new
THREE
.
Vector3
,
...
...
build/custom/ThreeWebGL.js
浏览文件 @
e7e47b1f
此差异已折叠。
点击以展开。
examples/canvas_performance.html
浏览文件 @
e7e47b1f
...
...
@@ -41,6 +41,7 @@
<script
type=
"text/javascript"
src=
"../src/lights/DirectionalLight.js"
></script>
<script
type=
"text/javascript"
src=
"../src/lights/PointLight.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/Material.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/Mappings.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/LineBasicMaterial.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/MeshBasicMaterial.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/MeshLambertMaterial.js"
></script>
...
...
@@ -55,13 +56,6 @@
<script
type=
"text/javascript"
src=
"../src/materials/Texture.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/RenderTarget.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/Uniforms.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/CubeReflectionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/CubeRefractionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/LatitudeReflectionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/LatitudeRefractionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/SphericalReflectionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/SphericalRefractionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/UVMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/objects/Particle.js"
></script>
<script
type=
"text/javascript"
src=
"../src/objects/ParticleSystem.js"
></script>
<script
type=
"text/javascript"
src=
"../src/objects/Line.js"
></script>
...
...
examples/canvas_sandbox.html
浏览文件 @
e7e47b1f
...
...
@@ -35,11 +35,13 @@
<script
type=
"text/javascript"
src=
"../src/animation/AnimationHandler.js"
></script>
<script
type=
"text/javascript"
src=
"../src/animation/Animation.js"
></script>
<script
type=
"text/javascript"
src=
"../src/cameras/Camera.js"
></script>
<script
type=
"text/javascript"
src=
"../src/cameras/QuakeCamera.js"
></script>
<script
type=
"text/javascript"
src=
"../src/lights/Light.js"
></script>
<script
type=
"text/javascript"
src=
"../src/lights/AmbientLight.js"
></script>
<script
type=
"text/javascript"
src=
"../src/lights/DirectionalLight.js"
></script>
<script
type=
"text/javascript"
src=
"../src/lights/PointLight.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/Material.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/Mappings.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/LineBasicMaterial.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/MeshBasicMaterial.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/MeshLambertMaterial.js"
></script>
...
...
@@ -54,13 +56,6 @@
<script
type=
"text/javascript"
src=
"../src/materials/Texture.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/RenderTarget.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/Uniforms.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/CubeReflectionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/CubeRefractionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/LatitudeReflectionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/LatitudeRefractionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/SphericalReflectionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/SphericalRefractionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/UVMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/objects/Particle.js"
></script>
<script
type=
"text/javascript"
src=
"../src/objects/ParticleSystem.js"
></script>
<script
type=
"text/javascript"
src=
"../src/objects/Line.js"
></script>
...
...
examples/misc_uqbiquity_test.html
浏览文件 @
e7e47b1f
...
...
@@ -36,11 +36,13 @@
<script
type=
"text/javascript"
src=
"../src/animation/AnimationHandler.js"
></script>
<script
type=
"text/javascript"
src=
"../src/animation/Animation.js"
></script>
<script
type=
"text/javascript"
src=
"../src/cameras/Camera.js"
></script>
<script
type=
"text/javascript"
src=
"../src/cameras/QuakeCamera.js"
></script>
<script
type=
"text/javascript"
src=
"../src/lights/Light.js"
></script>
<script
type=
"text/javascript"
src=
"../src/lights/AmbientLight.js"
></script>
<script
type=
"text/javascript"
src=
"../src/lights/DirectionalLight.js"
></script>
<script
type=
"text/javascript"
src=
"../src/lights/PointLight.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/Material.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/Mappings.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/LineBasicMaterial.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/MeshBasicMaterial.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/MeshLambertMaterial.js"
></script>
...
...
@@ -55,13 +57,6 @@
<script
type=
"text/javascript"
src=
"../src/materials/Texture.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/RenderTarget.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/Uniforms.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/CubeReflectionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/CubeRefractionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/LatitudeReflectionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/LatitudeRefractionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/SphericalReflectionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/SphericalRefractionMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/materials/mappings/UVMapping.js"
></script>
<script
type=
"text/javascript"
src=
"../src/objects/Particle.js"
></script>
<script
type=
"text/javascript"
src=
"../src/objects/ParticleSystem.js"
></script>
<script
type=
"text/javascript"
src=
"../src/objects/Line.js"
></script>
...
...
src/core/Color.js
浏览文件 @
e7e47b1f
...
...
@@ -10,9 +10,9 @@ THREE.Color = function ( hex ) {
THREE
.
Color
.
prototype
=
{
autoUpdate
:
true
,
autoUpdate
:
true
,
setRGB
:
function
(
r
,
g
,
b
)
{
setRGB
:
function
(
r
,
g
,
b
)
{
this
.
r
=
r
;
this
.
g
=
g
;
...
...
@@ -27,7 +27,7 @@ THREE.Color.prototype = {
},
setHSV
:
function
(
h
,
s
,
v
)
{
setHSV
:
function
(
h
,
s
,
v
)
{
// based on MochiKit implementation by Bob Ippolito
// h,s,v ranges are < 0.0 - 1.0 >
...
...
@@ -73,7 +73,7 @@ THREE.Color.prototype = {
},
setHex
:
function
(
hex
)
{
setHex
:
function
(
hex
)
{
this
.
hex
=
(
~~
hex
)
&
0xffffff
;
...
...
@@ -86,13 +86,13 @@ THREE.Color.prototype = {
},
updateHex
:
function
()
{
updateHex
:
function
()
{
this
.
hex
=
~~
(
this
.
r
*
255
)
<<
16
^
~~
(
this
.
g
*
255
)
<<
8
^
~~
(
this
.
b
*
255
);
this
.
hex
=
~~
(
this
.
r
*
255
)
<<
16
^
~~
(
this
.
g
*
255
)
<<
8
^
~~
(
this
.
b
*
255
);
},
updateRGBA
:
function
()
{
updateRGBA
:
function
()
{
this
.
r
=
(
this
.
hex
>>
16
&
255
)
/
255
;
this
.
g
=
(
this
.
hex
>>
8
&
255
)
/
255
;
...
...
@@ -100,19 +100,19 @@ THREE.Color.prototype = {
},
updateStyleString
:
function
()
{
updateStyleString
:
function
()
{
this
.
__styleString
=
'
rgb(
'
+
~~
(
this
.
r
*
255
)
+
'
,
'
+
~~
(
this
.
g
*
255
)
+
'
,
'
+
~~
(
this
.
b
*
255
)
+
'
)
'
;
this
.
__styleString
=
'
rgb(
'
+
~~
(
this
.
r
*
255
)
+
'
,
'
+
~~
(
this
.
g
*
255
)
+
'
,
'
+
~~
(
this
.
b
*
255
)
+
'
)
'
;
},
clone
:
function
()
{
clone
:
function
()
{
return
new
THREE
.
Color
(
this
.
hex
);
},
toString
:
function
()
{
toString
:
function
()
{
return
'
THREE.Color ( r:
'
+
this
.
r
+
'
, g:
'
+
this
.
g
+
'
, b:
'
+
this
.
b
+
'
, hex:
'
+
this
.
hex
+
'
)
'
;
...
...
src/core/Face3.js
浏览文件 @
e7e47b1f
...
...
@@ -18,7 +18,7 @@ THREE.Face3 = function ( a, b, c, normal, materials ) {
THREE
.
Face3
.
prototype
=
{
toString
:
function
()
{
toString
:
function
()
{
return
'
THREE.Face3 (
'
+
this
.
a
+
'
,
'
+
this
.
b
+
'
,
'
+
this
.
c
+
'
)
'
;
...
...
src/core/Face4.js
浏览文件 @
e7e47b1f
...
...
@@ -20,7 +20,7 @@ THREE.Face4 = function ( a, b, c, d, normal, materials ) {
THREE
.
Face4
.
prototype
=
{
toString
:
function
()
{
toString
:
function
()
{
return
'
THREE.Face4 (
'
+
this
.
a
+
'
,
'
+
this
.
b
+
'
,
'
+
this
.
c
+
'
'
+
this
.
d
+
'
)
'
;
...
...
src/core/Quaternion.js
浏览文件 @
e7e47b1f
...
...
@@ -4,33 +4,37 @@
THREE
.
Quaternion
=
function
(
x
,
y
,
z
,
w
)
{
this
.
x
=
x
||
0
;
this
.
y
=
y
||
0
;
this
.
z
=
z
||
0
;
this
.
w
=
w
!==
undefined
?
w
:
1
;
this
.
set
(
x
||
0
,
y
||
0
,
z
||
0
,
w
!==
undefined
?
w
:
1
);
};
THREE
.
Quaternion
.
prototype
=
{
THREE
.
Quaternion
.
prototype
.
set
=
function
(
x
,
y
,
z
,
w
)
{
this
.
x
=
x
;
this
.
y
=
y
;
this
.
z
=
z
;
this
.
w
=
w
;
set
:
function
(
x
,
y
,
z
,
w
)
{
return
this
;
this
.
x
=
x
;
this
.
y
=
y
;
this
.
z
=
z
;
this
.
w
=
w
;
}
;
return
this
;
},
THREE
.
Quaternion
.
prototype
.
setFromEuler
=
function
(
vec3
)
{
var
c
=
0.5
*
Math
.
PI
/
360
,
// 0.5 is an optimization
setFromEuler
:
function
(
vec3
)
{
var
c
=
0.5
*
Math
.
PI
/
360
,
// 0.5 is an optimization
x
=
vec3
.
x
*
c
,
y
=
vec3
.
y
*
c
,
z
=
vec3
.
z
*
c
,
c1
=
Math
.
cos
(
y
),
s1
=
Math
.
sin
(
y
),
c2
=
Math
.
cos
(
-
z
),
...
...
@@ -39,230 +43,139 @@ THREE.Quaternion.prototype.setFromEuler = function( vec3 ) {
s3
=
Math
.
sin
(
x
),
c1c2
=
c1
*
c2
,
s1s2
=
s1
*
s2
;
this
.
w
=
c1c2
*
c3
-
s1s2
*
s3
;
this
.
x
=
c1c2
*
s3
+
s1s2
*
c3
;
this
.
y
=
s1
*
c2
*
c3
+
c1
*
s2
*
s3
;
this
.
z
=
c1
*
s2
*
c3
-
s1
*
c2
*
s3
;
return
this
;
this
.
w
=
c1c2
*
c3
-
s1s2
*
s3
;
this
.
x
=
c1c2
*
s3
+
s1s2
*
c3
;
this
.
y
=
s1
*
c2
*
c3
+
c1
*
s2
*
s3
;
this
.
z
=
c1
*
s2
*
c3
-
s1
*
c2
*
s3
;
}
;
return
this
;
},
THREE
.
Quaternion
.
prototype
.
calculateW
=
function
()
{
calculateW
:
function
()
{
this
.
w
=
-
Math
.
sqrt
(
Math
.
abs
(
1.0
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
)
);
this
.
w
=
-
Math
.
sqrt
(
Math
.
abs
(
1.0
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
)
);
return
this
;
return
this
;
};
},
inverse
:
function
()
{
THREE
.
Quaternion
.
prototype
.
inverse
=
function
()
{
this
.
x
*=
-
1
;
this
.
y
*=
-
1
;
this
.
z
*=
-
1
;
this
.
x
*=
-
1
;
this
.
y
*=
-
1
;
this
.
z
*=
-
1
;
return
this
;
return
this
;
},
};
length
:
function
()
{
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
THREE
.
Quaternion
.
prototype
.
length
=
function
()
{
},
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
normalize
:
function
()
{
}
;
var
l
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)
;
if
(
l
==
0
)
{
THREE
.
Quaternion
.
prototype
.
normalize
=
function
()
{
var
len
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
if
(
len
==
0
)
{
this
.
x
=
0
;
this
.
y
=
0
;
this
.
z
=
0
;
this
.
w
=
0
;
}
else
{
len
=
1
/
len
;
this
.
x
=
this
.
x
*
len
;
this
.
y
=
this
.
y
*
len
;
this
.
z
=
this
.
z
*
len
;
this
.
w
=
this
.
w
*
len
;
}
return
this
;
this
.
x
=
0
;
this
.
y
=
0
;
this
.
z
=
0
;
this
.
w
=
0
;
};
}
else
{
l
=
1
/
l
;
THREE
.
Quaternion
.
prototype
.
multiplySelf
=
function
(
quat2
)
{
var
qax
=
this
.
x
,
qay
=
this
.
y
,
qaz
=
this
.
z
,
qaw
=
this
.
w
,
qbx
=
quat2
.
x
,
qby
=
quat2
.
y
,
qbz
=
quat2
.
z
,
qbw
=
quat2
.
w
;
this
.
x
=
qax
*
qbw
+
qaw
*
qbx
+
qay
*
qbz
-
qaz
*
qby
;
this
.
y
=
qay
*
qbw
+
qaw
*
qby
+
qaz
*
qbx
-
qax
*
qbz
;
this
.
z
=
qaz
*
qbw
+
qaw
*
qbz
+
qax
*
qby
-
qay
*
qbx
;
this
.
w
=
qaw
*
qbw
-
qax
*
qbx
-
qay
*
qby
-
qaz
*
qbz
;
this
.
x
=
this
.
x
*
l
;
this
.
y
=
this
.
y
*
l
;
this
.
z
=
this
.
z
*
l
;
this
.
w
=
this
.
w
*
l
;
return
this
;
}
}
;
return
this
;
},
THREE
.
Quaternion
.
prototype
.
multiplyVector3
=
function
(
vec
,
dest
)
{
if
(
!
dest
)
{
dest
=
vec
;
}
var
x
=
vec
.
x
,
y
=
vec
.
y
,
z
=
vec
.
z
,
qx
=
this
.
x
,
qy
=
this
.
y
,
qz
=
this
.
z
,
qw
=
this
.
w
;
// calculate quat * vec
var
ix
=
qw
*
x
+
qy
*
z
-
qz
*
y
,
iy
=
qw
*
y
+
qz
*
x
-
qx
*
z
,
iz
=
qw
*
z
+
qx
*
y
-
qy
*
x
,
iw
=
-
qx
*
x
-
qy
*
y
-
qz
*
z
;
// calculate result * inverse quat
dest
.
x
=
ix
*
qw
+
iw
*
-
qx
+
iy
*
-
qz
-
iz
*
-
qy
;
dest
.
y
=
iy
*
qw
+
iw
*
-
qy
+
iz
*
-
qx
-
ix
*
-
qz
;
dest
.
z
=
iz
*
qw
+
iw
*
-
qz
+
ix
*
-
qy
-
iy
*
-
qx
;
return
dest
;
multiplySelf
:
function
(
quat2
)
{
};
var
qax
=
this
.
x
,
qay
=
this
.
y
,
qaz
=
this
.
z
,
qaw
=
this
.
w
,
qbx
=
quat2
.
x
,
qby
=
quat2
.
y
,
qbz
=
quat2
.
z
,
qbw
=
quat2
.
w
;
this
.
x
=
qax
*
qbw
+
qaw
*
qbx
+
qay
*
qbz
-
qaz
*
qby
;
this
.
y
=
qay
*
qbw
+
qaw
*
qby
+
qaz
*
qbx
-
qax
*
qbz
;
this
.
z
=
qaz
*
qbw
+
qaw
*
qbz
+
qax
*
qby
-
qay
*
qbx
;
this
.
w
=
qaw
*
qbw
-
qax
*
qbx
-
qay
*
qby
-
qaz
*
qbz
;
THREE
.
Quaternion
.
prototype
.
toMatrix3
=
function
(
matrix3
)
{
/* todo: create a proper Matrix3 first
var x = quat[0], y = quat[1], z = quat[2], w = quat[3];
return
this
;
var x2 = x + x;
var y2 = y + y;
var z2 = z + z;
},
var xx = x*x2;
var xy = x*y2;
var xz = x*z2;
multiplyVector3
:
function
(
vec
,
dest
)
{
var yy = y*y2;
var yz = y*z2;
var zz = z*z2;
if
(
!
dest
)
{
dest
=
vec
;
}
var wx = w*x2;
var wy = w*y2;
var wz = w*z2;
var
x
=
vec
.
x
,
y
=
vec
.
y
,
z
=
vec
.
z
,
qx
=
this
.
x
,
qy
=
this
.
y
,
qz
=
this
.
z
,
qw
=
this
.
w
;
dest[0] = 1 - (yy + zz);
dest[1] = xy - wz;
dest[2] = xz + wy;
// calculate quat * vec
dest[3] = xy + wz;
dest[4] = 1 - (xx + zz);
dest[5] = yz - wx;
var
ix
=
qw
*
x
+
qy
*
z
-
qz
*
y
,
iy
=
qw
*
y
+
qz
*
x
-
qx
*
z
,
iz
=
qw
*
z
+
qx
*
y
-
qy
*
x
,
iw
=
-
qx
*
x
-
qy
*
y
-
qz
*
z
;
dest[6] = xz - wy;
dest[7] = yz + wx;
dest[8] = 1 - (xx + yy);
return dest;*/
};
// calculate result * inverse quat
THREE
.
Quaternion
.
prototype
.
toMatrix4
=
function
(
matrix4
)
{
/* todo: this is implemented in Matrix4.setFromQuaternion
dest
.
x
=
ix
*
qw
+
iw
*
-
qx
+
iy
*
-
qz
-
iz
*
-
qy
;
dest
.
y
=
iy
*
qw
+
iw
*
-
qy
+
iz
*
-
qx
-
ix
*
-
qz
;
dest
.
z
=
iz
*
qw
+
iw
*
-
qz
+
ix
*
-
qy
-
iy
*
-
qx
;
var x = quat[0], y = quat[1], z = quat[2], w = quat[3]
;
return
dest
;
var x2 = x + x;
var y2 = y + y;
var z2 = z + z;
},
var xx = x*x2;
var xy = x*y2;
var xz = x*z2;
slerp
:
function
(
qa
,
qb
,
qm
,
t
)
{
var yy = y*y2;
var yz = y*z2;
var zz = z*z2;
var
cosHalfTheta
=
qa
.
w
*
qb
.
w
+
qa
.
x
*
qb
.
x
+
qa
.
y
*
qb
.
y
+
qa
.
z
*
qb
.
z
;
var wx = w*x2;
var wy = w*y2;
var wz = w*z2;
if
(
Math
.
abs
(
cosHalfTheta
)
>=
1.0
)
{
dest[0] = 1 - (yy + zz);
dest[1] = xy - wz;
dest[2] = xz + wy;
dest[3] = 0;
qm
.
w
=
qa
.
w
;
qm
.
x
=
qa
.
x
;
qm
.
y
=
qa
.
y
;
qm
.
z
=
qa
.
z
;
return
qm
;
dest[4] = xy + wz;
dest[5] = 1 - (xx + zz);
dest[6] = yz - wx;
dest[7] = 0;
}
dest[8] = xz - wy;
dest[9] = yz + wx;
dest[10] = 1 - (xx + yy);
dest[11] = 0;
var
halfTheta
=
Math
.
acos
(
cosHalfTheta
),
sinHalfTheta
=
Math
.
sqrt
(
1.0
-
cosHalfTheta
*
cosHalfTheta
);
dest[12] = 0;
dest[13] = 0;
dest[14] = 0;
dest[15] = 1;
if
(
Math
.
abs
(
sinHalfTheta
)
<
0.001
)
{
*/
};
qm
.
w
=
0.5
*
(
qa
.
w
+
qb
.
w
);
qm
.
x
=
0.5
*
(
qa
.
x
+
qb
.
x
);
qm
.
y
=
0.5
*
(
qa
.
y
+
qb
.
y
);
qm
.
z
=
0.5
*
(
qa
.
z
+
qb
.
z
);
THREE
.
Quaternion
.
slerp
=
function
(
qa
,
qb
,
qm
,
t
)
{
var
cosHalfTheta
=
qa
.
w
*
qb
.
w
+
qa
.
x
*
qb
.
x
+
qa
.
y
*
qb
.
y
+
qa
.
z
*
qb
.
z
;
if
(
Math
.
abs
(
cosHalfTheta
)
>=
1.0
)
{
qm
.
w
=
qa
.
w
;
qm
.
x
=
qa
.
x
;
qm
.
y
=
qa
.
y
;
qm
.
z
=
qa
.
z
;
return
qm
;
}
var
halfTheta
=
Math
.
acos
(
cosHalfTheta
),
sinHalfTheta
=
Math
.
sqrt
(
1.0
-
cosHalfTheta
*
cosHalfTheta
);
return
qm
;
if
(
Math
.
abs
(
sinHalfTheta
)
<
0.001
)
{
qm
.
w
=
0.5
*
(
qa
.
w
+
qb
.
w
);
qm
.
x
=
0.5
*
(
qa
.
x
+
qb
.
x
);
qm
.
y
=
0.5
*
(
qa
.
y
+
qb
.
y
);
qm
.
z
=
0.5
*
(
qa
.
z
+
qb
.
z
);
return
qm
;
}
}
var
ratioA
=
Math
.
sin
(
(
1
-
t
)
*
halfTheta
)
/
sinHalfTheta
,
var
ratioA
=
Math
.
sin
(
(
1
-
t
)
*
halfTheta
)
/
sinHalfTheta
,
ratioB
=
Math
.
sin
(
t
*
halfTheta
)
/
sinHalfTheta
;
qm
.
w
=
(
qa
.
w
*
ratioA
+
qb
.
w
*
ratioB
);
qm
.
x
=
(
qa
.
x
*
ratioA
+
qb
.
x
*
ratioB
);
qm
.
y
=
(
qa
.
y
*
ratioA
+
qb
.
y
*
ratioB
);
qm
.
z
=
(
qa
.
z
*
ratioA
+
qb
.
z
*
ratioB
);
return
qm
;
qm
.
w
=
(
qa
.
w
*
ratioA
+
qb
.
w
*
ratioB
);
qm
.
x
=
(
qa
.
x
*
ratioA
+
qb
.
x
*
ratioB
);
qm
.
y
=
(
qa
.
y
*
ratioA
+
qb
.
y
*
ratioB
);
qm
.
z
=
(
qa
.
z
*
ratioA
+
qb
.
z
*
ratioB
);
};
return
qm
;
}
}
src/core/Ray.js
浏览文件 @
e7e47b1f
...
...
@@ -11,7 +11,7 @@ THREE.Ray = function ( origin, direction ) {
THREE
.
Ray
.
prototype
=
{
intersectScene
:
function
(
scene
)
{
intersectScene
:
function
(
scene
)
{
var
i
,
l
,
object
,
objects
=
scene
.
objects
,
...
...
@@ -35,7 +35,7 @@ THREE.Ray.prototype = {
},
intersectObject
:
function
(
object
)
{
intersectObject
:
function
(
object
)
{
var
f
,
fl
,
face
,
a
,
b
,
c
,
d
,
normal
,
dot
,
scalar
,
...
...
src/core/UV.js
浏览文件 @
e7e47b1f
...
...
@@ -4,21 +4,40 @@
THREE
.
UV
=
function
(
u
,
v
)
{
this
.
u
=
u
||
0
;
this
.
v
=
v
||
0
;
this
.
set
(
u
||
0
,
v
||
0
);
};
THREE
.
UV
.
prototype
=
{
copy
:
function
(
uv
)
{
set
:
function
(
u
,
v
)
{
this
.
u
=
u
;
this
.
v
=
v
;
return
this
;
},
copy
:
function
(
uv
)
{
this
.
set
(
uv
.
u
,
uv
.
v
);
this
.
u
=
uv
.
u
;
this
.
v
=
uv
.
v
;
return
this
;
},
toString
:
function
()
{
toString
:
function
()
{
return
'
THREE.UV (
'
+
this
.
u
+
'
,
'
+
this
.
v
+
'
)
'
;
...
...
src/core/Vector2.js
浏览文件 @
e7e47b1f
...
...
@@ -5,14 +5,18 @@
THREE
.
Vector2
=
function
(
x
,
y
)
{
this
.
x
=
x
||
0
;
this
.
y
=
y
||
0
;
this
.
set
(
x
||
0
,
y
||
0
);
};
THREE
.
Vector2
.
prototype
=
{
set
:
function
(
x
,
y
)
{
set
:
function
(
x
,
y
)
{
this
.
x
=
x
;
this
.
y
=
y
;
...
...
@@ -21,96 +25,124 @@ THREE.Vector2.prototype = {
},
copy
:
function
(
v
)
{
copy
:
function
(
v
)
{
this
.
set
(
this
.
x
=
v
.
x
;
this
.
y
=
v
.
y
;
v
.
x
,
v
.
y
);
return
this
;
},
addSelf
:
function
(
v
)
{
addSelf
:
function
(
v
)
{
this
.
set
(
this
.
x
+
v
.
x
,
this
.
y
+
v
.
y
this
.
x
+=
v
.
x
;
this
.
y
+=
v
.
y
;
);
return
this
;
},
add
:
function
(
v1
,
v2
)
{
add
:
function
(
v1
,
v2
)
{
this
.
x
=
v1
.
x
+
v2
.
x
;
this
.
y
=
v1
.
y
+
v2
.
y
;
this
.
set
(
v1
.
x
+
v2
.
x
,
v1
.
y
+
v2
.
y
);
return
this
;
},
subSelf
:
function
(
v
)
{
subSelf
:
function
(
v
)
{
this
.
set
(
this
.
x
-=
v
.
x
;
this
.
y
-=
v
.
y
;
this
.
x
-
v
.
x
,
this
.
y
-
v
.
y
);
return
this
;
},
sub
:
function
(
v1
,
v2
)
{
sub
:
function
(
v1
,
v2
)
{
this
.
set
(
v1
.
x
-
v2
.
x
,
v1
.
y
-
v2
.
y
this
.
x
=
v1
.
x
-
v2
.
x
;
this
.
y
=
v1
.
y
-
v2
.
y
;
);
return
this
;
},
multiplyScalar
:
function
(
s
)
{
multiplyScalar
:
function
(
s
)
{
this
.
x
*=
s
;
this
.
y
*=
s
;
this
.
set
(
this
.
x
*
s
,
this
.
y
*
s
);
return
this
;
},
unit
:
function
()
{
negate
:
function
()
{
this
.
multiplyScalar
(
1
/
this
.
length
()
);
this
.
set
(
-
this
.
x
,
-
this
.
y
);
return
this
;
},
length
:
function
()
{
unit
:
function
()
{
this
.
multiplyScalar
(
1
/
this
.
length
()
);
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
)
;
return
this
;
},
length
Sq
:
function
()
{
length
:
function
()
{
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
;
return
Math
.
sqrt
(
this
.
lengthSq
()
)
;
},
negate
:
function
()
{
lengthSq
:
function
()
{
this
.
x
=
-
this
.
x
;
this
.
y
=
-
this
.
y
;
return
this
;
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
;
},
clone
:
function
()
{
clone
:
function
()
{
return
new
THREE
.
Vector2
(
this
.
x
,
this
.
y
);
},
toString
:
function
()
{
toString
:
function
()
{
return
'
THREE.Vector2 (
'
+
this
.
x
+
'
,
'
+
this
.
y
+
'
)
'
;
...
...
src/core/Vector4.js
浏览文件 @
e7e47b1f
...
...
@@ -6,17 +6,20 @@
THREE
.
Vector4
=
function
(
x
,
y
,
z
,
w
)
{
this
.
x
=
x
||
0
;
this
.
y
=
y
||
0
;
this
.
z
=
z
||
0
;
//this.w = w !== undefined ? w : 1;
this
.
w
=
w
||
1
;
this
.
set
(
x
||
0
,
y
||
0
,
z
||
0
,
w
||
1
);
};
THREE
.
Vector4
.
prototype
=
{
set
:
function
(
x
,
y
,
z
,
w
)
{
set
:
function
(
x
,
y
,
z
,
w
)
{
this
.
x
=
x
;
this
.
y
=
y
;
...
...
@@ -27,99 +30,131 @@ THREE.Vector4.prototype = {
},
copy
:
function
(
v
)
{
copy
:
function
(
v
)
{
this
.
set
(
this
.
x
=
v
.
x
;
this
.
y
=
v
.
y
;
this
.
z
=
v
.
z
;
this
.
w
=
v
.
w
||
1.0
;
v
.
x
,
v
.
y
,
v
.
z
,
v
.
w
||
1.0
);
return
this
;
},
add
:
function
(
v1
,
v2
)
{
add
:
function
(
v1
,
v2
)
{
this
.
set
(
this
.
x
=
v1
.
x
+
v2
.
x
;
this
.
y
=
v1
.
y
+
v2
.
y
;
this
.
z
=
v1
.
z
+
v2
.
z
;
this
.
w
=
v1
.
w
+
v2
.
w
;
v1
.
x
+
v2
.
x
,
v1
.
y
+
v2
.
y
,
v1
.
z
+
v2
.
z
,
v1
.
w
+
v2
.
w
);
return
this
;
},
addSelf
:
function
(
v
)
{
addSelf
:
function
(
v
)
{
this
.
set
(
this
.
x
+=
v
.
x
;
this
.
y
+=
v
.
y
;
this
.
z
+=
v
.
z
;
this
.
w
+=
v
.
w
;
this
.
x
+
v
.
x
,
this
.
y
+
v
.
y
,
this
.
z
+
v
.
z
,
this
.
w
+
v
.
w
);
return
this
;
},
sub
:
function
(
v1
,
v2
)
{
sub
:
function
(
v1
,
v2
)
{
this
.
set
(
this
.
x
=
v1
.
x
-
v2
.
x
;
this
.
y
=
v1
.
y
-
v2
.
y
;
this
.
z
=
v1
.
z
-
v2
.
z
;
this
.
w
=
v1
.
w
-
v2
.
w
;
v1
.
x
-
v2
.
x
,
v1
.
y
-
v2
.
y
,
v1
.
z
-
v2
.
z
,
v1
.
w
-
v2
.
w
);
return
this
;
},
subSelf
:
function
(
v
)
{
subSelf
:
function
(
v
)
{
this
.
set
(
this
.
x
-
v
.
x
,
this
.
y
-
v
.
y
,
this
.
z
-
v
.
z
,
this
.
w
-
v
.
w
this
.
x
-=
v
.
x
;
this
.
y
-=
v
.
y
;
this
.
z
-=
v
.
z
;
this
.
w
-=
v
.
w
;
);
return
this
;
},
multiplyScalar
:
function
(
s
)
{
multiplyScalar
:
function
(
s
)
{
this
.
set
(
this
.
x
*
s
,
this
.
y
*
s
,
this
.
z
*
s
,
this
.
w
*
s
this
.
x
*=
s
;
this
.
y
*=
s
;
this
.
z
*=
s
;
this
.
w
*=
s
;
);
return
this
;
},
divideScalar
:
function
(
s
)
{
divideScalar
:
function
(
s
)
{
this
.
x
/=
s
;
this
.
y
/=
s
;
this
.
z
/=
s
;
this
.
w
/=
s
;
this
.
set
(
this
.
x
/
s
,
this
.
y
/
s
,
this
.
z
/
s
,
this
.
w
/
s
);
return
this
;
},
lerpSelf
:
function
(
v
,
alpha
)
{
lerpSelf
:
function
(
v
,
alpha
)
{
this
.
set
(
this
.
x
+
(
v
.
x
-
this
.
x
)
*
alpha
,
this
.
y
+
(
v
.
y
-
this
.
y
)
*
alpha
,
this
.
z
+
(
v
.
z
-
this
.
z
)
*
alpha
,
this
.
w
+
(
v
.
w
-
this
.
w
)
*
alpha
this
.
x
=
this
.
x
+
(
v
.
x
-
this
.
x
)
*
alpha
;
this
.
y
=
this
.
y
+
(
v
.
y
-
this
.
y
)
*
alpha
;
this
.
z
=
this
.
z
+
(
v
.
z
-
this
.
z
)
*
alpha
;
this
.
w
=
this
.
w
+
(
v
.
w
-
this
.
w
)
*
alpha
;
);
},
clone
:
function
()
{
clone
:
function
()
{
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
);
},
toString
:
function
()
{
toString
:
function
()
{
return
'
THREE.Vector4 (
'
+
this
.
x
+
'
,
'
+
this
.
y
+
'
,
'
+
this
.
z
+
'
,
'
+
this
.
w
+
'
)
'
;
...
...
src/core/Vertex.js
浏览文件 @
e7e47b1f
...
...
@@ -20,8 +20,9 @@ THREE.Vertex = function ( position, normal ) {
THREE
.
Vertex
.
prototype
=
{
toString
:
function
()
{
toString
:
function
()
{
return
'
THREE.Vertex ( position:
'
+
this
.
position
+
'
, normal:
'
+
this
.
normal
+
'
)
'
;
}
};
src/lights/AmbientLight.js
浏览文件 @
e7e47b1f
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
AmbientLight
=
function
(
hex
)
{
THREE
.
Light
.
call
(
this
,
hex
);
...
...
src/lights/DirectionalLight.js
浏览文件 @
e7e47b1f
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
DirectionalLight
=
function
(
hex
,
intensity
)
{
THREE
.
Light
.
call
(
this
,
hex
);
...
...
src/lights/Light.js
浏览文件 @
e7e47b1f
...
...
@@ -6,12 +6,11 @@
THREE
.
Light
=
function
(
hex
)
{
THREE
.
Object3D
.
call
(
this
);
this
.
color
=
new
THREE
.
Color
(
hex
);
};
THREE
.
Light
.
prototype
=
new
THREE
.
Object3D
();
THREE
.
Light
.
prototype
=
new
THREE
.
Object3D
();
THREE
.
Light
.
prototype
.
constructor
=
THREE
.
Light
;
THREE
.
Light
.
prototype
.
supr
=
THREE
.
Object3D
.
prototype
;
THREE
.
Light
.
prototype
.
supr
=
THREE
.
Object3D
.
prototype
;
src/lights/PointLight.js
浏览文件 @
e7e47b1f
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
PointLight
=
function
(
hex
,
intensity
)
{
THREE
.
Light
.
call
(
this
,
hex
);
...
...
src/materials/Mappings.js
0 → 100644
浏览文件 @
e7e47b1f
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
CubeReflectionMapping
=
function
()
{};
THREE
.
CubeRefractionMapping
=
function
()
{};
THREE
.
LatitudeReflectionMapping
=
function
()
{};
THREE
.
LatitudeRefractionMapping
=
function
()
{};
THREE
.
SphericalReflectionMapping
=
function
()
{};
THREE
.
SphericalRefractionMapping
=
function
()
{};
THREE
.
UVMapping
=
function
()
{};
src/materials/mappings/CubeReflectionMapping.js
已删除
100644 → 0
浏览文件 @
04172c6c
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
CubeReflectionMapping
=
function
()
{
};
src/materials/mappings/CubeRefractionMapping.js
已删除
100644 → 0
浏览文件 @
04172c6c
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
CubeRefractionMapping
=
function
()
{
};
src/materials/mappings/LatitudeReflectionMapping.js
已删除
100644 → 0
浏览文件 @
04172c6c
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
LatitudeReflectionMapping
=
function
()
{
};
src/materials/mappings/LatitudeRefractionMapping.js
已删除
100644 → 0
浏览文件 @
04172c6c
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
LatitudeRefractionMapping
=
function
()
{
};
src/materials/mappings/SphericalReflectionMapping.js
已删除
100644 → 0
浏览文件 @
04172c6c
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
SphericalReflectionMapping
=
function
()
{
};
src/materials/mappings/SphericalRefractionMapping.js
已删除
100644 → 0
浏览文件 @
04172c6c
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
SphericalRefractionMapping
=
function
()
{
};
src/materials/mappings/UVMapping.js
已删除
100644 → 0
浏览文件 @
04172c6c
/**
* @author mr.doob / http://mrdoob.com/
*/
THREE
.
UVMapping
=
function
()
{
};
src/scenes/Scene.js
浏览文件 @
e7e47b1f
...
...
@@ -112,7 +112,7 @@ THREE.Scene.prototype.removeChildRecurse = function( child ) {
}
THREE
.
Scene
.
prototype
.
addObject
=
THREE
.
Scene
.
prototype
.
addChild
;
THREE
.
Scene
.
prototype
.
addObject
=
THREE
.
Scene
.
prototype
.
addChild
;
THREE
.
Scene
.
prototype
.
removeObject
=
THREE
.
Scene
.
prototype
.
removeChild
;
THREE
.
Scene
.
prototype
.
addLight
=
THREE
.
Scene
.
prototype
.
addChild
;
THREE
.
Scene
.
prototype
.
removeLight
=
THREE
.
Scene
.
prototype
.
removeChild
;
THREE
.
Scene
.
prototype
.
addLight
=
THREE
.
Scene
.
prototype
.
addChild
;
THREE
.
Scene
.
prototype
.
removeLight
=
THREE
.
Scene
.
prototype
.
removeChild
;
utils/build.py
浏览文件 @
e7e47b1f
...
...
@@ -37,6 +37,7 @@ COMMON_FILES = [
'lights/DirectionalLight.js'
,
'lights/PointLight.js'
,
'materials/Material.js'
,
'materials/Mappings.js'
,
'materials/LineBasicMaterial.js'
,
'materials/MeshBasicMaterial.js'
,
'materials/MeshLambertMaterial.js'
,
...
...
@@ -51,13 +52,6 @@ COMMON_FILES = [
'materials/Texture.js'
,
'materials/RenderTarget.js'
,
'materials/Uniforms.js'
,
'materials/mappings/CubeReflectionMapping.js'
,
'materials/mappings/CubeRefractionMapping.js'
,
'materials/mappings/LatitudeReflectionMapping.js'
,
'materials/mappings/LatitudeRefractionMapping.js'
,
'materials/mappings/SphericalReflectionMapping.js'
,
'materials/mappings/SphericalRefractionMapping.js'
,
'materials/mappings/UVMapping.js'
,
'objects/Particle.js'
,
'objects/ParticleSystem.js'
,
'objects/Line.js'
,
...
...
@@ -186,6 +180,7 @@ CANVAS_FILES = [
'lights/DirectionalLight.js'
,
'lights/PointLight.js'
,
'materials/Material.js'
,
'materials/Mappings.js'
,
'materials/LineBasicMaterial.js'
,
'materials/MeshBasicMaterial.js'
,
'materials/MeshLambertMaterial.js'
,
...
...
@@ -196,13 +191,6 @@ CANVAS_FILES = [
'materials/ParticleBasicMaterial.js'
,
'materials/ParticleCircleMaterial.js'
,
'materials/Texture.js'
,
'materials/mappings/CubeReflectionMapping.js'
,
'materials/mappings/CubeRefractionMapping.js'
,
'materials/mappings/LatitudeReflectionMapping.js'
,
'materials/mappings/LatitudeRefractionMapping.js'
,
'materials/mappings/SphericalReflectionMapping.js'
,
'materials/mappings/SphericalRefractionMapping.js'
,
'materials/mappings/UVMapping.js'
,
'objects/Particle.js'
,
'objects/Line.js'
,
'objects/Mesh.js'
,
...
...
@@ -237,6 +225,7 @@ WEBGL_FILES = [
'lights/DirectionalLight.js'
,
'lights/PointLight.js'
,
'materials/Material.js'
,
'materials/Mappings.js'
,
'materials/LineBasicMaterial.js'
,
'materials/MeshBasicMaterial.js'
,
'materials/MeshLambertMaterial.js'
,
...
...
@@ -250,13 +239,6 @@ WEBGL_FILES = [
'materials/Texture.js'
,
'materials/RenderTarget.js'
,
'materials/Uniforms.js'
,
'materials/mappings/CubeReflectionMapping.js'
,
'materials/mappings/CubeRefractionMapping.js'
,
'materials/mappings/LatitudeReflectionMapping.js'
,
'materials/mappings/LatitudeRefractionMapping.js'
,
'materials/mappings/SphericalReflectionMapping.js'
,
'materials/mappings/SphericalRefractionMapping.js'
,
'materials/mappings/UVMapping.js'
,
'objects/Particle.js'
,
'objects/ParticleSystem.js'
,
'objects/Line.js'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录