Class Tex2D

Inheritance Relationships

Base Type

Class Documentation

class Tex2D : public Cacao::Asset

Asset type for 2D textures.

Public Functions

virtual void Bake() override

Convert the image data into a form suitable for rendering.

Throws:
  • BadBakeStateException – If the texture is already baked

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

virtual void Discard() override

Destroy the baked representation of the asset.

Throws:
  • BadBakeStateException – If the texture is not baked

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

~Tex2D()

Public Static Functions

static 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 to associate with the texture

Throws:
  • BadValueException – If the image buffer is empty

  • BadValueException – If the address is malformed