jubilant-funicular
|
#include <ContextData.h>
Public Member Functions | |
GLSLProgram * | getGLSLProgram (const utils::Path &progPath) |
GLSLProgram * | getGLSLProgram (crstring name, const utils::Path &vert, const utils::Path &frag) |
Result< GLTexture > | getTexture (const utils::Path &path, crvec2 dimensions=glm::vec2(0)) |
Gets a GLTexture representing the image at the given path. | |
Result< utils::Path > | getTextureFile (GLTexture tex) |
Gets the name of the file used the create tex. | |
Result< SpriteFont * > | getSpriteFont (const utils::Path &fontPath, int fontSize=32) |
Gets SpriteFont created from the given font with the given size. | |
void | reloadShaders () |
Reloads all known shaders. | |
void | reloadTextures () |
Reloads all known texture. More... | |
void | reload () |
Reloads everything. | |
void | setTextureFolder (const utils::Path &fldr) |
Sets the texture folder. | |
void | setGLSLFolder (const utils::Path &fldr) |
Sets the shader folder. | |
void | setFontFolder (const utils::Path &fldr) |
Sets the font folder. | |
void | destroy () |
Deletes all data (does not reset folder paths) | |
Private Attributes | |
std::map< std::string, GLSLProgram > | m_glslMap |
Collection of GLSLProgram. | |
std::map< utils::Path, GLTexture > | m_textureMap |
a map file names to textures | |
std::map< GLTexture, utils::Path > | m_textureFiles |
Inverse map to m_textureMap. | |
std::map< std::pair< utils::Path, int >, SpriteFont > | m_fontMap |
Map front (font name, font size) -> SpriteFont. | |
utils::Path | m_texture_folder = "./" |
Folder containing textures. | |
utils::Path | m_glsl_folder = "./" |
Folder containing shaders. | |
utils::Path | m_font_folder = "./" |
Folder containing fonts. | |
Certain pieces of data are tied to a specific GL context (e.g. a Window). This class manages all such data specific to one context.
Generally, there should be one ContextData per ScreenManager.
Definition at line 17 of file ContextData.h.
GLSLProgram * nta::ContextData::getGLSLProgram | ( | const utils::Path & | progPath | ) |
Gets GLSLProgram at specified path
Assumes vertex shader is (progPath + ".vert") and fragment shader is (progPath + ".frag")
Definition at line 6 of file ContextData.cpp.
GLSLProgram * nta::ContextData::getGLSLProgram | ( | crstring | name, |
const utils::Path & | vert, | ||
const utils::Path & | frag | ||
) |
Gets GLSLProgram, specifying explicitly where the vertex and fragment shaders are.
Uses name as the key in the map
Definition at line 14 of file ContextData.cpp.
void nta::ContextData::reloadTextures | ( | ) |
Reloads all known texture.
Definition at line 62 of file ContextData.cpp.
Referenced by reload().