Advanced
the alpha mode of the texture
Only really affects RenderTextures. Should we use antialiasing for this texture. It will look better, but may impact performance as a Blit operation will be required to resolve the texture.
If true, the Garbage Collector will unload this texture if it is not used after a period of time
Should we auto generate mipmaps for this texture? This will automatically generate mipmaps for this texture when uploading to the GPU. Mipmapped textures take up more memory, but can look better when scaled down.
For performance reasons, it is recommended to NOT use this with RenderTextures, as they are often updated every frame.
If you do, make sure to call updateMipmaps
after you update the texture.
Readonly
destroyedHas the source been destroyed?
how many dimensions does this texture have? currently v8 only supports 2d
the format that the texture data has
the height of this texture source, accounting for resolution eg pixelHeight 200, resolution 2, then height will be 100
Whether or not the video is ready to play.
optional label, can be used for debugging
The number of mip levels to generate for this texture. this is overridden if autoGenerateMipmaps is true
the pixel height of this texture source. This is the REAL pure number, not accounting resolution
the pixel width of this texture source. This is the REAL pure number, not accounting resolution
the resource that will be uploaded to the GPU. This is where we get our pixels from eg an ImageBimt / Canvas / Video etc
Readonly
uidunique id for this Texture source
The upload method for this texture.
the width of this texture source, accounting for resolution eg pixelWidth 200, resolution 2, then width will be 100
Static
defaultThe default options for video sources.
Static
extensionStatic
fromA helper function that creates a new TextureSource based on the resource you provide.
The resource to create the texture source from.
Static
Readonly
MIME_Map of video MIME types that can't be directly derived from file extensions.
Should the base texture automatically update itself, set to true by default.
Checks if the resource has valid dimensions.
True if width and height are set, otherwise false.
Specifies the minimum and maximum levels of detail, respectively, used internally when sampling a texture.
Specifies the minimum and maximum levels of detail, respectively, used internally when sampling a texture.
Specifies the sampling behavior when the sample footprint is smaller than or equal to one texel.
Specifies the sampling behavior when the sample footprint is larger than one texel.
Specifies behavior for sampling between mipmap levels.
the resolution of the texture. Changing this number, will not change the number of pixels in the actual texture but will the size of the texture when rendered.
changing the resolution of this texture to 2 for example will make it appear twice as small when rendered (as pixel density will have increased)
the height of the resource. This is the REAL pure number, not accounting resolution
the width of the resource. This is the REAL pure number, not accounting resolution
setting this will set magFilter,minFilter and mipmapFilter all at once!
returns itself
the style of the texture
How many times a second to update the texture from the video. Leave at 0 to update at every render. A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.
Cleans up resources and event listeners associated with this texture.
Resize the texture, this is handy if you want to use the texture as a render texture
Optional
width: numberthe new width of the texture
Optional
height: numberthe new height of the texture
Optional
resolution: numberthe new resolution of the texture
This will unload the Texture source from the GPU. This will free up the GPU memory As soon as it is required fore rendering, it will be re-uploaded.
call this if you have modified the texture outside of the constructor
Lets the renderer know that this texture has been updated and its mipmaps should be re-generated. This is only important for RenderTexture instances, as standard Texture instances will have their mipmaps generated on upload. You should call this method after you make any change to the texture
The reason for this is is can be quite expensive to update mipmaps for a texture. So by default, We want you, the developer to specify when this action should happen.
Generally you don't want to have mipmaps generated on Render targets that are changed every frame,
Static
test
A texture source that uses a video as its resource. It automatically resizes the texture based on the video dimensions. It also provides methods to control playback and handle video events. This class supports automatic loading, playback, and frame updates. It can also handle cross-origin videos and provides options for looping, muting, and inline playback.