Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
a6b93c1c
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,发现更多精彩内容 >>
提交
a6b93c1c
编写于
1月 15, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Editor: Lather code clean up.
上级
ae847060
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
25 deletion
+32
-25
editor/js/Menubar.Add.js
editor/js/Menubar.Add.js
+2
-2
editor/js/Sidebar.Geometry.LatheGeometry.js
editor/js/Sidebar.Geometry.LatheGeometry.js
+30
-23
未找到文件。
editor/js/Menubar.Add.js
浏览文件 @
a6b93c1c
...
...
@@ -246,7 +246,7 @@ Menubar.Add = function ( editor ) {
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
'
Lathe
geometry
'
);
option
.
setTextContent
(
'
Lathe
'
);
option
.
onClick
(
function
()
{
var
points
=
[];
...
...
@@ -268,7 +268,7 @@ Menubar.Add = function ( editor ) {
var
geometry
=
new
THREE
.
LatheGeometry
(
points
,
segments
,
phiStart
,
phiLength
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshStandardMaterial
(
{
side
:
THREE
.
DoubleSide
}
)
);
mesh
.
name
=
'
Lathe
'
+
(
++
meshCount
);
mesh
.
name
=
'
Lathe
'
+
(
++
meshCount
);
editor
.
execute
(
new
AddObjectCommand
(
mesh
)
);
...
...
editor/js/Sidebar.Geometry.LatheGeometry.js
浏览文件 @
a6b93c1c
...
...
@@ -45,32 +45,40 @@ Sidebar.Geometry.LatheGeometry = function( editor, object ) {
var
lastPointIdx
=
0
;
var
pointsUI
=
[];
var
pointsDiv
=
new
UI
.
Div
();
var
point
;
var
pointsRow
=
new
UI
.
Row
();
pointsRow
.
add
(
new
UI
.
Text
(
'
Points
'
).
setWidth
(
'
90px
'
)
);
var
points
=
new
UI
.
Span
().
setDisplay
(
'
inline-block
'
);
pointsRow
.
add
(
points
);
var
pointsList
=
new
UI
.
Div
();
points
.
add
(
pointsList
);
for
(
var
i
=
0
;
i
<
parameters
.
points
.
length
;
i
++
)
{
point
=
parameters
.
points
[
i
];
points
Div
.
add
(
createPointRow
(
point
.
x
,
point
.
z
)
);
var
point
=
parameters
.
points
[
i
];
points
List
.
add
(
createPointRow
(
point
.
x
,
point
.
z
)
);
}
var
pointsRow
=
new
UI
.
Row
().
setDisplay
(
'
flex
'
);
var
addPointButton
=
new
UI
.
Button
(
'
+
'
).
onClick
(
function
()
{
var
point
=
pointsUI
[
pointsUI
.
length
-
1
];
var
btnAdd
=
new
UI
.
Button
(
'
+
'
).
setMarginRight
(
'
15px
'
).
onClick
(
function
()
{
pointsList
.
add
(
createPointRow
(
point
.
x
.
getValue
(),
point
.
y
.
getValue
()
)
);
pointsDiv
.
add
(
createPointRow
(
0
,
0
)
);
update
();
}
);
points
.
add
(
addPointButton
);
pointsRow
.
add
(
new
UI
.
Text
(
'
Points
'
).
setWidth
(
'
50px
'
),
btnAdd
,
pointsDiv
);
container
.
add
(
pointsRow
);
//
function
createPointRow
(
x
,
y
)
{
var
pointRow
=
new
UI
.
Row
();
var
pointRow
=
new
UI
.
Div
();
var
lbl
=
new
UI
.
Text
(
lastPointIdx
+
1
).
setWidth
(
'
20px
'
);
var
txtX
=
new
UI
.
Number
(
x
).
setRange
(
0
,
Infinity
).
setWidth
(
'
40px
'
).
onChange
(
update
);
var
txtY
=
new
UI
.
Number
(
y
).
setWidth
(
'
40px
'
).
onChange
(
update
);
...
...
@@ -93,7 +101,7 @@ Sidebar.Geometry.LatheGeometry = function( editor, object ) {
if
(
!
pointsUI
[
idx
]
)
return
;
points
Div
.
remove
(
pointsUI
[
idx
].
row
);
points
List
.
remove
(
pointsUI
[
idx
].
row
);
pointsUI
[
idx
]
=
null
;
update
();
...
...
@@ -104,15 +112,12 @@ Sidebar.Geometry.LatheGeometry = function( editor, object ) {
var
points
=
[];
var
count
=
0
;
var
pointUI
;
for
(
var
i
=
0
;
i
<
pointsUI
.
length
;
i
++
)
{
pointUI
=
pointsUI
[
i
];
if
(
!
pointUI
)
{
for
(
var
i
=
0
;
i
<
pointsUI
.
length
;
i
++
)
{
continue
;
var
pointUI
=
pointsUI
[
i
]
;
}
if
(
!
pointUI
)
continue
;
points
.
push
(
new
THREE
.
Vector3
(
pointUI
.
x
.
getValue
(),
0
,
pointUI
.
y
.
getValue
()
)
);
count
++
;
...
...
@@ -120,15 +125,17 @@ Sidebar.Geometry.LatheGeometry = function( editor, object ) {
}
editor
.
execute
(
new
SetGeometryCommand
(
object
,
new
THREE
.
LatheGeometry
(
points
,
segments
.
getValue
(),
phiStart
.
getValue
()
/
180
*
Math
.
PI
,
phiLength
.
getValue
()
/
180
*
Math
.
PI
)
)
);
var
geometry
=
new
THREE
.
LatheGeometry
(
points
,
segments
.
getValue
(),
phiStart
.
getValue
()
/
180
*
Math
.
PI
,
phiLength
.
getValue
()
/
180
*
Math
.
PI
);
editor
.
execute
(
new
SetGeometryCommand
(
object
,
geometry
)
);
}
return
container
;
}
}
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录