Creates a new AbstractTexture instance. Automatically assigns a unique texture UID to this texture.
Protected Optional__Protected__Protected__Protected__Protected__Protected Optional__Protected Optional__Protected Optional__Protected__Protected__Protected__Protected__Protected__Protected__Protected__Protected__Protected Optional__Protected__Optional_Collection of tags associated with this object
The unique identifier for the underlying texture resource
The unique identifier for the texture view used as a render target
The unique identifier for the texture view resource
StaticcurrentCurrent maximum object count for UID generation
Static ReadonlyInvalidInvalid object UID constant
Sets the framebuffer object associated with this render target texture.
The FrameBuffer object to associate with this texture
Gets the framebuffer object associated with this render target texture.
The associated FrameBuffer object, or undefined if not set
Gets the height of the texture in pixels.
The texture height
Sets the height of the texture in pixels.
The new height value
Gets or creates an HTML canvas element with the texture content. If an image element exists, it will be drawn onto the canvas.
The HTML canvas element containing the texture data
Gets the HTML image element associated with this texture.
The HTML image element or undefined if not available
Checks whether this texture is marked as a dummy (placeholder) texture.
True if the texture is marked as dummy, false otherwise
Checks if the texture is ready for use.
True if the texture is ready, false otherwise
Checks if the texture contains transparent pixels.
True if the texture has transparency, false otherwise
Gets the name of the texture.
The texture name
Sets the name of the texture.
The new texture name
Gets the unique object identifier
The object's UID
Checks if the texture has started loading.
True if loading has started, false otherwise
Gets the unique identifier for this texture.
The unique texture UID
Gets the unique name of this object
The unique name string
Gets the URI/URL of the texture source.
The texture URI or undefined if not set
Gets the width of the texture in pixels.
The texture width
Sets the width of the texture in pixels.
The new width value
InternalCopies tag data from another RnObject instance to this object
The source RnObject to copy tags from
Creates and initializes the render target texture with the specified parameters.
Configuration object for the render target texture
Internal format of the texture
Height of the texture in pixels
OptionalmipLevelCount?: numberNumber of mip levels to generate (optional, defaults to full mip chain)
Width of the texture in pixels
Creates an HTMLCanvasElement containing the texture data read from GPU. This is useful for displaying texture previews when htmlImageElement is not available. Works with both WebGL and WebGPU backends.
Promise resolving to an HTMLCanvasElement with the texture content, or undefined if the texture is not ready or reading fails
Creates a cube texture view as a render target for the specified face and mip level. This method is currently not implemented and serves as a placeholder for future functionality.
Creates an internal canvas context for pixel manipulation operations. Uses existing canvas element if available, otherwise creates a new one.
Destroys all 3D API resources associated with this render target texture. This method should be called when the texture is no longer needed to free GPU memory.
True if the resources were successfully destroyed
Downloads the texture pixel data as a PNG image file. This method creates a canvas, draws the texture data to it, and triggers a download of the resulting image.
Generates mipmaps for the render target texture. Mipmaps are pre-calculated, optimized sequences of images that accompany a main texture, intended to increase rendering speed and reduce aliasing artifacts.
Calculates the height of the texture at a specific mip level.
The mip level to calculate height for
The height at the specified mip level (minimum 1 pixel)
Retrieves image data from a rectangular region of the texture. Creates an internal canvas context if one doesn't exist.
The x-coordinate of the top-left corner
The y-coordinate of the top-left corner
The width of the region
The height of the region
ImageData object containing the pixel data
Gets a single pixel value at the specified coordinates as a specific type. Supports various color and vector types for different use cases.
The x-coordinate of the pixel
The y-coordinate of the pixel
The class type to return the pixel as (ColorRgb, ColorRgba, Vector3, etc.)
An instance of the specified type containing the pixel data
Gets the pixel data at the specified coordinates as a raw Uint8ClampedArray. This provides direct access to the RGBA values as 8-bit integers.
The x-coordinate of the pixel
The y-coordinate of the pixel
A Uint8ClampedArray containing the RGBA pixel data
Gets the pixel value at the specified coordinates. The coordinate system has its origin at the bottom-left corner.
Horizontal pixel position (0 is left edge)
Vertical pixel position (0 is bottom edge)
OptionalargByteArray: Uint8Array<ArrayBufferLike>Optional pre-fetched pixel data array to avoid redundant GPU reads
A promise that resolves to a Vector4 containing the RGBA pixel values (0-255)
Retrieves a complete tag object (name and value) for the specified tag name
The name of the tag to retrieve
A Tag object containing the name and value
Retrieves the value associated with a specific tag name
The name of the tag whose value to retrieve
The tag value, or undefined if the tag doesn't exist
Converts the texture data to a TextureDataFloat object with the specified number of channels. This is useful for processing texture data in floating-point format.
The number of channels to include in the output (1-4)
A TextureDataFloat object containing the converted pixel data
Retrieves the pixel data from the render target texture. This operation reads back the texture data from GPU memory to CPU memory.
A promise that resolves to a Uint8Array containing the pixel data
Reads the texture data from GPU and returns it as a Uint8Array. This method works with both WebGL and WebGPU backends. Useful for textures that don't have an associated htmlImageElement (e.g., dummy textures).
Promise resolving to the pixel data as a Uint8Array in RGBA format, or undefined if the texture is not ready or reading fails
Calculates the width of the texture at a specific mip level.
The mip level to calculate width for
The width at the specified mip level (minimum 1 pixel)
Checks whether this object has a tag with the specified name
The name of the tag to check for
True if the tag exists (value is not null/undefined), false otherwise
Marks this texture as a dummy (placeholder) texture.
Whether to mark the texture as dummy (default: true)
Checks if this object has a tag with the specified name and value
The tag name to match
The tag value to match
True if the object has a matching tag, false otherwise
Checks if this object has all the specified tags with exactly matching values
Object containing tag names as keys and expected values
True if all specified tags exist with matching values, false otherwise
Checks if the object's combined tag string contains all the provided search strings. This allows for flexible searching within tag names and values.
Array of strings that must all be present in the combined tag string
True if all strings are found in the combined tag string, false otherwise
Removes a tag from this object
The name of the tag to remove
Resizes the render target texture to the specified dimensions. This operation destroys the existing resources and creates new ones.
New width in pixels
New height in pixels
Sets a pixel value at the specified coordinates using a color or vector object. Automatically determines the number of components based on the input type.
The x-coordinate of the pixel
The y-coordinate of the pixel
The color or vector value to set
Sets a specific channel value for a pixel at the given coordinates. Useful for modifying individual color channels (R, G, B, A).
The x-coordinate of the pixel
The y-coordinate of the pixel
The channel index (0=R, 1=G, 2=B, 3=A)
The new value for the channel (0-255)
Attempts to set a tag on this object. If the tag already exists, it will be replaced.
The tag object containing the name and value to set
True if the tag was successfully set, false if the tag name contains invalid characters
Attempts to set a unique name for this object
The desired unique name
If true, appends UID to make name unique when conflicts occur; if false, fails on conflict
True if the name was successfully set, false if there was a conflict and toAddNameIfConflict was false
Unregisters this object from all tracking collections. Should be called when the object is being destroyed.
Validates that a tag string contains only allowed characters (alphanumeric and underscore)
The string to validate
True if the string contains only valid characters, false if it contains invalid characters
Static_InternalResets all static object tracking data. Used primarily for testing.
StaticgetRetrieves an RnObject instance by its unique identifier
The unique identifier of the object to retrieve
The RnObject instance or undefined if not found or garbage collected
StaticgetRetrieves an RnObject instance by its unique name
The unique name of the object to retrieve
The RnObject instance or undefined if not found or garbage collected
StaticsearchSearches for the first object that has a specific tag with the given value
The tag name to search for
The tag value to match
WeakRef to the first matching object, or undefined if not found
A texture that can be used as a render target for off-screen rendering. This class extends AbstractTexture and implements IRenderable to provide functionality for rendering to texture, which is commonly used for post-processing effects, shadow mapping, and other advanced rendering techniques.