Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
c5de9812
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,发现更多精彩内容 >>
未验证
提交
c5de9812
编写于
4月 24, 2018
作者:
M
Mr.doob
提交者:
GitHub
4月 24, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13933 from Mugen87/dev11
Examples: Clean up
上级
f580da28
8b7f65e1
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
57 addition
and
33 deletion
+57
-33
examples/webgl_buffergeometry_drawcalls.html
examples/webgl_buffergeometry_drawcalls.html
+1
-1
examples/webgl_effects_peppersghost.html
examples/webgl_effects_peppersghost.html
+25
-6
examples/webgl_lines_sphere.html
examples/webgl_lines_sphere.html
+26
-21
examples/webgl_loader_nrrd.html
examples/webgl_loader_nrrd.html
+2
-2
examples/webgl_loader_obj2_meshspray.html
examples/webgl_loader_obj2_meshspray.html
+1
-1
examples/webgl_loader_obj2_options.html
examples/webgl_loader_obj2_options.html
+1
-1
examples/webgl_loader_obj2_run_director.html
examples/webgl_loader_obj2_run_director.html
+1
-1
未找到文件。
examples/webgl_buffergeometry_drawcalls.html
浏览文件 @
c5de9812
...
...
@@ -106,7 +106,7 @@
group
=
new
THREE
.
Group
();
scene
.
add
(
group
);
var
helper
=
new
THREE
.
BoxHelper
(
new
THREE
.
Mesh
(
new
THREE
.
BoxGeometry
(
r
,
r
,
r
)
)
);
var
helper
=
new
THREE
.
BoxHelper
(
new
THREE
.
Mesh
(
new
THREE
.
Box
Buffer
Geometry
(
r
,
r
,
r
)
)
);
helper
.
material
.
color
.
setHex
(
0x080808
);
helper
.
material
.
blending
=
THREE
.
AdditiveBlending
;
helper
.
material
.
transparent
=
true
;
...
...
examples/webgl_effects_peppersghost.html
浏览文件 @
c5de9812
...
...
@@ -71,17 +71,36 @@
// Cube
var
geometry
=
new
THREE
.
BoxGeometry
(
1
,
1
,
1
);
var
geometry
=
new
THREE
.
BoxBufferGeometry
(
1
,
1
,
1
);
geometry
=
geometry
.
toNonIndexed
();
// ensure unique vertices for each triangle
for
(
var
i
=
0
;
i
<
geometry
.
faces
.
length
;
i
+=
2
)
{
var
position
=
geometry
.
attributes
.
position
;
var
colors
=
[];
var
color
=
new
THREE
.
Color
();
var
hex
=
Math
.
random
()
*
0xffffff
;
geometry
.
faces
[
i
].
color
.
setHex
(
hex
);
geometry
.
faces
[
i
+
1
].
color
.
setHex
(
hex
);
// generate for each side of the cube a different color
for
(
var
i
=
0
;
i
<
position
.
count
;
i
+=
6
)
{
color
.
setHex
(
Math
.
random
()
*
0xffffff
);
// first face
colors
.
push
(
color
.
r
,
color
.
g
,
color
.
b
);
colors
.
push
(
color
.
r
,
color
.
g
,
color
.
b
);
colors
.
push
(
color
.
r
,
color
.
g
,
color
.
b
);
// second face
colors
.
push
(
color
.
r
,
color
.
g
,
color
.
b
);
colors
.
push
(
color
.
r
,
color
.
g
,
color
.
b
);
colors
.
push
(
color
.
r
,
color
.
g
,
color
.
b
);
}
var
material
=
new
THREE
.
MeshBasicMaterial
(
{
vertexColors
:
THREE
.
FaceColors
,
overdraw
:
0.5
}
);
geometry
.
addAttribute
(
'
color
'
,
new
THREE
.
Float32BufferAttribute
(
colors
,
3
)
);
var
material
=
new
THREE
.
MeshBasicMaterial
(
{
vertexColors
:
THREE
.
VertexColors
,
overdraw
:
0.5
}
);
for
(
var
i
=
0
;
i
<
10
;
i
++
)
{
...
...
examples/webgl_lines_sphere.html
浏览文件 @
c5de9812
...
...
@@ -69,11 +69,6 @@
function
init
()
{
var
container
;
container
=
document
.
createElement
(
'
div
'
);
document
.
body
.
appendChild
(
container
);
camera
=
new
THREE
.
PerspectiveCamera
(
80
,
SCREEN_WIDTH
/
SCREEN_HEIGHT
,
1
,
3000
);
camera
.
position
.
z
=
1000
;
...
...
@@ -93,7 +88,7 @@
line
=
new
THREE
.
LineSegments
(
geometry
,
material
);
line
.
scale
.
x
=
line
.
scale
.
y
=
line
.
scale
.
z
=
p
[
0
];
line
.
originalScale
=
p
[
0
];
line
.
userData
.
originalScale
=
p
[
0
];
line
.
rotation
.
y
=
Math
.
random
()
*
Math
.
PI
;
line
.
updateMatrix
();
scene
.
add
(
line
);
...
...
@@ -103,7 +98,7 @@
renderer
=
new
THREE
.
WebGLRenderer
(
{
antialias
:
true
}
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
SCREEN_WIDTH
,
SCREEN_HEIGHT
);
container
.
appendChild
(
renderer
.
domElement
);
document
.
body
.
appendChild
(
renderer
.
domElement
);
document
.
addEventListener
(
'
mousemove
'
,
onDocumentMouseMove
,
false
);
document
.
addEventListener
(
'
touchstart
'
,
onDocumentTouchStart
,
false
);
...
...
@@ -121,7 +116,7 @@
scene
.
traverse
(
function
(
object
)
{
if
(
object
instanceof
THREE
.
Line
)
{
if
(
object
.
is
Line
)
{
object
.
geometry
.
dispose
();
object
.
geometry
=
geometry
;
...
...
@@ -136,25 +131,29 @@
function
createGeometry
()
{
var
geometry
=
new
THREE
.
Geometry
();
var
geometry
=
new
THREE
.
BufferGeometry
();
var
vertices
=
[];
var
vertex
=
new
THREE
.
Vector3
();
for
(
var
i
=
0
;
i
<
1500
;
i
++
)
{
var
vertex1
=
new
THREE
.
Vector3
();
vertex1
.
x
=
Math
.
random
()
*
2
-
1
;
vertex1
.
y
=
Math
.
random
()
*
2
-
1
;
vertex1
.
z
=
Math
.
random
()
*
2
-
1
;
vertex1
.
normalize
();
vertex1
.
multiplyScalar
(
r
);
vertex
.
x
=
Math
.
random
()
*
2
-
1
;
vertex
.
y
=
Math
.
random
()
*
2
-
1
;
vertex
.
z
=
Math
.
random
()
*
2
-
1
;
vertex
.
normalize
();
vertex
.
multiplyScalar
(
r
);
var
vertex2
=
vertex1
.
clone
();
vertex2
.
multiplyScalar
(
Math
.
random
()
*
0.09
+
1
);
vertices
.
push
(
vertex
.
x
,
vertex
.
y
,
vertex
.
z
);
geometry
.
vertices
.
push
(
vertex1
);
geometry
.
vertices
.
push
(
vertex2
);
vertex
.
multiplyScalar
(
Math
.
random
()
*
0.09
+
1
);
vertices
.
push
(
vertex
.
x
,
vertex
.
y
,
vertex
.
z
);
}
geometry
.
addAttribute
(
'
position
'
,
new
THREE
.
Float32BufferAttribute
(
vertices
,
3
)
);
return
geometry
;
}
...
...
@@ -227,11 +226,17 @@
var
object
=
scene
.
children
[
i
];
if
(
object
instanceof
THREE
.
Line
)
{
if
(
object
.
is
Line
)
{
object
.
rotation
.
y
=
time
*
(
i
<
4
?
(
i
+
1
)
:
-
(
i
+
1
)
);
if
(
i
<
5
)
object
.
scale
.
x
=
object
.
scale
.
y
=
object
.
scale
.
z
=
object
.
originalScale
*
(
i
/
5
+
1
)
*
(
1
+
0.5
*
Math
.
sin
(
7
*
time
)
);
if
(
i
<
5
)
{
var
scale
=
object
.
userData
.
originalScale
*
(
i
/
5
+
1
)
*
(
1
+
0.5
*
Math
.
sin
(
7
*
time
)
);
object
.
scale
.
x
=
object
.
scale
.
y
=
object
.
scale
.
z
=
scale
;
}
}
...
...
examples/webgl_loader_nrrd.html
浏览文件 @
c5de9812
...
...
@@ -112,8 +112,8 @@
sliceX
;
//box helper to see the extend of the volume
var
geometry
=
new
THREE
.
BoxGeometry
(
volume
.
xLength
,
volume
.
yLength
,
volume
.
zLength
);
var
material
=
new
THREE
.
MeshBasicMaterial
(
{
color
:
0x00ff00
}
);
var
geometry
=
new
THREE
.
Box
Buffer
Geometry
(
volume
.
xLength
,
volume
.
yLength
,
volume
.
zLength
);
var
material
=
new
THREE
.
MeshBasicMaterial
(
{
color
:
0x00ff00
}
);
var
cube
=
new
THREE
.
Mesh
(
geometry
,
material
);
cube
.
visible
=
false
;
var
box
=
new
THREE
.
BoxHelper
(
cube
);
...
...
examples/webgl_loader_obj2_meshspray.html
浏览文件 @
c5de9812
...
...
@@ -426,7 +426,7 @@
var
helper
=
new
THREE
.
GridHelper
(
1200
,
60
,
0xFF4444
,
0x404040
);
this
.
scene
.
add
(
helper
);
var
geometry
=
new
THREE
.
BoxGeometry
(
10
,
10
,
10
);
var
geometry
=
new
THREE
.
Box
Buffer
Geometry
(
10
,
10
,
10
);
var
material
=
new
THREE
.
MeshNormalMaterial
();
this
.
cube
=
new
THREE
.
Mesh
(
geometry
,
material
);
this
.
cube
.
position
.
set
(
0
,
0
,
0
);
...
...
examples/webgl_loader_obj2_options.html
浏览文件 @
c5de9812
...
...
@@ -142,7 +142,7 @@
var
helper
=
new
THREE
.
GridHelper
(
1200
,
60
,
0xFF4444
,
0x404040
);
this
.
scene
.
add
(
helper
);
var
geometry
=
new
THREE
.
BoxGeometry
(
10
,
10
,
10
);
var
geometry
=
new
THREE
.
Box
Buffer
Geometry
(
10
,
10
,
10
);
var
material
=
new
THREE
.
MeshNormalMaterial
();
this
.
cube
=
new
THREE
.
Mesh
(
geometry
,
material
);
this
.
cube
.
position
.
set
(
0
,
0
,
0
);
...
...
examples/webgl_loader_obj2_run_director.html
浏览文件 @
c5de9812
...
...
@@ -154,7 +154,7 @@
this
.
scene
.
add
(
directionalLight2
);
this
.
scene
.
add
(
ambientLight
);
var
geometry
=
new
THREE
.
BoxGeometry
(
10
,
10
,
10
);
var
geometry
=
new
THREE
.
Box
Buffer
Geometry
(
10
,
10
,
10
);
var
material
=
new
THREE
.
MeshNormalMaterial
();
this
.
cube
=
new
THREE
.
Mesh
(
geometry
,
material
);
this
.
cube
.
position
.
set
(
0
,
0
,
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录