Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
315bc5ad
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,发现更多精彩内容 >>
提交
315bc5ad
编写于
12月 03, 2010
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updated build.
上级
ef2243bd
变更
3
展开全部
显示空白变更内容
内联
并排
Showing
3 changed file
with
548 addition
and
545 deletion
+548
-545
build/Three.js
build/Three.js
+169
-168
build/ThreeDebug.js
build/ThreeDebug.js
+170
-169
build/ThreeExtras.js
build/ThreeExtras.js
+209
-208
未找到文件。
build/Three.js
浏览文件 @
315bc5ad
此差异已折叠。
点击以展开。
build/ThreeDebug.js
浏览文件 @
315bc5ad
此差异已折叠。
点击以展开。
build/ThreeExtras.js
浏览文件 @
315bc5ad
...
...
@@ -43,12 +43,13 @@ THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld
THREE
.
Face3
=
function
(
a
,
b
,
d
,
e
,
f
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
d
;
this
.
centroid
=
new
THREE
.
Vector3
;
this
.
normal
=
e
instanceof
THREE
.
Vector3
?
e
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
e
instanceof
Array
?
e
:[];
this
.
material
=
f
instanceof
Array
?
f
:[
f
]};
THREE
.
Face3
.
prototype
=
{
toString
:
function
(){
return
"
THREE.Face3 (
"
+
this
.
a
+
"
,
"
+
this
.
b
+
"
,
"
+
this
.
c
+
"
)
"
}};
THREE
.
Face4
=
function
(
a
,
b
,
d
,
e
,
f
,
j
){
this
.
a
=
a
;
this
.
b
=
b
;
this
.
c
=
d
;
this
.
d
=
e
;
this
.
centroid
=
new
THREE
.
Vector3
;
this
.
normal
=
f
instanceof
THREE
.
Vector3
?
f
:
new
THREE
.
Vector3
;
this
.
vertexNormals
=
f
instanceof
Array
?
f
:[];
this
.
material
=
j
instanceof
Array
?
j
:[
j
]};
THREE
.
Face4
.
prototype
=
{
toString
:
function
(){
return
"
THREE.Face4 (
"
+
this
.
a
+
"
,
"
+
this
.
b
+
"
,
"
+
this
.
c
+
"
"
+
this
.
d
+
"
)
"
}};
THREE
.
UV
=
function
(
a
,
b
){
this
.
u
=
a
||
0
;
this
.
v
=
b
||
0
};
THREE
.
UV
.
prototype
=
{
copy
:
function
(
a
){
this
.
u
=
a
.
u
;
this
.
v
=
a
.
v
},
toString
:
function
(){
return
"
THREE.UV (
"
+
this
.
u
+
"
,
"
+
this
.
v
+
"
)
"
}};
THREE
.
Geometry
=
function
(){
this
.
vertices
=
[];
this
.
faces
=
[];
this
.
uvs
=
[];
this
.
geometryChunks
=
{}};
THREE
.
Geometry
.
prototype
=
{
computeCentroids
:
function
(){
var
a
,
b
,
d
;
a
=
0
;
for
(
b
=
this
.
faces
.
length
;
a
<
b
;
a
++
){
d
=
this
.
faces
[
a
];
d
.
centroid
.
set
(
0
,
0
,
0
);
d
.
centroid
.
addSelf
(
this
.
vertices
[
d
.
a
].
position
);
d
.
centroid
.
addSelf
(
this
.
vertices
[
d
.
b
].
position
);
d
.
centroid
.
addSelf
(
this
.
vertices
[
d
.
c
].
position
);
if
(
d
instanceof
THREE
.
Face3
)
d
.
centroid
.
divideScalar
(
3
);
else
if
(
d
instanceof
THREE
.
Face4
){
d
.
centroid
.
addSelf
(
this
.
vertices
[
d
.
d
].
position
);
d
.
centroid
.
divideScalar
(
4
)}}},
computeNormals
:
function
(
a
){
var
b
,
d
,
e
,
f
,
j
,
k
,
g
=
new
THREE
.
Vector3
,
p
=
new
THREE
.
Vector3
;
e
=
0
;
for
(
f
=
this
.
vertices
.
length
;
e
<
f
;
e
++
){
j
=
this
.
vertices
[
e
];
j
.
normal
.
set
(
0
,
0
,
0
)}
e
=
0
;
for
(
f
=
this
.
faces
.
length
;
e
<
f
;
e
++
){
j
=
this
.
faces
[
e
];
if
(
a
&&
j
.
vertexNormals
.
length
){
g
.
set
(
0
,
0
,
0
);
b
=
0
;
for
(
d
=
j
.
normal
.
length
;
b
<
d
;
b
++
)
g
.
addSelf
(
j
.
vertexNormals
[
b
]);
g
.
divideScalar
(
3
)}
else
{
b
=
this
.
vertices
[
j
.
a
];
d
=
this
.
vertices
[
j
.
b
];
k
=
this
.
vertices
[
j
.
c
];
g
.
sub
(
k
.
position
,
d
.
position
);
p
.
sub
(
b
.
position
,
d
.
position
);
g
.
crossSelf
(
p
)}
g
.
isZero
()
||
g
.
normalize
();
j
.
normal
.
copy
(
g
)}},
computeVertexNormals
:
function
(){
var
a
,
b
;
a
=
0
;
for
(
b
=
this
.
faces
.
length
;
a
<
b
;
a
++
);},
computeBoundingBox
:
function
(){
if
(
this
.
vertices
.
length
>
0
){
this
.
bbox
=
{
x
:[
this
.
vertices
[
0
].
position
.
x
,
this
.
vertices
[
0
].
position
.
x
],
y
:[
this
.
vertices
[
0
].
position
.
y
,
this
.
vertices
[
0
].
position
.
y
],
z
:[
this
.
vertices
[
0
].
position
.
z
,
this
.
vertices
[
0
].
position
.
z
]};
for
(
var
a
=
1
,
b
=
this
.
vertices
.
length
;
a
<
b
;
a
++
){
vertex
=
this
.
vertices
[
a
];
if
(
vertex
.
position
.
x
<
this
.
bbox
.
x
[
0
])
this
.
bbox
.
x
[
0
]
=
vertex
.
position
.
x
;
else
if
(
vertex
.
position
.
x
>
this
.
bbox
.
x
[
1
])
this
.
bbox
.
x
[
1
]
=
vertex
.
position
.
x
;
if
(
vertex
.
position
.
y
<
this
.
bbox
.
y
[
0
])
this
.
bbox
.
y
[
0
]
=
vertex
.
position
.
y
;
else
if
(
vertex
.
position
.
y
>
this
.
bbox
.
y
[
1
])
this
.
bbox
.
y
[
1
]
=
vertex
.
position
.
y
;
if
(
vertex
.
position
.
z
<
this
.
bbox
.
z
[
0
])
this
.
bbox
.
z
[
0
]
=
vertex
.
position
.
z
;
else
if
(
vertex
.
position
.
z
>
this
.
bbox
.
z
[
1
])
this
.
bbox
.
z
[
1
]
=
vertex
.
position
.
z
}}},
sortFacesByMaterial
:
function
(){
function
a
(
t
){
var
F
=
[];
b
=
0
;
for
(
d
=
t
.
length
;
b
<
d
;
b
++
)
t
[
b
]
==
undefined
?
F
.
push
(
"
undefined
"
):
F
.
push
(
t
[
b
].
toString
());
return
F
.
join
(
"
_
"
)}
var
b
,
d
,
e
,
f
,
j
,
k
,
g
,
p
,
c
=
{};
e
=
0
;
for
(
f
=
this
.
faces
.
length
;
e
<
f
;
e
++
){
j
=
this
.
faces
[
e
];
k
=
j
.
material
;
g
=
a
(
k
);
if
(
c
[
g
]
==
undefined
)
c
[
g
]
=
{
hash
:
g
,
counter
:
0
};
p
=
c
[
g
].
hash
+
"
_
"
+
c
[
g
].
counter
;
if
(
this
.
geometryChunks
[
p
]
==
undefined
)
this
.
geometryChunks
[
p
]
=
{
faces
:[],
material
:
k
,
vertices
:
0
};
j
=
j
instanceof
THREE
.
Face3
?
3
:
4
;
if
(
this
.
geometryChunks
[
p
].
vertices
+
j
>
65535
){
c
[
g
].
counter
+=
1
;
p
=
c
[
g
].
hash
+
"
_
"
+
c
[
g
].
counter
;
if
(
this
.
geometryChunks
[
p
]
==
undefined
)
this
.
geometryChunks
[
p
]
=
{
faces
:[],
material
:
k
,
vertices
:
0
}}
this
.
geometryChunks
[
p
].
faces
.
push
(
e
);
this
.
geometryChunks
[
p
].
vertices
+=
j
}},
toString
:
function
(){
return
"
THREE.Geometry ( vertices:
"
+
this
.
vertices
+
"
, faces:
"
+
this
.
faces
+
"
, uvs:
"
+
this
.
uvs
+
"
)
"
}};
THREE
.
Geometry
.
prototype
=
{
computeCentroids
:
function
(){
var
a
,
b
,
d
;
a
=
0
;
for
(
b
=
this
.
faces
.
length
;
a
<
b
;
a
++
){
d
=
this
.
faces
[
a
];
d
.
centroid
.
set
(
0
,
0
,
0
);
if
(
d
instanceof
THREE
.
Face3
){
d
.
centroid
.
addSelf
(
this
.
vertices
[
d
.
a
].
position
);
d
.
centroid
.
addSelf
(
this
.
vertices
[
d
.
b
].
position
);
d
.
centroid
.
addSelf
(
this
.
vertices
[
d
.
c
].
position
);
d
.
centroid
.
divideScalar
(
3
)}
else
if
(
d
instanceof
THREE
.
Face4
){
d
.
centroid
.
addSelf
(
this
.
vertices
[
d
.
a
].
position
);
d
.
centroid
.
addSelf
(
this
.
vertices
[
d
.
b
].
position
);
d
.
centroid
.
addSelf
(
this
.
vertices
[
d
.
c
].
position
);
d
.
centroid
.
addSelf
(
this
.
vertices
[
d
.
d
].
position
);
d
.
centroid
.
divideScalar
(
4
)}}},
computeNormals
:
function
(
a
){
var
b
,
d
,
e
,
f
,
j
,
k
,
g
=
new
THREE
.
Vector3
,
p
=
new
THREE
.
Vector3
;
e
=
0
;
for
(
f
=
this
.
vertices
.
length
;
e
<
f
;
e
++
){
j
=
this
.
vertices
[
e
];
j
.
normal
.
set
(
0
,
0
,
0
)}
e
=
0
;
for
(
f
=
this
.
faces
.
length
;
e
<
f
;
e
++
){
j
=
this
.
faces
[
e
];
if
(
a
&&
j
.
vertexNormals
.
length
){
g
.
set
(
0
,
0
,
0
);
b
=
0
;
for
(
d
=
j
.
normal
.
length
;
b
<
d
;
b
++
)
g
.
addSelf
(
j
.
vertexNormals
[
b
]);
g
.
divideScalar
(
3
)}
else
{
b
=
this
.
vertices
[
j
.
a
];
d
=
this
.
vertices
[
j
.
b
];
k
=
this
.
vertices
[
j
.
c
];
g
.
sub
(
k
.
position
,
d
.
position
);
p
.
sub
(
b
.
position
,
d
.
position
);
g
.
crossSelf
(
p
)}
g
.
isZero
()
||
g
.
normalize
();
j
.
normal
.
copy
(
g
)}},
computeVertexNormals
:
function
(){
var
a
,
b
=
[],
d
,
e
;
a
=
0
;
for
(
vl
=
this
.
vertices
.
length
;
a
<
vl
;
a
++
)
b
[
a
]
=
new
THREE
.
Vector3
;
a
=
0
;
for
(
d
=
this
.
faces
.
length
;
a
<
d
;
a
++
){
e
=
this
.
faces
[
a
];
if
(
e
instanceof
THREE
.
Face3
){
b
[
e
.
a
].
addSelf
(
e
.
normal
);
b
[
e
.
b
].
addSelf
(
e
.
normal
);
b
[
e
.
c
].
addSelf
(
e
.
normal
)}
else
if
(
e
instanceof
THREE
.
Face4
){
b
[
e
.
a
].
addSelf
(
e
.
normal
);
b
[
e
.
b
].
addSelf
(
e
.
normal
);
b
[
e
.
c
].
addSelf
(
e
.
normal
);
b
[
e
.
d
].
addSelf
(
e
.
normal
)}}
a
=
0
;
for
(
vl
=
this
.
vertices
.
length
;
a
<
vl
;
a
++
)
b
[
a
].
normalize
();
a
=
0
;
for
(
d
=
this
.
faces
.
length
;
a
<
d
;
a
++
){
e
=
this
.
faces
[
a
];
if
(
e
instanceof
THREE
.
Face3
){
e
.
vertexNormals
[
0
]
=
b
[
e
.
a
].
clone
();
e
.
vertexNormals
[
1
]
=
b
[
e
.
b
].
clone
();
e
.
vertexNormals
[
2
]
=
b
[
e
.
c
].
clone
()}
else
if
(
e
instanceof
THREE
.
Face4
){
e
.
vertexNormals
[
0
]
=
b
[
e
.
a
].
clone
();
e
.
vertexNormals
[
1
]
=
b
[
e
.
b
].
clone
();
e
.
vertexNormals
[
2
]
=
b
[
e
.
c
].
clone
();
e
.
vertexNormals
[
3
]
=
b
[
e
.
d
].
clone
()}}},
computeBoundingBox
:
function
(){
if
(
this
.
vertices
.
length
>
0
){
this
.
bbox
=
{
x
:[
this
.
vertices
[
0
].
position
.
x
,
this
.
vertices
[
0
].
position
.
x
],
y
:[
this
.
vertices
[
0
].
position
.
y
,
this
.
vertices
[
0
].
position
.
y
],
z
:[
this
.
vertices
[
0
].
position
.
z
,
this
.
vertices
[
0
].
position
.
z
]};
for
(
var
a
=
1
,
b
=
this
.
vertices
.
length
;
a
<
b
;
a
++
){
vertex
=
this
.
vertices
[
a
];
if
(
vertex
.
position
.
x
<
this
.
bbox
.
x
[
0
])
this
.
bbox
.
x
[
0
]
=
vertex
.
position
.
x
;
else
if
(
vertex
.
position
.
x
>
this
.
bbox
.
x
[
1
])
this
.
bbox
.
x
[
1
]
=
vertex
.
position
.
x
;
if
(
vertex
.
position
.
y
<
this
.
bbox
.
y
[
0
])
this
.
bbox
.
y
[
0
]
=
vertex
.
position
.
y
;
else
if
(
vertex
.
position
.
y
>
this
.
bbox
.
y
[
1
])
this
.
bbox
.
y
[
1
]
=
vertex
.
position
.
y
;
if
(
vertex
.
position
.
z
<
this
.
bbox
.
z
[
0
])
this
.
bbox
.
z
[
0
]
=
vertex
.
position
.
z
;
else
if
(
vertex
.
position
.
z
>
this
.
bbox
.
z
[
1
])
this
.
bbox
.
z
[
1
]
=
vertex
.
position
.
z
}}},
sortFacesByMaterial
:
function
(){
function
a
(
t
){
var
F
=
[];
b
=
0
;
for
(
d
=
t
.
length
;
b
<
d
;
b
++
)
t
[
b
]
==
undefined
?
F
.
push
(
"
undefined
"
):
F
.
push
(
t
[
b
].
toString
());
return
F
.
join
(
"
_
"
)}
var
b
,
d
,
e
,
f
,
j
,
k
,
g
,
p
,
c
=
{};
e
=
0
;
for
(
f
=
this
.
faces
.
length
;
e
<
f
;
e
++
){
j
=
this
.
faces
[
e
];
k
=
j
.
material
;
g
=
a
(
k
);
if
(
c
[
g
]
==
undefined
)
c
[
g
]
=
{
hash
:
g
,
counter
:
0
};
p
=
c
[
g
].
hash
+
"
_
"
+
c
[
g
].
counter
;
if
(
this
.
geometryChunks
[
p
]
==
undefined
)
this
.
geometryChunks
[
p
]
=
{
faces
:[],
material
:
k
,
vertices
:
0
};
j
=
j
instanceof
THREE
.
Face3
?
3
:
4
;
if
(
this
.
geometryChunks
[
p
].
vertices
+
j
>
65535
){
c
[
g
].
counter
+=
1
;
p
=
c
[
g
].
hash
+
"
_
"
+
c
[
g
].
counter
;
if
(
this
.
geometryChunks
[
p
]
==
undefined
)
this
.
geometryChunks
[
p
]
=
{
faces
:[],
material
:
k
,
vertices
:
0
}}
this
.
geometryChunks
[
p
].
faces
.
push
(
e
);
this
.
geometryChunks
[
p
].
vertices
+=
j
}},
toString
:
function
(){
return
"
THREE.Geometry ( vertices:
"
+
this
.
vertices
+
"
, faces:
"
+
this
.
faces
+
"
, uvs:
"
+
this
.
uvs
+
"
)
"
}};
THREE
.
Camera
=
function
(
a
,
b
,
d
,
e
){
this
.
position
=
new
THREE
.
Vector3
(
0
,
0
,
0
);
this
.
target
=
{
position
:
new
THREE
.
Vector3
(
0
,
0
,
0
)};
this
.
up
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
matrix
=
new
THREE
.
Matrix4
;
this
.
projectionMatrix
=
THREE
.
Matrix4
.
makePerspective
(
a
,
b
,
d
,
e
);
this
.
autoUpdateMatrix
=
true
;
this
.
updateMatrix
=
function
(){
this
.
matrix
.
lookAt
(
this
.
position
,
this
.
target
.
position
,
this
.
up
)};
this
.
toString
=
function
(){
return
"
THREE.Camera (
"
+
this
.
position
+
"
,
"
+
this
.
target
.
position
+
"
)
"
}};
THREE
.
Light
=
function
(
a
){
this
.
color
=
new
THREE
.
Color
(
a
)};
THREE
.
AmbientLight
=
function
(
a
){
THREE
.
Light
.
call
(
this
,
a
)};
THREE
.
AmbientLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
AmbientLight
.
prototype
.
constructor
=
THREE
.
AmbientLight
;
THREE
.
DirectionalLight
=
function
(
a
,
b
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
(
0
,
1
,
0
);
this
.
intensity
=
b
||
1
};
THREE
.
DirectionalLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
DirectionalLight
.
prototype
.
constructor
=
THREE
.
DirectionalLight
;
THREE
.
PointLight
=
function
(
a
,
b
){
THREE
.
Light
.
call
(
this
,
a
);
this
.
position
=
new
THREE
.
Vector3
;
this
.
intensity
=
b
||
1
};
THREE
.
DirectionalLight
.
prototype
=
new
THREE
.
Light
;
THREE
.
DirectionalLight
.
prototype
.
constructor
=
THREE
.
PointLight
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录