Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
fktz008
three.js
提交
d7747258
T
three.js
项目概览
fktz008
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
d7747258
编写于
1月 03, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated builds.
上级
fc8ac581
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
28 deletion
+26
-28
build/Three.js
build/Three.js
+13
-14
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+7
-7
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+6
-7
未找到文件。
build/Three.js
浏览文件 @
d7747258
此差异已折叠。
点击以展开。
build/custom/ThreeExtras.js
浏览文件 @
d7747258
此差异已折叠。
点击以展开。
build/custom/ThreeWebGL.js
浏览文件 @
d7747258
...
...
@@ -2,10 +2,7 @@
'
use strict
'
;
var
THREE
=
THREE
||
{};
if
(
!
self
.
Int32Array
)
self
.
Int32Array
=
Array
,
self
.
Float32Array
=
Array
;
if
(
!
self
.
requestAnimationFrame
)
self
.
requestAnimationFrame
=
function
(){
return
self
.
webkitRequestAnimationFrame
||
self
.
mozRequestAnimationFrame
||
self
.
oRequestAnimationFrame
||
self
.
msRequestAnimationFrame
||
function
(
a
){
self
.
setTimeout
(
a
,
1
E3
/
60
)}}();
THREE
.
Color
=
function
(
a
){
void
0
!==
a
&&
this
.
setHex
(
a
);
return
this
};
THREE
.
Color
.
prototype
=
{
constructor
:
THREE
.
Color
,
r
:
1
,
g
:
1
,
b
:
1
,
copy
:
function
(
a
){
this
.
r
=
a
.
r
;
this
.
g
=
a
.
g
;
this
.
b
=
a
.
b
;
return
this
},
copyGammaToLinear
:
function
(
a
){
this
.
r
=
a
.
r
*
a
.
r
;
this
.
g
=
a
.
g
*
a
.
g
;
this
.
b
=
a
.
b
*
a
.
b
;
return
this
},
copyLinearToGamma
:
function
(
a
){
this
.
r
=
Math
.
sqrt
(
a
.
r
);
this
.
g
=
Math
.
sqrt
(
a
.
g
);
this
.
b
=
Math
.
sqrt
(
a
.
b
);
return
this
},
convertGammaToLinear
:
function
(){
var
a
=
this
.
r
,
b
=
this
.
g
,
c
=
this
.
b
;
this
.
r
=
a
*
a
;
this
.
g
=
b
*
b
;
this
.
b
=
c
*
c
;
return
this
},
convertLinearToGamma
:
function
(){
this
.
r
=
Math
.
sqrt
(
this
.
r
);
this
.
g
=
Math
.
sqrt
(
this
.
g
);
this
.
b
=
Math
.
sqrt
(
this
.
b
);
return
this
},
setRGB
:
function
(
a
,
b
,
c
){
this
.
r
=
a
;
this
.
g
=
b
;
this
.
b
=
c
;
return
this
},
setHSV
:
function
(
a
,
b
,
c
){
var
d
,
g
,
e
;
if
(
0
===
c
)
this
.
r
=
this
.
g
=
this
.
b
=
0
;
else
switch
(
d
=
Math
.
floor
(
6
*
a
),
g
=
6
*
a
-
d
,
a
=
c
*
(
1
-
b
),
e
=
c
*
(
1
-
b
*
g
),
b
=
c
*
(
1
-
b
*
(
1
-
g
)),
d
){
case
1
:
this
.
r
=
e
;
this
.
g
=
c
;
this
.
b
=
a
;
break
;
case
2
:
this
.
r
=
a
;
this
.
g
=
c
;
this
.
b
=
b
;
break
;
case
3
:
this
.
r
=
a
;
this
.
g
=
e
;
this
.
b
=
c
;
break
;
case
4
:
this
.
r
=
b
;
this
.
g
=
a
;
this
.
b
=
c
;
break
;
case
5
:
this
.
r
=
c
;
this
.
g
=
a
;
this
.
b
=
e
;
break
;
case
6
:
case
0
:
this
.
r
=
c
,
this
.
g
=
b
,
this
.
b
=
a
}
return
this
},
setHex
:
function
(
a
){
a
=
Math
.
floor
(
a
);
this
.
r
=
(
a
>>
16
&
255
)
/
255
;
this
.
g
=
(
a
>>
8
&
255
)
/
255
;
this
.
b
=
(
a
&
255
)
/
255
;
return
this
},
getHex
:
function
(){
return
Math
.
floor
(
255
*
this
.
r
)
<<
16
^
Math
.
floor
(
255
*
this
.
g
)
<<
8
^
Math
.
floor
(
255
*
this
.
b
)},
getContextStyle
:
function
(){
return
"
rgb(
"
+
Math
.
floor
(
255
*
this
.
r
)
+
"
,
"
+
Math
.
floor
(
255
*
this
.
g
)
+
"
,
"
+
Math
.
floor
(
255
*
this
.
b
)
+
"
)
"
},
clone
:
function
(){
return
(
new
THREE
.
Color
).
setRGB
(
this
.
r
,
this
.
g
,
this
.
b
)}};
THREE
.
Frustum
=
function
(){
this
.
planes
=
[
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
]};
THREE
.
Frustum
.
prototype
.
setFromMatrix
=
function
(
a
){
var
b
,
c
=
this
.
planes
;
c
[
0
].
set
(
a
.
n41
-
a
.
n11
,
a
.
n42
-
a
.
n12
,
a
.
n43
-
a
.
n13
,
a
.
n44
-
a
.
n14
);
c
[
1
].
set
(
a
.
n41
+
a
.
n11
,
a
.
n42
+
a
.
n12
,
a
.
n43
+
a
.
n13
,
a
.
n44
+
a
.
n14
);
c
[
2
].
set
(
a
.
n41
+
a
.
n21
,
a
.
n42
+
a
.
n22
,
a
.
n43
+
a
.
n23
,
a
.
n44
+
a
.
n24
);
c
[
3
].
set
(
a
.
n41
-
a
.
n21
,
a
.
n42
-
a
.
n22
,
a
.
n43
-
a
.
n23
,
a
.
n44
-
a
.
n24
);
c
[
4
].
set
(
a
.
n41
-
a
.
n31
,
a
.
n42
-
a
.
n32
,
a
.
n43
-
a
.
n33
,
a
.
n44
-
a
.
n34
);
c
[
5
].
set
(
a
.
n41
+
a
.
n31
,
a
.
n42
+
a
.
n32
,
a
.
n43
+
a
.
n33
,
a
.
n44
+
a
.
n34
);
for
(
a
=
0
;
6
>
a
;
a
++
)
b
=
c
[
a
],
b
.
divideScalar
(
Math
.
sqrt
(
b
.
x
*
b
.
x
+
b
.
y
*
b
.
y
+
b
.
z
*
b
.
z
))};
THREE
.
Frustum
.
prototype
.
contains
=
function
(
a
){
for
(
var
b
=
this
.
planes
,
c
=
a
.
matrixWorld
,
d
=-
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
a
.
scale
.
x
,
Math
.
max
(
a
.
scale
.
y
,
a
.
scale
.
z
)),
g
=
0
;
6
>
g
;
g
++
)
if
(
a
=
b
[
g
].
x
*
c
.
n14
+
b
[
g
].
y
*
c
.
n24
+
b
[
g
].
z
*
c
.
n34
+
b
[
g
].
w
,
a
<=
d
)
return
!
1
;
return
!
0
};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
};
Math
.
floor
(
a
);
this
.
r
=
(
a
>>
16
&
255
)
/
255
;
this
.
g
=
(
a
>>
8
&
255
)
/
255
;
this
.
b
=
(
a
&
255
)
/
255
;
return
this
},
getHex
:
function
(){
return
Math
.
floor
(
255
*
this
.
r
)
<<
16
^
Math
.
floor
(
255
*
this
.
g
)
<<
8
^
Math
.
floor
(
255
*
this
.
b
)},
getContextStyle
:
function
(){
return
"
rgb(
"
+
Math
.
floor
(
255
*
this
.
r
)
+
"
,
"
+
Math
.
floor
(
255
*
this
.
g
)
+
"
,
"
+
Math
.
floor
(
255
*
this
.
b
)
+
"
)
"
},
clone
:
function
(){
return
(
new
THREE
.
Color
).
setRGB
(
this
.
r
,
this
.
g
,
this
.
b
)}};
THREE
.
Vector2
=
function
(
a
,
b
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
};
THREE
.
Vector2
.
prototype
=
{
constructor
:
THREE
.
Vector2
,
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
},
clone
:
function
(){
return
new
THREE
.
Vector2
(
this
.
x
,
this
.
y
)},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
return
this
},
addSelf
:
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
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
a
?(
this
.
x
/=
a
,
this
.
y
/=
a
):
this
.
set
(
0
,
0
);
return
this
},
negate
:
function
(){
return
this
.
multiplyScalar
(
-
1
)},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
lengthSq
())},
normalize
:
function
(){
return
this
.
divideScalar
(
this
.
length
())},
distanceTo
:
function
(
a
){
return
Math
.
sqrt
(
this
.
distanceToSquared
(
a
))},
distanceToSquared
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
a
=
this
.
y
-
a
.
y
;
return
b
*
b
+
a
*
a
},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
equals
:
function
(
a
){
return
a
.
x
===
this
.
x
&&
a
.
y
===
this
.
y
}};
THREE
.
Vector3
=
function
(
a
,
b
,
c
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
c
||
0
};
...
...
@@ -16,7 +13,9 @@ cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y
this
.
y
=
Math
.
asin
(
a
.
n13
);
1.0
E
-
5
<
Math
.
abs
(
b
)?(
this
.
x
=
Math
.
atan2
(
-
a
.
n23
/
b
,
a
.
n33
/
b
),
this
.
z
=
Math
.
atan2
(
-
a
.
n12
/
b
,
a
.
n11
/
b
)):(
this
.
x
=
0
,
this
.
z
=
Math
.
atan2
(
a
.
n21
,
a
.
n22
))},
isZero
:
function
(){
return
1.0
E
-
4
>
this
.
lengthSq
()}};
THREE
.
Vector4
=
function
(
a
,
b
,
c
,
d
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
c
||
0
;
this
.
w
=
void
0
!==
d
?
d
:
1
};
THREE
.
Vector4
.
prototype
=
{
constructor
:
THREE
.
Vector4
,
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
=
void
0
!==
a
.
w
?
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
.
z
=
this
.
y
=
this
.
x
=
0
,
this
.
w
=
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
}};
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
.
Frustum
=
function
(){
this
.
planes
=
[
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
,
new
THREE
.
Vector4
]};
THREE
.
Frustum
.
prototype
.
setFromMatrix
=
function
(
a
){
var
b
,
c
=
this
.
planes
;
c
[
0
].
set
(
a
.
n41
-
a
.
n11
,
a
.
n42
-
a
.
n12
,
a
.
n43
-
a
.
n13
,
a
.
n44
-
a
.
n14
);
c
[
1
].
set
(
a
.
n41
+
a
.
n11
,
a
.
n42
+
a
.
n12
,
a
.
n43
+
a
.
n13
,
a
.
n44
+
a
.
n14
);
c
[
2
].
set
(
a
.
n41
+
a
.
n21
,
a
.
n42
+
a
.
n22
,
a
.
n43
+
a
.
n23
,
a
.
n44
+
a
.
n24
);
c
[
3
].
set
(
a
.
n41
-
a
.
n21
,
a
.
n42
-
a
.
n22
,
a
.
n43
-
a
.
n23
,
a
.
n44
-
a
.
n24
);
c
[
4
].
set
(
a
.
n41
-
a
.
n31
,
a
.
n42
-
a
.
n32
,
a
.
n43
-
a
.
n33
,
a
.
n44
-
a
.
n34
);
c
[
5
].
set
(
a
.
n41
+
a
.
n31
,
a
.
n42
+
a
.
n32
,
a
.
n43
+
a
.
n33
,
a
.
n44
+
a
.
n34
);
for
(
a
=
0
;
6
>
a
;
a
++
)
b
=
c
[
a
],
b
.
divideScalar
(
Math
.
sqrt
(
b
.
x
*
b
.
x
+
b
.
y
*
b
.
y
+
b
.
z
*
b
.
z
))};
THREE
.
Frustum
.
prototype
.
contains
=
function
(
a
){
for
(
var
b
=
this
.
planes
,
c
=
a
.
matrixWorld
,
d
=
THREE
.
Frustum
.
__v1
.
set
(
c
.
getColumnX
().
length
(),
c
.
getColumnY
().
length
(),
c
.
getColumnZ
().
length
()),
d
=-
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
d
.
x
,
Math
.
max
(
d
.
y
,
d
.
z
)),
g
=
0
;
6
>
g
;
g
++
)
if
(
a
=
b
[
g
].
x
*
c
.
n14
+
b
[
g
].
y
*
c
.
n24
+
b
[
g
].
z
*
c
.
n34
+
b
[
g
].
w
,
a
<=
d
)
return
!
1
;
return
!
0
};
THREE
.
Frustum
.
__v1
=
new
THREE
.
Vector3
;
THREE
.
Ray
=
function
(
a
,
b
){
function
c
(
a
,
b
,
c
){
o
.
sub
(
c
,
a
);
t
=
o
.
dot
(
b
);
v
=
p
.
add
(
a
,
r
.
copy
(
b
).
multiplyScalar
(
t
));
return
F
=
c
.
distanceTo
(
v
)}
function
d
(
a
,
b
,
c
,
d
){
o
.
sub
(
d
,
b
);
p
.
sub
(
c
,
b
);
r
.
sub
(
a
,
b
);
A
=
o
.
dot
(
o
);
K
=
o
.
dot
(
p
);
y
=
o
.
dot
(
r
);
J
=
p
.
dot
(
p
);
H
=
p
.
dot
(
r
);
I
=
1
/
(
A
*
J
-
K
*
K
);
M
=
(
J
*
y
-
K
*
H
)
*
I
;
G
=
(
A
*
H
-
K
*
y
)
*
I
;
return
0
<=
M
&&
0
<=
G
&&
1
>
M
+
G
}
this
.
origin
=
a
||
new
THREE
.
Vector3
;
this
.
direction
=
b
||
new
THREE
.
Vector3
;
this
.
intersectScene
=
function
(
a
){
return
this
.
intersectObjects
(
a
.
children
)};
this
.
intersectObjects
=
function
(
a
){
var
b
,
c
,
d
=
[];
for
(
b
=
0
,
c
=
a
.
length
;
b
<
c
;
b
++
)
Array
.
prototype
.
push
.
apply
(
d
,
this
.
intersectObject
(
a
[
b
]));
d
.
sort
(
function
(
a
,
b
){
return
a
.
distance
-
b
.
distance
});
return
d
};
var
g
=
new
THREE
.
Vector3
,
e
=
new
THREE
.
Vector3
,
h
=
new
THREE
.
Vector3
,
i
=
new
THREE
.
Vector3
,
k
=
new
THREE
.
Vector3
,
l
=
new
THREE
.
Vector3
,
j
=
new
THREE
.
Vector3
,
n
=
new
THREE
.
Vector3
,
m
=
new
THREE
.
Vector3
;
this
.
intersectObject
=
function
(
a
){
for
(
var
b
,
p
=
[],
o
=
0
,
r
=
a
.
children
.
length
;
o
<
r
;
o
++
)
Array
.
prototype
.
push
.
apply
(
p
,
this
.
intersectObject
(
a
.
children
[
o
]));
if
(
a
instanceof
THREE
.
Particle
){
o
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
());
if
(
o
>
a
.
scale
.
x
)
return
[];
b
=
{
distance
:
o
,
point
:
a
.
position
,
face
:
null
,
object
:
a
};
p
.
push
(
b
)}
else
if
(
a
instanceof
THREE
.
Mesh
){
o
=
c
(
this
.
origin
,
this
.
direction
,
a
.
matrixWorld
.
getPosition
());
if
(
o
>
a
.
geometry
.
boundingSphere
.
radius
*
Math
.
max
(
a
.
scale
.
x
,
Math
.
max
(
a
.
scale
.
y
,
a
.
scale
.
z
)))
return
p
;
var
t
,
f
=
a
.
geometry
,
v
=
f
.
vertices
,
y
;
a
.
matrixRotationWorld
.
extractRotation
(
a
.
matrixWorld
);
for
(
o
=
0
,
r
=
f
.
faces
.
length
;
o
<
r
;
o
++
)
if
(
b
=
f
.
faces
[
o
],
k
.
copy
(
this
.
origin
),
l
.
copy
(
this
.
direction
),
...
...
@@ -66,7 +65,7 @@ this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRo
this
.
normalize
();
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
);
0
===
a
?
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
,
g
=
this
.
w
,
e
=
a
.
x
,
h
=
a
.
y
,
i
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
g
*
e
+
c
*
i
-
d
*
h
;
this
.
y
=
c
*
a
+
g
*
h
+
d
*
e
-
b
*
i
;
this
.
z
=
d
*
a
+
g
*
i
+
b
*
h
-
c
*
e
;
this
.
w
=
g
*
a
-
b
*
e
-
c
*
h
-
d
*
i
;
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
,
g
=
a
.
z
,
e
=
this
.
x
,
h
=
this
.
y
,
i
=
this
.
z
,
k
=
this
.
w
,
l
=
k
*
c
+
h
*
g
-
i
*
d
,
j
=
k
*
d
+
i
*
c
-
e
*
g
,
n
=
k
*
g
+
e
*
d
-
h
*
c
,
c
=-
e
*
c
-
h
*
d
-
i
*
g
;
b
.
x
=
l
*
k
+
c
*-
e
+
j
*-
i
-
n
*-
h
;
b
.
y
=
j
*
k
+
c
*-
h
+
n
*-
e
-
l
*-
i
;
b
.
z
=
n
*
k
+
c
*-
i
+
l
*-
h
-
j
*-
e
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
g
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
0
>
g
?(
c
.
w
=-
b
.
w
,
c
.
x
=-
b
.
x
,
c
.
y
=-
b
.
y
,
c
.
z
=-
b
.
z
,
g
=-
g
):
c
.
copy
(
b
);
if
(
1
<=
Math
.
abs
(
g
))
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
e
=
Math
.
acos
(
g
),
g
=
Math
.
sqrt
(
1
-
g
*
g
);
if
(
0.001
0
>
Math
.
abs
(
g
))
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
;
b
=
Math
.
sin
((
1
-
d
)
*
e
)
/
g
;
d
=
Math
.
sin
(
d
*
e
)
/
g
;
c
.
w
=
a
.
w
*
b
+
c
.
w
*
d
;
c
.
x
=
a
.
x
*
b
+
c
.
x
*
d
;
c
.
y
=
a
.
y
*
b
+
c
.
y
*
d
;
c
.
z
=
a
.
z
*
b
+
c
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
g
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
0
>
g
?(
c
.
w
=-
b
.
w
,
c
.
x
=-
b
.
x
,
c
.
y
=-
b
.
y
,
c
.
z
=-
b
.
z
,
g
=-
g
):
c
.
copy
(
b
);
if
(
1
<=
Math
.
abs
(
g
))
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
e
=
Math
.
acos
(
g
),
g
=
Math
.
sqrt
(
1
-
g
*
g
);
if
(
0.001
>
Math
.
abs
(
g
))
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
;
b
=
Math
.
sin
((
1
-
d
)
*
e
)
/
g
;
d
=
Math
.
sin
(
d
*
e
)
/
g
;
c
.
w
=
a
.
w
*
b
+
c
.
w
*
d
;
c
.
x
=
a
.
x
*
b
+
c
.
x
*
d
;
c
.
y
=
a
.
y
*
b
+
c
.
y
*
d
;
c
.
z
=
a
.
z
*
b
+
c
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
g
,
e
){
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
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materialIndex
=
e
;
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
g
,
e
,
h
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
g
instanceof
THREE
.
Vector3
?
g
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
g
instanceof
Array
?
g
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materialIndex
=
h
;
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
u
=
a
||
0
;
this
.
v
=
b
||
0
};
THREE
.
UV
.
prototype
=
{
constructor
:
THREE
.
UV
,
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
u
=
a
.
u
;
this
.
v
=
a
.
v
;
return
this
},
clone
:
function
(){
return
new
THREE
.
UV
(
this
.
u
,
this
.
v
)}};
...
...
@@ -338,7 +337,7 @@ b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b
"
color
"
);
m
.
scale
=
b
.
getUniformLocation
(
j
,
"
scale
"
);
m
.
rotation
=
b
.
getUniformLocation
(
j
,
"
rotation
"
);
m
.
screenPosition
=
b
.
getUniformLocation
(
j
,
"
screenPosition
"
);
o
=!
1
};
this
.
render
=
function
(
a
,
d
,
g
,
v
){
var
a
=
a
.
__webglFlares
,
F
=
a
.
length
;
if
(
F
){
var
A
=
new
THREE
.
Vector3
,
K
=
v
/
g
,
y
=
0.5
*
g
,
J
=
0.5
*
v
,
H
=
16
/
v
,
I
=
new
THREE
.
Vector2
(
H
*
K
,
H
),
M
=
new
THREE
.
Vector3
(
1
,
1
,
0
),
G
=
new
THREE
.
Vector2
(
1
,
1
),
L
=
m
,
H
=
n
;
b
.
useProgram
(
j
);
o
||
(
b
.
enableVertexAttribArray
(
n
.
vertex
),
b
.
enableVertexAttribArray
(
n
.
uv
),
o
=!
0
);
b
.
uniform1i
(
L
.
occlusionMap
,
0
);
b
.
uniform1i
(
L
.
map
,
1
);
b
.
bindBuffer
(
b
.
ARRAY_BUFFER
,
e
);
b
.
vertexAttribPointer
(
H
.
vertex
,
2
,
b
.
FLOAT
,
!
1
,
16
,
0
);
b
.
vertexAttribPointer
(
H
.
uv
,
2
,
b
.
FLOAT
,
!
1
,
16
,
8
);
b
.
bindBuffer
(
b
.
ELEMENT_ARRAY_BUFFER
,
h
);
b
.
disable
(
b
.
CULL_FACE
);
b
.
depthMask
(
!
1
);
var
ka
,
T
,
la
,
ca
,
z
;
for
(
ka
=
0
;
ka
<
F
;
ka
++
)
if
(
H
=
16
/
v
,
I
.
set
(
H
*
K
,
H
),
ca
=
a
[
ka
],
A
.
set
(
ca
.
matrixWorld
.
n14
,
ca
.
matrixWorld
.
n24
,
ca
.
matrixWorld
.
n34
),
d
.
matrixWorldInverse
.
multiplyVector3
(
A
),
d
.
projectionMatrix
.
multiplyVector3
(
A
),
M
.
copy
(
A
),
G
.
x
=
M
.
x
*
y
+
y
,
G
.
y
=
M
.
y
*
J
+
J
,
l
||
0
<
G
.
x
&&
G
.
x
<
g
&&
0
<
G
.
y
&&
G
.
y
<
v
){
b
.
activeTexture
(
b
.
TEXTURE1
);
b
.
bindTexture
(
b
.
TEXTURE_2D
,
i
);
b
.
copyTexImage2D
(
b
.
TEXTURE_2D
,
0
,
b
.
RGB
,
G
.
x
-
8
,
G
.
y
-
8
,
16
,
16
,
0
);
b
.
uniform1i
(
L
.
renderType
,
0
);
b
.
uniform2f
(
L
.
scale
,
I
.
x
,
I
.
y
);
b
.
uniform3f
(
L
.
screenPosition
,
M
.
x
,
M
.
y
,
M
.
z
);
b
.
disable
(
b
.
BLEND
);
b
.
enable
(
b
.
DEPTH_TEST
);
b
.
drawElements
(
b
.
TRIANGLES
,
6
,
b
.
UNSIGNED_SHORT
,
0
);
b
.
activeTexture
(
b
.
TEXTURE0
);
b
.
bindTexture
(
b
.
TEXTURE_2D
,
k
);
b
.
copyTexImage2D
(
b
.
TEXTURE_2D
,
0
,
b
.
RGBA
,
G
.
x
-
8
,
G
.
y
-
8
,
16
,
16
,
0
);
b
.
uniform1i
(
L
.
renderType
,
1
);
b
.
disable
(
b
.
DEPTH_TEST
);
b
.
activeTexture
(
b
.
TEXTURE1
);
b
.
bindTexture
(
b
.
TEXTURE_2D
,
i
);
b
.
drawElements
(
b
.
TRIANGLES
,
6
,
b
.
UNSIGNED_SHORT
,
0
);
ca
.
positionScreen
.
copy
(
M
);
ca
.
customUpdateCallback
?
ca
.
customUpdateCallback
(
ca
):
ca
.
updateLensFlares
();
b
.
uniform1i
(
L
.
renderType
,
2
);
b
.
enable
(
b
.
BLEND
);
for
(
T
=
0
,
la
=
ca
.
lensFlares
.
length
;
T
<
la
;
T
++
)
if
(
z
=
ca
.
lensFlares
[
T
],
0.001
0
<
z
.
opacity
&&
0.0010
<
z
.
scale
)
M
.
x
=
z
.
x
,
M
.
y
=
z
.
y
,
M
.
z
=
z
.
z
,
H
=
z
.
size
*
z
.
scale
/
v
,
I
.
x
=
H
*
K
,
I
.
y
=
H
,
b
.
uniform3f
(
L
.
screenPosition
,
M
.
x
,
M
.
y
,
M
.
z
),
b
.
uniform2f
(
L
.
scale
,
I
.
x
,
I
.
y
),
b
.
uniform1f
(
L
.
rotation
,
z
.
rotation
),
b
.
uniform1f
(
L
.
opacity
,
z
.
opacity
),
b
.
uniform3f
(
L
.
color
,
i
);
b
.
drawElements
(
b
.
TRIANGLES
,
6
,
b
.
UNSIGNED_SHORT
,
0
);
ca
.
positionScreen
.
copy
(
M
);
ca
.
customUpdateCallback
?
ca
.
customUpdateCallback
(
ca
):
ca
.
updateLensFlares
();
b
.
uniform1i
(
L
.
renderType
,
2
);
b
.
enable
(
b
.
BLEND
);
for
(
T
=
0
,
la
=
ca
.
lensFlares
.
length
;
T
<
la
;
T
++
)
if
(
z
=
ca
.
lensFlares
[
T
],
0.001
<
z
.
opacity
&&
0.001
<
z
.
scale
)
M
.
x
=
z
.
x
,
M
.
y
=
z
.
y
,
M
.
z
=
z
.
z
,
H
=
z
.
size
*
z
.
scale
/
v
,
I
.
x
=
H
*
K
,
I
.
y
=
H
,
b
.
uniform3f
(
L
.
screenPosition
,
M
.
x
,
M
.
y
,
M
.
z
),
b
.
uniform2f
(
L
.
scale
,
I
.
x
,
I
.
y
),
b
.
uniform1f
(
L
.
rotation
,
z
.
rotation
),
b
.
uniform1f
(
L
.
opacity
,
z
.
opacity
),
b
.
uniform3f
(
L
.
color
,
z
.
color
.
r
,
z
.
color
.
g
,
z
.
color
.
b
),
c
.
setBlending
(
z
.
blending
),
c
.
setTexture
(
z
.
texture
,
1
),
b
.
drawElements
(
b
.
TRIANGLES
,
6
,
b
.
UNSIGNED_SHORT
,
0
)}
b
.
enable
(
b
.
CULL_FACE
);
b
.
enable
(
b
.
DEPTH_TEST
);
b
.
depthMask
(
!
0
)}}};
THREE
.
ShadowMapPlugin
=
function
(){
var
a
,
b
,
c
,
d
,
g
,
e
=
new
THREE
.
Frustum
,
h
=
new
THREE
.
Matrix4
;
this
.
shadowMatrix
=
[];
this
.
shadowMap
=
[];
this
.
init
=
function
(
c
){
a
=
c
.
context
;
b
=
c
;
var
c
=
THREE
.
ShaderLib
.
depthRGBA
,
e
=
THREE
.
UniformsUtils
.
clone
(
c
.
uniforms
);
d
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
c
.
fragmentShader
,
vertexShader
:
c
.
vertexShader
,
uniforms
:
e
});
g
=
new
THREE
.
ShaderMaterial
({
fragmentShader
:
c
.
fragmentShader
,
vertexShader
:
c
.
vertexShader
,
uniforms
:
e
,
morphTargets
:
!
0
});
d
.
_shadowPass
=!
0
;
g
.
_shadowPass
=!
0
};
this
.
render
=
function
(
a
,
c
){
b
.
shadowMapEnabled
&&
b
.
shadowMapAutoUpdate
&&
this
.
update
(
a
,
c
)};
this
.
update
=
function
(
i
){
var
k
,
l
,
j
,
n
,
m
,
o
,
p
,
r
,
t
=
0
,
v
=
i
.
lights
;
c
||
(
c
=
new
THREE
.
PerspectiveCamera
(
b
.
shadowCameraFov
,
b
.
shadowMapWidth
/
b
.
shadowMapHeight
,
b
.
shadowCameraNear
,
b
.
shadowCameraFar
));
a
.
clearColor
(
1
,
1
,
1
,
1
);
a
.
disable
(
a
.
BLEND
);
b
.
shadowMapCullFrontFaces
&&
a
.
cullFace
(
a
.
FRONT
);
b
.
setDepthTest
(
!
0
);
for
(
k
=
0
,
l
=
v
.
length
;
k
<
l
;
k
++
)
if
(
p
=
v
[
k
],
p
.
castShadow
&&
p
instanceof
THREE
.
SpotLight
){
this
.
shadowMap
[
t
]
||
(
this
.
shadowMap
[
t
]
=
new
THREE
.
WebGLRenderTarget
(
b
.
shadowMapWidth
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录