Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
ea8a35d5
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,发现更多精彩内容 >>
未验证
提交
ea8a35d5
编写于
11月 08, 2019
作者:
M
Mr.doob
提交者:
GitHub
11月 08, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17887 from dialoguetrainer/exr_loader_rgba
EXRLoader: Fix for Firefox by only returning RGBA textures
上级
3ca156d0
8ed3500b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
46 addition
and
10 deletion
+46
-10
examples/js/loaders/EXRLoader.js
examples/js/loaders/EXRLoader.js
+23
-5
examples/jsm/loaders/EXRLoader.js
examples/jsm/loaders/EXRLoader.js
+23
-5
未找到文件。
examples/js/loaders/EXRLoader.js
浏览文件 @
ea8a35d5
...
@@ -1150,18 +1150,36 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
...
@@ -1150,18 +1150,36 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
var
width
=
EXRHeader
.
dataWindow
.
xMax
-
EXRHeader
.
dataWindow
.
xMin
+
1
;
var
width
=
EXRHeader
.
dataWindow
.
xMax
-
EXRHeader
.
dataWindow
.
xMin
+
1
;
var
height
=
EXRHeader
.
dataWindow
.
yMax
-
EXRHeader
.
dataWindow
.
yMin
+
1
;
var
height
=
EXRHeader
.
dataWindow
.
yMax
-
EXRHeader
.
dataWindow
.
yMin
+
1
;
var
numChannels
=
EXRHeader
.
channels
.
length
;
// Firefox only supports RGBA (half) float textures
// var numChannels = EXRHeader.channels.length;
var
numChannels
=
4
;
var
size
=
width
*
height
*
numChannels
;
// Fill initially with 1s for the alpha value if the texture is not RGBA, RGB values will be overwritten
switch
(
this
.
type
)
{
switch
(
this
.
type
)
{
case
THREE
.
FloatType
:
case
THREE
.
FloatType
:
var
byteArray
=
new
Float32Array
(
width
*
height
*
numChannels
);
var
byteArray
=
new
Float32Array
(
size
);
if
(
EXRHeader
.
channels
.
length
<
numChannels
)
{
byteArray
.
fill
(
1
,
0
,
size
);
}
break
;
break
;
case
THREE
.
HalfFloatType
:
case
THREE
.
HalfFloatType
:
var
byteArray
=
new
Uint16Array
(
width
*
height
*
numChannels
);
var
byteArray
=
new
Uint16Array
(
size
);
if
(
EXRHeader
.
channels
.
length
<
numChannels
)
{
byteArray
.
fill
(
0x3C00
,
0
,
size
);
// Uint16Array holds half float data, 0x3C00 is 1
}
break
;
break
;
default
:
default
:
...
@@ -1232,7 +1250,7 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
...
@@ -1232,7 +1250,7 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
var
tmpBuffer
=
new
Uint16Array
(
tmpBufferSize
);
var
tmpBuffer
=
new
Uint16Array
(
tmpBufferSize
);
var
tmpOffset
=
{
value
:
0
};
var
tmpOffset
=
{
value
:
0
};
decompressPIZ
(
tmpBuffer
,
tmpOffset
,
uInt8Array
,
bufferDataView
,
offset
,
tmpBufferSize
,
numChannels
,
EXRHeader
.
channels
,
width
,
scanlineBlockSize
);
decompressPIZ
(
tmpBuffer
,
tmpOffset
,
uInt8Array
,
bufferDataView
,
offset
,
tmpBufferSize
,
EXRHeader
.
channels
.
length
,
EXRHeader
.
channels
,
width
,
scanlineBlockSize
);
for
(
var
line_y
=
0
;
line_y
<
scanlineBlockSize
;
line_y
++
)
{
for
(
var
line_y
=
0
;
line_y
<
scanlineBlockSize
;
line_y
++
)
{
...
@@ -1359,7 +1377,7 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
...
@@ -1359,7 +1377,7 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
width
:
width
,
width
:
width
,
height
:
height
,
height
:
height
,
data
:
byteArray
,
data
:
byteArray
,
format
:
EXRHeader
.
channels
.
length
==
4
?
THREE
.
RGBAFormat
:
THREE
.
RGBFormat
,
format
:
numChannels
==
4
?
THREE
.
RGBAFormat
:
THREE
.
RGBFormat
,
type
:
this
.
type
type
:
this
.
type
};
};
...
...
examples/jsm/loaders/EXRLoader.js
浏览文件 @
ea8a35d5
...
@@ -1161,18 +1161,36 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
...
@@ -1161,18 +1161,36 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
var
width
=
EXRHeader
.
dataWindow
.
xMax
-
EXRHeader
.
dataWindow
.
xMin
+
1
;
var
width
=
EXRHeader
.
dataWindow
.
xMax
-
EXRHeader
.
dataWindow
.
xMin
+
1
;
var
height
=
EXRHeader
.
dataWindow
.
yMax
-
EXRHeader
.
dataWindow
.
yMin
+
1
;
var
height
=
EXRHeader
.
dataWindow
.
yMax
-
EXRHeader
.
dataWindow
.
yMin
+
1
;
var
numChannels
=
EXRHeader
.
channels
.
length
;
// Firefox only supports RGBA (half) float textures
// var numChannels = EXRHeader.channels.length;
var
numChannels
=
4
;
var
size
=
width
*
height
*
numChannels
;
// Fill initially with 1s for the alpha value if the texture is not RGBA, RGB values will be overwritten
switch
(
this
.
type
)
{
switch
(
this
.
type
)
{
case
FloatType
:
case
FloatType
:
var
byteArray
=
new
Float32Array
(
width
*
height
*
numChannels
);
var
byteArray
=
new
Float32Array
(
size
);
if
(
EXRHeader
.
channels
.
length
<
numChannels
)
{
byteArray
.
fill
(
1
,
0
,
size
);
}
break
;
break
;
case
HalfFloatType
:
case
HalfFloatType
:
var
byteArray
=
new
Uint16Array
(
width
*
height
*
numChannels
);
var
byteArray
=
new
Uint16Array
(
size
);
if
(
EXRHeader
.
channels
.
length
<
numChannels
)
{
byteArray
.
fill
(
0x3C00
,
0
,
size
);
// Uint16Array holds half float data, 0x3C00 is 1
}
break
;
break
;
default
:
default
:
...
@@ -1243,7 +1261,7 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
...
@@ -1243,7 +1261,7 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
var
tmpBuffer
=
new
Uint16Array
(
tmpBufferSize
);
var
tmpBuffer
=
new
Uint16Array
(
tmpBufferSize
);
var
tmpOffset
=
{
value
:
0
};
var
tmpOffset
=
{
value
:
0
};
decompressPIZ
(
tmpBuffer
,
tmpOffset
,
uInt8Array
,
bufferDataView
,
offset
,
tmpBufferSize
,
numChannels
,
EXRHeader
.
channels
,
width
,
scanlineBlockSize
);
decompressPIZ
(
tmpBuffer
,
tmpOffset
,
uInt8Array
,
bufferDataView
,
offset
,
tmpBufferSize
,
EXRHeader
.
channels
.
length
,
EXRHeader
.
channels
,
width
,
scanlineBlockSize
);
for
(
var
line_y
=
0
;
line_y
<
scanlineBlockSize
;
line_y
++
)
{
for
(
var
line_y
=
0
;
line_y
<
scanlineBlockSize
;
line_y
++
)
{
...
@@ -1370,7 +1388,7 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
...
@@ -1370,7 +1388,7 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
width
:
width
,
width
:
width
,
height
:
height
,
height
:
height
,
data
:
byteArray
,
data
:
byteArray
,
format
:
EXRHeader
.
channels
.
length
==
4
?
RGBAFormat
:
RGBFormat
,
format
:
numChannels
==
4
?
RGBAFormat
:
RGBFormat
,
type
:
this
.
type
type
:
this
.
type
};
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录