Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
7b917d71
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 搜索 >>
提交
7b917d71
编写于
2月 03, 2020
作者:
M
Mugen87
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Editor: Add support for equirect HDR textures.
上级
bbf158f9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
44 addition
and
6 deletion
+44
-6
editor/js/Sidebar.Project.js
editor/js/Sidebar.Project.js
+1
-0
editor/js/Sidebar.Scene.js
editor/js/Sidebar.Scene.js
+20
-3
editor/js/Viewport.js
editor/js/Viewport.js
+23
-3
未找到文件。
editor/js/Sidebar.Project.js
浏览文件 @
7b917d71
...
...
@@ -163,6 +163,7 @@ var SidebarProject = function ( editor ) {
currentRenderer
=
new
THREE
.
WebGLRenderer
(
parameters
);
currentPmremGenerator
=
new
THREE
.
PMREMGenerator
(
currentRenderer
);
currentPmremGenerator
.
compileCubemapShader
();
currentPmremGenerator
.
compileEquirectangularShader
();
if
(
shadows
)
{
...
...
editor/js/Sidebar.Scene.js
浏览文件 @
7b917d71
...
...
@@ -119,7 +119,8 @@ var SidebarScene = function ( editor ) {
backgroundType
.
getValue
(),
backgroundColor
.
getHexValue
(),
backgroundTexture
.
getValue
(),
backgroundCubeTexture
.
getValue
()
backgroundCubeTexture
.
getValue
(),
backgroundEquirectTexture
.
getValue
()
);
}
...
...
@@ -148,7 +149,8 @@ var SidebarScene = function ( editor ) {
'
None
'
:
'
None
'
,
'
Color
'
:
'
Color
'
,
'
Texture
'
:
'
Texture
'
,
'
CubeTexture
'
:
'
CubeTexture
'
'
CubeTexture
'
:
'
CubeTexture
'
,
'
Equirect
'
:
'
Equirect (HDR)
'
}
).
setWidth
(
'
150px
'
);
backgroundType
.
onChange
(
function
()
{
...
...
@@ -198,6 +200,17 @@ var SidebarScene = function ( editor ) {
//
var
equirectRow
=
new
UIRow
();
equirectRow
.
setDisplay
(
'
none
'
);
equirectRow
.
setMarginLeft
(
'
90px
'
);
var
backgroundEquirectTexture
=
new
UITexture
().
onChange
(
onTextureChanged
);
equirectRow
.
add
(
backgroundEquirectTexture
);
container
.
add
(
equirectRow
);
//
function
refreshBackgroundUI
()
{
var
type
=
backgroundType
.
getValue
();
...
...
@@ -205,6 +218,7 @@ var SidebarScene = function ( editor ) {
colorRow
.
setDisplay
(
type
===
'
Color
'
?
''
:
'
none
'
);
textureRow
.
setDisplay
(
type
===
'
Texture
'
?
''
:
'
none
'
);
cubeTextureRow
.
setDisplay
(
type
===
'
CubeTexture
'
?
''
:
'
none
'
);
equirectRow
.
setDisplay
(
type
===
'
Equirect
'
?
''
:
'
none
'
);
}
...
...
@@ -312,18 +326,21 @@ var SidebarScene = function ( editor ) {
backgroundColor
.
setHexValue
(
scene
.
background
.
getHex
()
);
backgroundTexture
.
setValue
(
null
);
backgroundCubeTexture
.
setValue
(
null
);
backgroundEquirectTexture
.
setValue
(
null
);
}
else
if
(
scene
.
background
.
isTexture
)
{
}
else
if
(
scene
.
background
.
isTexture
&&
!
scene
.
background
.
isPmremTexture
)
{
backgroundType
.
setValue
(
"
Texture
"
);
backgroundTexture
.
setValue
(
scene
.
background
);
backgroundCubeTexture
.
setValue
(
null
);
backgroundEquirectTexture
.
setValue
(
null
);
}
else
if
(
scene
.
background
.
isCubeTexture
)
{
backgroundType
.
setValue
(
"
CubeTexture
"
);
backgroundCubeTexture
.
setValue
(
scene
.
background
);
backgroundTexture
.
setValue
(
null
);
backgroundEquirectTexture
.
setValue
(
null
);
}
...
...
editor/js/Viewport.js
浏览文件 @
7b917d71
...
...
@@ -475,7 +475,7 @@ var Viewport = function ( editor ) {
var
currentBackgroundType
=
null
;
signals
.
sceneBackgroundChanged
.
add
(
function
(
backgroundType
,
backgroundColor
,
backgroundTexture
,
backgroundCubeTexture
)
{
signals
.
sceneBackgroundChanged
.
add
(
function
(
backgroundType
,
backgroundColor
,
backgroundTexture
,
backgroundCubeTexture
,
backgroundEquirectTexture
)
{
if
(
currentBackgroundType
!==
backgroundType
)
{
...
...
@@ -506,8 +506,11 @@ var Viewport = function ( editor ) {
if
(
backgroundCubeTexture
&&
backgroundCubeTexture
.
isHDRTexture
)
{
scene
.
background
=
pmremGenerator
.
fromCubemap
(
backgroundCubeTexture
).
texture
;
scene
.
environment
=
scene
.
background
;
var
texture
=
pmremGenerator
.
fromCubemap
(
backgroundCubeTexture
).
texture
;
texture
.
isPmremTexture
=
true
;
scene
.
background
=
texture
;
scene
.
environment
=
texture
;
}
else
{
...
...
@@ -516,6 +519,23 @@ var Viewport = function ( editor ) {
}
}
else
if
(
backgroundType
===
'
Equirect
'
)
{
if
(
backgroundEquirectTexture
&&
backgroundEquirectTexture
.
isHDRTexture
)
{
var
texture
=
pmremGenerator
.
fromEquirectangular
(
backgroundEquirectTexture
).
texture
;
texture
.
isPmremTexture
=
true
;
scene
.
background
=
texture
;
scene
.
environment
=
texture
;
}
else
{
scene
.
background
=
null
;
scene
.
environment
=
null
;
}
}
render
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录