Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
8ea0f276
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,发现更多精彩内容 >>
提交
8ea0f276
编写于
1月 04, 2011
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactored lines grid in materials_gl example.
上级
92c0c8c4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
22 addition
and
24 deletion
+22
-24
build/Three.js
build/Three.js
+3
-3
build/ThreeDebug.js
build/ThreeDebug.js
+3
-3
build/ThreeExtras.js
build/ThreeExtras.js
+3
-3
examples/materials_gl.html
examples/materials_gl.html
+13
-15
未找到文件。
build/Three.js
浏览文件 @
8ea0f276
...
...
@@ -5,9 +5,9 @@ THREE.Color.prototype={setRGB:function(a,b,f){this.r=a;this.g=b;this.b=f;if(this
THREE
.
Vector2
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
x
=
a
;
this
.
y
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
return
this
},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
return
this
},
unit
:
function
(){
this
.
multiplyScalar
(
1
/
this
.
length
());
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
)},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
},
negate
:
function
(){
this
.
x
=-
this
.
x
;
this
.
y
=-
this
.
y
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector2
(
this
.
x
,
this
.
y
)},
toString
:
function
(){
return
"
THREE.Vector2 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
)
"
}};
THREE
.
Vector3
=
function
(
a
,
b
,
f
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
f
||
0
};
THREE
.
Vector3
.
prototype
=
{
set
:
function
(
a
,
b
,
f
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
f
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
return
this
},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
return
this
},
addScalar
:
function
(
a
){
this
.
x
+=
a
;
this
.
y
+=
a
;
this
.
z
+=
a
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
return
this
},
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
-
a
.
y
*
b
.
x
;
return
this
},
crossSelf
:
function
(
a
){
var
b
=
this
.
x
,
f
=
this
.
y
,
e
=
this
.
z
;
this
.
x
=
f
*
a
.
z
-
e
*
a
.
y
;
this
.
y
=
e
*
a
.
x
-
b
*
a
.
z
;
this
.
z
=
b
*
a
.
y
-
f
*
a
.
x
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
x
;
this
.
y
=
a
.
y
*
b
.
y
;
this
.
z
=
a
.
z
*
b
.
z
;
return
this
},
multiplySelf
:
function
(
a
){
this
.
x
*=
a
.
x
;
this
.
y
*=
a
.
y
;
this
.
z
*=
a
.
z
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
return
this
},
divideS
calar
:
function
(
a
){
this
.
x
/=
a
;
this
.
y
/=
a
;
this
.
z
/=
a
;
return
this
},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
},
distanceTo
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
f
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
Math
.
sqrt
(
b
*
b
+
f
*
f
+
a
*
a
)},
distanceToSquared
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
f
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
b
*
b
+
f
*
f
+
a
*
a
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
)},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
},
negate
:
function
(){
this
.
x
=-
this
.
x
;
this
.
y
=-
this
.
y
;
this
.
z
=-
this
.
z
;
return
this
},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
);
a
>
0
?
this
.
multiplyScalar
(
1
/
a
):
this
.
set
(
0
,
0
,
0
);
return
this
},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
isZero
:
function
(){
return
Math
.
abs
(
this
.
x
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
y
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
z
)
<
1.0
E
-
4
},
clone
:
function
(){
return
new
THREE
.
Vector3
(
this
.
x
,
this
.
y
,
this
.
z
)},
toString
:
function
(){
return
"
THREE.Vector3 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
)
"
}};
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
-
a
.
y
*
b
.
x
;
return
this
},
crossSelf
:
function
(
a
){
var
b
=
this
.
x
,
f
=
this
.
y
,
e
=
this
.
z
;
this
.
x
=
f
*
a
.
z
-
e
*
a
.
y
;
this
.
y
=
e
*
a
.
x
-
b
*
a
.
z
;
this
.
z
=
b
*
a
.
y
-
f
*
a
.
x
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
x
;
this
.
y
=
a
.
y
*
b
.
y
;
this
.
z
=
a
.
z
*
b
.
z
;
return
this
},
multiplySelf
:
function
(
a
){
this
.
x
*=
a
.
x
;
this
.
y
*=
a
.
y
;
this
.
z
*=
a
.
z
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
return
this
},
divideS
elf
:
function
(
a
){
this
.
x
/=
a
.
x
;
this
.
y
/=
a
.
y
;
this
.
z
/=
a
.
z
;
return
this
},
divideScalar
:
function
(
a
){
this
.
x
/=
a
;
this
.
y
/=
a
;
this
.
z
/=
a
;
return
this
},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
},
distanceTo
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
f
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
Math
.
sqrt
(
b
*
b
+
f
*
f
+
a
*
a
)},
distanceToSquared
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
f
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
b
*
b
+
f
*
f
+
a
*
a
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
)},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
},
negate
:
function
(){
this
.
x
=
-
this
.
x
;
this
.
y
=-
this
.
y
;
this
.
z
=-
this
.
z
;
return
this
},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
);
a
>
0
?
this
.
multiplyScalar
(
1
/
a
):
this
.
set
(
0
,
0
,
0
);
return
this
},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
isZero
:
function
(){
return
Math
.
abs
(
this
.
x
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
y
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
z
)
<
1.0
E
-
4
},
clone
:
function
(){
return
new
THREE
.
Vector3
(
this
.
x
,
this
.
y
,
this
.
z
)},
toString
:
function
(){
return
"
THREE.Vector3 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
)
"
}};
THREE
.
Vector4
=
function
(
a
,
b
,
f
,
e
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
f
||
0
;
this
.
w
=
e
||
1
};
THREE
.
Vector4
.
prototype
=
{
set
:
function
(
a
,
b
,
f
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
f
;
this
.
w
=
e
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
a
.
w
||
1
;
return
this
},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
this
.
x
/=
a
;
this
.
y
/=
a
;
this
.
z
/=
a
;
this
.
w
/=
a
;
return
this
},
lerpSelf
:
function
(
a
,
b
){
this
.
x
+=
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
+=
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
+=
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
+=
(
a
.
w
-
this
.
w
)
*
b
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
toString
:
function
(){
return
"
THREE.Vector4 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
,
"
+
this
.
w
+
"
)
"
}};
...
...
build/ThreeDebug.js
浏览文件 @
8ea0f276
...
...
@@ -5,9 +5,9 @@ THREE.Color.prototype={setRGB:function(a,b,f){this.r=a;this.g=b;this.b=f;if(this
THREE
.
Vector2
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
x
=
a
;
this
.
y
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
return
this
},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
return
this
},
unit
:
function
(){
this
.
multiplyScalar
(
1
/
this
.
length
());
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
)},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
},
negate
:
function
(){
this
.
x
=-
this
.
x
;
this
.
y
=-
this
.
y
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector2
(
this
.
x
,
this
.
y
)},
toString
:
function
(){
return
"
THREE.Vector2 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
)
"
}};
THREE
.
Vector3
=
function
(
a
,
b
,
f
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
f
||
0
};
THREE
.
Vector3
.
prototype
=
{
set
:
function
(
a
,
b
,
f
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
f
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
return
this
},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
return
this
},
addScalar
:
function
(
a
){
this
.
x
+=
a
;
this
.
y
+=
a
;
this
.
z
+=
a
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
return
this
},
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
-
a
.
y
*
b
.
x
;
return
this
},
crossSelf
:
function
(
a
){
var
b
=
this
.
x
,
f
=
this
.
y
,
e
=
this
.
z
;
this
.
x
=
f
*
a
.
z
-
e
*
a
.
y
;
this
.
y
=
e
*
a
.
x
-
b
*
a
.
z
;
this
.
z
=
b
*
a
.
y
-
f
*
a
.
x
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
x
;
this
.
y
=
a
.
y
*
b
.
y
;
this
.
z
=
a
.
z
*
b
.
z
;
return
this
},
multiplySelf
:
function
(
a
){
this
.
x
*=
a
.
x
;
this
.
y
*=
a
.
y
;
this
.
z
*=
a
.
z
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
return
this
},
divideS
calar
:
function
(
a
){
this
.
x
/=
a
;
this
.
y
/=
a
;
this
.
z
/=
a
;
return
this
},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
},
distanceTo
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
f
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
Math
.
sqrt
(
b
*
b
+
f
*
f
+
a
*
a
)},
distanceToSquared
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
f
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
b
*
b
+
f
*
f
+
a
*
a
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
)},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
},
negate
:
function
(){
this
.
x
=-
this
.
x
;
this
.
y
=-
this
.
y
;
this
.
z
=-
this
.
z
;
return
this
},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
);
a
>
0
?
this
.
multiplyScalar
(
1
/
a
):
this
.
set
(
0
,
0
,
0
);
return
this
},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
isZero
:
function
(){
return
Math
.
abs
(
this
.
x
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
y
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
z
)
<
1.0
E
-
4
},
clone
:
function
(){
return
new
THREE
.
Vector3
(
this
.
x
,
this
.
y
,
this
.
z
)},
toString
:
function
(){
return
"
THREE.Vector3 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
)
"
}};
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
-
a
.
y
*
b
.
x
;
return
this
},
crossSelf
:
function
(
a
){
var
b
=
this
.
x
,
f
=
this
.
y
,
e
=
this
.
z
;
this
.
x
=
f
*
a
.
z
-
e
*
a
.
y
;
this
.
y
=
e
*
a
.
x
-
b
*
a
.
z
;
this
.
z
=
b
*
a
.
y
-
f
*
a
.
x
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
x
;
this
.
y
=
a
.
y
*
b
.
y
;
this
.
z
=
a
.
z
*
b
.
z
;
return
this
},
multiplySelf
:
function
(
a
){
this
.
x
*=
a
.
x
;
this
.
y
*=
a
.
y
;
this
.
z
*=
a
.
z
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
return
this
},
divideS
elf
:
function
(
a
){
this
.
x
/=
a
.
x
;
this
.
y
/=
a
.
y
;
this
.
z
/=
a
.
z
;
return
this
},
divideScalar
:
function
(
a
){
this
.
x
/=
a
;
this
.
y
/=
a
;
this
.
z
/=
a
;
return
this
},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
},
distanceTo
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
f
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
Math
.
sqrt
(
b
*
b
+
f
*
f
+
a
*
a
)},
distanceToSquared
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
f
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
b
*
b
+
f
*
f
+
a
*
a
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
)},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
},
negate
:
function
(){
this
.
x
=
-
this
.
x
;
this
.
y
=-
this
.
y
;
this
.
z
=-
this
.
z
;
return
this
},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
);
a
>
0
?
this
.
multiplyScalar
(
1
/
a
):
this
.
set
(
0
,
0
,
0
);
return
this
},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
isZero
:
function
(){
return
Math
.
abs
(
this
.
x
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
y
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
z
)
<
1.0
E
-
4
},
clone
:
function
(){
return
new
THREE
.
Vector3
(
this
.
x
,
this
.
y
,
this
.
z
)},
toString
:
function
(){
return
"
THREE.Vector3 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
)
"
}};
THREE
.
Vector4
=
function
(
a
,
b
,
f
,
e
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
f
||
0
;
this
.
w
=
e
||
1
};
THREE
.
Vector4
.
prototype
=
{
set
:
function
(
a
,
b
,
f
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
f
;
this
.
w
=
e
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
a
.
w
||
1
;
return
this
},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
this
.
x
/=
a
;
this
.
y
/=
a
;
this
.
z
/=
a
;
this
.
w
/=
a
;
return
this
},
lerpSelf
:
function
(
a
,
b
){
this
.
x
+=
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
+=
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
+=
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
+=
(
a
.
w
-
this
.
w
)
*
b
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
toString
:
function
(){
return
"
THREE.Vector4 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
,
"
+
this
.
w
+
"
)
"
}};
...
...
build/ThreeExtras.js
浏览文件 @
8ea0f276
...
...
@@ -5,9 +5,9 @@ THREE.Color.prototype={setRGB:function(a,b,f){this.r=a;this.g=b;this.b=f;if(this
THREE
.
Vector2
.
prototype
=
{
set
:
function
(
a
,
b
){
this
.
x
=
a
;
this
.
y
=
b
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
return
this
},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
return
this
},
unit
:
function
(){
this
.
multiplyScalar
(
1
/
this
.
length
());
return
this
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
)},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
},
negate
:
function
(){
this
.
x
=-
this
.
x
;
this
.
y
=-
this
.
y
;
return
this
},
clone
:
function
(){
return
new
THREE
.
Vector2
(
this
.
x
,
this
.
y
)},
toString
:
function
(){
return
"
THREE.Vector2 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
)
"
}};
THREE
.
Vector3
=
function
(
a
,
b
,
f
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
f
||
0
};
THREE
.
Vector3
.
prototype
=
{
set
:
function
(
a
,
b
,
f
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
f
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
return
this
},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
return
this
},
addScalar
:
function
(
a
){
this
.
x
+=
a
;
this
.
y
+=
a
;
this
.
z
+=
a
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
return
this
},
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
-
a
.
y
*
b
.
x
;
return
this
},
crossSelf
:
function
(
a
){
var
b
=
this
.
x
,
f
=
this
.
y
,
e
=
this
.
z
;
this
.
x
=
f
*
a
.
z
-
e
*
a
.
y
;
this
.
y
=
e
*
a
.
x
-
b
*
a
.
z
;
this
.
z
=
b
*
a
.
y
-
f
*
a
.
x
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
x
;
this
.
y
=
a
.
y
*
b
.
y
;
this
.
z
=
a
.
z
*
b
.
z
;
return
this
},
multiplySelf
:
function
(
a
){
this
.
x
*=
a
.
x
;
this
.
y
*=
a
.
y
;
this
.
z
*=
a
.
z
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
return
this
},
divideS
calar
:
function
(
a
){
this
.
x
/=
a
;
this
.
y
/=
a
;
this
.
z
/=
a
;
return
this
},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
},
distanceTo
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
f
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
Math
.
sqrt
(
b
*
b
+
f
*
f
+
a
*
a
)},
distanceToSquared
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
f
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
b
*
b
+
f
*
f
+
a
*
a
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
)},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
},
negate
:
function
(){
this
.
x
=-
this
.
x
;
this
.
y
=-
this
.
y
;
this
.
z
=-
this
.
z
;
return
this
},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
);
a
>
0
?
this
.
multiplyScalar
(
1
/
a
):
this
.
set
(
0
,
0
,
0
);
return
this
},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
isZero
:
function
(){
return
Math
.
abs
(
this
.
x
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
y
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
z
)
<
1.0
E
-
4
},
clone
:
function
(){
return
new
THREE
.
Vector3
(
this
.
x
,
this
.
y
,
this
.
z
)},
toString
:
function
(){
return
"
THREE.Vector3 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
)
"
}};
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
-
a
.
y
*
b
.
x
;
return
this
},
crossSelf
:
function
(
a
){
var
b
=
this
.
x
,
f
=
this
.
y
,
e
=
this
.
z
;
this
.
x
=
f
*
a
.
z
-
e
*
a
.
y
;
this
.
y
=
e
*
a
.
x
-
b
*
a
.
z
;
this
.
z
=
b
*
a
.
y
-
f
*
a
.
x
;
return
this
},
multiply
:
function
(
a
,
b
){
this
.
x
=
a
.
x
*
b
.
x
;
this
.
y
=
a
.
y
*
b
.
y
;
this
.
z
=
a
.
z
*
b
.
z
;
return
this
},
multiplySelf
:
function
(
a
){
this
.
x
*=
a
.
x
;
this
.
y
*=
a
.
y
;
this
.
z
*=
a
.
z
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
return
this
},
divideS
elf
:
function
(
a
){
this
.
x
/=
a
.
x
;
this
.
y
/=
a
.
y
;
this
.
z
/=
a
.
z
;
return
this
},
divideScalar
:
function
(
a
){
this
.
x
/=
a
;
this
.
y
/=
a
;
this
.
z
/=
a
;
return
this
},
dot
:
function
(
a
){
return
this
.
x
*
a
.
x
+
this
.
y
*
a
.
y
+
this
.
z
*
a
.
z
},
distanceTo
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
f
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
Math
.
sqrt
(
b
*
b
+
f
*
f
+
a
*
a
)},
distanceToSquared
:
function
(
a
){
var
b
=
this
.
x
-
a
.
x
,
f
=
this
.
y
-
a
.
y
;
a
=
this
.
z
-
a
.
z
;
return
b
*
b
+
f
*
f
+
a
*
a
},
length
:
function
(){
return
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
)},
lengthSq
:
function
(){
return
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
},
negate
:
function
(){
this
.
x
=
-
this
.
x
;
this
.
y
=-
this
.
y
;
this
.
z
=-
this
.
z
;
return
this
},
normalize
:
function
(){
var
a
=
Math
.
sqrt
(
this
.
x
*
this
.
x
+
this
.
y
*
this
.
y
+
this
.
z
*
this
.
z
);
a
>
0
?
this
.
multiplyScalar
(
1
/
a
):
this
.
set
(
0
,
0
,
0
);
return
this
},
setLength
:
function
(
a
){
return
this
.
normalize
().
multiplyScalar
(
a
)},
isZero
:
function
(){
return
Math
.
abs
(
this
.
x
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
y
)
<
1.0
E
-
4
&&
Math
.
abs
(
this
.
z
)
<
1.0
E
-
4
},
clone
:
function
(){
return
new
THREE
.
Vector3
(
this
.
x
,
this
.
y
,
this
.
z
)},
toString
:
function
(){
return
"
THREE.Vector3 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
)
"
}};
THREE
.
Vector4
=
function
(
a
,
b
,
f
,
e
){
this
.
x
=
a
||
0
;
this
.
y
=
b
||
0
;
this
.
z
=
f
||
0
;
this
.
w
=
e
||
1
};
THREE
.
Vector4
.
prototype
=
{
set
:
function
(
a
,
b
,
f
,
e
){
this
.
x
=
a
;
this
.
y
=
b
;
this
.
z
=
f
;
this
.
w
=
e
;
return
this
},
copy
:
function
(
a
){
this
.
x
=
a
.
x
;
this
.
y
=
a
.
y
;
this
.
z
=
a
.
z
;
this
.
w
=
a
.
w
||
1
;
return
this
},
add
:
function
(
a
,
b
){
this
.
x
=
a
.
x
+
b
.
x
;
this
.
y
=
a
.
y
+
b
.
y
;
this
.
z
=
a
.
z
+
b
.
z
;
this
.
w
=
a
.
w
+
b
.
w
;
return
this
},
addSelf
:
function
(
a
){
this
.
x
+=
a
.
x
;
this
.
y
+=
a
.
y
;
this
.
z
+=
a
.
z
;
this
.
w
+=
a
.
w
;
return
this
},
sub
:
function
(
a
,
b
){
this
.
x
=
a
.
x
-
b
.
x
;
this
.
y
=
a
.
y
-
b
.
y
;
this
.
z
=
a
.
z
-
b
.
z
;
this
.
w
=
a
.
w
-
b
.
w
;
return
this
},
subSelf
:
function
(
a
){
this
.
x
-=
a
.
x
;
this
.
y
-=
a
.
y
;
this
.
z
-=
a
.
z
;
this
.
w
-=
a
.
w
;
return
this
},
multiplyScalar
:
function
(
a
){
this
.
x
*=
a
;
this
.
y
*=
a
;
this
.
z
*=
a
;
this
.
w
*=
a
;
return
this
},
divideScalar
:
function
(
a
){
this
.
x
/=
a
;
this
.
y
/=
a
;
this
.
z
/=
a
;
this
.
w
/=
a
;
return
this
},
lerpSelf
:
function
(
a
,
b
){
this
.
x
+=
(
a
.
x
-
this
.
x
)
*
b
;
this
.
y
+=
(
a
.
y
-
this
.
y
)
*
b
;
this
.
z
+=
(
a
.
z
-
this
.
z
)
*
b
;
this
.
w
+=
(
a
.
w
-
this
.
w
)
*
b
},
clone
:
function
(){
return
new
THREE
.
Vector4
(
this
.
x
,
this
.
y
,
this
.
z
,
this
.
w
)},
toString
:
function
(){
return
"
THREE.Vector4 (
"
+
this
.
x
+
"
,
"
+
this
.
y
+
"
,
"
+
this
.
z
+
"
,
"
+
this
.
w
+
"
)
"
}};
...
...
examples/materials_gl.html
浏览文件 @
8ea0f276
...
...
@@ -44,24 +44,22 @@
// Grid
var
geometry
=
new
THREE
.
Geometry
();
geometry
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
-
500
,
0
,
0
)
)
);
geometry
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
500
,
0
,
0
)
)
);
for
(
var
i
=
0
;
i
<=
10
;
i
++
)
{
var
line
=
new
THREE
.
Line
(
geometry
,
new
THREE
.
LineBasicMaterial
(
{
color
:
0xffffff
,
opacity
:
0.2
}
)
);
line
.
position
.
y
=
-
120
;
line
.
position
.
z
=
(
i
*
100
)
-
500
;
scene
.
addObject
(
line
);
var
line_material
=
new
THREE
.
LineBasicMaterial
(
{
color
:
0xffffff
,
opacity
:
0.2
}
),
geometry
=
new
THREE
.
Geometry
(),
floor
=
-
75
,
step
=
25
;
for
(
var
i
=
0
;
i
<=
40
;
i
++
)
{
geometry
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
-
500
,
floor
,
i
*
step
-
500
)
)
);
geometry
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
500
,
floor
,
i
*
step
-
500
)
)
);
var
line
=
new
THREE
.
Line
(
geometry
,
new
THREE
.
LineBasicMaterial
(
{
color
:
0xffffff
,
opacity
:
0.2
}
)
);
line
.
position
.
x
=
(
i
*
100
)
-
500
;
line
.
position
.
y
=
-
120
;
line
.
rotation
.
y
=
90
*
Math
.
PI
/
180
;
scene
.
addObject
(
line
);
geometry
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
i
*
step
-
500
,
floor
,
-
500
)
)
);
geometry
.
vertices
.
push
(
new
THREE
.
Vertex
(
new
THREE
.
Vector3
(
i
*
step
-
500
,
floor
,
500
)
)
);
}
var
line
=
new
THREE
.
Line
(
geometry
,
line_material
,
THREE
.
LinePieces
);
scene
.
addObject
(
line
);
var
generatedTexture
=
new
THREE
.
Texture
(
generateTexture
()
);
generatedTexture
.
image
.
loaded
=
1
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录