FPLBase
An open source project by
FPL.
|
Texture coordinate dictionary. More...
#include <texture_atlas.h>
Texture coordinate dictionary.
A TextureAtlas supports sprite sheets by containing one texture and a list of subtexture bounding boxes, which can also be indexed by name using the index_map. Subtexture bounding boxes are returned in normalized texture coordinates, and take the form (u, v, width, height).
Public Member Functions | |
void | Delete () |
Delete the texture associated with this atlas. | |
const vec4 * | GetBounds (const std::string &name) |
Get the bounds of a subtexture associated with name. More... | |
const Texture * | atlas_texture () const |
Get the texture associated with this atlas. More... | |
Texture * | atlas_texture () |
Get the texture associated with this atlas. More... | |
void | set_atlas_texture (Texture *atlas_texture) |
Set the texture associated with this atlas. | |
const std::vector< vec4 > & | subtexture_bounds () const |
Get a vector of the bounds of each subtexture in this atlas. More... | |
std::vector< vec4 > & | subtexture_bounds () |
Get a vector of the bounds of each subtexture in this atlas. More... | |
const std::map< std::string, size_t > & | index_map () const |
Get a map of subtexture names to subtexture offsets. More... | |
std::map< std::string, size_t > & | index_map () |
Get a map of subtexture names to subtexture offsets. More... | |
Public Member Functions inherited from fplbase::Asset | |
void | IncreaseRefCount () |
indicate there is an additional owner of this asset. By default, when you call any of the UnLoad*() functions in the AssetManager, that will directly delete the asset since they all start out with a single reference count. Call this function to indicate multiple owners will call Unload*() independently, and only have the asset deleted by the last one. | |
Static Public Member Functions | |
static TextureAtlas * | LoadTextureAtlas (const char *filename, TextureFormat format, TextureFlags flags, const TextureLoaderFn &tlf) |
Load a texture atlas file. Used by the more convenient AssetManager interface, but can be used without it. | |
|
inline |
Get the texture associated with this atlas.
|
inline |
Get the texture associated with this atlas.
|
inline |
Get the bounds of a subtexture associated with name.
name | Name of the subtexture to lookup. |
|
inline |
Get a map of subtexture names to subtexture offsets.
Each entry in the map can be used to lookup the subtexture bounds in the vector returned by subtexture_bounds().
|
inline |
Get a map of subtexture names to subtexture offsets.
Each entry in the map can be used to lookup the subtexture bounds in the vector returned by subtexture_bounds().
|
inline |
Get a vector of the bounds of each subtexture in this atlas.
Each element of the vector consists of (offsetx, offsety, sizex, sizey) where offsetx / offsety are coordinates relative to the underlying atlased texture and sizex / sizey are the dimensions of the subtexture.
|
inline |
Get a vector of the bounds of each subtexture in this atlas.
Each element of the vector consists of (offsetx, offsety, sizex, sizey) where offsetx / offsety are coordinates relative to the underlying atlased texture and sizex / sizey are the dimensions of the subtexture.