Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
df4fc95b
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,发现更多精彩内容 >>
未验证
提交
df4fc95b
编写于
5月 04, 2018
作者:
M
Mr.doob
提交者:
GitHub
5月 04, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13987 from Mugen87/dev4
Examples: Clean up
上级
f455e853
52ab356c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
51 deletion
+39
-51
examples/js/controls/TransformControls.js
examples/js/controls/TransformControls.js
+4
-12
examples/misc_exporter_obj.html
examples/misc_exporter_obj.html
+26
-24
examples/webgl_geometry_minecraft.html
examples/webgl_geometry_minecraft.html
+9
-15
未找到文件。
examples/js/controls/TransformControls.js
浏览文件 @
df4fc95b
...
...
@@ -227,12 +227,8 @@
THREE
.
TransformGizmo
.
call
(
this
);
var
arrowGeometry
=
new
THREE
.
Geometry
();
var
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
CylinderGeometry
(
0
,
0.05
,
0.2
,
12
,
1
,
false
)
);
mesh
.
position
.
y
=
0.5
;
mesh
.
updateMatrix
();
arrowGeometry
.
merge
(
mesh
.
geometry
,
mesh
.
matrix
);
var
arrowGeometry
=
new
THREE
.
ConeBufferGeometry
(
0.05
,
0.2
,
12
,
1
,
false
);
arrowGeometry
.
translate
(
0
,
0.5
,
0
);
var
lineXGeometry
=
new
THREE
.
BufferGeometry
();
lineXGeometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32BufferAttribute
(
[
0
,
0
,
0
,
1
,
0
,
0
],
3
)
);
...
...
@@ -505,12 +501,8 @@
THREE
.
TransformGizmo
.
call
(
this
);
var
arrowGeometry
=
new
THREE
.
Geometry
();
var
mesh
=
new
THREE
.
Mesh
(
new
THREE
.
BoxGeometry
(
0.125
,
0.125
,
0.125
)
);
mesh
.
position
.
y
=
0.5
;
mesh
.
updateMatrix
();
arrowGeometry
.
merge
(
mesh
.
geometry
,
mesh
.
matrix
);
var
arrowGeometry
=
new
THREE
.
BoxBufferGeometry
(
0.125
,
0.125
,
0.125
);
arrowGeometry
.
translate
(
0
,
0.5
,
0
);
var
lineXGeometry
=
new
THREE
.
BufferGeometry
();
lineXGeometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32BufferAttribute
(
[
0
,
0
,
0
,
1
,
0
,
0
],
3
)
);
...
...
examples/misc_exporter_obj.html
浏览文件 @
df4fc95b
...
...
@@ -81,15 +81,15 @@
function
addGeometry
(
type
)
{
for
(
var
i
=
0
;
i
<
scene
.
children
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
scene
.
children
.
length
;
i
++
)
{
var
c
urrent
=
scene
.
children
[
i
];
var
c
hild
=
scene
.
children
[
i
];
if
(
c
urrent
instanceof
THREE
.
Mesh
)
{
if
(
c
hild
.
is
Mesh
)
{
c
urrent
.
geometry
.
dispose
();
scene
.
remove
(
c
urrent
);
i
--
;
c
hild
.
geometry
.
dispose
();
scene
.
remove
(
c
hild
);
i
--
;
}
...
...
@@ -98,14 +98,7 @@
if
(
type
===
1
)
{
var
material
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0x00cc00
}
);
var
geometry
=
new
THREE
.
Geometry
();
geometry
.
vertices
.
push
(
new
THREE
.
Vector3
(
-
50
,
-
50
,
0
)
);
geometry
.
vertices
.
push
(
new
THREE
.
Vector3
(
50
,
-
50
,
0
)
);
geometry
.
vertices
.
push
(
new
THREE
.
Vector3
(
50
,
50
,
0
)
);
var
face
=
new
THREE
.
Face3
(
0
,
1
,
2
);
geometry
.
faces
.
push
(
face
);
geometry
.
computeFaceNormals
();
var
geometry
=
generateTriangleGeometry
();
scene
.
add
(
new
THREE
.
Mesh
(
geometry
,
material
)
);
...
...
@@ -125,14 +118,7 @@
}
else
if
(
type
===
4
||
type
===
5
)
{
var
material
=
new
THREE
.
MeshLambertMaterial
(
{
color
:
0x00cc00
}
);
var
geometry
=
new
THREE
.
Geometry
();
geometry
.
vertices
.
push
(
new
THREE
.
Vector3
(
-
50
,
-
50
,
0
)
);
geometry
.
vertices
.
push
(
new
THREE
.
Vector3
(
50
,
-
50
,
0
)
);
geometry
.
vertices
.
push
(
new
THREE
.
Vector3
(
50
,
50
,
0
)
);
var
face
=
new
THREE
.
Face3
(
0
,
1
,
2
);
geometry
.
faces
.
push
(
face
);
geometry
.
computeFaceNormals
();
var
geometry
=
generateTriangleGeometry
()
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
position
.
x
=
-
200
;
...
...
@@ -244,8 +230,8 @@
requestAnimationFrame
(
animate
);
camera
.
position
.
x
+=
(
mouseX
-
camera
.
position
.
x
)
*
.
05
;
camera
.
position
.
y
+=
(
-
mouseY
-
camera
.
position
.
y
)
*
.
05
;
camera
.
position
.
x
+=
(
mouseX
-
camera
.
position
.
x
)
*
0
.05
;
camera
.
position
.
y
+=
(
-
mouseY
-
camera
.
position
.
y
)
*
0
.05
;
camera
.
lookAt
(
scene
.
position
);
light
.
position
.
set
(
camera
.
position
.
x
,
camera
.
position
.
y
,
camera
.
position
.
z
).
normalize
();
...
...
@@ -253,6 +239,22 @@
}
function
generateTriangleGeometry
()
{
var
geometry
=
new
THREE
.
BufferGeometry
();
var
vertices
=
[];
vertices
.
push
(
-
50
,
-
50
,
0
);
vertices
.
push
(
50
,
-
50
,
0
);
vertices
.
push
(
50
,
50
,
0
);
geometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32BufferAttribute
(
vertices
,
3
)
);
geometry
.
computeVertexNormals
();
return
geometry
;
}
init
();
animate
();
...
...
examples/webgl_geometry_minecraft.html
浏览文件 @
df4fc95b
...
...
@@ -45,6 +45,7 @@
<script
src=
"js/controls/FirstPersonControls.js"
></script>
<script
src=
"js/BufferGeometryUtils.js"
></script>
<script
src=
"js/ImprovedNoise.js"
></script>
<script
src=
"js/Detector.js"
></script>
<script
src=
"js/libs/stats.min.js"
></script>
...
...
@@ -124,13 +125,7 @@
//
// BufferGeometry cannot be merged yet.
var
tmpGeometry
=
new
THREE
.
Geometry
();
var
pxTmpGeometry
=
new
THREE
.
Geometry
().
fromBufferGeometry
(
pxGeometry
);
var
nxTmpGeometry
=
new
THREE
.
Geometry
().
fromBufferGeometry
(
nxGeometry
);
var
pyTmpGeometry
=
new
THREE
.
Geometry
().
fromBufferGeometry
(
pyGeometry
);
var
pzTmpGeometry
=
new
THREE
.
Geometry
().
fromBufferGeometry
(
pzGeometry
);
var
nzTmpGeometry
=
new
THREE
.
Geometry
().
fromBufferGeometry
(
nzGeometry
);
var
geometries
=
[];
for
(
var
z
=
0
;
z
<
worldDepth
;
z
++
)
{
...
...
@@ -149,29 +144,29 @@
var
pz
=
getY
(
x
,
z
+
1
);
var
nz
=
getY
(
x
,
z
-
1
);
tmpGeometry
.
merge
(
pyTmpGeometry
,
matrix
);
geometries
.
push
(
pyGeometry
.
clone
().
applyMatrix
(
matrix
)
);
if
(
(
px
!==
h
&&
px
!==
h
+
1
)
||
x
===
0
)
{
tmpGeometry
.
merge
(
pxTmpGeometry
,
matrix
);
geometries
.
push
(
pxGeometry
.
clone
().
applyMatrix
(
matrix
)
);
}
if
(
(
nx
!==
h
&&
nx
!==
h
+
1
)
||
x
===
worldWidth
-
1
)
{
tmpGeometry
.
merge
(
nxTmpGeometry
,
matrix
);
geometries
.
push
(
nxGeometry
.
clone
().
applyMatrix
(
matrix
)
);
}
if
(
(
pz
!==
h
&&
pz
!==
h
+
1
)
||
z
===
worldDepth
-
1
)
{
tmpGeometry
.
merge
(
pzTmpGeometry
,
matrix
);
geometries
.
push
(
pzGeometry
.
clone
().
applyMatrix
(
matrix
)
);
}
if
(
(
nz
!==
h
&&
nz
!==
h
+
1
)
||
z
===
0
)
{
tmpGeometry
.
merge
(
nzTmpGeometry
,
matrix
);
geometries
.
push
(
nzGeometry
.
clone
().
applyMatrix
(
matrix
)
);
}
...
...
@@ -179,12 +174,11 @@
}
var
geometry
=
new
THREE
.
BufferGeometry
().
fromGeometry
(
tmpGeometry
);
var
geometry
=
THREE
.
BufferGeometryUtils
.
mergeBufferGeometries
(
geometries
);
geometry
.
computeBoundingSphere
();
var
texture
=
new
THREE
.
TextureLoader
().
load
(
'
textures/minecraft/atlas.png
'
);
texture
.
magFilter
=
THREE
.
NearestFilter
;
texture
.
minFilter
=
THREE
.
LinearMipMapLinearFilter
;
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshLambertMaterial
(
{
map
:
texture
}
)
);
scene
.
add
(
mesh
);
...
...
@@ -196,7 +190,7 @@
directionalLight
.
position
.
set
(
1
,
1
,
0.5
).
normalize
();
scene
.
add
(
directionalLight
);
renderer
=
new
THREE
.
WebGLRenderer
();
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
window
.
innerWidth
,
window
.
innerHeight
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录