TDME2 1.9.121
TextureManager.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <unordered_map>
5
6#include <tdme/tdme.h>
11
12using std::string;
13using std::unordered_map;
14
19
20/**
21 * Texture manager
22 * @author Andreas Drewke
23 * @version $Id$
24 */
26{
28
29private:
30 Renderer* renderer { nullptr };
31 unordered_map<string, TextureManager_TextureManaged*> textures;
33
34public:
35
36 /**
37 * Adds a texture to manager
38 * @param id id
39 * @param created if managed texture has just been created
40 * @returns texture manager entity
41 */
42 TextureManager_TextureManaged* addTexture(const string& id, bool& created);
43
44 /**
45 * Adds a texture to manager
46 * @param texture texture
47 * @param contextIdx context index
48 * @returns texture id
49 */
50 int32_t addTexture(Texture* texture, int contextIdx = 0);
51
52 /**
53 * Adds a cube map texture to manager
54 * @param id id
55 * @param textureLeft texture left
56 * @param textureRight texture right
57 * @param textureTop texture top
58 * @param textureBottom texture bottom
59 * @param textureFront texture front
60 * @param textureBack texture back
61 * @param contextIdx context index or nullptr if using default context
62 * @returns texture id
63 */
64 int32_t addCubeMapTexture(const string& id, Texture* textureLeft, Texture* textureRight, Texture* textureTop, Texture* textureBottom, Texture* textureFront, Texture* textureBack, int contextIdx = 0);
65
66 /**
67 * Removes a texture from manager / open gl stack
68 * @param textureId texture id
69 */
70 void removeTexture(const string& textureId);
71
72 /**
73 * Public constructor
74 * @param renderer renderer
75 */
77
78 /**
79 * Destructor
80 */
82};
void removeTexture(const string &textureId)
Removes a texture from manager / open gl stack.
unordered_map< string, TextureManager_TextureManaged * > textures
TextureManager(Renderer *renderer)
Public constructor.
int32_t addCubeMapTexture(const string &id, Texture *textureLeft, Texture *textureRight, Texture *textureTop, Texture *textureBottom, Texture *textureFront, Texture *textureBack, int contextIdx=0)
Adds a cube map texture to manager.
TextureManager_TextureManaged * addTexture(const string &id, bool &created)
Adds a texture to manager.
Mutex implementation.
Definition: Mutex.h:27