C4 Engine
C4 Engine API Documentation

class Texture

Defined in:  C4Textures.h
The Texture class encapsulates a texture map.
Definition

class Texture : public Render::TextureObject, public Shared, public ListElement<Texture>

Member Functions
Texture::GetTexture Returns a reference to a texture object.
Texture::GetTextureWidth Returns the width of a texture map.
Texture::GetTextureHeight Returns the height of a texture map.
Texture::GetTextureHeader Returns the TextureHeader data structure for a texture object.
Texture::GetImagePointer Returns a pointer to the image data for a texture object.
Constructor

Texture(TextureResource *resource);

Texture(const TextureHeader *header, const void *image = nullptr);

Parameters
name The name of the texture resource.
header A pointer to a TextureHeader structure describing the texture.
image A pointer to the pixel image for the texture. If this is nullptr, then the location of the image is given by the information in the texture header.
Description
The Texture class encapsulates a texture map that is either stored in a resource or created in memory. Since textures are reference-counted shared objects that could be used by multiple parts of the engine, they cannot be created using the new operator. They should instead be created by calling the Texture::GetTexture function.

A texture should be released by calling the Shared::Release function.
Base Classes
Render::TextureObject Used internally by the Graphics Manager.
Shared Texture objects are reference counted.
ListElement<Texture> Used internally by the Graphics Manager.