Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
cb99e381
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,发现更多精彩内容 >>
提交
cb99e381
编写于
3月 11, 2014
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PlaneGeometry extending PlaneBufferGeometry.
Almost there...!
上级
007767bf
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
156 addition
and
81 deletion
+156
-81
examples/canvas_geometry_terrain.html
examples/canvas_geometry_terrain.html
+0
-4
src/extras/geometries/PlaneBufferGeometry.js
src/extras/geometries/PlaneBufferGeometry.js
+93
-0
src/extras/geometries/PlaneGeometry.js
src/extras/geometries/PlaneGeometry.js
+10
-77
src/math/TypedVector2.js
src/math/TypedVector2.js
+23
-0
src/math/TypedVector3.js
src/math/TypedVector3.js
+27
-0
utils/build/includes/common.json
utils/build/includes/common.json
+2
-0
utils/build/includes/extras.json
utils/build/includes/extras.json
+1
-0
未找到文件。
examples/canvas_geometry_terrain.html
浏览文件 @
cb99e381
...
...
@@ -36,8 +36,6 @@
<script
src=
"../build/three.min.js"
></script>
<script
src=
"js/wip/Geometry5b.js"
></script>
<script
src=
"js/ImprovedNoise.js"
></script>
<script
src=
"js/libs/stats.min.js"
></script>
...
...
@@ -77,8 +75,6 @@
var
plane
=
new
THREE
.
PlaneGeometry
(
2000
,
2000
,
quality
-
1
,
quality
-
1
);
plane
.
applyMatrix
(
new
THREE
.
Matrix4
().
makeRotationX
(
-
Math
.
PI
/
2
)
);
plane
=
new
THREE
.
Geometry5b
(
plane
);
for
(
var
i
=
0
,
l
=
plane
.
vertices
.
length
;
i
<
l
;
i
++
)
{
var
x
=
i
%
quality
,
y
=
Math
.
floor
(
i
/
quality
);
...
...
src/extras/geometries/PlaneBufferGeometry.js
0 → 100644
浏览文件 @
cb99e381
/**
* @author mrdoob / http://mrdoob.com/
* based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as
*/
THREE
.
PlaneBufferGeometry
=
function
(
width
,
height
,
widthSegments
,
heightSegments
)
{
THREE
.
BufferGeometry
.
call
(
this
);
this
.
parameters
=
{
width
:
width
,
height
:
height
,
widthSegments
:
widthSegments
,
heightSegments
:
heightSegments
};
var
width_half
=
width
/
2
;
var
height_half
=
height
/
2
;
var
gridX
=
widthSegments
||
1
;
var
gridY
=
heightSegments
||
1
;
var
gridX1
=
gridX
+
1
;
var
gridY1
=
gridY
+
1
;
var
segment_width
=
width
/
gridX
;
var
segment_height
=
height
/
gridY
;
var
vertices
=
new
Float32Array
(
gridX1
*
gridY1
*
3
);
var
normals
=
new
Float32Array
(
gridX1
*
gridY1
*
3
);
var
uvs
=
new
Float32Array
(
gridX1
*
gridY1
*
2
);
var
offset
=
0
;
var
offset2
=
0
;
for
(
var
iy
=
0
;
iy
<
gridY1
;
iy
++
)
{
var
y
=
iy
*
segment_height
-
height_half
;
for
(
var
ix
=
0
;
ix
<
gridX1
;
ix
++
)
{
var
x
=
ix
*
segment_width
-
width_half
;
vertices
[
offset
]
=
x
;
vertices
[
offset
+
1
]
=
-
y
;
normals
[
offset
+
2
]
=
1
;
uvs
[
offset2
]
=
ix
/
gridX
;
uvs
[
offset2
+
1
]
=
1
-
(
iy
/
gridY
);
offset
+=
3
;
offset2
+=
2
;
}
}
offset
=
0
;
var
indices
=
new
Uint16Array
(
gridX
*
gridY
*
6
);
for
(
var
iy
=
0
;
iy
<
gridY
;
iy
++
)
{
for
(
var
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
;
indices
[
offset
]
=
a
;
indices
[
offset
+
1
]
=
b
;
indices
[
offset
+
2
]
=
d
;
indices
[
offset
+
3
]
=
b
;
indices
[
offset
+
4
]
=
c
;
indices
[
offset
+
5
]
=
d
;
offset
+=
6
;
}
}
this
.
attributes
[
'
index
'
]
=
{
array
:
indices
,
itemSize
:
1
};
this
.
attributes
[
'
position
'
]
=
{
array
:
vertices
,
itemSize
:
3
};
this
.
attributes
[
'
normal
'
]
=
{
array
:
normals
,
itemSize
:
3
};
this
.
attributes
[
'
uv
'
]
=
{
array
:
uvs
,
itemSize
:
2
};
};
THREE
.
PlaneBufferGeometry
.
prototype
=
Object
.
create
(
THREE
.
BufferGeometry
.
prototype
);
src/extras/geometries/PlaneGeometry.js
浏览文件 @
cb99e381
...
...
@@ -5,89 +5,22 @@
THREE
.
PlaneGeometry
=
function
(
width
,
height
,
widthSegments
,
heightSegments
)
{
THREE
.
BufferGeometry
.
call
(
thi
s
);
THREE
.
PlaneBufferGeometry
.
call
(
this
,
width
,
height
,
widthSegments
,
heightSegment
s
);
this
.
parameters
=
{
width
:
width
,
height
:
height
,
widthSegments
:
widthSegments
,
heightSegments
:
heightSegments
};
var
length
=
this
.
attributes
.
position
.
array
.
length
;
var
width_half
=
width
/
2
;
var
height_half
=
height
/
2
;
this
.
vertices
=
[];
this
.
normals
=
[];
this
.
uvs
=
[];
var
gridX
=
widthSegments
||
1
;
var
gridY
=
heightSegments
||
1
;
for
(
var
i
=
0
,
l
=
length
/
3
;
i
<
l
;
i
++
)
{
var
gridX1
=
gridX
+
1
;
var
gridY1
=
gridY
+
1
;
var
segment_width
=
width
/
gridX
;
var
segment_height
=
height
/
gridY
;
var
vertices
=
new
Float32Array
(
gridX1
*
gridY1
*
3
);
var
normals
=
new
Float32Array
(
gridX1
*
gridY1
*
3
);
var
uvs
=
new
Float32Array
(
gridX1
*
gridY1
*
2
);
var
offset
=
0
;
var
offset2
=
0
;
for
(
var
iy
=
0
;
iy
<
gridY1
;
iy
++
)
{
var
y
=
iy
*
segment_height
-
height_half
;
for
(
var
ix
=
0
;
ix
<
gridX1
;
ix
++
)
{
var
x
=
ix
*
segment_width
-
width_half
;
vertices
[
offset
]
=
x
;
vertices
[
offset
+
1
]
=
-
y
;
normals
[
offset
+
2
]
=
1
;
uvs
[
offset2
]
=
ix
/
gridX
;
uvs
[
offset2
+
1
]
=
1
-
(
iy
/
gridY
);
offset
+=
3
;
offset2
+=
2
;
}
this
.
vertices
.
push
(
new
THREE
.
TypedVector3
(
this
.
attributes
.
position
.
array
,
i
*
3
)
);
this
.
normals
.
push
(
new
THREE
.
TypedVector3
(
this
.
attributes
.
normal
.
array
,
i
*
3
)
);
this
.
uvs
.
push
(
new
THREE
.
TypedVector2
(
this
.
attributes
.
uv
.
array
,
i
*
2
)
);
}
offset
=
0
;
var
indices
=
new
Uint16Array
(
gridX
*
gridY
*
6
);
for
(
var
iy
=
0
;
iy
<
gridY
;
iy
++
)
{
for
(
var
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
;
indices
[
offset
]
=
a
;
indices
[
offset
+
1
]
=
b
;
indices
[
offset
+
2
]
=
d
;
indices
[
offset
+
3
]
=
b
;
indices
[
offset
+
4
]
=
c
;
indices
[
offset
+
5
]
=
d
;
offset
+=
6
;
}
}
this
.
attributes
[
'
index
'
]
=
{
array
:
indices
,
itemSize
:
1
};
this
.
attributes
[
'
position
'
]
=
{
array
:
vertices
,
itemSize
:
3
};
this
.
attributes
[
'
normal
'
]
=
{
array
:
normals
,
itemSize
:
3
};
this
.
attributes
[
'
uv
'
]
=
{
array
:
uvs
,
itemSize
:
2
};
};
THREE
.
PlaneGeometry
.
prototype
=
Object
.
create
(
THREE
.
BufferGeometry
.
prototype
);
THREE
.
PlaneGeometry
.
prototype
=
Object
.
create
(
THREE
.
Plane
BufferGeometry
.
prototype
);
src/math/TypedVector2.js
0 → 100644
浏览文件 @
cb99e381
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE
.
TypedVector2
=
function
(
array
,
offset
)
{
this
.
array
=
array
;
this
.
offset
=
offset
;
};
THREE
.
TypedVector2
.
prototype
=
Object
.
create
(
THREE
.
Vector2
.
prototype
);
Object
.
defineProperties
(
THREE
.
TypedVector2
.
prototype
,
{
'
x
'
:
{
get
:
function
()
{
return
this
.
array
[
this
.
offset
];
},
set
:
function
(
v
)
{
this
.
array
[
this
.
offset
]
=
v
;
}
},
'
y
'
:
{
get
:
function
()
{
return
this
.
array
[
this
.
offset
+
1
];
},
set
:
function
(
v
)
{
this
.
array
[
this
.
offset
+
1
]
=
v
;
}
}
}
);
\ No newline at end of file
src/math/TypedVector3.js
0 → 100644
浏览文件 @
cb99e381
/**
* @author mrdoob / http://mrdoob.com/
*/
THREE
.
TypedVector3
=
function
(
array
,
offset
)
{
this
.
array
=
array
;
this
.
offset
=
offset
;
};
THREE
.
TypedVector3
.
prototype
=
Object
.
create
(
THREE
.
Vector3
.
prototype
);
Object
.
defineProperties
(
THREE
.
TypedVector3
.
prototype
,
{
'
x
'
:
{
get
:
function
()
{
return
this
.
array
[
this
.
offset
];
},
set
:
function
(
v
)
{
this
.
array
[
this
.
offset
]
=
v
;
}
},
'
y
'
:
{
get
:
function
()
{
return
this
.
array
[
this
.
offset
+
1
];
},
set
:
function
(
v
)
{
this
.
array
[
this
.
offset
+
1
]
=
v
;
}
},
'
z
'
:
{
get
:
function
()
{
return
this
.
array
[
this
.
offset
+
2
];
},
set
:
function
(
v
)
{
this
.
array
[
this
.
offset
+
2
]
=
v
;
}
}
}
);
\ No newline at end of file
utils/build/includes/common.json
浏览文件 @
cb99e381
...
...
@@ -5,6 +5,8 @@
"src/math/Vector2.js"
,
"src/math/Vector3.js"
,
"src/math/Vector4.js"
,
"src/math/TypedVector2.js"
,
"src/math/TypedVector3.js"
,
"src/math/Euler.js"
,
"src/math/Line3.js"
,
"src/math/Box2.js"
,
...
...
utils/build/includes/extras.json
浏览文件 @
cb99e381
...
...
@@ -32,6 +32,7 @@
"src/extras/geometries/ExtrudeGeometry.js"
,
"src/extras/geometries/ShapeGeometry.js"
,
"src/extras/geometries/LatheGeometry.js"
,
"src/extras/geometries/PlaneBufferGeometry.js"
,
"src/extras/geometries/PlaneGeometry.js"
,
"src/extras/geometries/RingGeometry.js"
,
"src/extras/geometries/SphereGeometry.js"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录