Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
8100bb66
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,发现更多精彩内容 >>
提交
8100bb66
编写于
1月 29, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Renamed CubeGeometry to BoxGeometry.
This should please @erich666 ;)
上级
7afb5349
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
123 addition
and
119 deletion
+123
-119
src/extras/geometries/BoxGeometry.js
src/extras/geometries/BoxGeometry.js
+120
-0
src/extras/geometries/CubeGeometry.js
src/extras/geometries/CubeGeometry.js
+2
-119
utils/build/includes/extras.json
utils/build/includes/extras.json
+1
-0
未找到文件。
src/extras/geometries/BoxGeometry.js
0 → 100644
浏览文件 @
8100bb66
/**
* @author mrdoob / http://mrdoob.com/
* based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Cube.as
*/
THREE
.
BoxGeometry
=
function
(
width
,
height
,
depth
,
widthSegments
,
heightSegments
,
depthSegments
)
{
THREE
.
Geometry
.
call
(
this
);
var
scope
=
this
;
this
.
width
=
width
;
this
.
height
=
height
;
this
.
depth
=
depth
;
this
.
widthSegments
=
widthSegments
||
1
;
this
.
heightSegments
=
heightSegments
||
1
;
this
.
depthSegments
=
depthSegments
||
1
;
var
width_half
=
this
.
width
/
2
;
var
height_half
=
this
.
height
/
2
;
var
depth_half
=
this
.
depth
/
2
;
buildPlane
(
'
z
'
,
'
y
'
,
-
1
,
-
1
,
this
.
depth
,
this
.
height
,
width_half
,
0
);
// px
buildPlane
(
'
z
'
,
'
y
'
,
1
,
-
1
,
this
.
depth
,
this
.
height
,
-
width_half
,
1
);
// nx
buildPlane
(
'
x
'
,
'
z
'
,
1
,
1
,
this
.
width
,
this
.
depth
,
height_half
,
2
);
// py
buildPlane
(
'
x
'
,
'
z
'
,
1
,
-
1
,
this
.
width
,
this
.
depth
,
-
height_half
,
3
);
// ny
buildPlane
(
'
x
'
,
'
y
'
,
1
,
-
1
,
this
.
width
,
this
.
height
,
depth_half
,
4
);
// pz
buildPlane
(
'
x
'
,
'
y
'
,
-
1
,
-
1
,
this
.
width
,
this
.
height
,
-
depth_half
,
5
);
// nz
function
buildPlane
(
u
,
v
,
udir
,
vdir
,
width
,
height
,
depth
,
materialIndex
)
{
var
w
,
ix
,
iy
,
gridX
=
scope
.
widthSegments
,
gridY
=
scope
.
heightSegments
,
width_half
=
width
/
2
,
height_half
=
height
/
2
,
offset
=
scope
.
vertices
.
length
;
if
(
(
u
===
'
x
'
&&
v
===
'
y
'
)
||
(
u
===
'
y
'
&&
v
===
'
x
'
)
)
{
w
=
'
z
'
;
}
else
if
(
(
u
===
'
x
'
&&
v
===
'
z
'
)
||
(
u
===
'
z
'
&&
v
===
'
x
'
)
)
{
w
=
'
y
'
;
gridY
=
scope
.
depthSegments
;
}
else
if
(
(
u
===
'
z
'
&&
v
===
'
y
'
)
||
(
u
===
'
y
'
&&
v
===
'
z
'
)
)
{
w
=
'
x
'
;
gridX
=
scope
.
depthSegments
;
}
var
gridX1
=
gridX
+
1
,
gridY1
=
gridY
+
1
,
segment_width
=
width
/
gridX
,
segment_height
=
height
/
gridY
,
normal
=
new
THREE
.
Vector3
();
normal
[
w
]
=
depth
>
0
?
1
:
-
1
;
for
(
iy
=
0
;
iy
<
gridY1
;
iy
++
)
{
for
(
ix
=
0
;
ix
<
gridX1
;
ix
++
)
{
var
vector
=
new
THREE
.
Vector3
();
vector
[
u
]
=
(
ix
*
segment_width
-
width_half
)
*
udir
;
vector
[
v
]
=
(
iy
*
segment_height
-
height_half
)
*
vdir
;
vector
[
w
]
=
depth
;
scope
.
vertices
.
push
(
vector
);
}
}
for
(
iy
=
0
;
iy
<
gridY
;
iy
++
)
{
for
(
ix
=
0
;
ix
<
gridX
;
ix
++
)
{
var
a
=
ix
+
gridX1
*
iy
;
var
b
=
ix
+
gridX1
*
(
iy
+
1
);
var
c
=
(
ix
+
1
)
+
gridX1
*
(
iy
+
1
);
var
d
=
(
ix
+
1
)
+
gridX1
*
iy
;
var
uva
=
new
THREE
.
Vector2
(
ix
/
gridX
,
1
-
iy
/
gridY
);
var
uvb
=
new
THREE
.
Vector2
(
ix
/
gridX
,
1
-
(
iy
+
1
)
/
gridY
);
var
uvc
=
new
THREE
.
Vector2
(
(
ix
+
1
)
/
gridX
,
1
-
(
iy
+
1
)
/
gridY
);
var
uvd
=
new
THREE
.
Vector2
(
(
ix
+
1
)
/
gridX
,
1
-
iy
/
gridY
);
var
face
=
new
THREE
.
Face3
(
a
+
offset
,
b
+
offset
,
d
+
offset
);
face
.
normal
.
copy
(
normal
);
face
.
vertexNormals
.
push
(
normal
.
clone
(),
normal
.
clone
(),
normal
.
clone
()
);
face
.
materialIndex
=
materialIndex
;
scope
.
faces
.
push
(
face
);
scope
.
faceVertexUvs
[
0
].
push
(
[
uva
,
uvb
,
uvd
]
);
face
=
new
THREE
.
Face3
(
b
+
offset
,
c
+
offset
,
d
+
offset
);
face
.
normal
.
copy
(
normal
);
face
.
vertexNormals
.
push
(
normal
.
clone
(),
normal
.
clone
(),
normal
.
clone
()
);
face
.
materialIndex
=
materialIndex
;
scope
.
faces
.
push
(
face
);
scope
.
faceVertexUvs
[
0
].
push
(
[
uvb
.
clone
(),
uvc
,
uvd
.
clone
()
]
);
}
}
}
this
.
computeCentroids
();
this
.
mergeVertices
();
};
THREE
.
BoxGeometry
.
prototype
=
Object
.
create
(
THREE
.
Geometry
.
prototype
);
src/extras/geometries/CubeGeometry.js
浏览文件 @
8100bb66
/**
* @author mrdoob / http://mrdoob.com/
* based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Cube.as
*/
// DEPRECATED
THREE
.
CubeGeometry
=
function
(
width
,
height
,
depth
,
widthSegments
,
heightSegments
,
depthSegments
)
{
THREE
.
Geometry
.
call
(
this
);
var
scope
=
this
;
this
.
width
=
width
;
this
.
height
=
height
;
this
.
depth
=
depth
;
this
.
widthSegments
=
widthSegments
||
1
;
this
.
heightSegments
=
heightSegments
||
1
;
this
.
depthSegments
=
depthSegments
||
1
;
var
width_half
=
this
.
width
/
2
;
var
height_half
=
this
.
height
/
2
;
var
depth_half
=
this
.
depth
/
2
;
buildPlane
(
'
z
'
,
'
y
'
,
-
1
,
-
1
,
this
.
depth
,
this
.
height
,
width_half
,
0
);
// px
buildPlane
(
'
z
'
,
'
y
'
,
1
,
-
1
,
this
.
depth
,
this
.
height
,
-
width_half
,
1
);
// nx
buildPlane
(
'
x
'
,
'
z
'
,
1
,
1
,
this
.
width
,
this
.
depth
,
height_half
,
2
);
// py
buildPlane
(
'
x
'
,
'
z
'
,
1
,
-
1
,
this
.
width
,
this
.
depth
,
-
height_half
,
3
);
// ny
buildPlane
(
'
x
'
,
'
y
'
,
1
,
-
1
,
this
.
width
,
this
.
height
,
depth_half
,
4
);
// pz
buildPlane
(
'
x
'
,
'
y
'
,
-
1
,
-
1
,
this
.
width
,
this
.
height
,
-
depth_half
,
5
);
// nz
function
buildPlane
(
u
,
v
,
udir
,
vdir
,
width
,
height
,
depth
,
materialIndex
)
{
var
w
,
ix
,
iy
,
gridX
=
scope
.
widthSegments
,
gridY
=
scope
.
heightSegments
,
width_half
=
width
/
2
,
height_half
=
height
/
2
,
offset
=
scope
.
vertices
.
length
;
if
(
(
u
===
'
x
'
&&
v
===
'
y
'
)
||
(
u
===
'
y
'
&&
v
===
'
x
'
)
)
{
w
=
'
z
'
;
}
else
if
(
(
u
===
'
x
'
&&
v
===
'
z
'
)
||
(
u
===
'
z
'
&&
v
===
'
x
'
)
)
{
w
=
'
y
'
;
gridY
=
scope
.
depthSegments
;
}
else
if
(
(
u
===
'
z
'
&&
v
===
'
y
'
)
||
(
u
===
'
y
'
&&
v
===
'
z
'
)
)
{
w
=
'
x
'
;
gridX
=
scope
.
depthSegments
;
}
var
gridX1
=
gridX
+
1
,
gridY1
=
gridY
+
1
,
segment_width
=
width
/
gridX
,
segment_height
=
height
/
gridY
,
normal
=
new
THREE
.
Vector3
();
normal
[
w
]
=
depth
>
0
?
1
:
-
1
;
for
(
iy
=
0
;
iy
<
gridY1
;
iy
++
)
{
for
(
ix
=
0
;
ix
<
gridX1
;
ix
++
)
{
var
vector
=
new
THREE
.
Vector3
();
vector
[
u
]
=
(
ix
*
segment_width
-
width_half
)
*
udir
;
vector
[
v
]
=
(
iy
*
segment_height
-
height_half
)
*
vdir
;
vector
[
w
]
=
depth
;
scope
.
vertices
.
push
(
vector
);
}
}
for
(
iy
=
0
;
iy
<
gridY
;
iy
++
)
{
for
(
ix
=
0
;
ix
<
gridX
;
ix
++
)
{
var
a
=
ix
+
gridX1
*
iy
;
var
b
=
ix
+
gridX1
*
(
iy
+
1
);
var
c
=
(
ix
+
1
)
+
gridX1
*
(
iy
+
1
);
var
d
=
(
ix
+
1
)
+
gridX1
*
iy
;
var
uva
=
new
THREE
.
Vector2
(
ix
/
gridX
,
1
-
iy
/
gridY
);
var
uvb
=
new
THREE
.
Vector2
(
ix
/
gridX
,
1
-
(
iy
+
1
)
/
gridY
);
var
uvc
=
new
THREE
.
Vector2
(
(
ix
+
1
)
/
gridX
,
1
-
(
iy
+
1
)
/
gridY
);
var
uvd
=
new
THREE
.
Vector2
(
(
ix
+
1
)
/
gridX
,
1
-
iy
/
gridY
);
var
face
=
new
THREE
.
Face3
(
a
+
offset
,
b
+
offset
,
d
+
offset
);
face
.
normal
.
copy
(
normal
);
face
.
vertexNormals
.
push
(
normal
.
clone
(),
normal
.
clone
(),
normal
.
clone
()
);
face
.
materialIndex
=
materialIndex
;
scope
.
faces
.
push
(
face
);
scope
.
faceVertexUvs
[
0
].
push
(
[
uva
,
uvb
,
uvd
]
);
face
=
new
THREE
.
Face3
(
b
+
offset
,
c
+
offset
,
d
+
offset
);
face
.
normal
.
copy
(
normal
);
face
.
vertexNormals
.
push
(
normal
.
clone
(),
normal
.
clone
(),
normal
.
clone
()
);
face
.
materialIndex
=
materialIndex
;
scope
.
faces
.
push
(
face
);
scope
.
faceVertexUvs
[
0
].
push
(
[
uvb
.
clone
(),
uvc
,
uvd
.
clone
()
]
);
}
}
}
this
.
computeCentroids
();
this
.
mergeVertices
();
};
THREE
.
CubeGeometry
.
prototype
=
Object
.
create
(
THREE
.
Geometry
.
prototype
);
THREE
.
CubeGeometry
=
THREE
.
BoxGeometry
;
utils/build/includes/extras.json
浏览文件 @
8100bb66
...
...
@@ -24,6 +24,7 @@
"src/extras/animation/KeyFrameAnimation.js"
,
"src/extras/cameras/CubeCamera.js"
,
"src/extras/cameras/CombinedCamera.js"
,
"src/extras/geometries/BoxGeometry.js"
,
"src/extras/geometries/CircleGeometry.js"
,
"src/extras/geometries/CubeGeometry.js"
,
"src/extras/geometries/CylinderGeometry.js"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录