Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
2752ab4c
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,发现更多精彩内容 >>
提交
2752ab4c
编写于
3月 04, 2019
作者:
T
Takahiro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add DataTexture2DArray
上级
a9e6a124
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
93 addition
and
3 deletion
+93
-3
rollup.config.js
rollup.config.js
+1
-0
src/Three.js
src/Three.js
+1
-0
src/renderers/WebGLRenderer.js
src/renderers/WebGLRenderer.js
+6
-0
src/renderers/webgl/WebGLTextures.js
src/renderers/webgl/WebGLTextures.js
+28
-3
src/renderers/webgl/WebGLUniforms.js
src/renderers/webgl/WebGLUniforms.js
+17
-0
src/textures/DataTexture2DArray.d.ts
src/textures/DataTexture2DArray.d.ts
+12
-0
src/textures/DataTexture2DArray.js
src/textures/DataTexture2DArray.js
+28
-0
未找到文件。
rollup.config.js
浏览文件 @
2752ab4c
...
...
@@ -117,6 +117,7 @@ function glconstants() {
ACTIVE_ATTRIBUTES
:
35721
,
IMPLEMENTATION_COLOR_READ_TYPE
:
35738
,
IMPLEMENTATION_COLOR_READ_FORMAT
:
35739
,
TEXTURE_2D_ARRAY
:
35866
,
DEPTH_COMPONENT32F
:
36012
,
COLOR_ATTACHMENT0
:
36064
,
FRAMEBUFFER_COMPLETE
:
36053
,
...
...
src/Three.js
浏览文件 @
2752ab4c
...
...
@@ -24,6 +24,7 @@ export { Points } from './objects/Points.js';
export
{
Group
}
from
'
./objects/Group.js
'
;
export
{
VideoTexture
}
from
'
./textures/VideoTexture.js
'
;
export
{
DataTexture
}
from
'
./textures/DataTexture.js
'
;
export
{
DataTexture2DArray
}
from
'
./textures/DataTexture2DArray.js
'
;
export
{
DataTexture3D
}
from
'
./textures/DataTexture3D.js
'
;
export
{
CompressedTexture
}
from
'
./textures/CompressedTexture.js
'
;
export
{
CubeTexture
}
from
'
./textures/CubeTexture.js
'
;
...
...
src/renderers/WebGLRenderer.js
浏览文件 @
2752ab4c
...
...
@@ -2462,6 +2462,12 @@ function WebGLRenderer( parameters ) {
}()
);
this
.
setTexture2DArray
=
function
(
texture
,
slot
)
{
textures
.
setTexture2DArray
(
texture
,
slot
);
};
this
.
setTexture3D
=
(
function
()
{
// backwards compatibility: peel texture.texture
...
...
src/renderers/webgl/WebGLTextures.js
浏览文件 @
2752ab4c
...
...
@@ -297,6 +297,22 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
}
function
setTexture2DArray
(
texture
,
slot
)
{
var
textureProperties
=
properties
.
get
(
texture
);
if
(
texture
.
version
>
0
&&
textureProperties
.
__version
!==
texture
.
version
)
{
uploadTexture
(
textureProperties
,
texture
,
slot
);
return
;
}
state
.
activeTexture
(
_gl
.
TEXTURE0
+
slot
);
state
.
bindTexture
(
_gl
.
TEXTURE_2D_ARRAY
,
textureProperties
.
__webglTexture
);
}
function
setTexture3D
(
texture
,
slot
)
{
var
textureProperties
=
properties
.
get
(
texture
);
...
...
@@ -449,7 +465,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
_gl
.
texParameteri
(
textureType
,
_gl
.
TEXTURE_WRAP_S
,
utils
.
convert
(
texture
.
wrapS
)
);
_gl
.
texParameteri
(
textureType
,
_gl
.
TEXTURE_WRAP_T
,
utils
.
convert
(
texture
.
wrapT
)
);
if
(
textureType
===
_gl
.
TEXTURE_3D
)
{
if
(
textureType
===
_gl
.
TEXTURE_3D
||
textureType
===
_gl
.
TEXTURE_2D_ARRAY
)
{
_gl
.
texParameteri
(
textureType
,
_gl
.
TEXTURE_WRAP_R
,
utils
.
convert
(
texture
.
wrapR
)
);
...
...
@@ -463,7 +479,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
_gl
.
texParameteri
(
textureType
,
_gl
.
TEXTURE_WRAP_S
,
_gl
.
CLAMP_TO_EDGE
);
_gl
.
texParameteri
(
textureType
,
_gl
.
TEXTURE_WRAP_T
,
_gl
.
CLAMP_TO_EDGE
);
if
(
textureType
===
_gl
.
TEXTURE_3D
)
{
if
(
textureType
===
_gl
.
TEXTURE_3D
||
textureType
===
_gl
.
TEXTURE_2D_ARRAY
)
{
_gl
.
texParameteri
(
textureType
,
_gl
.
TEXTURE_WRAP_R
,
_gl
.
CLAMP_TO_EDGE
);
...
...
@@ -522,7 +538,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
function
uploadTexture
(
textureProperties
,
texture
,
slot
)
{
var
textureType
=
(
texture
.
isDataTexture3D
)
?
_gl
.
TEXTURE_3D
:
_gl
.
TEXTURE_2D
;
var
textureType
=
_gl
.
TEXTURE_2D
;
if
(
texture
.
isDataTexture2DArray
)
textureType
=
_gl
.
TEXTURE_2D_ARRAY
;
if
(
texture
.
isDataTexture3D
)
textureType
=
_gl
.
TEXTURE_3D
;
initTexture
(
textureProperties
,
texture
);
...
...
@@ -654,6 +673,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
textureProperties
.
__maxMipLevel
=
mipmaps
.
length
-
1
;
}
else
if
(
texture
.
isDataTexture2DArray
)
{
state
.
texImage3D
(
_gl
.
TEXTURE_2D_ARRAY
,
0
,
glInternalFormat
,
image
.
width
,
image
.
height
,
image
.
depth
,
0
,
glFormat
,
glType
,
image
.
data
);
textureProperties
.
__maxMipLevel
=
0
;
}
else
if
(
texture
.
isDataTexture3D
)
{
state
.
texImage3D
(
_gl
.
TEXTURE_3D
,
0
,
glInternalFormat
,
image
.
width
,
image
.
height
,
image
.
depth
,
0
,
glFormat
,
glType
,
image
.
data
);
...
...
@@ -1052,6 +1076,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
}
this
.
setTexture2D
=
setTexture2D
;
this
.
setTexture2DArray
=
setTexture2DArray
;
this
.
setTexture3D
=
setTexture3D
;
this
.
setTextureCube
=
setTextureCube
;
this
.
setTextureCubeDynamic
=
setTextureCubeDynamic
;
...
...
src/renderers/webgl/WebGLUniforms.js
浏览文件 @
2752ab4c
...
...
@@ -390,6 +390,22 @@ function setValueT1( gl, v, renderer ) {
}
function
setValueT2DArray1
(
gl
,
v
,
renderer
)
{
var
cache
=
this
.
cache
;
var
unit
=
renderer
.
allocTextureUnit
();
if
(
cache
[
0
]
!==
unit
)
{
gl
.
uniform1i
(
this
.
addr
,
unit
);
cache
[
0
]
=
unit
;
}
renderer
.
setTexture2DArray
(
v
||
emptyTexture2dArray
,
unit
);
}
function
setValueT3D1
(
gl
,
v
,
renderer
)
{
var
cache
=
this
.
cache
;
...
...
@@ -478,6 +494,7 @@ function getSingularSetter( type ) {
case
0x8b5e
:
case
0x8d66
:
return
setValueT1
;
// SAMPLER_2D, SAMPLER_EXTERNAL_OES
case
0x8B5F
:
return
setValueT3D1
;
// SAMPLER_3D
case
0x8b60
:
return
setValueT6
;
// SAMPLER_CUBE
case
0x8DC1
:
return
setValueT2DArray1
;
// SAMPLER_2D_ARRAY
case
0x1404
:
case
0x8b56
:
return
setValue1i
;
// INT, BOOL
case
0x8b53
:
case
0x8b57
:
return
setValue2iv
;
// _VEC2
...
...
src/textures/DataTexture2DArray.d.ts
0 → 100644
浏览文件 @
2752ab4c
import
{
Texture
}
from
'
./Texture
'
;
import
{
NearestFilter
}
from
'
../constants
'
;
import
{
TypedArray
}
from
'
../polyfills
'
;
export
class
DataTexture2DArray
extends
Texture
{
constructor
(
data
:
ArrayBuffer
|
TypedArray
,
width
:
number
,
height
:
number
,
depth
:
number
);
}
src/textures/DataTexture2DArray.js
0 → 100644
浏览文件 @
2752ab4c
/**
* @author Takahiro https://github.com/takahirox
*/
import
{
Texture
}
from
'
./Texture.js
'
;
import
{
ClampToEdgeWrapping
,
NearestFilter
}
from
'
../constants.js
'
;
function
DataTexture2DArray
(
data
,
width
,
height
,
depth
)
{
Texture
.
call
(
this
,
null
);
this
.
image
=
{
data
:
data
,
width
:
width
,
height
:
height
,
depth
:
depth
};
this
.
magFilter
=
NearestFilter
;
this
.
minFilter
=
NearestFilter
;
this
.
wrapR
=
ClampToEdgeWrapping
;
this
.
generateMipmaps
=
false
;
this
.
flipY
=
false
;
}
DataTexture2DArray
.
prototype
=
Object
.
create
(
Texture
.
prototype
);
DataTexture2DArray
.
prototype
.
constructor
=
DataTexture2DArray
;
DataTexture2DArray
.
prototype
.
isDataTexture2DArray
=
true
;
export
{
DataTexture2DArray
};
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录