Creates an instance of CubeMapTexture. *
Optionalgl: WebGL2RenderingContextThe WebGL2 rendering context. *
OptionaltextureUris: string[]An array of six URIs for the cube map faces in the order: right, left, top, bottom, front, back.
Protected_Protected_The WebGL texture object.
Protected_The height of the texture in pixels.
Protected_A flag to indicate if the texture is currently in a bound state.
Protected_A promise that resolves when the texture is fully loaded.
Protected_Protected_Protected_The width of the texture in pixels.
Protected OptionalglThe WebGL2 rendering context. *
ProtectedimageThe HTML image element that contains the texture data.
ProtectedimagesAn array to hold the HTML image elements for each of the six faces. * *
ProtectedisIndicates whether the image data has been loaded.
ProtectedisIndicates whether the texture is currently in the process of loading.
Flag indicating if this texture is a procedurally generated white fallback cubemap.
The magnification filter.
The minification filter.
OptionaltextureThe URI of the image to load.
OptionaltextureAn array of six URIs for the cube map faces in the order: right, left, top, bottom, front, back.
The texture wrap mode for the S (horizontal) axis.
The texture wrap mode for the T (vertical) axis.
Gets the WebGLTexture object.
Gets the height of the texture.
Checks if the image data has been successfully loaded into the HTMLImageElement.
Gets the width of the texture.
ProtectedallProtectedChecks if all image fetch operations have completed, regardless of success. * *
ProtectedallProtectedChecks if all images have been successfully fetched and loaded. * *
Binds the cubemap texture to the TEXTURE_CUBE_MAP target.
*
*
ProtectedcreateProtectedCreates the WebGLTexture object from the six loaded images. * * *
The WebGL2 rendering context. *
ProtecteddeserializeDestroys the WebGL texture to free up GPU memory.
Populates the texture object from a JSON serializable object.
ProtectedgetReads the pixels from the texture and returns them as a Uint8Array. NOTE: This function requires the texture to be attached to a framebuffer object (FBO). A more complete implementation would handle FBO creation and binding.
The width of the texture to read.
The height of the texture to read.
A Uint8Array containing the pixel data, or null if an error occurred.
Loads all six images from their respective URLs. * *
Re-uploads the texture data to the GPU. This is useful if the underlying image or data has changed.
ProtectedserializeSets the WebGL2 rendering context for the texture.
The WebGL2 rendering context.
Updates the loading status of a single image and triggers the creation of the WebGL texture if all images are loaded. *
The index of the image that has finished loading. *
A boolean indicating if the image loaded successfully. *
Sets the magnification filter for the texture.
The magnification filter to apply.
Sets the minification filter for the texture.
The minification filter to apply.
Sets a sub-region of the texture's pixels.
The x-coordinate of the sub-region to update.
The y-coordinate of the sub-region to update.
The width of the sub-region.
The height of the sub-region.
The pixel data to upload.
Sets the texture filtering and wrapping parameters for the texture. This method applies the values stored in the class properties to the GPU.
Sets the URIs for the six faces of the cubemap texture. *
An array of six URIs. *
Sets the texture wrapping mode for the S axis.
The wrapping mode to apply.
Sets the texture wrapping mode for the T axis.
The wrapping mode to apply.
Converts the texture object to a JSON serializable format.
Unbinds the texture from the TEXTURE_2D target if it is currently bound.
StaticcreateCreates and returns a texture with a specified color and size. This is useful for creating fallback textures or solid colors.
The WebGL2 rendering context.
The width of the texture.
The height of the texture.
Optionalcolor: null | Uint8Array<ArrayBufferLike> = nullAn optional array of color data. If not provided, a single white pixel is used.
A new Texture instance.
StaticcreateCreates a new texture specifically for depth information (e.g., for shadow mapping).
The WebGL2 rendering context.
The width of the texture.
The height of the texture.
A new Texture instance configured as a depth texture.
StaticcreateCreates a 1x1 cubemap texture filled with white pixels for each face. This is useful as a default or fallback cubemap.
The WebGL2 rendering context.
A new CubemapTexture instance containing the white pixels.
A class for managing the loading, creation, and binding of a cubemap texture for use in WebGL.