diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2016-03-29 08:48:52 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2016-03-29 08:48:52 -0400 |
commit | a9a9777190086bd2ce2aa54e20a1101509614463 (patch) | |
tree | dfd754e45f2d8fc4cf955470681c39c502cde1b4 /include/texture.h | |
parent | 82c178d797b9a23c31d7dad1cc8cac29d27c6eb1 (diff) |
began reworking indoors
Diffstat (limited to 'include/texture.h')
-rw-r--r-- | include/texture.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/include/texture.h b/include/texture.h new file mode 100644 index 0000000..816a8bf --- /dev/null +++ b/include/texture.h @@ -0,0 +1,103 @@ +/** @file Texture.h + * @brief Defines a method for loading textures. + * + * This file gives facilities for easily loading and binding textures. + */ + +#ifndef TEXTURE_H +#define TEXTURE_H + +#include <common.h> + +/** + * When defined, DEBUG allows extra messages to be printed to the terminal for + * debugging purposes. + */ + +#define DEBUG + +/** + * Texture functions are given a namespace for better organization. + */ + +namespace Texture { + + /** + * Loads a texture from the given file name, returning the GLuint used for + * later referencing of the texture. + */ + + GLuint loadTexture(std::string fileName); + + void freeTextures(void); + + void initColorIndex(); + vec2 getIndex(Color c); + dim2 imageDim(std::string fileName); +} + +/** + * The Texturec class. + * + * This class can handle an array of textures and allows easy binding of those + * textures. + */ + +class Texturec{ +private: + + /** + * Contains the index in the image array of the currently loaded texture. + */ + + unsigned int texState; + +public: + + /** + * Contains an array of the GLuints returned from Texture::loadTexture(). + */ + + std::vector<GLuint> image; + + /** + * Populates the image array from a list of strings, with each string as a + * separate argument. + */ + + Texturec(uint amt, ...); + + /** + * Populates the image array from an array of strings. + */ + + Texturec(uint amt,const char **paths); + Texturec(std::vector<std::string>vec); + Texturec( std::initializer_list<std::string> l ); + + /** + * Frees memory taken by the image array. + */ + + ~Texturec(); + + /** + * Binds the next texture in the array, incrementing texState. + */ + + void bindNext(); + + /** + * Binds the previous texture in the array, decrementing texState. + */ + + void bindPrev(); + + /** + * Binds the texture with the provided index. + */ + + void bind(unsigned int); +}; + +#endif //TEXTURE_H |