Class Texture

Rendering @{

Hierarchy (view full)

Constructors

Accessors

  • get depth(): number
  • Returns the depth of the texture (only applicable for 3D textures).

    Returns number

  • get height(): number
  • Returns the height of the texture.

    Returns number

  • get isColorspaceSRGB(): boolean
  • Determines if the texture source data is sRGB colorspaced. If the texture format supports hardware sRGB conversion, the underlying data will be sRGB and convered to linear when sampled. Otherwise the data will be linearized on import.

    Returns boolean

  • get isDestroyed(): boolean
  • Determines if the resource is destroyed.

    Returns boolean

    This can happen when the Resource was forcefully unloaded or reverted. For this reason, it is safer to hold on to a instead of directly referencing a resource pointer, as the current Resource can always be retrieved via .value.

  • get isFullyStreamedIn(): boolean
  • Checks if all of the streaming data has been assigned.

    Returns boolean

    True if all the streaming data has been assigned via SetStreamingData.

  • get isGrayscale(): boolean
  • Checks wheteher the format is grayscale.

    Returns boolean

    true if the format is grayscale.

  • get maximumAnisotropicFilteringSampleCount(): number
  • Determines the maximum number of samples allowed during anisotropic filtering. Should be in range [1, 16], but the maximum range can be higher or lower depending on the hardware.

    Returns number

  • set maximumAnisotropicFilteringSampleCount(value): void
  • Parameters

    • value: number

    Returns void

  • get mipMapCount(): number
  • Gets the number of mipmaps to be used for this texture. This number excludes the top level map (which is always assumed to be present).

    Returns number

  • get name(): string
  • Name of the resource. Use primarily for easier identification and not important to the engine itself.

    Returns string

  • get sampleCount(): number
  • Gets the number of samples used for multisampling (0 or 1 if multisampling is not used).

    Returns number

  • get uuid(): UUID
  • Returns a universally unique identifier of this resource.

    Returns UUID

  • get width(): number
  • Returns the width of the texture.

    Returns number

Methods

  • Blits the contents a subresource in this texture to another texture.

    Parameters

    Returns void

  • Asynchronously compresses the texture using the specified compression options.

    Parameters

    Returns Promise<Texture>

    The compressed texture or null if the compression

    This method only supports uncompressed 2D textures currently.

  • Copies the contents a subresource in this texture to another texture. Texture format and size of the subresource must match.

    You are allowed to copy from a multisampled to non-multisampled surface, which will resolve the multisampled surface before copying.

    Parameters

    Returns void

  • Duplicates the resource and creates a unique UUID for the duplicated resource.

    Returns Resource

    The duplicated resource or null, if the duplication failed.

  • Reads internal texture data into a newly allocated buffer. Performs the read asynchronously without blocking the GPU.

    Parameters

    • Optionalface: number

      Texture face to read from.

    • OptionalmipLevel: number

      Mipmap level to read from.

    Returns AsyncOp<PixelData, void>

    Async operation object that will contain the buffer with the data once the operation completes.

    This is an "asynchronous method".

  • Returns pixels for the specified mip level & face. Pixels will be read from system memory, which means the texture has to be created with TextureUsageFlag.CPUCached. If the texture was updated from the GPU the pixels retrieved from this method will not reflect that, and you should use GetGPUPixels instead.

    Parameters

    • Optionalface: EnumValue<CubemapFace, number>

      Face to read the pixels from. Cubemap textures have six faces whose face indices are as specified in the CubemapFace enum. Array textures can have an arbitrary number of faces (if it's a cubemap array it has to be a multiple of 6).

    • OptionalmipLevel: number

      Mip level to retrieve pixels for. Top level (0) is the highest quality.

    Returns PixelData

    A set of pixels for the specified mip level.

  • Virtual

    Method called by RSX to perform actions required after the creation of the resource.

    Returns void

  • Virtual

    Method called by RSX to perform any operations needed after deserialization.

    Returns void

    Use this API to restore your serializable data into live objects.

  • Virtual

    Method called by RSX to disable the resource.

    Returns void

    Use this API to deactivate the resource before it is serialized.

  • Virtual

    Method called by RSX to enable the resource.

    Returns void

    Use this API to activate the resource after it has been disabled by serialization.

  • Virtual

    Method called by RSX to perform initialization of the resource.

    Returns void

    Use this API to initialize data and default construct all fields.

  • Virtual

    Method called by RSX to perform any operations before serialization.

    Returns void

    Use this API to bake your live data into serializable data.

  • Reverts the resource to the on-disk representation.

    Returns boolean

    This is a potentially expensive call, as it needs to deserialize and replace all existing in-memory resource handles.

  • Creates an empty 1D texture.

    Parameters

    • width: number

      Width of the texture in pixels.

    • Optionalformat: EnumValue<PixelFormat, number>

      Format of the pixels.

    • Optionalusage: EnumValue<TextureUsageFlag, number>

      Describes planned texture use.

    • OptionalhasMipmaps: boolean

      Determines if the texture allocates memory for the mip-map chain or only the top level.

    • OptionalisColorspaceSRGB: boolean

      If true the texture data is assumed be in sRGB color space.

    Returns Texture

    This typically is only set for textures that are used as "BaseColor" or "Diffuse" textures.

  • Creates an empty 2D texture.

    Parameters

    • width: number

      Width of the texture in pixels.

    • height: number

      Height of the texture in pixels.

    • Optionalformat: EnumValueTyped<PixelFormat, number>

      Format of the pixels.

    • Optionalusage: EnumValue<TextureUsageFlag, number>

      Describes planned texture use.

    • OptionalhasMipmaps: boolean

      Determines if the texture allocates memory for the mip-map chain or only the top level.

    • OptionalisColorspaceSRGB: boolean

      If true the texture data is assumed be in sRGB color space.

    Returns Texture

    This typically is only set for textures that are used as "BaseColor" or "Diffuse" textures.

  • Creates an empty 3D texture.

    Parameters

    • width: number

      Width of the texture in pixels.

    • height: number

      Height of the texture in pixels.

    • depth: number

      Depth of the texture in pixels.

    • Optionalformat: EnumValueTyped<PixelFormat, number>

      Format of the pixels.

    • Optionalusage: EnumValue<TextureUsageFlag, number>

      Describes planned texture use.

    • OptionalhasMipmaps: boolean

      Determines if the texture allocates memory for the mip-map chain or only the top level.

    Returns Texture

  • Creates an empty cubemap texture.

    Parameters

    • size: number

      Width and height of a single cubemap face in pixels.

    • Optionalformat: EnumValueTyped<PixelFormat, number>

      Format of the pixels.

    • Optionalusage: EnumValue<TextureUsageFlag, number>

      Describes planned texture use.

    • OptionalhasMipmaps: boolean

      Determines if the texture allocates memory for the mip-map chain or only the top level.

    • OptionalisColorspaceSRGB: boolean

      If true the texture data is assumed be in sRGB color space.

    Returns Texture

    This typically is only set for textures that are used as "BaseColor" or "Diffuse" textures.

  • Creates an empty multi-sampled 2D texture.

    Parameters

    • width: number

      Width of the texture in pixels.

    • height: number

      Height of the texture in pixels.

    • sampleCount: number

      The number of samples per pixel. Must be higher than 1.

    • Optionalformat: EnumValueTyped<PixelFormat, number>

      Format of the pixels.

    • Optionalusage: EnumValue<TextureUsageFlag, number>

      Describes planned texture use.

    • OptionalhasMipmaps: boolean

      Determines if the texture allocates memory for the mip-map chain or only the top level.

    • OptionalisColorspaceSRGB: boolean

      If true the texture data is assumed be in sRGB color space.

    Returns Texture

    This typically is only set for textures that are used as "BaseColor" or "Diffuse" textures.