Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
a6b0dc85
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,发现更多精彩内容 >>
提交
a6b0dc85
编写于
1月 15, 2016
作者:
R
rfm1201
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Lathe geometry in the editor
Added a minimal support of lathe geometry in the editor.
上级
110fea8a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
168 addition
and
0 deletion
+168
-0
editor/index.html
editor/index.html
+1
-0
editor/js/Menubar.Add.js
editor/js/Menubar.Add.js
+33
-0
editor/js/Sidebar.Geometry.LatheGeometry.js
editor/js/Sidebar.Geometry.LatheGeometry.js
+134
-0
未找到文件。
editor/index.html
浏览文件 @
a6b0dc85
...
@@ -119,6 +119,7 @@
...
@@ -119,6 +119,7 @@
<script
src=
"js/Sidebar.Geometry.TorusKnotGeometry.js"
></script>
<script
src=
"js/Sidebar.Geometry.TorusKnotGeometry.js"
></script>
<script
src=
"../examples/js/geometries/TeapotBufferGeometry.js"
></script>
<script
src=
"../examples/js/geometries/TeapotBufferGeometry.js"
></script>
<script
src=
"js/Sidebar.Geometry.TeapotBufferGeometry.js"
></script>
<script
src=
"js/Sidebar.Geometry.TeapotBufferGeometry.js"
></script>
<script
src=
"js/Sidebar.Geometry.LatheGeometry.js"
></script>
<script
src=
"js/Sidebar.Material.js"
></script>
<script
src=
"js/Sidebar.Material.js"
></script>
<script
src=
"js/Sidebar.Animation.js"
></script>
<script
src=
"js/Sidebar.Animation.js"
></script>
<script
src=
"js/Sidebar.Script.js"
></script>
<script
src=
"js/Sidebar.Script.js"
></script>
...
...
editor/js/Menubar.Add.js
浏览文件 @
a6b0dc85
...
@@ -242,6 +242,39 @@ Menubar.Add = function ( editor ) {
...
@@ -242,6 +242,39 @@ Menubar.Add = function ( editor ) {
options.add( option );
options.add( option );
*/
*/
// Lathe
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
'
Lathe geometry
'
);
option
.
onClick
(
function
()
{
var
points
=
[];
var
segments
=
20
;
var
phiStart
=
0
;
var
phiLength
=
2
*
Math
.
PI
;
points
.
push
(
new
THREE
.
Vector3
(
0
,
0
,
0
)
);
points
.
push
(
new
THREE
.
Vector3
(
4
,
0
,
0
)
);
points
.
push
(
new
THREE
.
Vector3
(
3.5
,
0
,
0.5
)
);
points
.
push
(
new
THREE
.
Vector3
(
1
,
0
,
0.75
)
);
points
.
push
(
new
THREE
.
Vector3
(
0.8
,
0
,
1
)
);
points
.
push
(
new
THREE
.
Vector3
(
0.8
,
0
,
4
)
);
points
.
push
(
new
THREE
.
Vector3
(
1
,
0
,
4.2
)
);
points
.
push
(
new
THREE
.
Vector3
(
1.4
,
0
,
4.8
)
);
points
.
push
(
new
THREE
.
Vector3
(
2
,
0
,
5
)
);
points
.
push
(
new
THREE
.
Vector3
(
2.5
,
0
,
5.4
)
);
points
.
push
(
new
THREE
.
Vector3
(
2.5
,
0
,
12
)
);
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
);
editor
.
execute
(
new
AddObjectCommand
(
mesh
)
);
}
);
options
.
add
(
option
);
// Sprite
// Sprite
var
option
=
new
UI
.
Row
();
var
option
=
new
UI
.
Row
();
...
...
editor/js/Sidebar.Geometry.LatheGeometry.js
0 → 100644
浏览文件 @
a6b0dc85
/**
* @author rfm1201
*/
Sidebar
.
Geometry
.
LatheGeometry
=
function
(
editor
,
object
)
{
var
signals
=
editor
.
signals
;
var
container
=
new
UI
.
Row
();
var
parameters
=
object
.
geometry
.
parameters
;
// segments
var
segmentsRow
=
new
UI
.
Row
();
var
segments
=
new
UI
.
Integer
(
parameters
.
segments
).
onChange
(
update
);
segmentsRow
.
add
(
new
UI
.
Text
(
'
Segments
'
).
setWidth
(
'
90px
'
)
);
segmentsRow
.
add
(
segments
);
container
.
add
(
segmentsRow
);
// phiStart
var
phiStartRow
=
new
UI
.
Row
();
var
phiStart
=
new
UI
.
Number
(
parameters
.
phiStart
*
180
/
Math
.
PI
).
onChange
(
update
);
phiStartRow
.
add
(
new
UI
.
Text
(
'
Phi start (°)
'
).
setWidth
(
'
90px
'
)
);
phiStartRow
.
add
(
phiStart
);
container
.
add
(
phiStartRow
);
// phiLength
var
phiLengthRow
=
new
UI
.
Row
();
var
phiLength
=
new
UI
.
Number
(
parameters
.
phiLength
*
180
/
Math
.
PI
).
onChange
(
update
);
phiLengthRow
.
add
(
new
UI
.
Text
(
'
Phi length (°)
'
).
setWidth
(
'
90px
'
)
);
phiLengthRow
.
add
(
phiLength
);
container
.
add
(
phiLengthRow
);
// points
var
lastPointIdx
=
0
;
var
pointsUI
=
[];
var
pointsDiv
=
new
UI
.
Div
();
var
point
;
for
(
var
i
=
0
;
i
<
parameters
.
points
.
length
;
i
++
)
{
point
=
parameters
.
points
[
i
];
pointsDiv
.
add
(
createPointRow
(
point
.
x
,
point
.
z
)
);
}
var
pointsRow
=
new
UI
.
Row
().
setDisplay
(
'
flex
'
);
var
btnAdd
=
new
UI
.
Button
(
'
+
'
).
setMarginRight
(
'
15px
'
).
onClick
(
function
()
{
pointsDiv
.
add
(
createPointRow
(
0
,
0
)
);
update
();
}
);
pointsRow
.
add
(
new
UI
.
Text
(
'
Points
'
).
setWidth
(
'
50px
'
),
btnAdd
,
pointsDiv
);
container
.
add
(
pointsRow
);
//
function
createPointRow
(
x
,
y
)
{
var
pointRow
=
new
UI
.
Row
();
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
);
var
idx
=
lastPointIdx
;
var
btn
=
new
UI
.
Button
(
'
-
'
).
onClick
(
function
()
{
deletePointRow
(
idx
);
}
);
pointsUI
.
push
(
{
row
:
pointRow
,
lbl
:
lbl
,
x
:
txtX
,
y
:
txtY
}
);
lastPointIdx
++
;
pointRow
.
add
(
lbl
,
txtX
,
txtY
,
btn
);
return
pointRow
;
}
function
deletePointRow
(
idx
)
{
if
(
!
pointsUI
[
idx
]
)
return
;
pointsDiv
.
remove
(
pointsUI
[
idx
].
row
);
pointsUI
[
idx
]
=
null
;
update
();
}
function
update
()
{
var
points
=
[];
var
count
=
0
;
var
pointUI
;
for
(
var
i
=
0
;
i
<
pointsUI
.
length
;
i
++
)
{
pointUI
=
pointsUI
[
i
];
if
(
!
pointUI
)
{
continue
;
}
points
.
push
(
new
THREE
.
Vector3
(
pointUI
.
x
.
getValue
(),
0
,
pointUI
.
y
.
getValue
()
)
);
count
++
;
pointUI
.
lbl
.
setValue
(
count
);
}
editor
.
execute
(
new
SetGeometryCommand
(
object
,
new
THREE
.
LatheGeometry
(
points
,
segments
.
getValue
(),
phiStart
.
getValue
()
/
180
*
Math
.
PI
,
phiLength
.
getValue
()
/
180
*
Math
.
PI
)
)
);
}
return
container
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录