15 #ifndef FPLBASE_TEXTURE_ATLAS_H
16 #define FPLBASE_TEXTURE_ATLAS_H
22 #include "fplbase/config.h"
23 #include "fplbase/asset.h"
51 atlas_texture_ =
nullptr;
60 auto index_iter = index_map_.find(name);
61 if (index_iter != index_map_.end()) {
62 return &subtexture_bounds_[index_iter->second];
86 return subtexture_bounds_;
105 const std::map<std::string, size_t> &
index_map()
const {
return index_map_; }
114 std::map<std::string, size_t> &
index_map() {
return index_map_; }
126 std::vector<vec4> subtexture_bounds_;
128 std::map<std::string, size_t> index_map_;
134 #endif // FPLBASE_TEXTURE_ATLAS_H
void set_atlas_texture(Texture *atlas_texture)
Set the texture associated with this atlas.
Definition: texture_atlas.h:74
void Delete()
Delete the Texture stored in id_, and reset id_ to 0.
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 withou...
Abstraction for a texture object loaded on the GPU.
Definition: texture.h:104
Base class of all assets that may be managed by Assetmanager.
Definition: asset.h:26
std::vector< vec4 > & subtexture_bounds()
Get a vector of the bounds of each subtexture in this atlas.
Definition: texture_atlas.h:96
TextureFormat
Definition: texture.h:36
Texture * atlas_texture()
Get the texture associated with this atlas.
Definition: texture_atlas.h:72
const vec4 * GetBounds(const std::string &name)
Get the bounds of a subtexture associated with name.
Definition: texture_atlas.h:59
const std::map< std::string, size_t > & index_map() const
Get a map of subtexture names to subtexture offsets.
Definition: texture_atlas.h:105
std::map< std::string, size_t > & index_map()
Get a map of subtexture names to subtexture offsets.
Definition: texture_atlas.h:114
TextureFlags
Flags affecting loading and sampler modes for a texture.
Definition: texture.h:52
const Texture * atlas_texture() const
Get the texture associated with this atlas.
Definition: texture_atlas.h:69
const std::vector< vec4 > & subtexture_bounds() const
Get a vector of the bounds of each subtexture in this atlas.
Definition: texture_atlas.h:85
Texture coordinate dictionary.
Definition: texture_atlas.h:43
std::function< Texture *(const char *filename, TextureFormat format, TextureFlags flags)> TextureLoaderFn
used by some functions to allow the texture loading mechanism to be specified by the caller...
Definition: texture.h:431
void Delete()
Delete the texture associated with this atlas.
Definition: texture_atlas.h:49