Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
ec13438b
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,发现更多精彩内容 >>
提交
ec13438b
编写于
11月 24, 2010
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
差异文件
Merge remote branch 'remotes/upstream/master'
上级
aaf56993
cd41fc1e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
29 deletion
+26
-29
src/extras/GeometryUtils.js
src/extras/GeometryUtils.js
+26
-29
未找到文件。
src/extras/GeometryUtils.js
浏览文件 @
ec13438b
var
GeometryUtils
=
{
merge
:
function
(
object1
,
object2
)
{
merge
:
function
(
geometry1
,
object2
/* mesh | geometry */
)
{
var
isMesh
=
object2
instanceof
THREE
.
Mesh
;
var
geometry1
=
object1
,
var
isMesh
=
object2
instanceof
THREE
.
Mesh
,
vertexPosition
=
geometry1
.
vertices
.
length
,
facePosition
=
geometry1
.
faces
.
length
,
uvPosition
=
geometry1
.
uvs
.
length
,
geometry2
=
isMesh
?
object2
.
geometry
:
object2
;
geometry2
=
isMesh
?
object2
.
geometry
:
object2
,
vertices1
=
geometry1
.
vertices
,
vertices2
=
geometry2
.
vertices
,
faces1
=
geometry1
.
faces
,
faces2
=
geometry2
.
faces
,
uvs1
=
geometry1
.
uvs
,
uvs2
=
geometry2
.
uvs
;
i
f
(
isMesh
)
object2
.
updateMatrix
();
i
sMesh
&&
object2
.
updateMatrix
();
for
(
var
i
=
0
,
il
=
geometry2
.
vertices
.
length
;
i
<
il
;
i
++
)
{
for
(
var
i
=
0
,
il
=
vertices2
.
length
;
i
<
il
;
i
++
)
{
var
vertex
=
geometry2
.
vertices
[
i
];
var
vertex
=
vertices2
[
i
];
var
vertexCopy
=
new
THREE
.
Vertex
(
vertex
.
position
.
clone
()
);
i
f
(
isMesh
)
object2
.
matrix
.
transform
(
vertexCopy
.
position
);
i
sMesh
&&
object2
.
matrix
.
transform
(
vertexCopy
.
position
);
geometry1
.
vertices
.
push
(
vertexCopy
);
vertices1
.
push
(
vertexCopy
);
}
for
(
var
i
=
0
,
il
=
geometry2
.
faces
.
length
;
i
<
il
;
i
++
)
{
for
(
var
i
=
0
,
il
=
faces2
.
length
;
i
<
il
;
i
++
)
{
var
face
=
geometry2
.
faces
[
i
];
var
face
=
faces2
[
i
],
faceCopy
,
normal
,
faceVertexNormals
=
face
.
vertexNormals
;
if
(
face
instanceof
THREE
.
Face3
)
{
var
faceCopy
=
new
THREE
.
Face3
();
faceCopy
.
a
=
face
.
a
+
vertexPosition
;
faceCopy
.
b
=
face
.
b
+
vertexPosition
;
faceCopy
.
c
=
face
.
c
+
vertexPosition
;
faceCopy
=
new
THREE
.
Face3
(
face
.
a
+
vertexPosition
,
face
.
b
+
vertexPosition
,
face
.
c
+
vertexPosition
);
}
else
if
(
face
instanceof
THREE
.
Face4
)
{
var
faceCopy
=
new
THREE
.
Face4
();
faceCopy
.
a
=
face
.
a
+
vertexPosition
;
faceCopy
.
b
=
face
.
b
+
vertexPosition
;
faceCopy
.
c
=
face
.
c
+
vertexPosition
;
faceCopy
.
d
=
face
.
d
+
vertexPosition
;
faceCopy
=
new
THREE
.
Face4
(
face
.
a
+
vertexPosition
,
face
.
b
+
vertexPosition
,
face
.
c
+
vertexPosition
,
face
.
d
+
vertexPosition
);
}
for
(
var
j
=
0
,
jl
=
face
.
v
ertexNormals
.
length
;
j
<
jl
;
j
++
)
{
for
(
var
j
=
0
,
jl
=
face
V
ertexNormals
.
length
;
j
<
jl
;
j
++
)
{
var
normal
=
face
.
v
ertexNormals
[
j
];
normal
=
faceV
ertexNormals
[
j
];
faceCopy
.
vertexNormals
.
push
(
normal
.
clone
()
);
}
geometry1
.
faces
.
push
(
faceCopy
);
faces1
.
push
(
faceCopy
);
}
for
(
var
i
=
0
,
il
=
geometry2
.
uvs
.
length
;
i
<
il
;
i
++
)
{
var
uv
=
geometry2
.
uvs
[
i
];
for
(
var
i
=
0
,
il
=
uvs2
.
length
;
i
<
il
;
i
++
)
{
var
uvCopy
=
[];
var
uv
=
uvs2
[
i
],
uv
Copy
=
[];
for
(
var
j
=
0
,
jl
=
uv
.
length
;
j
<
jl
;
j
++
)
{
...
...
@@ -67,7 +64,7 @@ var GeometryUtils = {
}
geometry1
.
uvs
.
push
(
uvCopy
);
uvs1
.
push
(
uvCopy
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录