Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
38814cb2
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,发现更多精彩内容 >>
未验证
提交
38814cb2
编写于
4月 29, 2019
作者:
M
Mr.doob
提交者:
GitHub
4月 29, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16319 from linbingquan/dev1
Editor: Sorting objects for Menubar.Add.js
上级
ee7b03e7
ca76af37
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
123 addition
and
123 deletion
+123
-123
editor/js/Menubar.Add.js
editor/js/Menubar.Add.js
+123
-123
未找到文件。
editor/js/Menubar.Add.js
浏览文件 @
38814cb2
...
...
@@ -37,135 +37,180 @@ Menubar.Add = function ( editor ) {
options
.
add
(
new
UI
.
HorizontalRule
()
);
//
Plane
//
Box
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
plane
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
box
'
)
);
option
.
onClick
(
function
()
{
var
geometry
=
new
THREE
.
PlaneBufferGeometry
(
1
,
1
,
1
,
1
);
var
material
=
new
THREE
.
MeshStandardMaterial
();
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
name
=
'
Plane
'
;
var
geometry
=
new
THREE
.
BoxBufferGeometry
(
1
,
1
,
1
,
1
,
1
,
1
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshStandardMaterial
()
);
mesh
.
name
=
'
Box
'
;
editor
.
execute
(
new
AddObjectCommand
(
mesh
)
);
}
);
options
.
add
(
option
);
//
Box
//
Circle
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
box
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
circle
'
)
);
option
.
onClick
(
function
()
{
var
geometry
=
new
THREE
.
BoxBufferGeometry
(
1
,
1
,
1
,
1
,
1
,
1
);
var
geometry
=
new
THREE
.
CircleBufferGeometry
(
1
,
8
,
0
,
Math
.
PI
*
2
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshStandardMaterial
()
);
mesh
.
name
=
'
Box
'
;
mesh
.
name
=
'
Circle
'
;
editor
.
execute
(
new
AddObjectCommand
(
mesh
)
);
}
);
options
.
add
(
option
);
// C
ircle
// C
ylinder
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/c
ircle
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/c
ylinder
'
)
);
option
.
onClick
(
function
()
{
var
geometry
=
new
THREE
.
C
ircleBufferGeometry
(
1
,
8
,
0
,
Math
.
PI
*
2
);
var
geometry
=
new
THREE
.
C
ylinderBufferGeometry
(
1
,
1
,
1
,
8
,
1
,
false
,
0
,
Math
.
PI
*
2
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshStandardMaterial
()
);
mesh
.
name
=
'
C
ircle
'
;
mesh
.
name
=
'
C
ylinder
'
;
editor
.
execute
(
new
AddObjectCommand
(
mesh
)
);
}
);
options
.
add
(
option
);
//
Ring
//
Icosahedron
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
ring
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
icosahedron
'
)
);
option
.
onClick
(
function
()
{
var
geometry
=
new
THREE
.
RingBufferGeometry
(
0.5
,
1
,
8
,
1
,
0
,
Math
.
PI
*
2
);
var
geometry
=
new
THREE
.
IcosahedronBufferGeometry
(
1
,
0
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshStandardMaterial
()
);
mesh
.
name
=
'
Ring
'
;
mesh
.
name
=
'
Icosahedron
'
;
editor
.
execute
(
new
AddObjectCommand
(
mesh
)
);
}
);
options
.
add
(
option
);
//
Cylinder
//
Lathe
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
cylinder
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
lathe
'
)
);
option
.
onClick
(
function
()
{
var
geometry
=
new
THREE
.
CylinderBufferGeometry
(
1
,
1
,
1
,
8
,
1
,
false
,
0
,
Math
.
PI
*
2
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshStandardMaterial
()
);
mesh
.
name
=
'
Cylinder
'
;
var
points
=
[
new
THREE
.
Vector2
(
0
,
0
),
new
THREE
.
Vector2
(
0.4
,
0
),
new
THREE
.
Vector2
(
0.35
,
0.05
),
new
THREE
.
Vector2
(
0.1
,
0.075
),
new
THREE
.
Vector2
(
0.08
,
0.1
),
new
THREE
.
Vector2
(
0.08
,
0.4
),
new
THREE
.
Vector2
(
0.1
,
0.42
),
new
THREE
.
Vector2
(
0.14
,
0.48
),
new
THREE
.
Vector2
(
0.2
,
0.5
),
new
THREE
.
Vector2
(
0.25
,
0.54
),
new
THREE
.
Vector2
(
0.3
,
1.2
)
];
var
geometry
=
new
THREE
.
LatheBufferGeometry
(
points
,
12
,
0
,
Math
.
PI
*
2
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshStandardMaterial
(
{
side
:
THREE
.
DoubleSide
}
)
);
mesh
.
name
=
'
Lathe
'
;
editor
.
execute
(
new
AddObjectCommand
(
mesh
)
);
}
);
options
.
add
(
option
);
//
Sphere
//
Octahedron
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
sphere
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
octahedron
'
)
);
option
.
onClick
(
function
()
{
var
geometry
=
new
THREE
.
SphereBufferGeometry
(
1
,
8
,
6
,
0
,
Math
.
PI
*
2
,
0
,
Math
.
PI
);
var
geometry
=
new
THREE
.
OctahedronBufferGeometry
(
1
,
0
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshStandardMaterial
()
);
mesh
.
name
=
'
Sphere
'
;
mesh
.
name
=
'
Octahedron
'
;
editor
.
execute
(
new
AddObjectCommand
(
mesh
)
);
}
);
options
.
add
(
option
);
//
Icosahedron
//
Plane
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
icosahedron
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
plane
'
)
);
option
.
onClick
(
function
()
{
var
geometry
=
new
THREE
.
IcosahedronBufferGeometry
(
1
,
0
);
var
geometry
=
new
THREE
.
PlaneBufferGeometry
(
1
,
1
,
1
,
1
);
var
material
=
new
THREE
.
MeshStandardMaterial
();
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
material
);
mesh
.
name
=
'
Plane
'
;
editor
.
execute
(
new
AddObjectCommand
(
mesh
)
);
}
);
options
.
add
(
option
)
// Ring
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/ring
'
)
);
option
.
onClick
(
function
()
{
var
geometry
=
new
THREE
.
RingBufferGeometry
(
0.5
,
1
,
8
,
1
,
0
,
Math
.
PI
*
2
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshStandardMaterial
()
);
mesh
.
name
=
'
Icosahedron
'
;
mesh
.
name
=
'
Ring
'
;
editor
.
execute
(
new
AddObjectCommand
(
mesh
)
);
}
);
options
.
add
(
option
);
//
Octahedron
//
Sphere
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
octahedron
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
sphere
'
)
);
option
.
onClick
(
function
()
{
var
geometry
=
new
THREE
.
OctahedronBufferGeometry
(
1
,
0
);
var
geometry
=
new
THREE
.
SphereBufferGeometry
(
1
,
8
,
6
,
0
,
Math
.
PI
*
2
,
0
,
Math
.
PI
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshStandardMaterial
()
);
mesh
.
name
=
'
Octahedron
'
;
mesh
.
name
=
'
Sphere
'
;
editor
.
execute
(
new
AddObjectCommand
(
mesh
)
);
}
);
options
.
add
(
option
);
// Sprite
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/sprite
'
)
);
option
.
onClick
(
function
()
{
var
sprite
=
new
THREE
.
Sprite
(
new
THREE
.
SpriteMaterial
()
);
sprite
.
name
=
'
Sprite
'
;
editor
.
execute
(
new
AddObjectCommand
(
sprite
)
);
}
);
options
.
add
(
option
);
// Tetrahedron
var
option
=
new
UI
.
Row
();
...
...
@@ -266,90 +311,40 @@ Menubar.Add = function ( editor ) {
options.add( option );
*/
// Lathe
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/lathe
'
)
);
option
.
onClick
(
function
()
{
var
points
=
[
new
THREE
.
Vector2
(
0
,
0
),
new
THREE
.
Vector2
(
0.4
,
0
),
new
THREE
.
Vector2
(
0.35
,
0.05
),
new
THREE
.
Vector2
(
0.1
,
0.075
),
new
THREE
.
Vector2
(
0.08
,
0.1
),
new
THREE
.
Vector2
(
0.08
,
0.4
),
new
THREE
.
Vector2
(
0.1
,
0.42
),
new
THREE
.
Vector2
(
0.14
,
0.48
),
new
THREE
.
Vector2
(
0.2
,
0.5
),
new
THREE
.
Vector2
(
0.25
,
0.54
),
new
THREE
.
Vector2
(
0.3
,
1.2
)
];
var
geometry
=
new
THREE
.
LatheBufferGeometry
(
points
,
12
,
0
,
Math
.
PI
*
2
);
var
mesh
=
new
THREE
.
Mesh
(
geometry
,
new
THREE
.
MeshStandardMaterial
(
{
side
:
THREE
.
DoubleSide
}
)
);
mesh
.
name
=
'
Lathe
'
;
editor
.
execute
(
new
AddObjectCommand
(
mesh
)
);
}
);
options
.
add
(
option
);
// Sprite
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/sprite
'
)
);
option
.
onClick
(
function
()
{
var
sprite
=
new
THREE
.
Sprite
(
new
THREE
.
SpriteMaterial
()
);
sprite
.
name
=
'
Sprite
'
;
editor
.
execute
(
new
AddObjectCommand
(
sprite
)
);
}
);
options
.
add
(
option
);
//
options
.
add
(
new
UI
.
HorizontalRule
()
);
//
Poi
ntLight
//
Ambie
ntLight
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
poi
ntlight
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
ambie
ntlight
'
)
);
option
.
onClick
(
function
()
{
var
color
=
0xffffff
;
var
intensity
=
1
;
var
distance
=
0
;
var
color
=
0x222222
;
var
light
=
new
THREE
.
PointLight
(
color
,
intensity
,
distance
);
light
.
name
=
'
Poi
ntLight
'
;
var
light
=
new
THREE
.
AmbientLight
(
color
);
light
.
name
=
'
Ambie
ntLight
'
;
editor
.
execute
(
new
AddObjectCommand
(
light
)
);
}
);
options
.
add
(
option
);
//
Spot
Light
//
Directional
Light
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
spot
light
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
directional
light
'
)
);
option
.
onClick
(
function
()
{
var
color
=
0xffffff
;
var
intensity
=
1
;
var
distance
=
0
;
var
angle
=
Math
.
PI
*
0.1
;
var
penumbra
=
0
;
var
light
=
new
THREE
.
SpotLight
(
color
,
intensity
,
distance
,
angle
,
penumbra
);
light
.
name
=
'
Spot
Light
'
;
light
.
target
.
name
=
'
Spot
Light Target
'
;
var
light
=
new
THREE
.
DirectionalLight
(
color
,
intensity
);
light
.
name
=
'
Directional
Light
'
;
light
.
target
.
name
=
'
Directional
Light Target
'
;
light
.
position
.
set
(
5
,
10
,
7.5
);
...
...
@@ -358,59 +353,64 @@ Menubar.Add = function ( editor ) {
}
);
options
.
add
(
option
);
//
Directional
Light
//
Hemisphere
Light
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
directional
light
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
hemisphere
light
'
)
);
option
.
onClick
(
function
()
{
var
color
=
0xffffff
;
var
skyColor
=
0x00aaff
;
var
groundColor
=
0xffaa00
;
var
intensity
=
1
;
var
light
=
new
THREE
.
DirectionalLight
(
color
,
intensity
);
light
.
name
=
'
DirectionalLight
'
;
light
.
target
.
name
=
'
DirectionalLight Target
'
;
var
light
=
new
THREE
.
HemisphereLight
(
skyColor
,
groundColor
,
intensity
);
light
.
name
=
'
HemisphereLight
'
;
light
.
position
.
set
(
5
,
10
,
7.5
);
light
.
position
.
set
(
0
,
10
,
0
);
editor
.
execute
(
new
AddObjectCommand
(
light
)
);
}
);
options
.
add
(
option
);
//
Hemisphere
Light
//
Point
Light
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
hemisphere
light
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
point
light
'
)
);
option
.
onClick
(
function
()
{
var
skyColor
=
0x00aaff
;
var
groundColor
=
0xffaa00
;
var
color
=
0xffffff
;
var
intensity
=
1
;
var
distance
=
0
;
var
light
=
new
THREE
.
HemisphereLight
(
skyColor
,
groundColor
,
intensity
);
light
.
name
=
'
HemisphereLight
'
;
light
.
position
.
set
(
0
,
10
,
0
);
var
light
=
new
THREE
.
PointLight
(
color
,
intensity
,
distance
);
light
.
name
=
'
PointLight
'
;
editor
.
execute
(
new
AddObjectCommand
(
light
)
);
}
);
options
.
add
(
option
);
//
Ambien
tLight
//
Spo
tLight
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
ambien
tlight
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
spo
tlight
'
)
);
option
.
onClick
(
function
()
{
var
color
=
0x222222
;
var
color
=
0xffffff
;
var
intensity
=
1
;
var
distance
=
0
;
var
angle
=
Math
.
PI
*
0.1
;
var
penumbra
=
0
;
var
light
=
new
THREE
.
AmbientLight
(
color
);
light
.
name
=
'
AmbientLight
'
;
var
light
=
new
THREE
.
SpotLight
(
color
,
intensity
,
distance
,
angle
,
penumbra
);
light
.
name
=
'
SpotLight
'
;
light
.
target
.
name
=
'
SpotLight Target
'
;
light
.
position
.
set
(
5
,
10
,
7.5
);
editor
.
execute
(
new
AddObjectCommand
(
light
)
);
...
...
@@ -421,30 +421,30 @@ Menubar.Add = function ( editor ) {
options
.
add
(
new
UI
.
HorizontalRule
()
);
//
Perspective
Camera
//
Orthographic
Camera
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
perspective
camera
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
orthographic
camera
'
)
);
option
.
onClick
(
function
()
{
var
camera
=
new
THREE
.
Perspective
Camera
();
camera
.
name
=
'
Perspective
Camera
'
;
var
camera
=
new
THREE
.
Orthographic
Camera
();
camera
.
name
=
'
Orthographic
Camera
'
;
editor
.
execute
(
new
AddObjectCommand
(
camera
)
);
}
);
options
.
add
(
option
);
//
Orthographic
Camera
//
Perspective
Camera
var
option
=
new
UI
.
Row
();
option
.
setClass
(
'
option
'
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
orthographic
camera
'
)
);
option
.
setTextContent
(
strings
.
getKey
(
'
menubar/add/
perspective
camera
'
)
);
option
.
onClick
(
function
()
{
var
camera
=
new
THREE
.
Orthographic
Camera
();
camera
.
name
=
'
Orthographic
Camera
'
;
var
camera
=
new
THREE
.
Perspective
Camera
();
camera
.
name
=
'
Perspective
Camera
'
;
editor
.
execute
(
new
AddObjectCommand
(
camera
)
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录