Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
c1ff8fcb
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,发现更多精彩内容 >>
提交
c1ff8fcb
编写于
3月 29, 2018
作者:
T
Takahiro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update internalFormat for WebGL2.0
上级
f02117fe
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
20 addition
and
20 deletion
+20
-20
src/renderers/webgl/WebGLTextures.js
src/renderers/webgl/WebGLTextures.js
+20
-20
未找到文件。
src/renderers/webgl/WebGLTextures.js
浏览文件 @
c1ff8fcb
...
...
@@ -302,7 +302,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
var
image
=
cubeImage
[
0
],
isPowerOfTwoImage
=
isPowerOfTwo
(
image
),
glFormat
=
utils
.
convert
(
texture
.
format
),
glType
=
utils
.
convert
(
texture
.
type
);
glType
=
utils
.
convert
(
texture
.
type
),
glInternalFormat
=
getInternalFormat
(
glFormat
,
glType
);
setTextureParameters
(
_gl
.
TEXTURE_CUBE_MAP
,
texture
,
isPowerOfTwoImage
);
...
...
@@ -312,11 +313,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
if
(
isDataTexture
)
{
state
.
texImage2D
(
_gl
.
TEXTURE_CUBE_MAP_POSITIVE_X
+
i
,
0
,
glFormat
,
cubeImage
[
i
].
width
,
cubeImage
[
i
].
height
,
0
,
glFormat
,
glType
,
cubeImage
[
i
].
data
);
state
.
texImage2D
(
_gl
.
TEXTURE_CUBE_MAP_POSITIVE_X
+
i
,
0
,
gl
Internal
Format
,
cubeImage
[
i
].
width
,
cubeImage
[
i
].
height
,
0
,
glFormat
,
glType
,
cubeImage
[
i
].
data
);
}
else
{
state
.
texImage2D
(
_gl
.
TEXTURE_CUBE_MAP_POSITIVE_X
+
i
,
0
,
glFormat
,
glFormat
,
glType
,
cubeImage
[
i
]
);
state
.
texImage2D
(
_gl
.
TEXTURE_CUBE_MAP_POSITIVE_X
+
i
,
0
,
gl
Internal
Format
,
glFormat
,
glType
,
cubeImage
[
i
]
);
}
...
...
@@ -332,7 +333,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
if
(
state
.
getCompressedTextureFormats
().
indexOf
(
glFormat
)
>
-
1
)
{
state
.
compressedTexImage2D
(
_gl
.
TEXTURE_CUBE_MAP_POSITIVE_X
+
i
,
j
,
glFormat
,
mipmap
.
width
,
mipmap
.
height
,
0
,
mipmap
.
data
);
state
.
compressedTexImage2D
(
_gl
.
TEXTURE_CUBE_MAP_POSITIVE_X
+
i
,
j
,
gl
Internal
Format
,
mipmap
.
width
,
mipmap
.
height
,
0
,
mipmap
.
data
);
}
else
{
...
...
@@ -342,7 +343,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
}
else
{
state
.
texImage2D
(
_gl
.
TEXTURE_CUBE_MAP_POSITIVE_X
+
i
,
j
,
glFormat
,
mipmap
.
width
,
mipmap
.
height
,
0
,
glFormat
,
glType
,
mipmap
.
data
);
state
.
texImage2D
(
_gl
.
TEXTURE_CUBE_MAP_POSITIVE_X
+
i
,
j
,
gl
Internal
Format
,
mipmap
.
width
,
mipmap
.
height
,
0
,
glFormat
,
glType
,
mipmap
.
data
);
}
...
...
@@ -474,9 +475,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
var
isPowerOfTwoImage
=
isPowerOfTwo
(
image
),
glFormat
=
utils
.
convert
(
texture
.
format
),
glType
=
utils
.
convert
(
texture
.
type
);
var
internalFormat
=
getInternalFormat
(
glFormat
,
glType
);
glType
=
utils
.
convert
(
texture
.
type
),
glInternalFormat
=
getInternalFormat
(
glFormat
,
glType
);
setTextureParameters
(
_gl
.
TEXTURE_2D
,
texture
,
isPowerOfTwoImage
);
...
...
@@ -486,21 +486,21 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
// populate depth texture with dummy data
i
nternalFormat
=
_gl
.
DEPTH_COMPONENT
;
glI
nternalFormat
=
_gl
.
DEPTH_COMPONENT
;
if
(
texture
.
type
===
FloatType
)
{
if
(
!
_isWebGL2
)
throw
new
Error
(
'
Float Depth Texture only supported in WebGL2.0
'
);
i
nternalFormat
=
_gl
.
DEPTH_COMPONENT32F
;
glI
nternalFormat
=
_gl
.
DEPTH_COMPONENT32F
;
}
else
if
(
_isWebGL2
)
{
// WebGL 2.0 requires signed internalformat for glTexImage2D
i
nternalFormat
=
_gl
.
DEPTH_COMPONENT16
;
glI
nternalFormat
=
_gl
.
DEPTH_COMPONENT16
;
}
if
(
texture
.
format
===
DepthFormat
&&
i
nternalFormat
===
_gl
.
DEPTH_COMPONENT
)
{
if
(
texture
.
format
===
DepthFormat
&&
glI
nternalFormat
===
_gl
.
DEPTH_COMPONENT
)
{
// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
// DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
...
...
@@ -520,7 +520,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
// (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
if
(
texture
.
format
===
DepthStencilFormat
)
{
i
nternalFormat
=
_gl
.
DEPTH_STENCIL
;
glI
nternalFormat
=
_gl
.
DEPTH_STENCIL
;
// The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
// DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.
...
...
@@ -536,7 +536,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
}
state
.
texImage2D
(
_gl
.
TEXTURE_2D
,
0
,
i
nternalFormat
,
image
.
width
,
image
.
height
,
0
,
glFormat
,
glType
,
null
);
state
.
texImage2D
(
_gl
.
TEXTURE_2D
,
0
,
glI
nternalFormat
,
image
.
width
,
image
.
height
,
0
,
glFormat
,
glType
,
null
);
}
else
if
(
texture
.
isDataTexture
)
{
...
...
@@ -549,7 +549,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
for
(
var
i
=
0
,
il
=
mipmaps
.
length
;
i
<
il
;
i
++
)
{
mipmap
=
mipmaps
[
i
];
state
.
texImage2D
(
_gl
.
TEXTURE_2D
,
i
,
i
nternalFormat
,
mipmap
.
width
,
mipmap
.
height
,
0
,
glFormat
,
glType
,
mipmap
.
data
);
state
.
texImage2D
(
_gl
.
TEXTURE_2D
,
i
,
glI
nternalFormat
,
mipmap
.
width
,
mipmap
.
height
,
0
,
glFormat
,
glType
,
mipmap
.
data
);
}
...
...
@@ -558,7 +558,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
}
else
{
state
.
texImage2D
(
_gl
.
TEXTURE_2D
,
0
,
i
nternalFormat
,
image
.
width
,
image
.
height
,
0
,
glFormat
,
glType
,
image
.
data
);
state
.
texImage2D
(
_gl
.
TEXTURE_2D
,
0
,
glI
nternalFormat
,
image
.
width
,
image
.
height
,
0
,
glFormat
,
glType
,
image
.
data
);
textureProperties
.
__maxMipLevel
=
0
;
}
...
...
@@ -573,7 +573,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
if
(
state
.
getCompressedTextureFormats
().
indexOf
(
glFormat
)
>
-
1
)
{
state
.
compressedTexImage2D
(
_gl
.
TEXTURE_2D
,
i
,
i
nternalFormat
,
mipmap
.
width
,
mipmap
.
height
,
0
,
mipmap
.
data
);
state
.
compressedTexImage2D
(
_gl
.
TEXTURE_2D
,
i
,
glI
nternalFormat
,
mipmap
.
width
,
mipmap
.
height
,
0
,
mipmap
.
data
);
}
else
{
...
...
@@ -583,7 +583,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
}
else
{
state
.
texImage2D
(
_gl
.
TEXTURE_2D
,
i
,
i
nternalFormat
,
mipmap
.
width
,
mipmap
.
height
,
0
,
glFormat
,
glType
,
mipmap
.
data
);
state
.
texImage2D
(
_gl
.
TEXTURE_2D
,
i
,
glI
nternalFormat
,
mipmap
.
width
,
mipmap
.
height
,
0
,
glFormat
,
glType
,
mipmap
.
data
);
}
...
...
@@ -604,7 +604,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
for
(
var
i
=
0
,
il
=
mipmaps
.
length
;
i
<
il
;
i
++
)
{
mipmap
=
mipmaps
[
i
];
state
.
texImage2D
(
_gl
.
TEXTURE_2D
,
i
,
i
nternalFormat
,
glFormat
,
glType
,
mipmap
);
state
.
texImage2D
(
_gl
.
TEXTURE_2D
,
i
,
glI
nternalFormat
,
glFormat
,
glType
,
mipmap
);
}
...
...
@@ -613,7 +613,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
}
else
{
state
.
texImage2D
(
_gl
.
TEXTURE_2D
,
0
,
i
nternalFormat
,
glFormat
,
glType
,
image
);
state
.
texImage2D
(
_gl
.
TEXTURE_2D
,
0
,
glI
nternalFormat
,
glFormat
,
glType
,
image
);
textureProperties
.
__maxMipLevel
=
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录