Object constructor, requires a context and a valid identifier.
Valid context to create the object for.
Meaningful name for identification of this instance.
For tracking approximate use of GPU storage in bytes per face.
Number of references to this object. If at least a single reference was counted, this object can neither be initialized (and thus created) nor uninitialized (and thus deleted). The reference count is controlled via ref() and unref() functions.
Asserts the objects initialization status to be true. Note that the implementation is cached and forwarded to either an empty function when initialized and to an acutal assert(false) otherwise.
Asserts the objects initialization status to be false. Note that the implementation is cached and forwarded to either an empty function when uninitialized and to an acutal assert(false) otherwise.
Default texture, e.g., used for unbind.
Returns the number of bytes this object approximately allocates on the GPU. The size will be zero when no image data was passed to the texture object.
Read-only access to the objects context, used to get context information and WebGL API access.
Cached format of the data provided to the texture object for efficient resize. This is set on initialization and might change on data transfers.
Every GPU asset that allocates memory should provide a human readable identifier for GPU allocation tracking and debugging purposes. Please note that the identifier might changed on initialization due to the generation and assignment of a unique identifier.
Property getter for readonly access to the initialization status of an initializable instance.
Cached internal format of the texture for efficient resize. This can only be changed by re-initialization.
Read-only access to the WebGL object handle.
The width/height of the texture object (each cube map face is required to be a square).
Cached type of the data provided to the texture used for efficient resize. This is set on initialization and might change on data transfers.
Cached object status used to derive validity when initialized.
Bind the texture object to a texture unit.
This function returns how big a specific mip level for this cubemap hast to be.
The level for which the size should be determined
Create a texture object on the GPU.
Initial size (width/height) of each face, which are required to be a square texture.
Internal format of the texture object.
Format of the texture data even though no data is passed.
Data type of the texel data.
Crops the contents of an image and returns a ImageData element of the resulting image. Offsets and sizes of the cropping range need to be supplied. The resulting image data will have the same height and width as the crop size.
Pass data of six images to the texture cube object.
Per face texel data that will be copied into the objects data store. Either provided via object or as tuple, providing the data associated to the targeted face (as GLenum).
Allows to skip binding the texture (e.g., when binding is handled outside).
Allows to skip unbinding the texture (e.g., when binding is handled outside).
Delete the texture object on the GPU. This should have the reverse effect of create
.
Loads one mip map level from a texture atlas in which all mipmap levels of a cubemap are stored. The format is assumed to be NX, PZ, PX, NZ in the top row and PY, NY in the bottom row. The bottom right quarter is assumed to be the next lower mipmap level. This repeats until the highest mipmap level is reached.
Source texture atlas.
Level to load.
Provides an ID for each of the six texture cube identifier (0: +x, 1: -x, 2: +y, 3: -y, 4: +z, 5: -z).
Texture cube face identifier, e.g., TEXTURE_CUBE_MAP_POSITIVE_X
.
Asynchronous load of multiple images (specified per texture cube face) via URI or data URI. Please note that the texture will not be resized and is assumed to be resized upfront accordingly.
URI linking the image that should be loaded for a specific face. Data URI is also supported.
Enable cross origin data loading.
Asynchronously loads a cubemap and its mipmap levels from a single texture atlas. The format is assumed to be NX, PZ, PX, NZ in the top row and PY, NY in the bottom row. The bottom right quarter is assumed to be the next lower mipmap level. This repeats until the highest mipmap level is reached.
URI linking the texture atlas that should be loaded.
Enable cross origin data loading.
Sets the texture object's magnification and minification filter.
Value for the TEXTURE_MAG_FILTER parameter.
Value for the TEXTURE_MIN_FILTER parameter.
Allows to skip binding the texture (e.g., when binding is handled outside).
Allows to skip unbinding the texture (e.g., when binding is handled outside).
Set the textures base and max level for mip mapping. This needs to be used when mip levels are uploaded manually to specifiy how many mip levels exist.
The level with the maximal resolution, usually this will be 0.
The level with the minimal resolution.
Allows to skip binding the texture (e.g., when binding is handled outside).
Allows to skip unbinding the texture (e.g., when binding is handled outside).
Increment the reference count of this object.
This can be used to reformat the texture image without creating a new texture object. Please note that this resets the texture's image data to undefined. @see data for setting new image data.
Internal format of the texture object.
Format of the texture data even though no data is passed.
Data type of the texel data.
Allows to skip binding the texture (e.g., when binding is handled outside).
Allows to skip unbinding the texture (e.g., when binding is handled outside).
This should be used to efficiently resize the texture.
Targeted/new size (width/height) of the texture in px.
Allows to skip binding the texture (e.g., when binding is handled outside).
Allows to skip unbinding the texture (e.g., when binding is handled outside).
Unbind the texture object from a texture unit.
Decrement the reference count of this object.
Sets the texture object's wrapping function for s and t coordinates.
Value for the TEXTURE_WRAP_S parameter.
Value for the TEXTURE_WRAP_T parameter.
Allows to skip binding the texture (e.g., when binding is handled outside).
Allows to skip unbinding the texture (e.g., when binding is handled outside).
Method decorator for asserting the initialization status of an initializable to be true.
Method decorator for asserting the initialization status of an initializable to be false.
Method decorator for discarding of Initializable inheritors. This decorator asserts the initialization
status of the instance that is to be discarded, invokes its uninitialization, and falsifies the
initialization status. In order to encourage the use of assertInitialized
and assertUninitialized
they are
dynamically bound to a static, always-failing assert and an empty/undefined function respectively.
Method decorator for initialization of Initializable inheritors. This decorator asserts the initialization status
of the instance that is to be initialized, invokes its initialization with arbitrary number of parameters,
and sets the initialization status to the initialization success (either false or true).
In order to encourage the use of assertInitialized
and assertUninitialized
they are dynamically
bound to either a static, always-failing assert or an empty/undefined function.
Method decorator for uninitialization of Initializable inheritors. This decorator asserts the initialization
status of the instance that is to be uninitialized, invokes its uninitialization, and falsifies the
initialization status. In order to encourage the use of assertInitialized
and assertUninitialized
they are
dynamically bound to a static, always-failing assert and an empty/undefined function respectively.
Wrapper for an WebGL cube texture providing size accessors and requiring for bind, unbind, resize, validity, and initialization implementations. The texture cube object is created on initialization and deleted on uninitialization. After being initialized, the texture cube can be resized, reformated, and data can set directly or via fetch:
Please note that each of the six textures of a texture cube is required to be of the exact same, square dimensions. This is reflected within this classes interface by providing a single size property in favor to width and height.