Class Tex2D

Inheritance Relationships

Base Type

Class Documentation

class Tex2D : public Cacao::Asset

Asset type for 2D textures.

Public Functions

virtual void Realize()

Synchronously convert the image data into a form suitable for rendering.

Throws:
  • BadRealizeStateException – If the texture is already realized

  • BadInitStateException – If the graphics backend is not initialized or connected

virtual std::shared_future<void> RealizeAsync()

Asynchronously convert the image data into a form suitable for rendering.

Throws:
  • BadRealizeStateException – If the texture is already realized

  • BadInitStateException – If the graphics backend is not initialized or connected

Returns:

A future that will resolve when realization is complete or fails

virtual void DropRealized()

Destroy the realized representation of the asset.

Throws:
  • BadRealizeStateException – If the texture is not realized

  • BadInitStateException – If the graphics backend is not initialized or connected

~Tex2D()

Public Static Functions

static inline std::shared_ptr<Tex2D> Create(libcacaoimage::Image &&imageBuffer, const std::string &addr)

Create a new 2D texture from image data.

Parameters:
  • imageBuffer – The image data for the texture

  • addr – The resource address identifier to associate with the texture