DOMTexture constructor
Renderer object or GPUCurtains class object used to create this DOMTexture
parameters used to create this DOMTexture
The GPUExternalTexture used if any.
The MediaTexture sources to use if any.
Options used to create this MediaTexture.
Array of requestVideoFrameCallback returned ids if used.
Vec2 offset to apply to the Texture if useTransform parameter has been set to true.
Vec2 scale to apply to the Texture if useTransform parameter has been set to true.
Vec2 transformation origin to use when applying the transformations to the Texture if useTransform parameter has been set to true. A value of (0.5, 0.5) corresponds to the center of the texture. Default is (0, 0), the upper left.
Mat3 transformation matrix to apply to the Texture if useTransform parameter has been set to true.
OptionaltransformBufferBinding to send the transformation matrix to the shaders if useTransform parameter has been set to true.
The type of the Texture.
ReadonlyuuidThe universal unique id of this Texture.
The GPUTexture used.
Array of bindings that will actually only hold one texture binding.
GPUCurtainsRenderer used by this DOMTexture.
Get the actual rotation value.
Set the actual rotation value and update the modelMatrix.
new rotation value to use.
Get our texture binding.
Get our texture parent mesh if any.
Set our texture parent mesh.
texture parent mesh to set.
Get our unique source, since DOMTexture have a fixed '2d' view dimension.
function assigned to the onSourceLoaded callback
function assigned to the onAllSourcesLoaded callback
function assigned to the onSourceUploaded callback
function assigned to the onAllSourcesUploaded callback
Set our bindings.
Create the texture (or copy it from source) and update the binding resource.
Load an HTMLImageElement from a URL and create an ImageBitmap to use as a source.
URL of the image to load.
Load and create an ImageBitmap from a URL or HTMLImageElement, use it as a source and create the GPUTexture.
the image URL or HTMLImageElement to load.
Use an already loaded ImageBitmap as a sources.
ImageBitmap to use.
Index at which to insert the source in the sources array in case of cube map.
Load and create images using loadImage from an array of images sources as strings or HTMLImageElement. Useful for cube maps.
Array of images sources as strings or HTMLImageElement to load.
Import a GPUExternalTexture from the Renderer, update the textureBinding and its bind group
Close an external source VideoFrame if any.
Set our source shouldUpdate flag to true at each new video frame.
Callback to run when a HTMLVideoElement has loaded (when it has enough data to play). Set the HTMLVideoElement as a MediaTextureSource.source and create the GPUTexture or GPUExternalTexture.
the newly loaded HTMLVideoElement.
Index of the HTMLVideoElement in the sources array.
Get whether the provided source is a video.
TextureSource to check.
Get whether the provided video source is ready to be played.
TextureSource to check.
Get whether the provided video source is ready to be uploaded.
TextureSource to check.
Load a video from a URL or HTMLVideoElement and register onVideoLoaded callback.
the video URL or HTMLVideoElement to load.
Use a HTMLVideoElement as a sources.
HTMLVideoElement to use.
Index at which to insert the source in the sources array in case of cube map.
Load and create videos using loadVideo from an array of videos sources as strings or HTMLVideoElement. Useful for cube maps.
Array of images sources as strings or HTMLVideoElement to load.
Load a HTMLCanvasElement and use it as one of our sources.
the HTMLCanvasElement to use.
Load an array of HTMLCanvasElement using loadCanvas . Useful for cube maps.
Array of HTMLCanvasElement to load.
Set the sourceUploaded flag to true for the source at a given index in our sources array. If all sources have been uploaded, set our sourcesUploaded flag to true.
Callback to run when one of the source has been loaded.
callback to run when one of the source has been loaded.
Callback to run when all of the source have been loaded.
callback to run when all of the sources have been loaded.
Callback to run when one of the MediaTextureSource.source has been uploaded to the GPU.
callback to run when one of the source has been uploaded to the GPU.
Callback to run when all of the source have been uploaded to the GPU.
callback to run when all of the sources been uploaded to the GPU.
Update a MediaTexture by uploading the texture if needed.
New Renderer or GPUCurtains instance to use.
Copy a GPUTexture directly into this Texture. Mainly used for depth textures.
GPUTexture to copy.
Upload a source to the GPU and use it for our texture.
parameters used to upload the source.
source to use for our texture.
Optionalwidth?: numbersource width.
Optionalheight?: numbersource height.
Optionaldepth?: numbersource depth.
Optionalorigin?: GPUOrigin3D().destination.origin | GPUOrigin3D of the source copy.
OptionalcolorSpace?: PredefinedColorSpaceUse data as the texture source and upload it to the GPU.
parameters used to upload the source.
Optionalwidth?: numberdata source width.
Optionalheight?: numberdata source height.
Optionaldepth?: numberdata source depth.
Optionalorigin?: GPUOrigin3D().destination.origin | GPUOrigin3D of the data source copy.
Optionaldata?: Float32ArrayFloat32Array data to use as source.
Update our Texture quality ratio and resize it.
New quality ratio to use.
Set our Texture size, recreate it/copy it again and tell the texture bind group to update.
the new size to set.
Update the modelMatrix.
Set our source size and update the modelMatrix.
Resize our DOMTexture.
Copy a DOMTexture.
DOMTexture to copy.
Destroy the DOMTexture.
Used to create GPUTexture or GPUExternalTexture, specially made to handle different kinds of DOM elements sources, like HTMLImageElement, HTMLVideoElement or HTMLCanvasElement.
Handles the various sources loading and uploading, GPU textures creation,texture model matrix binding and GPU texture binding.
Example