Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
750973be
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 搜索 >>
提交
750973be
编写于
8月 14, 2016
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Editor: Added background color support.
上级
127cff03
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
28 addition
and
19 deletion
+28
-19
editor/index.html
editor/index.html
+1
-0
editor/js/Editor.js
editor/js/Editor.js
+3
-0
editor/js/Sidebar.Scene.js
editor/js/Sidebar.Scene.js
+16
-10
editor/js/Viewport.js
editor/js/Viewport.js
+8
-9
未找到文件。
editor/index.html
浏览文件 @
750973be
...
...
@@ -254,6 +254,7 @@
signals
.
objectChanged
.
add
(
saveState
);
signals
.
objectRemoved
.
add
(
saveState
);
signals
.
materialChanged
.
add
(
saveState
);
signals
.
sceneBackgroundChanged
.
add
(
saveState
);
signals
.
sceneFogChanged
.
add
(
saveState
);
signals
.
sceneGraphChanged
.
add
(
saveState
);
signals
.
scriptChanged
.
add
(
saveState
);
...
...
editor/js/Editor.js
浏览文件 @
750973be
...
...
@@ -47,6 +47,7 @@ var Editor = function () {
spaceChanged
:
new
Signal
(),
rendererChanged
:
new
Signal
(),
sceneBackgroundChanged
:
new
Signal
(),
sceneFogChanged
:
new
Signal
(),
sceneGraphChanged
:
new
Signal
(),
...
...
@@ -88,6 +89,7 @@ var Editor = function () {
this
.
scene
=
new
THREE
.
Scene
();
this
.
scene
.
name
=
'
Scene
'
;
this
.
scene
.
background
=
new
THREE
.
Color
(
0xaaaaaa
);
this
.
sceneHelpers
=
new
THREE
.
Scene
();
...
...
@@ -119,6 +121,7 @@ Editor.prototype = {
this
.
scene
.
uuid
=
scene
.
uuid
;
this
.
scene
.
name
=
scene
.
name
;
if
(
scene
.
background
!==
null
)
this
.
scene
.
background
=
scene
.
background
.
clone
();
if
(
scene
.
fog
!==
null
)
this
.
scene
.
fog
=
scene
.
fog
.
clone
();
this
.
scene
.
userData
=
JSON
.
parse
(
JSON
.
stringify
(
scene
.
userData
)
);
...
...
editor/js/Sidebar.Scene.js
浏览文件 @
750973be
...
...
@@ -76,24 +76,22 @@ Sidebar.Scene = function ( editor ) {
container
.
add
(
outliner
);
container
.
add
(
new
UI
.
Break
()
);
/*
// background
var backgroundRow = new UI.Row();
var background = new UI.Select().setOptions( {
function
onBackgroundChanged
()
{
'None': 'None',
'Color': 'Color',
'Texture': 'Texture'
signals
.
sceneBackgroundChanged
.
dispatch
(
backgroundColor
.
getHexValue
()
);
} ).setWidth( '150px' );
background.onChange( function () {} );
}
var
backgroundRow
=
new
UI
.
Row
();
var
backgroundColor
=
new
UI
.
Color
().
setValue
(
'
#aaaaaa
'
).
onChange
(
onBackgroundChanged
);
backgroundRow
.
add
(
new
UI
.
Text
(
'
Background
'
).
setWidth
(
'
90px
'
)
);
backgroundRow.add( background );
backgroundRow
.
add
(
background
Color
);
container
.
add
(
backgroundRow
);
*/
// fog
...
...
@@ -191,6 +189,14 @@ Sidebar.Scene = function ( editor ) {
}
console
.
log
(
scene
.
background
);
if
(
scene
.
background
)
{
backgroundColor
.
setHexValue
(
scene
.
background
.
getHex
()
);
}
if
(
scene
.
fog
)
{
fogColor
.
setHexValue
(
scene
.
fog
.
color
.
getHex
()
);
...
...
editor/js/Viewport.js
浏览文件 @
750973be
...
...
@@ -289,8 +289,6 @@ var Viewport = function ( editor ) {
}
);
var
clearColor
;
signals
.
themeChanged
.
add
(
function
(
value
)
{
switch
(
value
)
{
...
...
@@ -299,19 +297,15 @@ var Viewport = function ( editor ) {
sceneHelpers
.
remove
(
grid
);
grid
=
new
THREE
.
GridHelper
(
30
,
60
,
0x444444
,
0x888888
);
sceneHelpers
.
add
(
grid
);
clearColor
=
0xaaaaaa
;
break
;
case
'
css/dark.css
'
:
sceneHelpers
.
remove
(
grid
);
grid
=
new
THREE
.
GridHelper
(
30
,
60
,
0xbbbbbb
,
0x888888
);
sceneHelpers
.
add
(
grid
);
clearColor
=
0x333333
;
break
;
}
renderer
.
setClearColor
(
clearColor
);
render
();
}
);
...
...
@@ -346,7 +340,6 @@ var Viewport = function ( editor ) {
renderer
.
autoClear
=
false
;
renderer
.
autoUpdateScene
=
false
;
renderer
.
setClearColor
(
clearColor
);
renderer
.
setPixelRatio
(
window
.
devicePixelRatio
);
renderer
.
setSize
(
container
.
dom
.
offsetWidth
,
container
.
dom
.
offsetHeight
);
...
...
@@ -490,6 +483,14 @@ var Viewport = function ( editor ) {
// fog
signals
.
sceneBackgroundChanged
.
add
(
function
(
backgroundColor
)
{
scene
.
background
.
setHex
(
backgroundColor
);
render
();
}
);
var
currentFogType
=
null
;
signals
.
sceneFogChanged
.
add
(
function
(
fogType
,
fogColor
,
fogNear
,
fogFar
,
fogDensity
)
{
...
...
@@ -603,14 +604,12 @@ var Viewport = function ( editor ) {
vrControls
.
update
();
camera
.
updateMatrixWorld
();
renderer
.
clear
();
vrEffect
.
render
(
scene
,
vrCamera
);
vrEffect
.
render
(
sceneHelpers
,
vrCamera
);
}
else
{
renderer
.
clear
();
renderer
.
render
(
scene
,
camera
);
if
(
renderer
instanceof
THREE
.
RaytracingRenderer
===
false
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录