This represents the smallest workload to use an already existing element (Canvas or Video) as a texture. To be as efficient as possible depending on your constraints nothing aside the first upload is automatically managed. It is a cheap VideoTexture or DynamicTexture if you prefer to keep full control of the elements in your application.
As the update is not automatic, you need to call them manually.
Instantiates a HtmlElementTexture from the following parameters.
Defines the name of the texture
Defines the video or canvas the texture is filled with
Defines the other none mandatory texture creation options
Define the list of animation attached to the texture.
With compliant hardware and browser (supporting anisotropic filtering) this defines the level of anisotropic filtering in the texture. The higher the better but the slower. This defaults to 4 as it seems to be the best tradeoff.
Get if the texture can rescale.
Define the UV chanel to use starting from 0 and defaulting to 0. This is part of the texture as textures usually maps to one uv set.
How a texture is mapped.
Define the current state of the loading sequence when in delayed load mode.
The texture URL.
Define if the texture contains data in gamma space (most of the png/jpg aside bump). HDR texture are usually stored in linear space. This only impacts the PBR and Background materials
Defines if the alpha value should be determined via the rgb values. If true the luminance of the pixel might be used to find the corresponding alpha value.
Define if the texture is having a usable alpha value (can be use for transparency or glossiness for instance).
Is Z inverted in the texture (useful in a cube texture).
In case a better definition than spherical harmonics is required for the diffuse part of the environment. You can set the irradiance texture to rely on a texture instead of the spherical approach. This texture need to have the same characteristics than its parent (Cube vs 2d, coordinates mode, Gamma/Linear, RGBD).
Define if the texture is a 2d array texture (webgl 2) or if false a 2d texture.
Define if the texture is a 3d texture (webgl 2) or if false a 2d texture.
Define if the texture is preventinga material to render or not. If not and the texture is not ready, the engine will use a default black texture instead.
Define if the texture is a cube texture or if false a 2d texture.
Gets or sets whether or not the texture contains RGBD data.
Define if the texture is a render target.
Intensity or strength of the texture. It is commonly used by materials to fine tune the intensity of the texture
With prefiltered texture, defined if the specular generation is based on a linear ramp. By default we are using a log2 of the linear roughness helping to keep a better resolution for average roughness values.
With prefiltered texture, defined the offset used during the prefiltering steps.
With prefiltered texture, defined the scale used during the prefiltering steps.
Gets or sets an object used to store user defined information.
Define the name of the texture.
Are mip maps generated for this texture or not.
Callback triggered when the texture has been disposed. Kept for back compatibility, you can use the onDisposeObservable instead.
An event triggered when the texture is disposed.
For internal use only. Please do not use.
Get the polynomial representation of the texture data. This is mainly use as a fast way to recover IBL Diffuse irradiance data.
Get the texture underlying format (RGB, RGBA...)
Get the texture underlying type (INT, FLOAT...)
Define the unique id of the texture in the scene.
Gets or sets the unique id of the texture
Default anisotropic filtering level for the application. It is set to 4 as a good tradeoff between perf and quality.
Triggers the load sequence in delayed load mode.
Dispose the texture and release its associated resources.
Get the base size of the texture. It can be different from the size if the texture has been resized for POT for instance
the base size
Get the class name of the texture.
Get the texture reflection matrix used to rotate/transform the reflection.
the reflection matrix
Get the size of the texture.
the texture size.
Returns the texture matrix used in most of the material.
Get if the texture is ready to be used (downloaded, converted, mip mapped...).
true if fully ready
Get if the texture is ready to be consumed (either it is ready or it is not blocking)
true if ready or not blocking
Reads the pixels stored in the webgl texture and returns them as an ArrayBuffer. This will returns an RGBA array buffer containing either in values (0-255) or float values (0-1) depending of the underlying buffer type.
defines the face of the texture to read (in case of cube texture)
defines the LOD level of the texture to read (in case of Mip Maps)
defines a user defined buffer to fill with data (can be null)
The Array buffer containing the pixels data.
Release and destroy the underlying lower level texture aka internalTexture.
Scales the texture if is
the resize factor we want to use to rescale
Serialize the texture into a JSON representation that can be parsed later on.
the JSON representation of the texture
Return a string representation of the texture.
the texture as a string
Updates the content of the texture.
Defines wether the texture should be inverted on Y (false by default on video and true on canvas)
Update the sampling mode of the texture. Default is Trilinear mode.
|1||NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR||Nearest is: mag = nearest, min = nearest, mip = linear|
|2||BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST||Bilinear is: mag = linear, min = linear, mip = nearest|
|3||TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR||Trilinear is: mag = linear, min = linear, mip = linear|
mag: magnification filter (close to the viewer) min: minification filter (far from the viewer) mip: filter used between mip map levels
Define the new sampling mode of the texture
Helper function to be called back once a list of texture contains only ready textures.
Define the list of textures to wait for
Define the callback triggered once the entire list will be ready
Generated using TypeDoc