Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
d6515a7a
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,体验更适合开发者的 AI 搜索 >>
提交
d6515a7a
编写于
3月 08, 2021
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
GridHelper: Removed colorCenterLine
上级
ddae84dd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
6 addition
and
20 deletion
+6
-20
docs/api/en/helpers/GridHelper.html
docs/api/en/helpers/GridHelper.html
+2
-3
src/helpers/GridHelper.js
src/helpers/GridHelper.js
+4
-17
未找到文件。
docs/api/en/helpers/GridHelper.html
浏览文件 @
d6515a7a
...
...
@@ -30,12 +30,11 @@
<h2>
Constructor
</h2>
<h3>
[name]( [param:number size], [param:Number divisions], [param:Color color
CenterLine], [param:Color colorGrid
] )
</h3>
<h3>
[name]( [param:number size], [param:Number divisions], [param:Color color] )
</h3>
<p>
size -- The size of the grid. Default is 10.
<br
/>
divisions -- The number of divisions across the grid. Default is 10.
<br
/>
colorCenterLine -- The color of the centerline. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x444444
<br
/>
colorGrid -- The color of the lines of the grid. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x888888
color -- The color of the lines of the grid. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0x888888
</p>
<p>
Creates a new [name] of size 'size' and divided into 'divisions' segments per side. Colors are optional.
...
...
src/helpers/GridHelper.js
浏览文件 @
d6515a7a
...
...
@@ -2,40 +2,27 @@ import { LineSegments } from '../objects/LineSegments.js';
import
{
LineBasicMaterial
}
from
'
../materials/LineBasicMaterial.js
'
;
import
{
Float32BufferAttribute
}
from
'
../core/BufferAttribute.js
'
;
import
{
BufferGeometry
}
from
'
../core/BufferGeometry.js
'
;
import
{
Color
}
from
'
../math/Color.js
'
;
class
GridHelper
extends
LineSegments
{
constructor
(
size
=
10
,
divisions
=
10
,
color
1
=
0x444444
,
color2
=
0x888888
)
{
constructor
(
size
=
10
,
divisions
=
10
,
color
=
0x444444
)
{
color1
=
new
Color
(
color1
);
color2
=
new
Color
(
color2
);
const
center
=
divisions
/
2
;
const
step
=
size
/
divisions
;
const
halfSize
=
size
/
2
;
const
vertices
=
[]
,
colors
=
[]
;
const
vertices
=
[];
for
(
let
i
=
0
,
j
=
0
,
k
=
-
halfSize
;
i
<=
divisions
;
i
++
,
k
+=
step
)
{
for
(
let
i
=
0
,
k
=
-
halfSize
;
i
<=
divisions
;
i
++
,
k
+=
step
)
{
vertices
.
push
(
-
halfSize
,
0
,
k
,
halfSize
,
0
,
k
);
vertices
.
push
(
k
,
0
,
-
halfSize
,
k
,
0
,
halfSize
);
const
color
=
i
===
center
?
color1
:
color2
;
color
.
toArray
(
colors
,
j
);
j
+=
3
;
color
.
toArray
(
colors
,
j
);
j
+=
3
;
color
.
toArray
(
colors
,
j
);
j
+=
3
;
color
.
toArray
(
colors
,
j
);
j
+=
3
;
}
const
geometry
=
new
BufferGeometry
();
geometry
.
setAttribute
(
'
position
'
,
new
Float32BufferAttribute
(
vertices
,
3
)
);
geometry
.
setAttribute
(
'
color
'
,
new
Float32BufferAttribute
(
colors
,
3
)
);
const
material
=
new
LineBasicMaterial
(
{
vertexColors
:
true
,
toneMapped
:
false
}
);
const
material
=
new
LineBasicMaterial
(
{
color
:
color
,
toneMapped
:
false
}
);
super
(
geometry
,
material
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录