Texture constructor
renderer object or GPUCurtains class object used to create this Texture
parameters used to create this Texture
The type of the Texture
Readonly
uuidThe universal unique id of this Texture
The GPUTexture used
Size of the texture source, usually our renderer canvas size
Options used to create this Texture
Array of bindings that will actually only hold one texture binding
Private
#autoWhether this texture should be automatically resized when the renderer size changes. Default to true.
Get our texture binding
Texture to copy
Copy a GPUTexture directly into this Texture. Mainly used for depth textures.
GPUTexture to copy
Create the GPUTexture | texture (or copy it from source) and update the binding resource
Upload a source to the GPU and use it for our texture.
parameters used to upload the source.
source to use for our texture.
Optional
width?: numbersource width.
Optional
height?: numbersource height.
Optional
depth?: numbersource depth.
Optional
origin?: GPUOrigin3DGPUOrigin3D | origin of the source copy.
Optional
colorUse data as the texture source and upload it to the GPU.
parameters used to upload the source.
Optional
width?: numberdata source width.
Optional
height?: numberdata source height.
Optional
depth?: numberdata source depth.
Optional
origin?: GPUOrigin3DGPUOrigin3D | origin of the data source copy.
Optional
data?: Float32ArrayFloat32Array data to use as source.
Set our bindings
Resize our Texture, which means recreate it/copy it again and tell the texture bind group to update
the optional new size to set
Destroy our Texture
This is the main class used to create and handle GPUTexture | textures that can be used with ComputePass and/or Mesh. Also used as copy source/destination for RenderPass and RenderTarget.
Basically useful for any kind of textures: for external sources (however in some cases, DOMTexture might be preferred), depth, storages or to copy anything outputted to the screen at one point or another.
Will create a GPUTexture and its associated TextureBinding.
Example