Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
1b4a538b
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,发现更多精彩内容 >>
提交
1b4a538b
编写于
7月 23, 2018
作者:
A
artur.trzesiok
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Texture3d support - style fix
上级
80dcd17a
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
60 addition
and
45 deletion
+60
-45
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+8
-6
src/renderers/webgl/WebGLState.js
src/renderers/webgl/WebGLState.js
+9
-8
src/renderers/webgl/WebGLTextures.js
src/renderers/webgl/WebGLTextures.js
+31
-21
src/renderers/webgl/WebGLUniforms.js
src/renderers/webgl/WebGLUniforms.js
+11
-9
src/renderers/webgl/WebGLUtils.js
src/renderers/webgl/WebGLUtils.js
+1
-1
未找到文件。
src/renderers/WebGLRenderer.js
浏览文件 @
1b4a538b
...
...
@@ -2353,13 +2353,15 @@ function WebGLRenderer( parameters ) {
}()
);
this
.
setTexture3D
=
(
function
()
{
// backwards compatibility: peel texture.texture
return
function
setTexture3D
(
texture
,
slot
)
{
textures
.
setTexture3D
(
texture
,
slot
);
this
.
setTexture3D
=
(
function
()
{
};
}()
);
// backwards compatibility: peel texture.texture
return
function
setTexture3D
(
texture
,
slot
)
{
textures
.
setTexture3D
(
texture
,
slot
);
};
}()
);
this
.
setTexture
=
(
function
()
{
...
...
src/renderers/webgl/WebGLState.js
浏览文件 @
1b4a538b
...
...
@@ -844,19 +844,20 @@ function WebGLState( gl, extensions, utils ) {
}
function
texImage3D
()
{
function
texImage3D
()
{
try
{
try
{
gl
.
texImage3D
.
apply
(
gl
,
arguments
);
gl
.
texImage3D
.
apply
(
gl
,
arguments
);
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'
THREE.WebGLState:
'
,
error
);
console
.
error
(
'
THREE.WebGLState:
'
,
error
);
}
}
}
}
//
function
scissor
(
scissor
)
{
...
...
@@ -949,7 +950,7 @@ function WebGLState( gl, extensions, utils ) {
bindTexture
:
bindTexture
,
compressedTexImage2D
:
compressedTexImage2D
,
texImage2D
:
texImage2D
,
texImage3D
:
texImage3D
,
texImage3D
:
texImage3D
,
scissor
:
scissor
,
viewport
:
viewport
,
...
...
src/renderers/webgl/WebGLTextures.js
浏览文件 @
1b4a538b
...
...
@@ -104,13 +104,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
if
(
!
_gl
.
isWebGL2
)
return
glFormat
;
if
(
glFormat
===
_gl
.
RED
)
{
if
(
glFormat
===
_gl
.
RED
)
{
if
(
glType
===
_gl
.
FLOAT
)
return
_gl
.
R32F
;
if
(
glType
===
_gl
.
HALF_FLOAT
)
return
_gl
.
R16F
;
if
(
glType
===
_gl
.
UNSIGNED_BYTE
)
return
_gl
.
R8
;
if
(
glType
===
_gl
.
FLOAT
)
return
_gl
.
R32F
;
if
(
glType
===
_gl
.
HALF_FLOAT
)
return
_gl
.
R16F
;
if
(
glType
===
_gl
.
UNSIGNED_BYTE
)
return
_gl
.
R8
;
}
}
if
(
glFormat
===
_gl
.
RGB
)
{
...
...
@@ -281,21 +281,24 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
}
function
setTexture3D
(
texture
,
slot
)
{
function
setTexture3D
(
texture
,
slot
)
{
var
textureProperties
=
properties
.
get
(
texture
);
var
textureProperties
=
properties
.
get
(
texture
);
if
(
texture
.
version
>
0
&&
textureProperties
.
__version
!==
texture
.
version
)
{
if
(
texture
.
version
>
0
&&
textureProperties
.
__version
!==
texture
.
version
)
{
uploadTexture
(
textureProperties
,
texture
,
slot
);
return
;
}
state
.
activeTexture
(
_gl
.
TEXTURE0
+
slot
);
state
.
bindTexture
(
_gl
.
TEXTURE_3D
,
textureProperties
.
__webglTexture
);
}
}
state
.
activeTexture
(
_gl
.
TEXTURE0
+
slot
);
state
.
bindTexture
(
_gl
.
TEXTURE_3D
,
textureProperties
.
__webglTexture
);
}
function
setTextureCube
(
texture
,
slot
)
{
function
setTextureCube
(
texture
,
slot
)
{
var
textureProperties
=
properties
.
get
(
texture
);
...
...
@@ -483,12 +486,17 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
}
function
uploadTexture
(
textureProperties
,
texture
,
slot
)
{
var
textureType
;
if
(
texture
.
isTexture3D
)
{
textureType
=
_gl
.
TEXTURE_3D
;
}
else
{
textureType
=
_gl
.
TEXTURE_2D
;
if
(
texture
.
isTexture3D
)
{
textureType
=
_gl
.
TEXTURE_3D
;
}
else
{
textureType
=
_gl
.
TEXTURE_2D
;
}
...
...
@@ -640,9 +648,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
textureProperties
.
__maxMipLevel
=
mipmaps
.
length
-
1
;
}
else
if
(
texture
.
isTexture3D
)
{
state
.
texImage3D
(
_gl
.
TEXTURE_3D
,
0
,
glInternalFormat
,
image
.
width
,
image
.
height
,
image
.
length
,
0
,
glFormat
,
glType
,
image
.
data
);
textureProperties
.
__maxMipLevel
=
0
;
}
else
if
(
texture
.
isTexture3D
)
{
state
.
texImage3D
(
_gl
.
TEXTURE_3D
,
0
,
glInternalFormat
,
image
.
width
,
image
.
height
,
image
.
length
,
0
,
glFormat
,
glType
,
image
.
data
);
textureProperties
.
__maxMipLevel
=
0
;
}
else
{
// regular Texture (image, video, canvas)
...
...
@@ -926,7 +936,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
}
this
.
setTexture2D
=
setTexture2D
;
this
.
setTexture3D
=
setTexture3D
;
this
.
setTexture3D
=
setTexture3D
;
this
.
setTextureCube
=
setTextureCube
;
this
.
setTextureCubeDynamic
=
setTextureCubeDynamic
;
this
.
setupRenderTarget
=
setupRenderTarget
;
...
...
src/renderers/webgl/WebGLUniforms.js
浏览文件 @
1b4a538b
...
...
@@ -389,18 +389,20 @@ function setValueT1( gl, v, renderer ) {
}
function
setValueT3D1
(
gl
,
v
,
renderer
)
{
var
cache
=
this
.
cache
;
var
unit
=
renderer
.
allocTextureUnit
();
function
setValueT3D1
(
gl
,
v
,
renderer
)
{
if
(
cache
[
0
]
!==
unit
)
{
var
cache
=
this
.
cache
;
var
unit
=
renderer
.
allocTextureUnit
();
if
(
cache
[
0
]
!==
unit
)
{
gl
.
uniform1i
(
this
.
addr
,
unit
);
cache
[
0
]
=
unit
;
gl
.
uniform1i
(
this
.
addr
,
unit
);
cache
[
0
]
=
unit
;
}
}
renderer
.
setTexture3D
(
v
||
emptyTexture3d
,
unit
);
renderer
.
setTexture3D
(
v
||
emptyTexture3d
,
unit
);
}
function
setValueT6
(
gl
,
v
,
renderer
)
{
...
...
@@ -473,7 +475,7 @@ function getSingularSetter( type ) {
case
0x8b5c
:
return
setValue4fm
;
// _MAT4
case
0x8b5e
:
case
0x8d66
:
return
setValueT1
;
// SAMPLER_2D, SAMPLER_EXTERNAL_OES
case
0x8B5F
:
return
setValueT3D1
;
// SAMPLER_3D
case
0x8B5F
:
return
setValueT3D1
;
// SAMPLER_3D
case
0x8b60
:
return
setValueT6
;
// SAMPLER_CUBE
case
0x1404
:
case
0x8b56
:
return
setValue1i
;
// INT, BOOL
...
...
src/renderers/webgl/WebGLUtils.js
浏览文件 @
1b4a538b
...
...
@@ -51,7 +51,7 @@ function WebGLUtils( gl, extensions ) {
if
(
p
===
LuminanceAlphaFormat
)
return
gl
.
LUMINANCE_ALPHA
;
if
(
p
===
DepthFormat
)
return
gl
.
DEPTH_COMPONENT
;
if
(
p
===
DepthStencilFormat
)
return
gl
.
DEPTH_STENCIL
;
if
(
p
===
RedFormat
)
return
gl
.
RED
;
if
(
p
===
RedFormat
)
return
gl
.
RED
;
if
(
p
===
AddEquation
)
return
gl
.
FUNC_ADD
;
if
(
p
===
SubtractEquation
)
return
gl
.
FUNC_SUBTRACT
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录