OrbitEngine::Graphics::TextureAtlas class

A 2D texture atlas.

To generate a TextureAtlas check the BitmapAtlas class.

Base classes

class Atlas
Generic 2D atlas class.

Public static functions

static auto Load(const std::string& metadata, const std::string& image) -> TextureAtlas*
Creates a TextureAtlas from disk.
template<typename T, unsigned int N>
static auto CreateFromBitmap(const BitmapAtlas<T, N>& atlas) -> TextureAtlas*

Constructors, destructors, conversion operators

~TextureAtlas()

Public functions

auto getUVs(FrameIndex index) const -> Math::UV
Get frame uv.
auto getTexture() const -> Texture*
Get the underlying texture.
auto getTexelSize() const -> Math::Vec2f override
Returns texel sizes in both dimensions (1.0f / size)
void drawFrame(FrameIndex index, const Math::Vec2f& position, const Math::Vec2f& size, SpriteRenderer& sr)
Draws a frame using a SpriteRenderer.

Function documentation

static TextureAtlas* OrbitEngine::Graphics::TextureAtlas::Load(const std::string& metadata, const std::string& image)

Creates a TextureAtlas from disk.

Parameters
metadata in path to the metadata file to read (.json)
image in path to the image file to read (.png)
Returns The TextureAtlas instance if the operation was successful, NULL otherwise

void OrbitEngine::Graphics::TextureAtlas::drawFrame(FrameIndex index, const Math::Vec2f& position, const Math::Vec2f& size, SpriteRenderer& sr)

Draws a frame using a SpriteRenderer.

Parameters
index in index of the frame to draw
position in position to render the frame
size in dimensions to render the frame
sr in renderer to submit the draw