Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
306afd21
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,发现更多精彩内容 >>
提交
306afd21
编写于
8月 30, 2012
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
GUI: Materials panel clean up.
上级
12744d49
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
199 addition
and
51 deletion
+199
-51
gui/js/UI.js
gui/js/UI.js
+3
-10
gui/js/ui/Sidebar.Properties.Material.js
gui/js/ui/Sidebar.Properties.Material.js
+196
-41
未找到文件。
gui/js/UI.js
浏览文件 @
306afd21
...
...
@@ -508,17 +508,10 @@ UI.Number.prototype.setValue = function ( value ) {
};
UI
.
Number
.
prototype
.
set
Min
=
function
(
value
)
{
UI
.
Number
.
prototype
.
set
Range
=
function
(
min
,
max
)
{
this
.
min
=
value
;
return
this
;
};
UI
.
Number
.
prototype
.
setMax
=
function
(
value
)
{
this
.
max
=
value
;
this
.
min
=
min
;
this
.
max
=
max
;
return
this
;
...
...
gui/js/ui/Sidebar.Properties.Material.js
浏览文件 @
306afd21
...
...
@@ -23,60 +23,136 @@ Sidebar.Properties.Material = function ( signals ) {
container
.
add
(
new
UI
.
Text
().
setValue
(
'
MATERIAL
'
).
setColor
(
'
#666
'
)
);
container
.
add
(
new
UI
.
Break
(),
new
UI
.
Break
()
);
container
.
add
(
new
UI
.
Text
().
setValue
(
'
Name
'
).
setColor
(
'
#666
'
)
);
// name
var
materialNameRow
=
new
UI
.
Panel
();
var
materialName
=
new
UI
.
Text
(
'
absolute
'
).
setLeft
(
'
90px
'
).
setColor
(
'
#444
'
).
setFontSize
(
'
12px
'
);
container
.
add
(
materialName
);
container
.
add
(
new
UI
.
HorizontalRule
()
);
materialNameRow
.
add
(
new
UI
.
Text
().
setValue
(
'
Name
'
).
setColor
(
'
#666
'
),
materialName
);
container
.
add
(
materialNameRow
);
// class
container
.
add
(
new
UI
.
Text
().
setValue
(
'
Class
'
).
setColor
(
'
#666
'
)
);
var
materialClassRow
=
new
UI
.
Panel
(
);
var
materialClass
=
new
UI
.
Select
(
'
absolute
'
).
setOptions
(
[
'
LineBasicMaterial
'
,
'
MeshBasicMaterial
'
,
'
MeshDepthMaterial
'
,
'
MeshFaceMaterial
'
,
'
MeshLambertMaterial
'
,
'
MeshNormalMaterial
'
,
'
MeshPhongMaterial
'
,
'
ParticleBasicMaterial
'
,
'
ParticleCanvasMaterial
'
,
'
ParticleDOMMaterial
'
,
'
ShaderMaterial
'
]
).
setLeft
(
'
90px
'
).
setWidth
(
'
180px
'
).
setColor
(
'
#444
'
).
setFontSize
(
'
12px
'
).
onChange
(
update
);
container
.
add
(
materialClass
);
container
.
add
(
new
UI
.
HorizontalRule
()
);
materialClassRow
.
add
(
new
UI
.
HorizontalRule
(),
new
UI
.
Text
().
setValue
(
'
Class
'
).
setColor
(
'
#666
'
),
materialClass
);
container
.
add
(
new
UI
.
Text
().
setValue
(
'
Color
'
).
setColor
(
'
#666
'
)
);
container
.
add
(
materialClassRow
);
// color
var
materialColorRow
=
new
UI
.
Panel
();
var
materialColor
=
new
UI
.
Color
(
'
absolute
'
).
setLeft
(
'
90px
'
).
onChange
(
update
);
container
.
add
(
materialColor
);
container
.
add
(
new
UI
.
HorizontalRule
()
);
materialColorRow
.
add
(
new
UI
.
HorizontalRule
(),
new
UI
.
Text
().
setValue
(
'
Color
'
).
setColor
(
'
#666
'
),
materialColor
);
container
.
add
(
materialColorRow
);
container
.
add
(
new
UI
.
Text
().
setValue
(
'
Ambient
'
).
setColor
(
'
#666
'
)
);
// ambient
var
materialAmbientRow
=
new
UI
.
Panel
();
var
materialAmbient
=
new
UI
.
Color
(
'
absolute
'
).
setLeft
(
'
90px
'
).
onChange
(
update
);
container
.
add
(
materialAmbient
);
container
.
add
(
new
UI
.
HorizontalRule
()
);
materialAmbientRow
.
add
(
new
UI
.
HorizontalRule
(),
new
UI
.
Text
().
setValue
(
'
Ambient
'
).
setColor
(
'
#666
'
),
materialAmbient
);
container
.
add
(
new
UI
.
Text
().
setValue
(
'
Specular
'
).
setColor
(
'
#666
'
)
);
container
.
add
(
materialAmbientRow
);
// specular
var
materialSpecularRow
=
new
UI
.
Panel
();
var
materialSpecular
=
new
UI
.
Color
(
'
absolute
'
).
setLeft
(
'
90px
'
).
onChange
(
update
);
container
.
add
(
materialSpecular
);
container
.
add
(
new
UI
.
HorizontalRule
()
);
materialSpecularRow
.
add
(
new
UI
.
HorizontalRule
(),
new
UI
.
Text
().
setValue
(
'
Specular
'
).
setColor
(
'
#666
'
),
materialSpecular
);
container
.
add
(
materialSpecularRow
);
// map
container
.
add
(
new
UI
.
Text
().
setValue
(
'
Map
'
).
setColor
(
'
#666
'
)
);
var
materialMapRow
=
new
UI
.
Panel
(
);
var
materialMap
=
new
UI
.
Text
(
'
absolute
'
).
setLeft
(
'
90px
'
).
setColor
(
'
#444
'
).
setFontSize
(
'
12px
'
);
container
.
add
(
materialMap
);
container
.
add
(
new
UI
.
HorizontalRule
()
);
materialMapRow
.
add
(
new
UI
.
HorizontalRule
(),
new
UI
.
Text
().
setValue
(
'
Map
'
).
setColor
(
'
#666
'
),
materialMap
);
container
.
add
(
materialSpecularRow
);
// opacity
container
.
add
(
new
UI
.
Text
().
setValue
(
'
Opacity
'
).
setColor
(
'
#666
'
)
);
var
materialOpacity
=
new
UI
.
Number
(
'
absolute
'
).
setLeft
(
'
90px
'
).
setWidth
(
'
60px
'
).
setMin
(
0
).
setMax
(
1
).
onChange
(
update
);
container
.
add
(
materialOpacity
);
var
materialOpacityRow
=
new
UI
.
Panel
();
var
materialOpacity
=
new
UI
.
Number
(
'
absolute
'
).
setLeft
(
'
90px
'
).
setWidth
(
'
60px
'
).
setRange
(
0
,
1
).
onChange
(
update
);
container
.
add
(
new
UI
.
HorizontalRule
()
);
materialOpacityRow
.
add
(
new
UI
.
HorizontalRule
(),
new
UI
.
Text
().
setValue
(
'
Opacity
'
).
setColor
(
'
#666
'
),
materialOpacity
);
container
.
add
(
new
UI
.
Text
().
setValue
(
'
Transparent
'
).
setColor
(
'
#666
'
)
);
container
.
add
(
materialOpacityRow
);
// transparent
var
materialTransparentRow
=
new
UI
.
Panel
();
var
materialTransparent
=
new
UI
.
Boolean
(
'
absolute
'
).
setValue
(
false
).
setLeft
(
'
90px
'
).
onChange
(
update
);
container
.
add
(
materialTransparent
);
container
.
add
(
new
UI
.
HorizontalRule
()
);
materialTransparentRow
.
add
(
new
UI
.
HorizontalRule
(),
new
UI
.
Text
().
setValue
(
'
Transparent
'
).
setColor
(
'
#666
'
),
materialTransparent
);
container
.
add
(
materialTransparentRow
);
container
.
add
(
new
UI
.
Text
().
setValue
(
'
Wireframe
'
).
setColor
(
'
#666
'
)
);
// wireframe
var
materialWireframeRow
=
new
UI
.
Panel
();
var
materialWireframe
=
new
UI
.
Boolean
(
'
absolute
'
).
setValue
(
false
).
setLeft
(
'
90px
'
).
onChange
(
update
);
container
.
add
(
materialWireframe
);
materialWireframeRow
.
add
(
new
UI
.
HorizontalRule
(),
new
UI
.
Text
().
setValue
(
'
Wireframe
'
).
setColor
(
'
#666
'
),
materialWireframe
);
container
.
add
(
materialWireframeRow
);
// wireframeLinewidth
var
materialWireframeLinewidthRow
=
new
UI
.
Panel
();
var
materialWireframeLinewidth
=
new
UI
.
Number
(
'
absolute
'
).
setValue
(
1
).
setLeft
(
'
90px
'
).
setRange
(
0
,
100
).
onChange
(
update
);
materialWireframeLinewidthRow
.
add
(
new
UI
.
HorizontalRule
(),
new
UI
.
Text
().
setValue
(
'
Linewidth
'
).
setColor
(
'
#666
'
),
materialWireframeLinewidth
);
container
.
add
(
materialWireframeLinewidthRow
);
//
...
...
@@ -95,33 +171,70 @@ Sidebar.Properties.Material = function ( signals ) {
}
if
(
material
.
color
)
{
if
(
material
.
color
!==
undefined
)
{
material
.
color
.
setHex
(
parseInt
(
materialColor
.
getValue
().
substr
(
1
),
16
)
);
}
if
(
material
.
ambient
)
{
if
(
material
.
ambient
!==
undefined
)
{
material
.
ambient
.
setHex
(
parseInt
(
materialAmbient
.
getValue
().
substr
(
1
),
16
)
);
}
if
(
material
.
specular
)
{
if
(
material
.
specular
!==
undefined
)
{
material
.
specular
.
setHex
(
parseInt
(
materialSpecular
.
getValue
().
substr
(
1
),
16
)
);
}
material
.
opacity
=
materialOpacity
.
getValue
();
material
.
transparent
=
materialTransparent
.
getValue
();
material
.
wireframe
=
materialWireframe
.
getValue
();
if
(
material
.
opacity
!==
undefined
)
{
material
.
opacity
=
materialOpacity
.
getValue
();
}
if
(
material
.
transparent
!==
undefined
)
{
material
.
transparent
=
materialTransparent
.
getValue
();
}
if
(
material
.
wireframe
!==
undefined
)
{
material
.
wireframe
=
materialWireframe
.
getValue
();
}
if
(
material
.
wireframe
===
true
)
{
material
.
wireframeLinewidth
=
materialWireframeLinewidth
.
getValue
();
}
updateRows
();
signals
.
materialChanged
.
dispatch
(
material
);
}
}
};
function
updateRows
()
{
var
material
=
selected
.
material
;
materialColorRow
.
setDisplay
(
material
.
color
!==
undefined
?
''
:
'
none
'
);
materialAmbientRow
.
setDisplay
(
material
.
ambient
!==
undefined
?
''
:
'
none
'
);
materialSpecularRow
.
setDisplay
(
material
.
specular
!==
undefined
?
''
:
'
none
'
);
materialMapRow
.
setDisplay
(
material
.
map
!==
undefined
?
''
:
'
none
'
);
materialOpacityRow
.
setDisplay
(
material
.
opacity
!==
undefined
?
''
:
'
none
'
);
materialTransparentRow
.
setDisplay
(
material
.
transparent
!==
undefined
?
''
:
'
none
'
);
materialWireframeRow
.
setDisplay
(
material
.
wireframe
!==
undefined
?
''
:
'
none
'
);
materialWireframeLinewidthRow
.
setDisplay
(
material
.
wireframe
===
true
?
''
:
'
none
'
);
};
signals
.
objectSelected
.
add
(
function
(
object
)
{
...
...
@@ -129,20 +242,62 @@ Sidebar.Properties.Material = function ( signals ) {
selected
=
object
;
container
.
setDisplay
(
'
block
'
);
container
.
setDisplay
(
''
);
var
material
=
object
.
material
;
materialName
.
setValue
(
material
.
name
);
materialClass
.
setValue
(
getMaterialInstanceName
(
material
)
);
if
(
material
.
color
)
materialColor
.
setValue
(
'
#
'
+
material
.
color
.
getHex
().
toString
(
16
)
);
if
(
material
.
ambient
)
materialAmbient
.
setValue
(
'
#
'
+
material
.
ambient
.
getHex
().
toString
(
16
)
);
if
(
material
.
specular
)
materialSpecular
.
setValue
(
'
#
'
+
material
.
specular
.
getHex
().
toString
(
16
)
);
if
(
material
.
map
)
materialMap
.
setValue
(
material
.
map
);
if
(
material
.
color
!==
undefined
)
{
materialColor
.
setValue
(
'
#
'
+
material
.
color
.
getHex
().
toString
(
16
)
);
}
if
(
material
.
ambient
!==
undefined
)
{
materialAmbient
.
setValue
(
'
#
'
+
material
.
ambient
.
getHex
().
toString
(
16
)
);
}
if
(
material
.
specular
!==
undefined
)
{
materialSpecular
.
setValue
(
'
#
'
+
material
.
specular
.
getHex
().
toString
(
16
)
);
}
if
(
material
.
map
!==
undefined
)
{
materialMap
.
setValue
(
material
.
map
);
}
if
(
material
.
opacity
!==
undefined
)
{
materialOpacity
.
setValue
(
material
.
opacity
);
}
if
(
material
.
transparent
!==
undefined
)
{
materialTransparent
.
setValue
(
material
.
transparent
);
}
if
(
material
.
wireframe
!==
undefined
)
{
materialWireframe
.
setValue
(
material
.
wireframe
);
}
if
(
material
.
wireframeLinewidth
!==
undefined
)
{
materialWireframeLinewidth
.
setValue
(
material
.
wireframeLinewidth
);
}
materialOpacity
.
setValue
(
material
.
opacity
);
materialTransparent
.
setValue
(
material
.
transparent
);
updateRows
();
}
else
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录