Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
d46a1ee3
T
three.js
项目概览
Ablesons
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d46a1ee3
编写于
6月 13, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Checking if WebGLRenderer exists before creating AnaglyphWebGLRenderer and CrosseyedWebGLRenderer.
上级
1bfb6dbe
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
191 addition
and
177 deletion
+191
-177
build/Three.js
build/Three.js
+40
-37
build/custom/ThreeCanvas.js
build/custom/ThreeCanvas.js
+1
-1
build/custom/ThreeDOM.js
build/custom/ThreeDOM.js
+1
-1
build/custom/ThreeExtras.js
build/custom/ThreeExtras.js
+38
-35
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+1
-1
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+2
-2
src/extras/renderers/AnaglyphWebGLRenderer.js
src/extras/renderers/AnaglyphWebGLRenderer.js
+63
-59
src/extras/renderers/CrosseyedWebGLRenderer.js
src/extras/renderers/CrosseyedWebGLRenderer.js
+45
-41
未找到文件。
build/Three.js
浏览文件 @
d46a1ee3
此差异已折叠。
点击以展开。
build/custom/ThreeCanvas.js
浏览文件 @
d46a1ee3
...
@@ -51,7 +51,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
...
@@ -51,7 +51,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
d
;
this
.
z
=
a
.
z
*
d
;
this
.
w
=
Math
.
cos
(
c
);
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
a
==
0
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
a
=
1
/
a
,
this
.
x
*=
a
,
this
.
y
*=
a
,
this
.
z
*=
a
,
this
.
w
*=
a
);
return
this
},
d
;
this
.
z
=
a
.
z
*
d
;
this
.
w
=
Math
.
cos
(
c
);
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
a
==
0
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
a
=
1
/
a
,
this
.
x
*=
a
,
this
.
y
*=
a
,
this
.
z
*=
a
,
this
.
w
*=
a
);
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
g
+
c
*
h
-
d
*
f
;
this
.
y
=
c
*
a
+
e
*
f
+
d
*
g
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
f
-
c
*
g
;
this
.
w
=
e
*
a
-
b
*
g
-
c
*
f
-
d
*
h
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
w
+
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
+
a
.
w
*
b
.
x
;
this
.
y
=-
a
.
x
*
b
.
z
+
a
.
y
*
b
.
w
+
a
.
z
*
b
.
x
+
a
.
w
*
b
.
y
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
+
a
.
z
*
b
.
w
+
a
.
w
*
b
.
z
;
this
.
w
=-
a
.
x
*
b
.
x
-
a
.
y
*
b
.
y
-
a
.
z
*
b
.
z
+
a
.
w
*
b
.
w
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
h
=
this
.
z
,
j
=
this
.
w
,
k
=
j
*
c
+
f
*
e
-
h
*
d
,
m
=
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
g
+
c
*
h
-
d
*
f
;
this
.
y
=
c
*
a
+
e
*
f
+
d
*
g
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
f
-
c
*
g
;
this
.
w
=
e
*
a
-
b
*
g
-
c
*
f
-
d
*
h
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
w
+
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
+
a
.
w
*
b
.
x
;
this
.
y
=-
a
.
x
*
b
.
z
+
a
.
y
*
b
.
w
+
a
.
z
*
b
.
x
+
a
.
w
*
b
.
y
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
+
a
.
z
*
b
.
w
+
a
.
w
*
b
.
z
;
this
.
w
=-
a
.
x
*
b
.
x
-
a
.
y
*
b
.
y
-
a
.
z
*
b
.
z
+
a
.
w
*
b
.
w
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
h
=
this
.
z
,
j
=
this
.
w
,
k
=
j
*
c
+
f
*
e
-
h
*
d
,
m
=
j
*
d
+
h
*
c
-
g
*
e
,
p
=
j
*
e
+
g
*
d
-
f
*
c
,
c
=-
g
*
c
-
f
*
d
-
h
*
e
;
b
.
x
=
k
*
j
+
c
*-
g
+
m
*-
h
-
p
*-
f
;
b
.
y
=
m
*
j
+
c
*-
f
+
p
*-
g
-
k
*-
h
;
b
.
z
=
p
*
j
+
c
*-
h
+
k
*-
f
-
m
*-
g
;
return
b
}};
j
*
d
+
h
*
c
-
g
*
e
,
p
=
j
*
e
+
g
*
d
-
f
*
c
,
c
=-
g
*
c
-
f
*
d
-
h
*
e
;
b
.
x
=
k
*
j
+
c
*-
g
+
m
*-
h
-
p
*-
f
;
b
.
y
=
m
*
j
+
c
*-
f
+
p
*-
g
-
k
*-
h
;
b
.
z
=
p
*
j
+
c
*-
h
+
k
*-
f
-
m
*-
g
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
0
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
edges
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
morphColors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
edges
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
morphColors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
...
...
build/custom/ThreeDOM.js
浏览文件 @
d46a1ee3
...
@@ -51,7 +51,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
...
@@ -51,7 +51,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
d
;
this
.
z
=
a
.
z
*
d
;
this
.
w
=
Math
.
cos
(
c
);
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
a
==
0
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
a
=
1
/
a
,
this
.
x
*=
a
,
this
.
y
*=
a
,
this
.
z
*=
a
,
this
.
w
*=
a
);
return
this
},
d
;
this
.
z
=
a
.
z
*
d
;
this
.
w
=
Math
.
cos
(
c
);
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
a
==
0
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
a
=
1
/
a
,
this
.
x
*=
a
,
this
.
y
*=
a
,
this
.
z
*=
a
,
this
.
w
*=
a
);
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
g
+
c
*
h
-
d
*
f
;
this
.
y
=
c
*
a
+
e
*
f
+
d
*
g
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
f
-
c
*
g
;
this
.
w
=
e
*
a
-
b
*
g
-
c
*
f
-
d
*
h
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
w
+
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
+
a
.
w
*
b
.
x
;
this
.
y
=-
a
.
x
*
b
.
z
+
a
.
y
*
b
.
w
+
a
.
z
*
b
.
x
+
a
.
w
*
b
.
y
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
+
a
.
z
*
b
.
w
+
a
.
w
*
b
.
z
;
this
.
w
=-
a
.
x
*
b
.
x
-
a
.
y
*
b
.
y
-
a
.
z
*
b
.
z
+
a
.
w
*
b
.
w
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
h
=
this
.
z
,
i
=
this
.
w
,
k
=
i
*
c
+
f
*
e
-
h
*
d
,
l
=
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
g
+
c
*
h
-
d
*
f
;
this
.
y
=
c
*
a
+
e
*
f
+
d
*
g
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
f
-
c
*
g
;
this
.
w
=
e
*
a
-
b
*
g
-
c
*
f
-
d
*
h
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
w
+
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
+
a
.
w
*
b
.
x
;
this
.
y
=-
a
.
x
*
b
.
z
+
a
.
y
*
b
.
w
+
a
.
z
*
b
.
x
+
a
.
w
*
b
.
y
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
+
a
.
z
*
b
.
w
+
a
.
w
*
b
.
z
;
this
.
w
=-
a
.
x
*
b
.
x
-
a
.
y
*
b
.
y
-
a
.
z
*
b
.
z
+
a
.
w
*
b
.
w
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
h
=
this
.
z
,
i
=
this
.
w
,
k
=
i
*
c
+
f
*
e
-
h
*
d
,
l
=
i
*
d
+
h
*
c
-
g
*
e
,
n
=
i
*
e
+
g
*
d
-
f
*
c
,
c
=-
g
*
c
-
f
*
d
-
h
*
e
;
b
.
x
=
k
*
i
+
c
*-
g
+
l
*-
h
-
n
*-
f
;
b
.
y
=
l
*
i
+
c
*-
f
+
n
*-
g
-
k
*-
h
;
b
.
z
=
n
*
i
+
c
*-
h
+
k
*-
f
-
l
*-
g
;
return
b
}};
i
*
d
+
h
*
c
-
g
*
e
,
n
=
i
*
e
+
g
*
d
-
f
*
c
,
c
=-
g
*
c
-
f
*
d
-
h
*
e
;
b
.
x
=
k
*
i
+
c
*-
g
+
l
*-
h
-
n
*-
f
;
b
.
y
=
l
*
i
+
c
*-
f
+
n
*-
g
-
k
*-
h
;
b
.
z
=
n
*
i
+
c
*-
h
+
k
*-
f
-
l
*-
g
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
0
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Camera
=
function
(
a
,
b
,
c
,
d
,
e
){
THREE
.
Object3D
.
call
(
this
);
this
.
fov
=
a
||
50
;
this
.
aspect
=
b
||
1
;
this
.
near
=
c
||
0.1
;
this
.
far
=
d
||
2
E3
;
this
.
target
=
e
||
new
THREE
.
Object3D
;
this
.
useTarget
=!
0
;
this
.
matrixWorldInverse
=
new
THREE
.
Matrix4
;
this
.
projectionMatrix
=
null
;
this
.
updateProjectionMatrix
()};
THREE
.
Camera
.
prototype
=
new
THREE
.
Object3D
;
THREE
.
Camera
.
prototype
.
constructor
=
THREE
.
Camera
;
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Camera
=
function
(
a
,
b
,
c
,
d
,
e
){
THREE
.
Object3D
.
call
(
this
);
this
.
fov
=
a
||
50
;
this
.
aspect
=
b
||
1
;
this
.
near
=
c
||
0.1
;
this
.
far
=
d
||
2
E3
;
this
.
target
=
e
||
new
THREE
.
Object3D
;
this
.
useTarget
=!
0
;
this
.
matrixWorldInverse
=
new
THREE
.
Matrix4
;
this
.
projectionMatrix
=
null
;
this
.
updateProjectionMatrix
()};
THREE
.
Camera
.
prototype
=
new
THREE
.
Object3D
;
THREE
.
Camera
.
prototype
.
constructor
=
THREE
.
Camera
;
...
...
build/custom/ThreeExtras.js
浏览文件 @
d46a1ee3
此差异已折叠。
点击以展开。
build/custom/ThreeSVG.js
浏览文件 @
d46a1ee3
...
@@ -51,7 +51,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
...
@@ -51,7 +51,7 @@ THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;thi
d
;
this
.
z
=
a
.
z
*
d
;
this
.
w
=
Math
.
cos
(
c
);
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
a
==
0
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
a
=
1
/
a
,
this
.
x
*=
a
,
this
.
y
*=
a
,
this
.
z
*=
a
,
this
.
w
*=
a
);
return
this
},
d
;
this
.
z
=
a
.
z
*
d
;
this
.
w
=
Math
.
cos
(
c
);
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
a
==
0
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
a
=
1
/
a
,
this
.
x
*=
a
,
this
.
y
*=
a
,
this
.
z
*=
a
,
this
.
w
*=
a
);
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
g
+
c
*
h
-
d
*
f
;
this
.
y
=
c
*
a
+
e
*
f
+
d
*
g
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
f
-
c
*
g
;
this
.
w
=
e
*
a
-
b
*
g
-
c
*
f
-
d
*
h
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
w
+
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
+
a
.
w
*
b
.
x
;
this
.
y
=-
a
.
x
*
b
.
z
+
a
.
y
*
b
.
w
+
a
.
z
*
b
.
x
+
a
.
w
*
b
.
y
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
+
a
.
z
*
b
.
w
+
a
.
w
*
b
.
z
;
this
.
w
=-
a
.
x
*
b
.
x
-
a
.
y
*
b
.
y
-
a
.
z
*
b
.
z
+
a
.
w
*
b
.
w
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
h
=
this
.
z
,
i
=
this
.
w
,
l
=
i
*
c
+
f
*
e
-
h
*
d
,
k
=
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
d
=
this
.
z
,
e
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
h
=
a
.
z
,
a
=
a
.
w
;
this
.
x
=
b
*
a
+
e
*
g
+
c
*
h
-
d
*
f
;
this
.
y
=
c
*
a
+
e
*
f
+
d
*
g
-
b
*
h
;
this
.
z
=
d
*
a
+
e
*
h
+
b
*
f
-
c
*
g
;
this
.
w
=
e
*
a
-
b
*
g
-
c
*
f
-
d
*
h
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
w
+
a
.
y
*
b
.
z
-
a
.
z
*
b
.
y
+
a
.
w
*
b
.
x
;
this
.
y
=-
a
.
x
*
b
.
z
+
a
.
y
*
b
.
w
+
a
.
z
*
b
.
x
+
a
.
w
*
b
.
y
;
this
.
z
=
a
.
x
*
b
.
y
-
a
.
y
*
b
.
x
+
a
.
z
*
b
.
w
+
a
.
w
*
b
.
z
;
this
.
w
=-
a
.
x
*
b
.
x
-
a
.
y
*
b
.
y
-
a
.
z
*
b
.
z
+
a
.
w
*
b
.
w
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
d
=
a
.
y
,
e
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
h
=
this
.
z
,
i
=
this
.
w
,
l
=
i
*
c
+
f
*
e
-
h
*
d
,
k
=
i
*
d
+
h
*
c
-
g
*
e
,
n
=
i
*
e
+
g
*
d
-
f
*
c
,
c
=-
g
*
c
-
f
*
d
-
h
*
e
;
b
.
x
=
l
*
i
+
c
*-
g
+
k
*-
h
-
n
*-
f
;
b
.
y
=
k
*
i
+
c
*-
f
+
n
*-
g
-
l
*-
h
;
b
.
z
=
n
*
i
+
c
*-
h
+
l
*-
f
-
k
*-
g
;
return
b
}};
i
*
d
+
h
*
c
-
g
*
e
,
n
=
i
*
e
+
g
*
d
-
f
*
c
,
c
=-
g
*
c
-
f
*
d
-
h
*
e
;
b
.
x
=
l
*
i
+
c
*-
g
+
k
*-
h
-
n
*-
f
;
b
.
y
=
k
*
i
+
c
*-
f
+
n
*-
g
-
l
*-
h
;
b
.
z
=
n
*
i
+
c
*-
h
+
l
*-
f
-
k
*-
g
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
0
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
d
){
var
e
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
e
)
>=
1
)
return
c
.
w
=
a
.
w
,
c
.
x
=
a
.
x
,
c
.
y
=
a
.
y
,
c
.
z
=
a
.
z
,
c
;
var
g
=
Math
.
acos
(
e
),
f
=
Math
.
sqrt
(
1
-
e
*
e
);
if
(
Math
.
abs
(
f
)
<
0.001
)
return
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
),
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
),
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
),
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
),
c
;
e
=
Math
.
sin
((
1
-
d
)
*
g
)
/
f
;
d
=
Math
.
sin
(
d
*
g
)
/
f
;
c
.
w
=
a
.
w
*
e
+
b
.
w
*
d
;
c
.
x
=
a
.
x
*
e
+
b
.
x
*
d
;
c
.
y
=
a
.
y
*
e
+
b
.
y
*
d
;
c
.
z
=
a
.
z
*
e
+
b
.
z
*
d
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
d
,
e
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
e
instanceof
THREE
.
Color
?
e
:
new
THREE
.
Color
;
this
.
vertexColors
=
e
instanceof
Array
?
e
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
d
,
e
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
d
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
edges
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
morphColors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
edges
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
morphColors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
...
...
build/custom/ThreeWebGL.js
浏览文件 @
d46a1ee3
...
@@ -51,7 +51,7 @@ THREE.Quaternion.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;thi
...
@@ -51,7 +51,7 @@ THREE.Quaternion.prototype={set:function(b,d,e,f){this.x=b;this.y=d;this.z=e;thi
f
;
this
.
z
=
b
.
z
*
f
;
this
.
w
=
Math
.
cos
(
e
);
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
b
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
b
==
0
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
b
=
1
/
b
,
this
.
x
*=
b
,
this
.
y
*=
b
,
this
.
z
*=
b
,
this
.
w
*=
b
);
return
this
},
f
;
this
.
z
=
b
.
z
*
f
;
this
.
w
=
Math
.
cos
(
e
);
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
b
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
b
==
0
?
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
:(
b
=
1
/
b
,
this
.
x
*=
b
,
this
.
y
*=
b
,
this
.
z
*=
b
,
this
.
w
*=
b
);
return
this
},
multiplySelf
:
function
(
b
){
var
d
=
this
.
x
,
e
=
this
.
y
,
f
=
this
.
z
,
h
=
this
.
w
,
i
=
b
.
x
,
g
=
b
.
y
,
j
=
b
.
z
,
b
=
b
.
w
;
this
.
x
=
d
*
b
+
h
*
i
+
e
*
j
-
f
*
g
;
this
.
y
=
e
*
b
+
h
*
g
+
f
*
i
-
d
*
j
;
this
.
z
=
f
*
b
+
h
*
j
+
d
*
g
-
e
*
i
;
this
.
w
=
h
*
b
-
d
*
i
-
e
*
g
-
f
*
j
;
return
this
},
multiply
:
function
(
b
,
d
){
this
.
x
=
b
.
x
*
d
.
w
+
b
.
y
*
d
.
z
-
b
.
z
*
d
.
y
+
b
.
w
*
d
.
x
;
this
.
y
=-
b
.
x
*
d
.
z
+
b
.
y
*
d
.
w
+
b
.
z
*
d
.
x
+
b
.
w
*
d
.
y
;
this
.
z
=
b
.
x
*
d
.
y
-
b
.
y
*
d
.
x
+
b
.
z
*
d
.
w
+
b
.
w
*
d
.
z
;
this
.
w
=-
b
.
x
*
d
.
x
-
b
.
y
*
d
.
y
-
b
.
z
*
d
.
z
+
b
.
w
*
d
.
w
;
return
this
},
multiplyVector3
:
function
(
b
,
d
){
d
||
(
d
=
b
);
var
e
=
b
.
x
,
f
=
b
.
y
,
h
=
b
.
z
,
i
=
this
.
x
,
g
=
this
.
y
,
j
=
this
.
z
,
p
=
this
.
w
,
k
=
p
*
e
+
g
*
h
-
j
*
f
,
n
=
multiplySelf
:
function
(
b
){
var
d
=
this
.
x
,
e
=
this
.
y
,
f
=
this
.
z
,
h
=
this
.
w
,
i
=
b
.
x
,
g
=
b
.
y
,
j
=
b
.
z
,
b
=
b
.
w
;
this
.
x
=
d
*
b
+
h
*
i
+
e
*
j
-
f
*
g
;
this
.
y
=
e
*
b
+
h
*
g
+
f
*
i
-
d
*
j
;
this
.
z
=
f
*
b
+
h
*
j
+
d
*
g
-
e
*
i
;
this
.
w
=
h
*
b
-
d
*
i
-
e
*
g
-
f
*
j
;
return
this
},
multiply
:
function
(
b
,
d
){
this
.
x
=
b
.
x
*
d
.
w
+
b
.
y
*
d
.
z
-
b
.
z
*
d
.
y
+
b
.
w
*
d
.
x
;
this
.
y
=-
b
.
x
*
d
.
z
+
b
.
y
*
d
.
w
+
b
.
z
*
d
.
x
+
b
.
w
*
d
.
y
;
this
.
z
=
b
.
x
*
d
.
y
-
b
.
y
*
d
.
x
+
b
.
z
*
d
.
w
+
b
.
w
*
d
.
z
;
this
.
w
=-
b
.
x
*
d
.
x
-
b
.
y
*
d
.
y
-
b
.
z
*
d
.
z
+
b
.
w
*
d
.
w
;
return
this
},
multiplyVector3
:
function
(
b
,
d
){
d
||
(
d
=
b
);
var
e
=
b
.
x
,
f
=
b
.
y
,
h
=
b
.
z
,
i
=
this
.
x
,
g
=
this
.
y
,
j
=
this
.
z
,
p
=
this
.
w
,
k
=
p
*
e
+
g
*
h
-
j
*
f
,
n
=
p
*
f
+
j
*
e
-
i
*
h
,
v
=
p
*
h
+
i
*
f
-
g
*
e
,
e
=-
i
*
e
-
g
*
f
-
j
*
h
;
d
.
x
=
k
*
p
+
e
*-
i
+
n
*-
j
-
v
*-
g
;
d
.
y
=
n
*
p
+
e
*-
g
+
v
*-
i
-
k
*-
j
;
d
.
z
=
v
*
p
+
e
*-
j
+
k
*-
g
-
n
*-
i
;
return
d
}};
p
*
f
+
j
*
e
-
i
*
h
,
v
=
p
*
h
+
i
*
f
-
g
*
e
,
e
=-
i
*
e
-
g
*
f
-
j
*
h
;
d
.
x
=
k
*
p
+
e
*-
i
+
n
*-
j
-
v
*-
g
;
d
.
y
=
n
*
p
+
e
*-
g
+
v
*-
i
-
k
*-
j
;
d
.
z
=
v
*
p
+
e
*-
j
+
k
*-
g
-
n
*-
i
;
return
d
}};
THREE
.
Quaternion
.
slerp
=
function
(
b
,
d
,
e
,
f
){
var
h
=
b
.
w
*
d
.
w
+
b
.
x
*
d
.
x
+
b
.
y
*
d
.
y
+
b
.
z
*
d
.
z
;
if
(
Math
.
abs
(
h
)
>=
1
)
return
e
.
w
=
b
.
w
,
e
.
x
=
b
.
x
,
e
.
y
=
b
.
y
,
e
.
z
=
b
.
z
,
e
;
var
i
=
Math
.
acos
(
h
),
g
=
Math
.
sqrt
(
1
-
h
*
h
);
if
(
Math
.
abs
(
g
)
<
0.001
0
)
return
e
.
w
=
0.5
*
(
b
.
w
+
d
.
w
),
e
.
x
=
0.5
*
(
b
.
x
+
d
.
x
),
e
.
y
=
0.5
*
(
b
.
y
+
d
.
y
),
e
.
z
=
0.5
*
(
b
.
z
+
d
.
z
),
e
;
h
=
Math
.
sin
((
1
-
f
)
*
i
)
/
g
;
f
=
Math
.
sin
(
f
*
i
)
/
g
;
e
.
w
=
b
.
w
*
h
+
d
.
w
*
f
;
e
.
x
=
b
.
x
*
h
+
d
.
x
*
f
;
e
.
y
=
b
.
y
*
h
+
d
.
y
*
f
;
e
.
z
=
b
.
z
*
h
+
d
.
z
*
f
;
return
e
};
THREE
.
Vertex
=
function
(
b
){
this
.
position
=
b
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
b
,
d
,
e
,
f
){
var
h
=
b
.
w
*
d
.
w
+
b
.
x
*
d
.
x
+
b
.
y
*
d
.
y
+
b
.
z
*
d
.
z
;
if
(
Math
.
abs
(
h
)
>=
1
)
return
e
.
w
=
b
.
w
,
e
.
x
=
b
.
x
,
e
.
y
=
b
.
y
,
e
.
z
=
b
.
z
,
e
;
var
i
=
Math
.
acos
(
h
),
g
=
Math
.
sqrt
(
1
-
h
*
h
);
if
(
Math
.
abs
(
g
)
<
0.001
)
return
e
.
w
=
0.5
*
(
b
.
w
+
d
.
w
),
e
.
x
=
0.5
*
(
b
.
x
+
d
.
x
),
e
.
y
=
0.5
*
(
b
.
y
+
d
.
y
),
e
.
z
=
0.5
*
(
b
.
z
+
d
.
z
),
e
;
h
=
Math
.
sin
((
1
-
f
)
*
i
)
/
g
;
f
=
Math
.
sin
(
f
*
i
)
/
g
;
e
.
w
=
b
.
w
*
h
+
d
.
w
*
f
;
e
.
x
=
b
.
x
*
h
+
d
.
x
*
f
;
e
.
y
=
b
.
y
*
h
+
d
.
y
*
f
;
e
.
z
=
b
.
z
*
h
+
d
.
z
*
f
;
return
e
};
THREE
.
Vertex
=
function
(
b
){
this
.
position
=
b
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
b
,
d
,
e
,
f
,
h
,
i
){
this
.
a
=
b
;
this
.
b
=
d
;
this
.
c
=
e
;
this
.
normal
=
f
instanceof
THREE
.
Vector3
?
f
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
f
instanceof
Array
?
f
:[];
this
.
color
=
h
instanceof
THREE
.
Color
?
h
:
new
THREE
.
Color
;
this
.
vertexColors
=
h
instanceof
Array
?
h
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
i
instanceof
Array
?
i
:[
i
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
b
,
d
,
e
,
f
,
h
,
i
){
this
.
a
=
b
;
this
.
b
=
d
;
this
.
c
=
e
;
this
.
normal
=
f
instanceof
THREE
.
Vector3
?
f
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
f
instanceof
Array
?
f
:[];
this
.
color
=
h
instanceof
THREE
.
Color
?
h
:
new
THREE
.
Color
;
this
.
vertexColors
=
h
instanceof
Array
?
h
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
i
instanceof
Array
?
i
:[
i
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
b
,
d
,
e
,
f
,
h
,
i
,
g
){
this
.
a
=
b
;
this
.
b
=
d
;
this
.
c
=
e
;
this
.
d
=
f
;
this
.
normal
=
h
instanceof
THREE
.
Vector3
?
h
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
h
instanceof
Array
?
h
:[];
this
.
color
=
i
instanceof
THREE
.
Color
?
i
:
new
THREE
.
Color
;
this
.
vertexColors
=
i
instanceof
Array
?
i
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
b
,
d
){
this
.
set
(
b
||
0
,
d
||
0
)};
THREE
.
Face4
=
function
(
b
,
d
,
e
,
f
,
h
,
i
,
g
){
this
.
a
=
b
;
this
.
b
=
d
;
this
.
c
=
e
;
this
.
d
=
f
;
this
.
normal
=
h
instanceof
THREE
.
Vector3
?
h
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
h
instanceof
Array
?
h
:[];
this
.
color
=
i
instanceof
THREE
.
Color
?
i
:
new
THREE
.
Color
;
this
.
vertexColors
=
i
instanceof
Array
?
i
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
b
,
d
){
this
.
set
(
b
||
0
,
d
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
b
,
d
){
this
.
u
=
b
;
this
.
v
=
d
;
return
this
},
copy
:
function
(
b
){
this
.
set
(
b
.
u
,
b
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
edges
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
morphColors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
THREE
.
UV
.
prototype
=
{
set
:
function
(
b
,
d
){
this
.
u
=
b
;
this
.
v
=
d
;
return
this
},
copy
:
function
(
b
){
this
.
set
(
b
.
u
,
b
.
v
);
return
this
}};
THREE
.
Geometry
=
function
(){
this
.
id
=
"
Geometry
"
+
THREE
.
GeometryIdCounter
++
;
this
.
vertices
=
[];
this
.
colors
=
[];
this
.
faces
=
[];
this
.
edges
=
[];
this
.
faceUvs
=
[[]];
this
.
faceVertexUvs
=
[[]];
this
.
morphTargets
=
[];
this
.
morphColors
=
[];
this
.
skinWeights
=
[];
this
.
skinIndices
=
[];
this
.
boundingSphere
=
this
.
boundingBox
=
null
;
this
.
hasTangents
=!
1
};
...
@@ -217,7 +217,7 @@ c.uniform1f(h.rotation,g.rotation),c.uniform2fv(h.scale,k),g.mergeWith3D&&!n?(c.
...
@@ -217,7 +217,7 @@ c.uniform1f(h.rotation,g.rotation),c.uniform2fv(h.scale,k),g.mergeWith3D&&!n?(c.
(
c
.
enableVertexAttribArray
(
t
.
attributes
.
vertex
),
c
.
enableVertexAttribArray
(
t
.
attributes
.
uv
),
Fa
=!
0
);
c
.
uniform1i
(
y
.
occlusionMap
,
0
);
c
.
uniform1i
(
y
.
map
,
1
);
c
.
bindBuffer
(
c
.
ARRAY_BUFFER
,
t
.
vertexBuffer
);
c
.
vertexAttribPointer
(
e
.
vertex
,
2
,
c
.
FLOAT
,
!
1
,
16
,
0
);
c
.
vertexAttribPointer
(
e
.
uv
,
2
,
c
.
FLOAT
,
!
1
,
16
,
8
);
c
.
bindBuffer
(
c
.
ELEMENT_ARRAY_BUFFER
,
t
.
elementBuffer
);
c
.
disable
(
c
.
CULL_FACE
);
c
.
depthMask
(
!
1
);
c
.
activeTexture
(
c
.
TEXTURE0
);
c
.
bindTexture
(
c
.
TEXTURE_2D
,
t
.
occlusionTexture
);
c
.
activeTexture
(
c
.
TEXTURE1
);
for
(
f
=
0
;
f
<
g
;
f
++
)
if
(
e
=
(
c
.
enableVertexAttribArray
(
t
.
attributes
.
vertex
),
c
.
enableVertexAttribArray
(
t
.
attributes
.
uv
),
Fa
=!
0
);
c
.
uniform1i
(
y
.
occlusionMap
,
0
);
c
.
uniform1i
(
y
.
map
,
1
);
c
.
bindBuffer
(
c
.
ARRAY_BUFFER
,
t
.
vertexBuffer
);
c
.
vertexAttribPointer
(
e
.
vertex
,
2
,
c
.
FLOAT
,
!
1
,
16
,
0
);
c
.
vertexAttribPointer
(
e
.
uv
,
2
,
c
.
FLOAT
,
!
1
,
16
,
8
);
c
.
bindBuffer
(
c
.
ELEMENT_ARRAY_BUFFER
,
t
.
elementBuffer
);
c
.
disable
(
c
.
CULL_FACE
);
c
.
depthMask
(
!
1
);
c
.
activeTexture
(
c
.
TEXTURE0
);
c
.
bindTexture
(
c
.
TEXTURE_2D
,
t
.
occlusionTexture
);
c
.
activeTexture
(
c
.
TEXTURE1
);
for
(
f
=
0
;
f
<
g
;
f
++
)
if
(
e
=
b
.
__webglLensFlares
[
f
].
object
,
k
.
set
(
e
.
matrixWorld
.
n14
,
e
.
matrixWorld
.
n24
,
e
.
matrixWorld
.
n34
),
d
.
matrixWorldInverse
.
multiplyVector3
(
k
),
d
.
projectionMatrix
.
multiplyVector3
(
k
),
q
[
0
]
=
k
.
x
,
q
[
1
]
=
k
.
y
,
q
[
2
]
=
k
.
z
,
z
[
0
]
=
q
[
0
]
*
o
+
o
,
z
[
1
]
=
q
[
1
]
*
n
+
n
,
t
.
hasVertexTexture
||
z
[
0
]
>
0
&&
z
[
0
]
<
O
&&
z
[
1
]
>
0
&&
z
[
1
]
<
H
){
c
.
bindTexture
(
c
.
TEXTURE_2D
,
t
.
tempTexture
);
c
.
copyTexImage2D
(
c
.
TEXTURE_2D
,
0
,
c
.
RGB
,
z
[
0
]
-
8
,
z
[
1
]
-
8
,
16
,
16
,
0
);
c
.
uniform1i
(
y
.
renderType
,
0
);
c
.
uniform2fv
(
y
.
scale
,
v
);
c
.
uniform3fv
(
y
.
screenPosition
,
q
);
c
.
disable
(
c
.
BLEND
);
c
.
enable
(
c
.
DEPTH_TEST
);
b
.
__webglLensFlares
[
f
].
object
,
k
.
set
(
e
.
matrixWorld
.
n14
,
e
.
matrixWorld
.
n24
,
e
.
matrixWorld
.
n34
),
d
.
matrixWorldInverse
.
multiplyVector3
(
k
),
d
.
projectionMatrix
.
multiplyVector3
(
k
),
q
[
0
]
=
k
.
x
,
q
[
1
]
=
k
.
y
,
q
[
2
]
=
k
.
z
,
z
[
0
]
=
q
[
0
]
*
o
+
o
,
z
[
1
]
=
q
[
1
]
*
n
+
n
,
t
.
hasVertexTexture
||
z
[
0
]
>
0
&&
z
[
0
]
<
O
&&
z
[
1
]
>
0
&&
z
[
1
]
<
H
){
c
.
bindTexture
(
c
.
TEXTURE_2D
,
t
.
tempTexture
);
c
.
copyTexImage2D
(
c
.
TEXTURE_2D
,
0
,
c
.
RGB
,
z
[
0
]
-
8
,
z
[
1
]
-
8
,
16
,
16
,
0
);
c
.
uniform1i
(
y
.
renderType
,
0
);
c
.
uniform2fv
(
y
.
scale
,
v
);
c
.
uniform3fv
(
y
.
screenPosition
,
q
);
c
.
disable
(
c
.
BLEND
);
c
.
enable
(
c
.
DEPTH_TEST
);
c
.
drawElements
(
c
.
TRIANGLES
,
6
,
c
.
UNSIGNED_SHORT
,
0
);
c
.
bindTexture
(
c
.
TEXTURE_2D
,
t
.
occlusionTexture
);
c
.
copyTexImage2D
(
c
.
TEXTURE_2D
,
0
,
c
.
RGBA
,
z
[
0
]
-
8
,
z
[
1
]
-
8
,
16
,
16
,
0
);
c
.
uniform1i
(
y
.
renderType
,
1
);
c
.
disable
(
c
.
DEPTH_TEST
);
c
.
bindTexture
(
c
.
TEXTURE_2D
,
t
.
tempTexture
);
c
.
drawElements
(
c
.
TRIANGLES
,
6
,
c
.
UNSIGNED_SHORT
,
0
);
e
.
positionScreen
.
x
=
q
[
0
];
e
.
positionScreen
.
y
=
q
[
1
];
e
.
positionScreen
.
z
=
q
[
2
];
e
.
customUpdateCallback
?
e
.
customUpdateCallback
(
e
):
e
.
updateLensFlares
();
c
.
uniform1i
(
y
.
renderType
,
2
);
c
.
enable
(
c
.
BLEND
);
h
=
0
;
for
(
i
=
e
.
lensFlares
.
length
;
h
<
c
.
drawElements
(
c
.
TRIANGLES
,
6
,
c
.
UNSIGNED_SHORT
,
0
);
c
.
bindTexture
(
c
.
TEXTURE_2D
,
t
.
occlusionTexture
);
c
.
copyTexImage2D
(
c
.
TEXTURE_2D
,
0
,
c
.
RGBA
,
z
[
0
]
-
8
,
z
[
1
]
-
8
,
16
,
16
,
0
);
c
.
uniform1i
(
y
.
renderType
,
1
);
c
.
disable
(
c
.
DEPTH_TEST
);
c
.
bindTexture
(
c
.
TEXTURE_2D
,
t
.
tempTexture
);
c
.
drawElements
(
c
.
TRIANGLES
,
6
,
c
.
UNSIGNED_SHORT
,
0
);
e
.
positionScreen
.
x
=
q
[
0
];
e
.
positionScreen
.
y
=
q
[
1
];
e
.
positionScreen
.
z
=
q
[
2
];
e
.
customUpdateCallback
?
e
.
customUpdateCallback
(
e
):
e
.
updateLensFlares
();
c
.
uniform1i
(
y
.
renderType
,
2
);
c
.
enable
(
c
.
BLEND
);
h
=
0
;
for
(
i
=
e
.
lensFlares
.
length
;
h
<
i
;
h
++
)
if
(
j
=
e
.
lensFlares
[
h
],
j
.
opacity
>
0.001
0
&&
j
.
scale
>
0.0010
)
q
[
0
]
=
j
.
x
,
q
[
1
]
=
j
.
y
,
q
[
2
]
=
j
.
z
,
r
=
j
.
size
*
j
.
scale
/
H
,
v
[
0
]
=
r
*
p
,
v
[
1
]
=
r
,
c
.
uniform3fv
(
y
.
screenPosition
,
q
),
c
.
uniform2fv
(
y
.
scale
,
v
),
c
.
uniform1f
(
y
.
rotation
,
j
.
rotation
),
c
.
uniform1f
(
y
.
opacity
,
j
.
opacity
),
L
(
j
.
blending
),
x
(
j
.
texture
,
1
),
c
.
drawElements
(
c
.
TRIANGLES
,
6
,
c
.
UNSIGNED_SHORT
,
0
)}
c
.
enable
(
c
.
CULL_FACE
);
c
.
enable
(
c
.
DEPTH_TEST
);
c
.
depthMask
(
ra
)}
function
D
(
b
,
c
){
b
.
_modelViewMatrix
.
multiplyToArray
(
c
.
matrixWorldInverse
,
b
.
matrixWorld
,
b
.
_modelViewMatrixArray
);
THREE
.
Matrix4
.
makeInvert3x3
(
b
.
_modelViewMatrix
).
transposeIntoArray
(
b
.
_normalMatrixArray
)}
i
;
h
++
)
if
(
j
=
e
.
lensFlares
[
h
],
j
.
opacity
>
0.001
&&
j
.
scale
>
0.001
)
q
[
0
]
=
j
.
x
,
q
[
1
]
=
j
.
y
,
q
[
2
]
=
j
.
z
,
r
=
j
.
size
*
j
.
scale
/
H
,
v
[
0
]
=
r
*
p
,
v
[
1
]
=
r
,
c
.
uniform3fv
(
y
.
screenPosition
,
q
),
c
.
uniform2fv
(
y
.
scale
,
v
),
c
.
uniform1f
(
y
.
rotation
,
j
.
rotation
),
c
.
uniform1f
(
y
.
opacity
,
j
.
opacity
),
L
(
j
.
blending
),
x
(
j
.
texture
,
1
),
c
.
drawElements
(
c
.
TRIANGLES
,
6
,
c
.
UNSIGNED_SHORT
,
0
)}
c
.
enable
(
c
.
CULL_FACE
);
c
.
enable
(
c
.
DEPTH_TEST
);
c
.
depthMask
(
ra
)}
function
D
(
b
,
c
){
b
.
_modelViewMatrix
.
multiplyToArray
(
c
.
matrixWorldInverse
,
b
.
matrixWorld
,
b
.
_modelViewMatrixArray
);
THREE
.
Matrix4
.
makeInvert3x3
(
b
.
_modelViewMatrix
).
transposeIntoArray
(
b
.
_normalMatrixArray
)}
function
y
(
b
){
var
e
,
f
,
g
,
h
,
i
;
if
(
b
instanceof
THREE
.
Mesh
){
f
=
b
.
geometry
;
for
(
e
in
f
.
geometryGroups
){
g
=
f
.
geometryGroups
[
e
];
i
=!
1
;
for
(
h
in
g
.
__webglCustomAttributes
)
if
(
g
.
__webglCustomAttributes
[
h
].
needsUpdate
){
i
=!
0
;
break
}
if
(
f
.
__dirtyVertices
||
f
.
__dirtyMorphTargets
||
f
.
__dirtyElements
||
f
.
__dirtyUvs
||
f
.
__dirtyNormals
||
f
.
__dirtyColors
||
f
.
__dirtyTangents
||
i
){
i
=
b
;
var
j
=
c
.
DYNAMIC_DRAW
;
if
(
g
.
__inittedArrays
){
var
k
=
void
0
,
p
=
void
0
,
n
=
void
0
,
o
=
void
0
,
G
=
n
=
void
0
,
r
=
void
0
,
v
=
void
0
,
q
=
void
0
,
t
=
void
0
,
z
=
void
0
,
y
=
void
0
,
function
y
(
b
){
var
e
,
f
,
g
,
h
,
i
;
if
(
b
instanceof
THREE
.
Mesh
){
f
=
b
.
geometry
;
for
(
e
in
f
.
geometryGroups
){
g
=
f
.
geometryGroups
[
e
];
i
=!
1
;
for
(
h
in
g
.
__webglCustomAttributes
)
if
(
g
.
__webglCustomAttributes
[
h
].
needsUpdate
){
i
=!
0
;
break
}
if
(
f
.
__dirtyVertices
||
f
.
__dirtyMorphTargets
||
f
.
__dirtyElements
||
f
.
__dirtyUvs
||
f
.
__dirtyNormals
||
f
.
__dirtyColors
||
f
.
__dirtyTangents
||
i
){
i
=
b
;
var
j
=
c
.
DYNAMIC_DRAW
;
if
(
g
.
__inittedArrays
){
var
k
=
void
0
,
p
=
void
0
,
n
=
void
0
,
o
=
void
0
,
G
=
n
=
void
0
,
r
=
void
0
,
v
=
void
0
,
q
=
void
0
,
t
=
void
0
,
z
=
void
0
,
y
=
void
0
,
x
=
void
0
,
C
=
void
0
,
u
=
void
0
,
I
=
void
0
,
K
=
void
0
,
D
=
void
0
,
s
=
o
=
q
=
o
=
v
=
r
=
void
0
,
A
=
void
0
,
m
=
A
=
s
=
r
=
void
0
,
F
=
void
0
,
J
=
m
=
A
=
s
=
n
=
n
=
G
=
q
=
o
=
m
=
A
=
s
=
F
=
m
=
A
=
s
=
F
=
m
=
A
=
s
=
void
0
,
B
=
0
,
E
=
0
,
O
=
0
,
P
=
0
,
H
=
0
,
M
=
0
,
T
=
0
,
N
=
0
,
ca
=
0
,
w
=
0
,
da
=
0
,
A
=
s
=
0
,
L
=
g
.
__vertexArray
,
Z
=
g
.
__uvArray
,
$
=
g
.
__uv2Array
,
Q
=
g
.
__normalArray
,
U
=
g
.
__tangentArray
,
ea
=
g
.
__colorArray
,
V
=
g
.
__skinVertexAArray
,
W
=
g
.
__skinVertexBArray
,
X
=
g
.
__skinIndexArray
,
Y
=
g
.
__skinWeightArray
,
aa
=
g
.
__morphTargetsArrays
,
R
=
g
.
__webglCustomAttributes
,
m
=
void
0
,
ma
=
g
.
__faceArray
,
S
=
g
.
__lineArray
,
ja
=
g
.
__needsSmoothNormals
,
x
=
void
0
,
C
=
void
0
,
u
=
void
0
,
I
=
void
0
,
K
=
void
0
,
D
=
void
0
,
s
=
o
=
q
=
o
=
v
=
r
=
void
0
,
A
=
void
0
,
m
=
A
=
s
=
r
=
void
0
,
F
=
void
0
,
J
=
m
=
A
=
s
=
n
=
n
=
G
=
q
=
o
=
m
=
A
=
s
=
F
=
m
=
A
=
s
=
F
=
m
=
A
=
s
=
void
0
,
B
=
0
,
E
=
0
,
O
=
0
,
P
=
0
,
H
=
0
,
M
=
0
,
T
=
0
,
N
=
0
,
ca
=
0
,
w
=
0
,
da
=
0
,
A
=
s
=
0
,
L
=
g
.
__vertexArray
,
Z
=
g
.
__uvArray
,
$
=
g
.
__uv2Array
,
Q
=
g
.
__normalArray
,
U
=
g
.
__tangentArray
,
ea
=
g
.
__colorArray
,
V
=
g
.
__skinVertexAArray
,
W
=
g
.
__skinVertexBArray
,
X
=
g
.
__skinIndexArray
,
Y
=
g
.
__skinWeightArray
,
aa
=
g
.
__morphTargetsArrays
,
R
=
g
.
__webglCustomAttributes
,
m
=
void
0
,
ma
=
g
.
__faceArray
,
S
=
g
.
__lineArray
,
ja
=
g
.
__needsSmoothNormals
,
z
=
g
.
__vertexColorType
,
t
=
g
.
__uvType
,
y
=
g
.
__normalType
,
ga
=
i
.
geometry
,
ha
=
ga
.
__dirtyVertices
,
ia
=
ga
.
__dirtyElements
,
fa
=
ga
.
__dirtyUvs
,
ka
=
ga
.
__dirtyNormals
,
na
=
ga
.
__dirtyTangents
,
oa
=
ga
.
__dirtyColors
,
pa
=
ga
.
__dirtyMorphTargets
,
la
=
ga
.
vertices
,
qa
=
g
.
faces
,
ra
=
ga
.
faces
,
sa
=
ga
.
faceVertexUvs
[
0
],
ta
=
ga
.
faceVertexUvs
[
1
],
ya
=
ga
.
skinVerticesA
,
za
=
ga
.
skinVerticesB
,
Aa
=
ga
.
skinIndices
,
wa
=
ga
.
skinWeights
,
xa
=
i
instanceof
THREE
.
ShadowVolume
?
ga
.
edgeFaces
:
void
0
,
ua
=
ga
.
morphTargets
;
if
(
R
)
for
(
J
in
R
)
R
[
J
].
offset
=
0
,
R
[
J
].
offsetSrc
=
0
;
k
=
0
;
z
=
g
.
__vertexColorType
,
t
=
g
.
__uvType
,
y
=
g
.
__normalType
,
ga
=
i
.
geometry
,
ha
=
ga
.
__dirtyVertices
,
ia
=
ga
.
__dirtyElements
,
fa
=
ga
.
__dirtyUvs
,
ka
=
ga
.
__dirtyNormals
,
na
=
ga
.
__dirtyTangents
,
oa
=
ga
.
__dirtyColors
,
pa
=
ga
.
__dirtyMorphTargets
,
la
=
ga
.
vertices
,
qa
=
g
.
faces
,
ra
=
ga
.
faces
,
sa
=
ga
.
faceVertexUvs
[
0
],
ta
=
ga
.
faceVertexUvs
[
1
],
ya
=
ga
.
skinVerticesA
,
za
=
ga
.
skinVerticesB
,
Aa
=
ga
.
skinIndices
,
wa
=
ga
.
skinWeights
,
xa
=
i
instanceof
THREE
.
ShadowVolume
?
ga
.
edgeFaces
:
void
0
,
ua
=
ga
.
morphTargets
;
if
(
R
)
for
(
J
in
R
)
R
[
J
].
offset
=
0
,
R
[
J
].
offsetSrc
=
0
;
k
=
0
;
...
...
src/extras/renderers/AnaglyphWebGLRenderer.js
浏览文件 @
d46a1ee3
...
@@ -2,98 +2,102 @@
...
@@ -2,98 +2,102 @@
* @author mrdoob / http://mrdoob.com/
* @author mrdoob / http://mrdoob.com/
*/
*/
THREE
.
AnaglyphWebGLRenderer
=
function
(
parameters
)
{
if
(
THREE
.
WebGLRenderer
)
{
THREE
.
WebGLRenderer
.
call
(
this
,
parameters
);
THREE
.
AnaglyphWebGLRenderer
=
function
(
parameters
)
{
var
_this
=
this
,
_setSize
=
this
.
setSize
,
_render
=
this
.
render
;
THREE
.
WebGLRenderer
.
call
(
this
,
parameters
);
var
_cameraL
=
new
THREE
.
Camera
(),
_cameraR
=
new
THREE
.
Camera
();
var
_params
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
NearestFilter
,
format
:
THREE
.
RGBAFormat
}
;
var
_this
=
this
,
_setSize
=
this
.
setSize
,
_render
=
this
.
render
;
var
_renderTargetL
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
_params
),
_renderTargetR
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
_params
);
var
_cameraL
=
new
THREE
.
Camera
(),
_cameraR
=
new
THREE
.
Camera
(
);
var
_camera
=
new
THREE
.
Camera
(
53
,
1
,
1
,
10000
)
;
var
_params
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
NearestFilter
,
format
:
THREE
.
RGBAFormat
}
;
_camera
.
position
.
z
=
2
;
var
_renderTargetL
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
_params
),
_renderTargetR
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
_params
)
;
_material
=
new
THREE
.
MeshShaderMaterial
(
{
var
_camera
=
new
THREE
.
Camera
(
53
,
1
,
1
,
10000
);
_camera
.
position
.
z
=
2
;
uniforms
:
{
_material
=
new
THREE
.
MeshShaderMaterial
(
{
"
mapLeft
"
:
{
type
:
"
t
"
,
value
:
0
,
texture
:
_renderTargetL
},
uniforms
:
{
"
mapRight
"
:
{
type
:
"
t
"
,
value
:
1
,
texture
:
_renderTargetR
}
},
"
mapLeft
"
:
{
type
:
"
t
"
,
value
:
0
,
texture
:
_renderTargetL
},
vertexShader
:
[
"
mapRight
"
:
{
type
:
"
t
"
,
value
:
1
,
texture
:
_renderTargetR
}
"
varying vec2 vUv;
"
,
},
vertexShader
:
[
"
void main() {
"
,
"
varying vec2 vUv;
"
,
"
vUv = vec2( uv.x, 1.0 - uv.y );
"
,
"
void main() {
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
"
}
"
"
vUv = vec2( uv.x, 1.0 - uv.y );
"
,
"
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
"
,
].
join
(
"
\n
"
),
"
}
"
fragmentShader
:
[
"
uniform sampler2D mapLeft;
"
,
].
join
(
"
\n
"
),
"
uniform sampler2D mapRight;
"
,
fragmentShader
:
[
"
varying vec2 vUv;
"
,
"
void main() {
"
,
"
uniform sampler2D mapLeft;
"
,
"
uniform sampler2D mapRight;
"
,
"
varying vec2 vUv;
"
,
"
vec4 colorL, colorR;
"
,
"
void main() {
"
,
"
vec2 uv = vUv;
"
,
"
colorL = texture2D( mapLeft, uv )
;
"
,
"
vec4 colorL, colorR
;
"
,
"
colorR = texture2D( mapRight, uv )
;
"
,
"
vec2 uv = vUv
;
"
,
// http://3dtv.at/Knowhow/AnaglyphComparison_en.aspx
"
colorL = texture2D( mapLeft, uv );
"
,
"
colorR = texture2D( mapRight, uv );
"
,
"
gl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;
"
,
// http://3dtv.at/Knowhow/AnaglyphComparison_en.aspx
"
}
"
"
gl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;
"
,
].
join
(
"
\n
"
)
"
}
"
}
);
].
join
(
"
\n
"
)
var
_scene
=
new
THREE
.
Scene
();
}
);
_scene
.
addObject
(
new
THREE
.
Mesh
(
new
THREE
.
Plane
(
2
,
2
),
_material
)
);
this
.
setSize
=
function
(
width
,
height
)
{
var
_scene
=
new
THREE
.
Scene
();
_scene
.
addObject
(
new
THREE
.
Mesh
(
new
THREE
.
Plane
(
2
,
2
),
_material
)
);
_setSize
.
call
(
_this
,
width
,
height
);
this
.
setSize
=
function
(
width
,
height
)
{
_renderTargetL
.
width
=
width
;
_setSize
.
call
(
_this
,
width
,
height
);
_renderTargetL
.
height
=
height
;
_renderTargetR
.
width
=
width
;
_renderTargetL
.
width
=
width
;
_renderTargetR
.
height
=
height
;
_renderTargetL
.
height
=
height
;
};
_renderTargetR
.
width
=
width
;
_renderTargetR
.
height
=
height
;
this
.
render
=
function
(
scene
,
camera
,
renderTarget
,
forceClear
)
{
};
_cameraL
.
projectionMatrix
=
camera
.
projectionMatrix
;
this
.
render
=
function
(
scene
,
camera
,
renderTarget
,
forceClear
)
{
_cameraL
.
position
.
copy
(
camera
.
position
);
_cameraL
.
target
.
position
.
copy
(
camera
.
target
.
position
);
_cameraL
.
translateX
(
-
10
);
_cameraR
.
projectionMatrix
=
camera
.
projectionMatrix
;
_cameraL
.
projectionMatrix
=
camera
.
projectionMatrix
;
_cameraR
.
position
.
copy
(
camera
.
position
);
_cameraL
.
position
.
copy
(
camera
.
position
);
_cameraR
.
target
.
position
.
copy
(
camera
.
target
.
position
);
_cameraL
.
target
.
position
.
copy
(
camera
.
target
.
position
);
_cameraR
.
translateX
(
10
);
_cameraL
.
translateX
(
-
10
);
_render
.
call
(
_this
,
scene
,
_cameraL
,
_renderTargetL
,
true
);
_cameraR
.
projectionMatrix
=
camera
.
projectionMatrix
;
_render
.
call
(
_this
,
scene
,
_cameraR
,
_renderTargetR
,
true
);
_cameraR
.
position
.
copy
(
camera
.
position
);
_cameraR
.
target
.
position
.
copy
(
camera
.
target
.
position
);
_cameraR
.
translateX
(
10
);
_render
.
call
(
_this
,
_scene
,
_camera
);
_render
.
call
(
_this
,
scene
,
_cameraL
,
_renderTargetL
,
true
);
_render
.
call
(
_this
,
scene
,
_cameraR
,
_renderTargetR
,
true
);
}
;
_render
.
call
(
_this
,
_scene
,
_camera
)
;
};
};
};
THREE
.
AnaglyphWebGLRenderer
.
prototype
=
new
THREE
.
WebGLRenderer
();
THREE
.
AnaglyphWebGLRenderer
.
prototype
=
new
THREE
.
WebGLRenderer
();
THREE
.
AnaglyphWebGLRenderer
.
prototype
.
constructor
=
THREE
.
AnaglyphWebGLRenderer
;
THREE
.
AnaglyphWebGLRenderer
.
prototype
.
constructor
=
THREE
.
AnaglyphWebGLRenderer
;
}
src/extras/renderers/CrosseyedWebGLRenderer.js
浏览文件 @
d46a1ee3
...
@@ -2,68 +2,72 @@
...
@@ -2,68 +2,72 @@
* @author alteredq / http://alteredqualia.com/
* @author alteredq / http://alteredqualia.com/
*/
*/
THREE
.
CrosseyedWebGLRenderer
=
function
(
parameters
)
{
if
(
THREE
.
WebGLRenderer
)
{
THREE
.
WebGLRenderer
.
call
(
this
,
parameters
);
THREE
.
CrosseyedWebGLRenderer
=
function
(
parameters
)
{
this
.
autoClear
=
false
;
THREE
.
WebGLRenderer
.
call
(
this
,
parameters
)
;
var
_this
=
this
,
_setSize
=
this
.
setSize
,
_render
=
this
.
render
;
this
.
autoClear
=
false
;
var
_width
,
_height
;
var
_this
=
this
,
_setSize
=
this
.
setSize
,
_render
=
this
.
render
;
var
_width
,
_height
;
var
_cameraL
=
new
THREE
.
Camera
(),
var
_cameraL
=
new
THREE
.
Camera
(),
_cameraR
=
new
THREE
.
Camera
();
_cameraR
=
new
THREE
.
Camera
();
_this
.
separation
=
10
;
_this
.
separation
=
10
;
if
(
parameters
&&
parameters
.
separation
!==
undefined
)
_this
.
separation
=
parameters
.
separation
;
if
(
parameters
&&
parameters
.
separation
!==
undefined
)
_this
.
separation
=
parameters
.
separation
;
var
SCREEN_WIDTH
=
window
.
innerWidth
;
var
SCREEN_WIDTH
=
window
.
innerWidth
;
var
SCREEN_HEIGHT
=
window
.
innerHeight
;
var
SCREEN_HEIGHT
=
window
.
innerHeight
;
var
HALF_WIDTH
=
SCREEN_WIDTH
/
2
;
var
HALF_WIDTH
=
SCREEN_WIDTH
/
2
;
var
_camera
=
new
THREE
.
Camera
(
53
,
HALF_WIDTH
/
SCREEN_HEIGHT
,
1
,
10000
);
var
_camera
=
new
THREE
.
Camera
(
53
,
HALF_WIDTH
/
SCREEN_HEIGHT
,
1
,
10000
);
_camera
.
position
.
z
=
-
10
;
_camera
.
position
.
z
=
-
10
;
this
.
setSize
=
function
(
width
,
height
)
{
this
.
setSize
=
function
(
width
,
height
)
{
_setSize
.
call
(
_this
,
width
,
height
);
_setSize
.
call
(
_this
,
width
,
height
);
_width
=
width
/
2
;
_width
=
width
/
2
;
_height
=
height
;
_height
=
height
;
};
};
this
.
render
=
function
(
scene
,
camera
,
renderTarget
,
forceClear
)
{
this
.
render
=
function
(
scene
,
camera
,
renderTarget
,
forceClear
)
{
this
.
clear
();
this
.
clear
();
_cameraL
.
fov
=
camera
.
fov
;
_cameraL
.
fov
=
camera
.
fov
;
_cameraL
.
aspect
=
0.5
*
camera
.
aspect
;
_cameraL
.
aspect
=
0.5
*
camera
.
aspect
;
_cameraL
.
near
=
camera
.
near
;
_cameraL
.
near
=
camera
.
near
;
_cameraL
.
far
=
camera
.
far
;
_cameraL
.
far
=
camera
.
far
;
_cameraL
.
updateProjectionMatrix
();
_cameraL
.
updateProjectionMatrix
();
_cameraL
.
position
.
copy
(
camera
.
position
);
_cameraL
.
position
.
copy
(
camera
.
position
);
_cameraL
.
target
.
position
.
copy
(
camera
.
target
.
position
);
_cameraL
.
target
.
position
.
copy
(
camera
.
target
.
position
);
_cameraL
.
translateX
(
_this
.
separation
);
_cameraL
.
translateX
(
_this
.
separation
);
_cameraR
.
projectionMatrix
=
_cameraL
.
projectionMatrix
;
_cameraR
.
projectionMatrix
=
_cameraL
.
projectionMatrix
;
_cameraR
.
position
.
copy
(
camera
.
position
);
_cameraR
.
position
.
copy
(
camera
.
position
);
_cameraR
.
target
.
position
.
copy
(
camera
.
target
.
position
);
_cameraR
.
target
.
position
.
copy
(
camera
.
target
.
position
);
_cameraR
.
translateX
(
-
_this
.
separation
);
_cameraR
.
translateX
(
-
_this
.
separation
);
this
.
setViewport
(
0
,
0
,
_width
,
_height
);
this
.
setViewport
(
0
,
0
,
_width
,
_height
);
_render
.
call
(
_this
,
scene
,
_cameraL
);
_render
.
call
(
_this
,
scene
,
_cameraL
);
this
.
setViewport
(
_width
,
0
,
_width
,
_height
);
this
.
setViewport
(
_width
,
0
,
_width
,
_height
);
_render
.
call
(
_this
,
scene
,
_cameraR
,
false
);
_render
.
call
(
_this
,
scene
,
_cameraR
,
false
);
};
};
};
};
THREE
.
CrosseyedWebGLRenderer
.
prototype
=
new
THREE
.
WebGLRenderer
();
THREE
.
CrosseyedWebGLRenderer
.
prototype
=
new
THREE
.
WebGLRenderer
();
THREE
.
CrosseyedWebGLRenderer
.
prototype
.
constructor
=
THREE
.
CrosseyedWebGLRenderer
;
THREE
.
CrosseyedWebGLRenderer
.
prototype
.
constructor
=
THREE
.
CrosseyedWebGLRenderer
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录