Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd12f5d9

Browse files
authored
TextureArray Support (#2447)
* Initial work* Fixes + tests + docs* Tweaks* Add texture_array to doctree
1 parentf8755e2 commitd12f5d9

File tree

8 files changed

+993
-2
lines changed

8 files changed

+993
-2
lines changed

‎arcade/gl/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from .bufferimportBuffer
2626
from .vertex_arrayimportGeometry,VertexArray
2727
from .textureimportTexture2D
28+
from .texture_arrayimportTextureArray
2829
from .samplerimportSampler
2930
from .framebufferimportFramebuffer
3031
from .programimportProgram
@@ -43,6 +44,7 @@
4344
"ShaderException",
4445
"VertexArray",
4546
"Texture2D",
47+
"TextureArray",
4648
"Sampler",
4749
"geometry",
4850
]

‎arcade/gl/context.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from .queryimportQuery
3333
from .samplerimportSampler
3434
from .textureimportTexture2D
35+
from .texture_arrayimportTextureArray
3536
from .typesimportBufferDescription,GLenumLike,PyGLenum
3637
from .vertex_arrayimportGeometry
3738

@@ -1069,6 +1070,40 @@ def texture(
10691070
compressed_data=compressed_data,
10701071
)
10711072

1073+
deftexture_array(
1074+
self,
1075+
size:Tuple[int,int,int],
1076+
*,
1077+
components:int=4,
1078+
dtype:str="f1",
1079+
data:BufferProtocol|None=None,
1080+
wrap_x:PyGLenum|None=None,
1081+
wrap_y:PyGLenum|None=None,
1082+
filter:Tuple[PyGLenum,PyGLenum]|None=None,
1083+
)->TextureArray:
1084+
"""
1085+
Create a 2D Texture Array.
1086+
1087+
This is a 2D texture with multiple layers. This is useful for
1088+
storing multiple textures in a single texture object. This can
1089+
be used for texture atlases or storing multiple frames of an
1090+
animation in a single texture or equally sized tile textures.
1091+
1092+
Note that ``size`` is a 3-tuple where the last value is the number of layers.
1093+
1094+
See :py:meth:`~arcade.gl.Context.texture` for arguments.
1095+
"""
1096+
returnTextureArray(
1097+
self,
1098+
size,
1099+
components=components,
1100+
dtype=dtype,
1101+
data=data,
1102+
wrap_x=wrap_x,
1103+
wrap_y=wrap_y,
1104+
filter=filter,
1105+
)
1106+
10721107
defdepth_texture(
10731108
self,size:Tuple[int,int],*,data:BufferProtocol|None=None
10741109
)->Texture2D:

‎arcade/gl/texture.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,8 @@ def write(self, data: BufferOrBufferProtocol, level: int = 0, viewport=None) ->
648648
level:
649649
The texture level to write
650650
viewport:
651-
The area of the texture to write. 2 or 4 component tuple
651+
The area of the texture to write. 2 or 4 component tuple.
652+
(x, y, w, h) or (w, h). Default is the full texture.
652653
"""
653654
# TODO: Support writing to layers using viewport + alignment
654655
ifself._samples>0:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp