Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
e8847848
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,发现更多精彩内容 >>
提交
e8847848
编写于
4月 09, 2011
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Merging with alteredq's branch.
上级
c74f046b
变更
15
展开全部
隐藏空白更改
内联
并排
Showing
15 changed file
with
757 addition
and
759 deletion
+757
-759
build/Three.js
build/Three.js
+388
-392
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
+93
-107
build/custom/ThreeSVG.js
build/custom/ThreeSVG.js
+1
-1
build/custom/ThreeWebGL.js
build/custom/ThreeWebGL.js
+231
-235
examples/misc_sound.html
examples/misc_sound.html
+1
-1
examples/webgl_lines_colors.html
examples/webgl_lines_colors.html
+1
-1
examples/webgl_materials_video.html
examples/webgl_materials_video.html
+1
-1
examples/webgl_postprocessing.html
examples/webgl_postprocessing.html
+5
-3
examples/webgl_postprocessing_dof.html
examples/webgl_postprocessing_dof.html
+1
-1
examples/webgl_ribbons.html
examples/webgl_ribbons.html
+1
-1
examples/webgl_rtt.html
examples/webgl_rtt.html
+1
-1
examples/webgl_shader_lava.html
examples/webgl_shader_lava.html
+1
-1
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+30
-12
未找到文件。
build/Three.js
浏览文件 @
e8847848
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
build/custom/ThreeCanvas.js
浏览文件 @
e8847848
...
...
@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
e
;
return
this
},
setFromEuler
:
function
(
a
){
var
b
=
0.5
*
Math
.
PI
/
360
,
c
=
a
.
x
*
b
,
e
=
a
.
y
*
b
,
d
=
a
.
z
*
b
;
a
=
Math
.
cos
(
e
);
e
=
Math
.
sin
(
e
);
b
=
Math
.
cos
(
-
d
);
d
=
Math
.
sin
(
-
d
);
var
g
=
Math
.
cos
(
c
);
c
=
Math
.
sin
(
c
);
var
f
=
a
*
b
,
i
=
e
*
d
;
this
.
w
=
f
*
g
-
i
*
c
;
this
.
x
=
f
*
c
+
i
*
g
;
this
.
y
=
e
*
b
*
g
+
a
*
d
*
c
;
this
.
z
=
a
*
d
*
g
-
e
*
b
*
c
;
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=
-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
if
(
a
==
0
)
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
;
else
{
a
=
1
/
a
;
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
}
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
e
=
this
.
z
,
d
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
i
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
b
*
a
+
d
*
g
+
c
*
i
-
e
*
f
;
this
.
y
=
c
*
a
+
d
*
f
+
e
*
g
-
b
*
i
;
this
.
z
=
e
*
a
+
d
*
i
+
b
*
f
-
c
*
g
;
this
.
w
=
d
*
a
-
b
*
g
-
c
*
f
-
e
*
i
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
e
=
a
.
y
,
d
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
i
=
this
.
z
,
h
=
this
.
w
,
j
=
h
*
c
+
f
*
d
-
i
*
e
,
k
=
h
*
e
+
i
*
c
-
g
*
d
,
n
=
h
*
d
+
g
*
e
-
f
*
c
;
c
=-
g
*
c
-
f
*
e
-
i
*
d
;
b
.
x
=
j
*
h
+
c
*-
g
+
k
*-
i
-
n
*-
f
;
b
.
y
=
k
*
h
+
c
*-
f
+
n
*-
g
-
j
*-
i
;
b
.
z
=
n
*
h
+
c
*-
i
+
j
*-
f
-
k
*-
g
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
0
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
e
,
d
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
d
instanceof
THREE
.
Color
?
d
:
new
THREE
.
Color
;
this
.
vertexColors
=
d
instanceof
Array
?
d
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
e
,
d
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
e
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
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
浏览文件 @
e8847848
...
...
@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
e
;
return
this
},
setFromEuler
:
function
(
a
){
var
b
=
0.5
*
Math
.
PI
/
360
,
c
=
a
.
x
*
b
,
e
=
a
.
y
*
b
,
d
=
a
.
z
*
b
;
a
=
Math
.
cos
(
e
);
e
=
Math
.
sin
(
e
);
b
=
Math
.
cos
(
-
d
);
d
=
Math
.
sin
(
-
d
);
var
g
=
Math
.
cos
(
c
);
c
=
Math
.
sin
(
c
);
var
f
=
a
*
b
,
i
=
e
*
d
;
this
.
w
=
f
*
g
-
i
*
c
;
this
.
x
=
f
*
c
+
i
*
g
;
this
.
y
=
e
*
b
*
g
+
a
*
d
*
c
;
this
.
z
=
a
*
d
*
g
-
e
*
b
*
c
;
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=
-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
if
(
a
==
0
)
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
;
else
{
a
=
1
/
a
;
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
}
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
e
=
this
.
z
,
d
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
i
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
b
*
a
+
d
*
g
+
c
*
i
-
e
*
f
;
this
.
y
=
c
*
a
+
d
*
f
+
e
*
g
-
b
*
i
;
this
.
z
=
e
*
a
+
d
*
i
+
b
*
f
-
c
*
g
;
this
.
w
=
d
*
a
-
b
*
g
-
c
*
f
-
e
*
i
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
e
=
a
.
y
,
d
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
i
=
this
.
z
,
h
=
this
.
w
,
j
=
h
*
c
+
f
*
d
-
i
*
e
,
l
=
h
*
e
+
i
*
c
-
g
*
d
,
m
=
h
*
d
+
g
*
e
-
f
*
c
;
c
=-
g
*
c
-
f
*
e
-
i
*
d
;
b
.
x
=
j
*
h
+
c
*-
g
+
l
*-
i
-
m
*-
f
;
b
.
y
=
l
*
h
+
c
*-
f
+
m
*-
g
-
j
*-
i
;
b
.
z
=
m
*
h
+
c
*-
i
+
j
*-
f
-
l
*-
g
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
0
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
e
,
d
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
d
instanceof
THREE
.
Color
?
d
:
new
THREE
.
Color
;
this
.
vertexColors
=
d
instanceof
Array
?
d
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
e
,
d
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
e
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
...
...
build/custom/ThreeExtras.js
浏览文件 @
e8847848
此差异已折叠。
点击以展开。
build/custom/ThreeSVG.js
浏览文件 @
e8847848
...
...
@@ -48,7 +48,7 @@ b,c)}};THREE.Quaternion=function(a,b,c,e){this.set(a||0,b||0,c||0,e!==undefined?
THREE
.
Quaternion
.
prototype
=
{
set
:
function
(
a
,
b
,
c
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
c
;
this
.
w
=
e
;
return
this
},
setFromEuler
:
function
(
a
){
var
b
=
0.5
*
Math
.
PI
/
360
,
c
=
a
.
x
*
b
,
e
=
a
.
y
*
b
,
d
=
a
.
z
*
b
;
a
=
Math
.
cos
(
e
);
e
=
Math
.
sin
(
e
);
b
=
Math
.
cos
(
-
d
);
d
=
Math
.
sin
(
-
d
);
var
g
=
Math
.
cos
(
c
);
c
=
Math
.
sin
(
c
);
var
f
=
a
*
b
,
i
=
e
*
d
;
this
.
w
=
f
*
g
-
i
*
c
;
this
.
x
=
f
*
c
+
i
*
g
;
this
.
y
=
e
*
b
*
g
+
a
*
d
*
c
;
this
.
z
=
a
*
d
*
g
-
e
*
b
*
c
;
return
this
},
calculateW
:
function
(){
this
.
w
=-
Math
.
sqrt
(
Math
.
abs
(
1
-
this
.
x
*
this
.
x
-
this
.
y
*
this
.
y
-
this
.
z
*
this
.
z
));
return
this
},
inverse
:
function
(){
this
.
x
*=-
1
;
this
.
y
*=
-
1
;
this
.
z
*=-
1
;
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
)},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
+
this
.
w
*
this
.
w
);
if
(
a
==
0
)
this
.
w
=
this
.
z
=
this
.
y
=
this
.
x
=
0
;
else
{
a
=
1
/
a
;
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
}
return
this
},
multiplySelf
:
function
(
a
){
var
b
=
this
.
x
,
c
=
this
.
y
,
e
=
this
.
z
,
d
=
this
.
w
,
g
=
a
.
x
,
f
=
a
.
y
,
i
=
a
.
z
;
a
=
a
.
w
;
this
.
x
=
b
*
a
+
d
*
g
+
c
*
i
-
e
*
f
;
this
.
y
=
c
*
a
+
d
*
f
+
e
*
g
-
b
*
i
;
this
.
z
=
e
*
a
+
d
*
i
+
b
*
f
-
c
*
g
;
this
.
w
=
d
*
a
-
b
*
g
-
c
*
f
-
e
*
i
;
return
this
},
multiplyVector3
:
function
(
a
,
b
){
b
||
(
b
=
a
);
var
c
=
a
.
x
,
e
=
a
.
y
,
d
=
a
.
z
,
g
=
this
.
x
,
f
=
this
.
y
,
i
=
this
.
z
,
h
=
this
.
w
,
j
=
h
*
c
+
f
*
d
-
i
*
e
,
l
=
h
*
e
+
i
*
c
-
g
*
d
,
m
=
h
*
d
+
g
*
e
-
f
*
c
;
c
=-
g
*
c
-
f
*
e
-
i
*
d
;
b
.
x
=
j
*
h
+
c
*-
g
+
l
*-
i
-
m
*-
f
;
b
.
y
=
l
*
h
+
c
*-
f
+
m
*-
g
-
j
*-
i
;
b
.
z
=
m
*
h
+
c
*-
i
+
j
*-
f
-
l
*-
g
;
return
b
}};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Quaternion
.
slerp
=
function
(
a
,
b
,
c
,
e
){
var
d
=
a
.
w
*
b
.
w
+
a
.
x
*
b
.
x
+
a
.
y
*
b
.
y
+
a
.
z
*
b
.
z
;
if
(
Math
.
abs
(
d
)
>=
1
){
c
.
w
=
a
.
w
;
c
.
x
=
a
.
x
;
c
.
y
=
a
.
y
;
c
.
z
=
a
.
z
;
return
c
}
var
g
=
Math
.
acos
(
d
),
f
=
Math
.
sqrt
(
1
-
d
*
d
);
if
(
Math
.
abs
(
f
)
<
0.001
0
){
c
.
w
=
0.5
*
(
a
.
w
+
b
.
w
);
c
.
x
=
0.5
*
(
a
.
x
+
b
.
x
);
c
.
y
=
0.5
*
(
a
.
y
+
b
.
y
);
c
.
z
=
0.5
*
(
a
.
z
+
b
.
z
);
return
c
}
d
=
Math
.
sin
((
1
-
e
)
*
g
)
/
f
;
e
=
Math
.
sin
(
e
*
g
)
/
f
;
c
.
w
=
a
.
w
*
d
+
b
.
w
*
e
;
c
.
x
=
a
.
x
*
d
+
b
.
x
*
e
;
c
.
y
=
a
.
y
*
d
+
b
.
y
*
e
;
c
.
z
=
a
.
z
*
d
+
b
.
z
*
e
;
return
c
};
THREE
.
Vertex
=
function
(
a
){
this
.
position
=
a
||
new
THREE
.
Vector3
};
THREE
.
Face3
=
function
(
a
,
b
,
c
,
e
,
d
,
g
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
color
=
d
instanceof
THREE
.
Color
?
d
:
new
THREE
.
Color
;
this
.
vertexColors
=
d
instanceof
Array
?
d
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
g
instanceof
Array
?
g
:[
g
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
Face4
=
function
(
a
,
b
,
c
,
e
,
d
,
g
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
c
;
this
.
d
=
e
;
this
.
normal
=
d
instanceof
THREE
.
Vector3
?
d
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
d
instanceof
Array
?
d
:[];
this
.
color
=
g
instanceof
THREE
.
Color
?
g
:
new
THREE
.
Color
;
this
.
vertexColors
=
g
instanceof
Array
?
g
:[];
this
.
vertexTangents
=
[];
this
.
materials
=
f
instanceof
Array
?
f
:[
f
];
this
.
centroid
=
new
THREE
.
Vector3
};
THREE
.
UV
=
function
(
a
,
b
){
this
.
set
(
a
||
0
,
b
||
0
)};
THREE
.
UV
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
u
=
a
;
this
.
v
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
set
(
a
.
u
,
a
.
v
);
return
this
}};
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
浏览文件 @
e8847848
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
examples/misc_sound.html
浏览文件 @
e8847848
...
...
@@ -160,7 +160,7 @@
postprocessing
.
camera
.
projectionMatrix
=
THREE
.
Matrix4
.
makeOrtho
(
window
.
innerWidth
/
-
2
,
window
.
innerWidth
/
2
,
window
.
innerHeight
/
2
,
window
.
innerHeight
/
-
2
,
-
10000
,
10000
);
postprocessing
.
camera
.
position
.
z
=
100
;
var
pars
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
};
var
pars
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
,
format
:
THREE
.
RGBFormat
};
postprocessing
.
rtTexture1
=
new
THREE
.
WebGLRenderTarget
(
window
.
innerWidth
,
window
.
innerHeight
,
pars
);
postprocessing
.
rtTexture2
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
pars
);
postprocessing
.
rtTexture3
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
pars
);
...
...
examples/webgl_lines_colors.html
浏览文件 @
e8847848
...
...
@@ -200,7 +200,7 @@
postprocessing
.
camera
.
projectionMatrix
=
THREE
.
Matrix4
.
makeOrtho
(
window
.
innerWidth
/
-
2
,
window
.
innerWidth
/
2
,
window
.
innerHeight
/
2
,
window
.
innerHeight
/
-
2
,
-
10000
,
10000
);
postprocessing
.
camera
.
position
.
z
=
100
;
var
pars
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
};
var
pars
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
,
format
:
THREE
.
RGBFormat
};
postprocessing
.
rtTexture1
=
new
THREE
.
WebGLRenderTarget
(
window
.
innerWidth
,
window
.
innerHeight
,
pars
);
postprocessing
.
rtTexture2
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
pars
);
postprocessing
.
rtTexture3
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
pars
);
...
...
examples/webgl_materials_video.html
浏览文件 @
e8847848
...
...
@@ -203,7 +203,7 @@
postprocessing
.
camera
.
projectionMatrix
=
THREE
.
Matrix4
.
makeOrtho
(
window
.
innerWidth
/
-
2
,
window
.
innerWidth
/
2
,
window
.
innerHeight
/
2
,
window
.
innerHeight
/
-
2
,
-
10000
,
10000
);
postprocessing
.
camera
.
position
.
z
=
100
;
var
pars
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
};
var
pars
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
,
format
:
THREE
.
RGBFormat
};
postprocessing
.
rtTexture1
=
new
THREE
.
WebGLRenderTarget
(
window
.
innerWidth
,
window
.
innerHeight
,
pars
);
postprocessing
.
rtTexture2
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
pars
);
postprocessing
.
rtTexture3
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
pars
);
...
...
examples/webgl_postprocessing.html
浏览文件 @
e8847848
...
...
@@ -107,9 +107,11 @@
directionalLight
.
position
.
normalize
();
sceneModel
.
addLight
(
directionalLight
);
rtTexture1
=
new
THREE
.
WebGLRenderTarget
(
window
.
innerWidth
,
window
.
innerHeight
,
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
NearestFilter
}
);
rtTexture2
=
new
THREE
.
WebGLRenderTarget
(
256
,
512
,
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
}
);
rtTexture3
=
new
THREE
.
WebGLRenderTarget
(
512
,
256
,
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
}
);
var
pars1
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
NearestFilter
,
format
:
THREE
.
RGBFormat
},
pars2
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
,
format
:
THREE
.
RGBFormat
};
rtTexture1
=
new
THREE
.
WebGLRenderTarget
(
window
.
innerWidth
,
window
.
innerHeight
,
pars1
);
rtTexture2
=
new
THREE
.
WebGLRenderTarget
(
256
,
512
,
pars2
);
rtTexture3
=
new
THREE
.
WebGLRenderTarget
(
512
,
256
,
pars2
);
materialColor
=
new
THREE
.
MeshShaderMaterial
(
{
...
...
examples/webgl_postprocessing_dof.html
浏览文件 @
e8847848
...
...
@@ -238,7 +238,7 @@
postprocessing
.
camera
.
projectionMatrix
=
THREE
.
Matrix4
.
makeOrtho
(
window
.
innerWidth
/
-
2
,
window
.
innerWidth
/
2
,
window
.
innerHeight
/
2
,
window
.
innerHeight
/
-
2
,
-
10000
,
10000
);
postprocessing
.
camera
.
position
.
z
=
100
;
var
pars
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
};
var
pars
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
,
format
:
THREE
.
RGBFormat
};
postprocessing
.
rtTextureDepth
=
new
THREE
.
WebGLRenderTarget
(
window
.
innerWidth
,
height
,
pars
);
postprocessing
.
rtTextureColor
=
new
THREE
.
WebGLRenderTarget
(
window
.
innerWidth
,
height
,
pars
);
...
...
examples/webgl_ribbons.html
浏览文件 @
e8847848
...
...
@@ -231,7 +231,7 @@
postprocessing
.
camera
.
projectionMatrix
=
THREE
.
Matrix4
.
makeOrtho
(
window
.
innerWidth
/
-
2
,
window
.
innerWidth
/
2
,
window
.
innerHeight
/
2
,
window
.
innerHeight
/
-
2
,
-
10000
,
10000
);
postprocessing
.
camera
.
position
.
z
=
100
;
var
pars
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
};
var
pars
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
,
format
:
THREE
.
RGBFormat
};
postprocessing
.
rtTexture1
=
new
THREE
.
WebGLRenderTarget
(
window
.
innerWidth
,
window
.
innerHeight
,
pars
);
postprocessing
.
rtTexture2
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
pars
);
postprocessing
.
rtTexture3
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
pars
);
...
...
examples/webgl_rtt.html
浏览文件 @
e8847848
...
...
@@ -130,7 +130,7 @@
light
.
position
.
normalize
();
sceneRTT
.
addLight
(
light
);
rtTexture
=
new
THREE
.
WebGLRenderTarget
(
window
.
innerWidth
,
window
.
innerHeight
,
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
NearestFilter
}
);
rtTexture
=
new
THREE
.
WebGLRenderTarget
(
window
.
innerWidth
,
window
.
innerHeight
,
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
NearestFilter
,
format
:
THREE
.
RGBFormat
}
);
material
=
new
THREE
.
MeshShaderMaterial
(
{
...
...
examples/webgl_shader_lava.html
浏览文件 @
e8847848
...
...
@@ -207,7 +207,7 @@
postprocessing
.
camera
.
projectionMatrix
=
THREE
.
Matrix4
.
makeOrtho
(
window
.
innerWidth
/
-
2
,
window
.
innerWidth
/
2
,
window
.
innerHeight
/
2
,
window
.
innerHeight
/
-
2
,
-
10000
,
10000
);
postprocessing
.
camera
.
position
.
z
=
100
;
var
pars
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
};
var
pars
=
{
minFilter
:
THREE
.
LinearFilter
,
magFilter
:
THREE
.
LinearFilter
,
format
:
THREE
.
RGBFormat
};
postprocessing
.
rtTexture1
=
new
THREE
.
WebGLRenderTarget
(
window
.
innerWidth
,
window
.
innerHeight
,
pars
);
postprocessing
.
rtTexture2
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
pars
);
postprocessing
.
rtTexture3
=
new
THREE
.
WebGLRenderTarget
(
512
,
512
,
pars
);
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
e8847848
...
...
@@ -215,9 +215,10 @@ THREE.WebGLRenderer = function ( parameters ) {
_lensFlare
.
uniforms
.
rotation
=
_gl
.
getUniformLocation
(
_lensFlare
.
program
,
"
rotation
"
);
_lensFlare
.
uniforms
.
screenPosition
=
_gl
.
getUniformLocation
(
_lensFlare
.
program
,
"
screenPosition
"
);
_gl
.
enableVertexAttribArray
(
_lensFlare
.
attributes
.
vertex
);
_gl
.
enableVertexAttribArray
(
_lensFlare
.
attributes
.
uv
);
//
_gl.enableVertexAttribArray( _lensFlare.attributes.vertex );
//
_gl.enableVertexAttribArray( _lensFlare.attributes.uv );
var
_lensFlareAttributesEnabled
=
false
;
// prepare sprites
...
...
@@ -272,9 +273,10 @@ THREE.WebGLRenderer = function ( parameters ) {
_sprite
.
uniforms
.
modelViewMatrix
=
_gl
.
getUniformLocation
(
_sprite
.
program
,
"
modelViewMatrix
"
);
_sprite
.
uniforms
.
projectionMatrix
=
_gl
.
getUniformLocation
(
_sprite
.
program
,
"
projectionMatrix
"
);
_gl
.
enableVertexAttribArray
(
_sprite
.
attributes
.
position
);
_gl
.
enableVertexAttribArray
(
_sprite
.
attributes
.
uv
);
//
_gl.enableVertexAttribArray( _sprite.attributes.position );
//
_gl.enableVertexAttribArray( _sprite.attributes.uv );
var
_spriteAttributesEnabled
=
false
;
this
.
setSize
=
function
(
width
,
height
)
{
...
...
@@ -2064,7 +2066,7 @@ THREE.WebGLRenderer = function ( parameters ) {
function
refreshUniformsCommon
(
uniforms
,
material
)
{
uniforms
.
diffuse
.
value
.
setRGB
(
material
.
color
.
r
,
material
.
color
.
g
,
material
.
color
.
b
)
;
uniforms
.
diffuse
.
value
=
material
.
color
;
uniforms
.
opacity
.
value
=
material
.
opacity
;
uniforms
.
map
.
texture
=
material
.
map
;
...
...
@@ -2080,14 +2082,14 @@ THREE.WebGLRenderer = function ( parameters ) {
function
refreshUniformsLine
(
uniforms
,
material
)
{
uniforms
.
diffuse
.
value
.
setRGB
(
material
.
color
.
r
,
material
.
color
.
g
,
material
.
color
.
b
)
;
uniforms
.
diffuse
.
value
=
material
.
color
;
uniforms
.
opacity
.
value
=
material
.
opacity
;
};
function
refreshUniformsParticle
(
uniforms
,
material
)
{
uniforms
.
psColor
.
value
.
setRGB
(
material
.
color
.
r
,
material
.
color
.
g
,
material
.
color
.
b
)
;
uniforms
.
psColor
.
value
=
material
.
color
;
uniforms
.
opacity
.
value
=
material
.
opacity
;
uniforms
.
size
.
value
=
material
.
size
;
uniforms
.
scale
.
value
=
_canvas
.
height
/
2.0
;
// TODO: Cache this.
...
...
@@ -2097,7 +2099,7 @@ THREE.WebGLRenderer = function ( parameters ) {
function
refreshUniformsFog
(
uniforms
,
fog
)
{
uniforms
.
fogColor
.
value
.
setHex
(
fog
.
color
.
hex
)
;
uniforms
.
fogColor
.
value
=
fog
.
color
;
if
(
fog
instanceof
THREE
.
Fog
)
{
...
...
@@ -2114,10 +2116,8 @@ THREE.WebGLRenderer = function ( parameters ) {
function
refreshUniformsPhong
(
uniforms
,
material
)
{
//uniforms.ambient.value.setHex( material.ambient.hex );
//uniforms.specular.value.setHex( material.specular.hex );
uniforms
.
ambient
.
value
.
setRGB
(
material
.
ambient
.
r
,
material
.
ambient
.
g
,
material
.
ambient
.
b
);
uniforms
.
specular
.
value
.
setRGB
(
material
.
specular
.
r
,
material
.
specular
.
g
,
material
.
specular
.
b
);
uniforms
.
ambient
.
value
=
material
.
ambient
;
uniforms
.
specular
.
value
=
material
.
specular
;
uniforms
.
shininess
.
value
=
material
.
shininess
;
};
...
...
@@ -3335,6 +3335,15 @@ THREE.WebGLRenderer = function ( parameters ) {
_currentProgram
=
_sprite
.
program
;
_oldBlending
=
""
;
if
(
!
_spriteAttributesEnabled
)
{
_gl
.
enableVertexAttribArray
(
_sprite
.
attributes
.
position
);
_gl
.
enableVertexAttribArray
(
_sprite
.
attributes
.
uv
);
_spriteAttributesEnabled
=
true
;
}
_gl
.
disable
(
_gl
.
CULL_FACE
);
_gl
.
enable
(
_gl
.
BLEND
);
_gl
.
depthMask
(
true
);
...
...
@@ -3491,6 +3500,15 @@ THREE.WebGLRenderer = function ( parameters ) {
_oldBlending
=
""
;
if
(
!
_lensFlareAttributesEnabled
)
{
_gl
.
enableVertexAttribArray
(
_lensFlare
.
attributes
.
vertex
);
_gl
.
enableVertexAttribArray
(
_lensFlare
.
attributes
.
uv
);
_lensFlareAttributesEnabled
=
true
;
}
// loop through all lens flares to update their occlusion and positions
// setup gl and common used attribs/unforms
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录