Przeglądaj źródła

TextureManager is now completely static.

Thomas Buck 9 lat temu
rodzic
commit
e2f3ea30ad

+ 1
- 0
ChangeLog.md Wyświetl plik

8
     * Added ShaderBuffer class.
8
     * Added ShaderBuffer class.
9
     * Level geometry now stored in GL buffers at level load.
9
     * Level geometry now stored in GL buffers at level load.
10
         * Greatly improved level load times, more FPS.
10
         * Greatly improved level load times, more FPS.
11
+    * TextureManager is now completely static.
11
 
12
 
12
     [ 20141231 ]
13
     [ 20141231 ]
13
     * No longer using Exceptions.
14
     * No longer using Exceptions.

+ 1
- 1
include/Render.h Wyświetl plik

37
     static void screenShot(const char* filenameBase);
37
     static void screenShot(const char* filenameBase);
38
 
38
 
39
     static void drawTexture(float x, float y, float w, float h, glm::vec4 color,
39
     static void drawTexture(float x, float y, float w, float h, glm::vec4 color,
40
-                            unsigned int texture, TextureManager::TextureStorage s);
40
+                            unsigned int texture, TextureStorage s);
41
 
41
 
42
     static void setDisplayViewFrustum(bool d) { displayViewFrustum = d; }
42
     static void setDisplayViewFrustum(bool d) { displayViewFrustum = d; }
43
     static bool getDisplayViewFrustum() { return displayViewFrustum; }
43
     static bool getDisplayViewFrustum() { return displayViewFrustum; }

+ 43
- 49
include/TextureManager.h Wyświetl plik

40
     std::vector<TextureTileVertex> vertices;
40
     std::vector<TextureTileVertex> vertices;
41
 };
41
 };
42
 
42
 
43
+enum class ColorMode {
44
+    RGB,
45
+    RGBA,
46
+    ARGB,
47
+    BGR,
48
+    BGRA
49
+};
50
+
51
+enum class TextureStorage {
52
+    GAME,
53
+    SYSTEM
54
+};
55
+
43
 /*!
56
 /*!
44
  * \brief Texture registry
57
  * \brief Texture registry
45
  */
58
  */
46
 class TextureManager {
59
 class TextureManager {
47
   public:
60
   public:
61
+    static int initialize();
62
+    static int initializeSplash();
63
+    static void shutdown();
64
+    static void clear();
48
 
65
 
49
-    enum class ColorMode {
50
-        RGB,
51
-        RGBA,
52
-        ARGB,
53
-        BGR,
54
-        BGRA
55
-    };
56
-
57
-    enum class TextureStorage {
58
-        GAME,
59
-        SYSTEM
60
-    };
61
-
62
-    TextureManager() : nextFreeTextureUnit(0) { }
63
-    ~TextureManager();
64
-
65
-    int initialize();
66
-    int initializeSplash();
67
-
68
-    void clear();
69
-
70
-    int numTextures(TextureStorage s = TextureStorage::GAME);
66
+    static int numTextures(TextureStorage s = TextureStorage::GAME);
71
 
67
 
72
     /*!
68
     /*!
73
      * \brief Bind texture to next free texture unit.
69
      * \brief Bind texture to next free texture unit.
75
      * \param s Place where texture is stored
71
      * \param s Place where texture is stored
76
      * \returns ID of GL texture unit to which this texture is bound.
72
      * \returns ID of GL texture unit to which this texture is bound.
77
      */
73
      */
78
-    int bindTexture(unsigned int n, TextureStorage s);
74
+    static int bindTexture(unsigned int n, TextureStorage s);
79
 
75
 
80
     /*!
76
     /*!
81
      * \brief Loads Buffer as texture
77
      * \brief Loads Buffer as texture
89
      * \param filter if the texture should be mipmap filtered
85
      * \param filter if the texture should be mipmap filtered
90
      * \returns texture ID or < 0 on error
86
      * \returns texture ID or < 0 on error
91
      */
87
      */
92
-    int loadBufferSlot(unsigned char* image = nullptr,
93
-                       unsigned int width = 256, unsigned int height = 256,
94
-                       ColorMode mode = ColorMode::RGBA, unsigned int bpp = 32,
95
-                       TextureStorage s = TextureStorage::GAME,
96
-                       int slot = -1, bool filter = true);
88
+    static int loadBufferSlot(unsigned char* image = nullptr,
89
+                              unsigned int width = 256, unsigned int height = 256,
90
+                              ColorMode mode = ColorMode::RGBA, unsigned int bpp = 32,
91
+                              TextureStorage s = TextureStorage::GAME,
92
+                              int slot = -1, bool filter = true);
97
 
93
 
98
-    int loadImage(std::string filename, TextureStorage s = TextureStorage::GAME, int slot = -1);
94
+    static int loadImage(std::string filename, TextureStorage s = TextureStorage::GAME, int slot = -1);
99
 
95
 
100
-    void addTile(TextureTile* t);
101
-    int numTiles();
102
-    TextureTile& getTile(int index);
96
+    static void addTile(TextureTile* t);
97
+    static int numTiles();
98
+    static TextureTile& getTile(int index);
103
 
99
 
104
-    void addAnimatedTile(int index, int tile);
105
-    int numAnimatedTiles();
106
-    int getFirstTileAnimation(int index);
107
-    int getNextTileAnimation(int tile);
100
+    static void addAnimatedTile(int index, int tile);
101
+    static int numAnimatedTiles();
102
+    static int getFirstTileAnimation(int index);
103
+    static int getNextTileAnimation(int tile);
108
 
104
 
109
   private:
105
   private:
110
-    std::vector<unsigned int>& getIds(TextureStorage s);
111
-    std::vector<int>& getUnits(TextureStorage s);
106
+    static std::vector<unsigned int>& getIds(TextureStorage s);
107
+    static std::vector<int>& getUnits(TextureStorage s);
112
 
108
 
113
-    void bindTextureId(unsigned int n, TextureStorage s, unsigned int unit);
114
-    int loadPCX(std::string filename, TextureStorage s, int slot);
109
+    static void bindTextureId(unsigned int n, TextureStorage s, unsigned int unit);
110
+    static int loadPCX(std::string filename, TextureStorage s, int slot);
115
 
111
 
116
-    std::vector<unsigned int> mTextureIdsGame;
117
-    std::vector<unsigned int> mTextureIdsSystem;
112
+    static std::vector<unsigned int> mTextureIdsGame;
113
+    static std::vector<unsigned int> mTextureIdsSystem;
118
 
114
 
119
-    std::vector<TextureTile*> tiles;
120
-    std::vector<std::vector<int>> animations;
115
+    static std::vector<TextureTile*> tiles;
116
+    static std::vector<std::vector<int>> animations;
121
 
117
 
122
-    std::vector<int> gameUnits;
123
-    std::vector<int> systemUnits;
124
-    unsigned int nextFreeTextureUnit;
118
+    static std::vector<int> gameUnits;
119
+    static std::vector<int> systemUnits;
120
+    static unsigned int nextFreeTextureUnit;
125
 };
121
 };
126
 
122
 
127
-TextureManager& getTextureManager();
128
-
129
 #endif
123
 #endif
130
 
124
 

+ 4
- 4
include/system/Shader.h Wyświetl plik

52
     void loadUniform(int uni, glm::vec2 vec);
52
     void loadUniform(int uni, glm::vec2 vec);
53
     void loadUniform(int uni, glm::vec4 vec);
53
     void loadUniform(int uni, glm::vec4 vec);
54
     void loadUniform(int uni, glm::mat4 mat);
54
     void loadUniform(int uni, glm::mat4 mat);
55
-    void loadUniform(int uni, int texture, TextureManager::TextureStorage store);
55
+    void loadUniform(int uni, int texture, TextureStorage store);
56
 
56
 
57
     static int initialize();
57
     static int initialize();
58
     static void shutdown();
58
     static void shutdown();
59
 
59
 
60
     static void drawGL(ShaderBuffer& vertices, ShaderBuffer& uvs, glm::vec4 color, unsigned int texture,
60
     static void drawGL(ShaderBuffer& vertices, ShaderBuffer& uvs, glm::vec4 color, unsigned int texture,
61
-                       TextureManager::TextureStorage store = TextureManager::TextureStorage::SYSTEM);
61
+                       TextureStorage store = TextureStorage::SYSTEM);
62
 
62
 
63
     static void drawGL(ShaderBuffer& vertices, ShaderBuffer& uvs, unsigned int texture, glm::mat4 MVP,
63
     static void drawGL(ShaderBuffer& vertices, ShaderBuffer& uvs, unsigned int texture, glm::mat4 MVP,
64
-                       TextureManager::TextureStorage store = TextureManager::TextureStorage::GAME);
64
+                       TextureStorage store = TextureStorage::GAME);
65
     static void drawGL(ShaderBuffer& vertices, ShaderBuffer& uvs, ShaderBuffer& indices,
65
     static void drawGL(ShaderBuffer& vertices, ShaderBuffer& uvs, ShaderBuffer& indices,
66
                        unsigned int texture, glm::mat4 MVP,
66
                        unsigned int texture, glm::mat4 MVP,
67
-                       TextureManager::TextureStorage store = TextureManager::TextureStorage::GAME);
67
+                       TextureStorage store = TextureStorage::GAME);
68
 
68
 
69
     static void drawGL(ShaderBuffer& vertices, ShaderBuffer& colors, glm::mat4 MVP,
69
     static void drawGL(ShaderBuffer& vertices, ShaderBuffer& colors, glm::mat4 MVP,
70
                        unsigned int mode = GL_TRIANGLES);
70
                        unsigned int mode = GL_TRIANGLES);

+ 1
- 1
include/utils/pcx.h Wyświetl plik

32
  */
32
  */
33
 int pcxLoad(const char* filename, unsigned char** image,
33
 int pcxLoad(const char* filename, unsigned char** image,
34
             unsigned int* width, unsigned int* height,
34
             unsigned int* width, unsigned int* height,
35
-            TextureManager::ColorMode* mode, unsigned int* bpp);
35
+            ColorMode* mode, unsigned int* bpp);
36
 
36
 
37
 #endif
37
 #endif
38
 
38
 

+ 1
- 1
src/Game.cpp Wyświetl plik

77
     Camera::reset();
77
     Camera::reset();
78
     Render::clearRoomList();
78
     Render::clearRoomList();
79
     SoundManager::clear();
79
     SoundManager::clear();
80
-    getTextureManager().clear();
80
+    TextureManager::clear();
81
     getWorld().destroy();
81
     getWorld().destroy();
82
 }
82
 }
83
 
83
 

+ 1
- 1
src/MenuFolder.cpp Wyświetl plik

82
     // Draw half-transparent overlay
82
     // Draw half-transparent overlay
83
     glm::vec4 color(0.0f, 0.0f, 0.0f, 0.75f);
83
     glm::vec4 color(0.0f, 0.0f, 0.0f, 0.75f);
84
     Render::drawTexture(0.0f, 0.0f, Window::getSize().x, Window::getSize().y,
84
     Render::drawTexture(0.0f, 0.0f, Window::getSize().x, Window::getSize().y,
85
-                        color, TEXTURE_WHITE, TextureManager::TextureStorage::SYSTEM);
85
+                        color, TEXTURE_WHITE, TextureStorage::SYSTEM);
86
 
86
 
87
     // Draw heading
87
     // Draw heading
88
     Font::drawTextCentered(0, 10, 1.2f, BLUE, Window::getSize().x, VERSION);
88
     Font::drawTextCentered(0, 10, 1.2f, BLUE, Window::getSize().x, VERSION);

+ 2
- 2
src/Mesh.cpp Wyświetl plik

58
 
58
 
59
     int vertIndex = 0;
59
     int vertIndex = 0;
60
     for (int i = 0; i < indicesBuff.size(); i++) {
60
     for (int i = 0; i < indicesBuff.size(); i++) {
61
-        unsigned int texture = getTextureManager().getTile(texturesBuff.at(i)).getTexture();
61
+        unsigned int texture = TextureManager::getTile(texturesBuff.at(i)).getTexture();
62
         for (int v = 0; v < ((indicesBuff.at(i) == 0) ? 4 : 3); v++) {
62
         for (int v = 0; v < ((indicesBuff.at(i) == 0) ? 4 : 3); v++) {
63
             ind.push_back(vert.size());
63
             ind.push_back(vert.size());
64
             vert.push_back(verticesBuff.at(vertIndex + v));
64
             vert.push_back(verticesBuff.at(vertIndex + v));
65
-            uvBuff.push_back(getTextureManager().getTile(texturesBuff.at(i)).getUV(v));
65
+            uvBuff.push_back(TextureManager::getTile(texturesBuff.at(i)).getUV(v));
66
             tex.push_back(texture);
66
             tex.push_back(texture);
67
         }
67
         }
68
 
68
 

+ 2
- 2
src/Render.cpp Wyświetl plik

53
     if (mode == RenderMode::LoadScreen) {
53
     if (mode == RenderMode::LoadScreen) {
54
         glm::vec4 color(1.0f, 1.0f, 1.0f, 1.0f);
54
         glm::vec4 color(1.0f, 1.0f, 1.0f, 1.0f);
55
         drawTexture(0.0f, 0.0f, Window::getSize().x, Window::getSize().y,
55
         drawTexture(0.0f, 0.0f, Window::getSize().x, Window::getSize().y,
56
-                    color, TEXTURE_SPLASH, TextureManager::TextureStorage::SYSTEM);
56
+                    color, TEXTURE_SPLASH, TextureStorage::SYSTEM);
57
         return;
57
         return;
58
     }
58
     }
59
 
59
 
165
 }
165
 }
166
 
166
 
167
 void Render::drawTexture(float x, float y, float w, float h, glm::vec4 color,
167
 void Render::drawTexture(float x, float y, float w, float h, glm::vec4 color,
168
-                         unsigned int texture, TextureManager::TextureStorage s) {
168
+                         unsigned int texture, TextureStorage s) {
169
     std::vector<glm::vec2> vertices;
169
     std::vector<glm::vec2> vertices;
170
     std::vector<glm::vec2> uvs;
170
     std::vector<glm::vec2> uvs;
171
 
171
 

+ 2
- 2
src/RoomMesh.cpp Wyświetl plik

38
 
38
 
39
     int vertIndex = 0;
39
     int vertIndex = 0;
40
     for (int i = 0; i < indicesBuff.size(); i++) {
40
     for (int i = 0; i < indicesBuff.size(); i++) {
41
-        unsigned int texture = getTextureManager().getTile(texturesBuff.at(i)).getTexture();
41
+        unsigned int texture = TextureManager::getTile(texturesBuff.at(i)).getTexture();
42
         for (int v = 0; v < ((indicesBuff.at(i) == 0) ? 4 : 3); v++) {
42
         for (int v = 0; v < ((indicesBuff.at(i) == 0) ? 4 : 3); v++) {
43
             ind.push_back(vert.size());
43
             ind.push_back(vert.size());
44
             vert.push_back(verticesBuff.at(vertIndex + v));
44
             vert.push_back(verticesBuff.at(vertIndex + v));
45
-            uvBuff.push_back(getTextureManager().getTile(texturesBuff.at(i)).getUV(v));
45
+            uvBuff.push_back(TextureManager::getTile(texturesBuff.at(i)).getUV(v));
46
             tex.push_back(texture);
46
             tex.push_back(texture);
47
         }
47
         }
48
 
48
 

+ 119
- 111
src/TextureManager.cpp Wyświetl plik

23
 #include "utils/strings.h"
23
 #include "utils/strings.h"
24
 #include "TextureManager.h"
24
 #include "TextureManager.h"
25
 
25
 
26
-glm::vec2 TextureTile::getUV(unsigned int i) {
27
-    glm::vec2 uv(vertices.at(i).xPixel,
28
-                 vertices.at(i).yPixel);
29
-
30
-    /*! \fixme
31
-     * This is my somewhat hacky approach to fixing
32
-     * the bad texture-bleeding problems everywhere.
33
-     * That's better, but makes the seams between
34
-     * each sector much more visible!
35
-     */
36
-
37
-    if (vertices.at(i).xCoordinate == 1) {
38
-        uv.x += 0.375f;
39
-    }
40
-
41
-    if (vertices.at(i).yCoordinate == 1) {
42
-        uv.y += 0.375f;
43
-    }
44
-
45
-    return uv / 256.0f;
46
-}
47
-
48
-// ----------------------------------------------------------------------------
49
-
50
-TextureManager::~TextureManager() {
51
-    while (mTextureIdsSystem.size() > 0) {
52
-        unsigned int id = mTextureIdsSystem.at(mTextureIdsSystem.size() - 1);
53
-        glDeleteTextures(1, &id);
54
-        mTextureIdsSystem.pop_back();
55
-    }
56
-
57
-    clear();
58
-}
59
-
60
-void TextureManager::clear() {
61
-    while (mTextureIdsGame.size() > 0) {
62
-        unsigned int id = mTextureIdsGame.at(mTextureIdsGame.size() - 1);
63
-        glDeleteTextures(1, &id);
64
-        mTextureIdsGame.pop_back();
65
-    }
66
-
67
-    while (!tiles.empty()) {
68
-        delete tiles.at(tiles.size() - 1);
69
-        tiles.pop_back();
70
-    }
71
-
72
-    animations.clear();
73
-
74
-    gameUnits.clear();
75
-    systemUnits.clear();
76
-    nextFreeTextureUnit = 0;
77
-}
78
-
79
-void TextureManager::addTile(TextureTile* t) {
80
-    tiles.push_back(t);
81
-}
82
-
83
-int TextureManager::numTiles() {
84
-    return tiles.size();
85
-}
86
-
87
-TextureTile& TextureManager::getTile(int index) {
88
-    assert(index >= 0);
89
-    assert(index < tiles.size());
90
-    return *tiles.at(index);
91
-}
92
-
93
-void TextureManager::addAnimatedTile(int index, int tile) {
94
-    while (index >= animations.size())
95
-        animations.push_back(std::vector<int>());
96
-
97
-    animations.at(index).push_back(tile);
98
-}
99
-
100
-int TextureManager::numAnimatedTiles() {
101
-    return animations.size();
102
-}
103
-
104
-int TextureManager::getFirstTileAnimation(int index) {
105
-    assert(index < animations.size());
106
-    assert(animations.at(index).size() > 0);
107
-    return animations.at(index).at(0);
108
-}
109
-
110
-int TextureManager::getNextTileAnimation(int tile) {
111
-    for (int a = 0; a < animations.size(); a++) {
112
-        for (int i = 0; i < animations.at(a).size(); i++) {
113
-            if (animations.at(a).at(i) == tile) {
114
-                if (i < (animations.at(a).size() - 1))
115
-                    return animations.at(a).at(i + 1);
116
-                else
117
-                    return animations.at(a).at(0);
118
-            }
119
-        }
120
-    }
121
-    return -1;
122
-}
123
-
124
-std::vector<unsigned int>& TextureManager::getIds(TextureStorage s) {
125
-    if (s == TextureStorage::GAME)
126
-        return mTextureIdsGame;
127
-    else
128
-        return mTextureIdsSystem;
129
-}
130
-
131
-std::vector<int>& TextureManager::getUnits(TextureStorage s) {
132
-    if (s == TextureStorage::GAME)
133
-        return gameUnits;
134
-    else
135
-        return systemUnits;
136
-}
26
+std::vector<unsigned int> TextureManager::mTextureIdsGame;
27
+std::vector<unsigned int> TextureManager::mTextureIdsSystem;
28
+std::vector<TextureTile*> TextureManager::tiles;
29
+std::vector<std::vector<int>> TextureManager::animations;
30
+std::vector<int> TextureManager::gameUnits;
31
+std::vector<int> TextureManager::systemUnits;
32
+unsigned int TextureManager::nextFreeTextureUnit = 0;
137
 
33
 
138
 int TextureManager::initialize() {
34
 int TextureManager::initialize() {
139
     assert(mTextureIdsGame.size() == 0);
35
     assert(mTextureIdsGame.size() == 0);
176
     return 0;
72
     return 0;
177
 }
73
 }
178
 
74
 
75
+void TextureManager::shutdown() {
76
+    while (mTextureIdsSystem.size() > 0) {
77
+        unsigned int id = mTextureIdsSystem.at(mTextureIdsSystem.size() - 1);
78
+        glDeleteTextures(1, &id);
79
+        mTextureIdsSystem.pop_back();
80
+    }
81
+
82
+    clear();
83
+}
84
+
85
+void TextureManager::clear() {
86
+    while (mTextureIdsGame.size() > 0) {
87
+        unsigned int id = mTextureIdsGame.at(mTextureIdsGame.size() - 1);
88
+        glDeleteTextures(1, &id);
89
+        mTextureIdsGame.pop_back();
90
+    }
91
+
92
+    while (!tiles.empty()) {
93
+        delete tiles.at(tiles.size() - 1);
94
+        tiles.pop_back();
95
+    }
96
+
97
+    animations.clear();
98
+
99
+    gameUnits.clear();
100
+    systemUnits.clear();
101
+    nextFreeTextureUnit = 0;
102
+}
103
+
179
 int TextureManager::loadBufferSlot(unsigned char* image,
104
 int TextureManager::loadBufferSlot(unsigned char* image,
180
                                    unsigned int width, unsigned int height,
105
                                    unsigned int width, unsigned int height,
181
                                    ColorMode mode, unsigned int bpp,
106
                                    ColorMode mode, unsigned int bpp,
272
     }
197
     }
273
 }
198
 }
274
 
199
 
200
+void TextureManager::addTile(TextureTile* t) {
201
+    tiles.push_back(t);
202
+}
203
+
204
+int TextureManager::numTiles() {
205
+    return tiles.size();
206
+}
207
+
208
+TextureTile& TextureManager::getTile(int index) {
209
+    assert(index >= 0);
210
+    assert(index < tiles.size());
211
+    return *tiles.at(index);
212
+}
213
+
214
+void TextureManager::addAnimatedTile(int index, int tile) {
215
+    while (index >= animations.size())
216
+        animations.push_back(std::vector<int>());
217
+
218
+    animations.at(index).push_back(tile);
219
+}
220
+
221
+int TextureManager::numAnimatedTiles() {
222
+    return animations.size();
223
+}
224
+
225
+int TextureManager::getFirstTileAnimation(int index) {
226
+    assert(index < animations.size());
227
+    assert(animations.at(index).size() > 0);
228
+    return animations.at(index).at(0);
229
+}
230
+
231
+int TextureManager::getNextTileAnimation(int tile) {
232
+    for (int a = 0; a < animations.size(); a++) {
233
+        for (int i = 0; i < animations.at(a).size(); i++) {
234
+            if (animations.at(a).at(i) == tile) {
235
+                if (i < (animations.at(a).size() - 1))
236
+                    return animations.at(a).at(i + 1);
237
+                else
238
+                    return animations.at(a).at(0);
239
+            }
240
+        }
241
+    }
242
+    return -1;
243
+}
244
+
275
 int TextureManager::loadImage(std::string filename, TextureStorage s, int slot) {
245
 int TextureManager::loadImage(std::string filename, TextureStorage s, int slot) {
276
     if (stringEndsWith(filename, ".pcx")) {
246
     if (stringEndsWith(filename, ".pcx")) {
277
         return loadPCX(filename, s, slot);
247
         return loadPCX(filename, s, slot);
321
     return -4;
291
     return -4;
322
 }
292
 }
323
 
293
 
294
+std::vector<unsigned int>& TextureManager::getIds(TextureStorage s) {
295
+    if (s == TextureStorage::GAME)
296
+        return mTextureIdsGame;
297
+    else
298
+        return mTextureIdsSystem;
299
+}
300
+
301
+std::vector<int>& TextureManager::getUnits(TextureStorage s) {
302
+    if (s == TextureStorage::GAME)
303
+        return gameUnits;
304
+    else
305
+        return systemUnits;
306
+}
307
+
308
+// ----------------------------------------------------------------------------
309
+
310
+glm::vec2 TextureTile::getUV(unsigned int i) {
311
+    glm::vec2 uv(vertices.at(i).xPixel,
312
+                 vertices.at(i).yPixel);
313
+
314
+    /*! \fixme
315
+     * This is my somewhat hacky approach to fixing
316
+     * the bad texture-bleeding problems everywhere.
317
+     * That's better, but makes the seams between
318
+     * each sector much more visible!
319
+     */
320
+
321
+    if (vertices.at(i).xCoordinate == 1) {
322
+        uv.x += 0.375f;
323
+    }
324
+
325
+    if (vertices.at(i).yCoordinate == 1) {
326
+        uv.y += 0.375f;
327
+    }
328
+
329
+    return uv / 256.0f;
330
+}
331
+

+ 27
- 31
src/UI.cpp Wyświetl plik

92
     void* tex_data = stbi_load_from_memory((const unsigned char*)png_data,
92
     void* tex_data = stbi_load_from_memory((const unsigned char*)png_data,
93
                                            (int)png_size, &tex_x, &tex_y, &tex_comp, 0);
93
                                            (int)png_size, &tex_x, &tex_y, &tex_comp, 0);
94
 
94
 
95
-    fontTex = getTextureManager().loadBufferSlot((unsigned char*)tex_data,
96
-              tex_x, tex_y, TextureManager::ColorMode::RGBA, 32,
97
-              TextureManager::TextureStorage::SYSTEM, -1, false);
95
+    fontTex = TextureManager::loadBufferSlot((unsigned char*)tex_data,
96
+                                             tex_x, tex_y, ColorMode::RGBA, 32,
97
+                                             TextureStorage::SYSTEM, -1, false);
98
 
98
 
99
     stbi_image_free(tex_data);
99
     stbi_image_free(tex_data);
100
 
100
 
219
             static bool game = getGame().isLoaded();
219
             static bool game = getGame().isLoaded();
220
             static int index = 0;
220
             static int index = 0;
221
             ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
221
             ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
222
-            ImGui::SliderInt("##texslide", &index, 0, getTextureManager().numTextures(
223
-                                 game ? TextureManager::TextureStorage::GAME
224
-                                 : TextureManager::TextureStorage::SYSTEM) - 1);
222
+            ImGui::SliderInt("##texslide", &index, 0, TextureManager::.numTextures(
223
+                                 game ? TextureStorage::GAME : TextureStorage::SYSTEM) - 1);
225
             ImGui::PopItemWidth();
224
             ImGui::PopItemWidth();
226
             ImGui::SameLine();
225
             ImGui::SameLine();
227
             if (ImGui::Button("+##texplus", ImVec2(0, 0), true)) {
226
             if (ImGui::Button("+##texplus", ImVec2(0, 0), true)) {
228
-                if (index < (getTextureManager().numTextures(
229
-                                 game ? TextureManager::TextureStorage::GAME
230
-                                 : TextureManager::TextureStorage::SYSTEM) - 1))
227
+                if (index < (TextureManager::numTextures(
228
+                                 game ? TextureStorage::GAME : TextureStorage::SYSTEM) - 1))
231
                     index++;
229
                     index++;
232
                 else
230
                 else
233
                     index = 0;
231
                     index = 0;
237
                 if (index > 0)
235
                 if (index > 0)
238
                     index--;
236
                     index--;
239
                 else
237
                 else
240
-                    index = getTextureManager().numTextures(
241
-                                game ? TextureManager::TextureStorage::GAME
242
-                                : TextureManager::TextureStorage::SYSTEM) - 1;
238
+                    index = TextureManager::numTextures(
239
+                                game ? TextureStorage::GAME : TextureStorage::SYSTEM) - 1;
243
             }
240
             }
244
             ImGui::SameLine();
241
             ImGui::SameLine();
245
-            if ((getTextureManager().numTextures() > 0)) {
242
+            if ((TextureManager::numTextures() > 0)) {
246
                 ImGui::Checkbox("Game##texgame", &game);
243
                 ImGui::Checkbox("Game##texgame", &game);
247
             } else {
244
             } else {
248
                 game = false;
245
                 game = false;
261
             }
258
             }
262
             if (visibleTex) {
259
             if (visibleTex) {
263
                 getRender().debugDisplayTexture(index,
260
                 getRender().debugDisplayTexture(index,
264
-                                                game ? TextureManager::TextureStorage::GAME
265
-                                                : TextureManager::TextureStorage::SYSTEM,
261
+                                                game ? TextureStorage::GAME : TextureStorage::SYSTEM,
266
                                                 ImGui::GetWindowPos().x - ImGui::GetWindowWidth(),
262
                                                 ImGui::GetWindowPos().x - ImGui::GetWindowWidth(),
267
                                                 ImGui::GetWindowPos().y,
263
                                                 ImGui::GetWindowPos().y,
268
                                                 ImGui::GetWindowWidth(), ImGui::GetWindowWidth());
264
                                                 ImGui::GetWindowWidth(), ImGui::GetWindowWidth());
270
         }
266
         }
271
 
267
 
272
         if (ImGui::CollapsingHeader("Textile Viewer")) {
268
         if (ImGui::CollapsingHeader("Textile Viewer")) {
273
-            if (getTextureManager().numTiles() > 0) {
269
+            if (TextureManager::numTiles() > 0) {
274
                 static int index = 0;
270
                 static int index = 0;
275
                 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
271
                 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
276
-                ImGui::SliderInt("##tileslide", &index, 0, getTextureManager().numTiles() - 1);
272
+                ImGui::SliderInt("##tileslide", &index, 0, TextureManager::numTiles() - 1);
277
                 ImGui::PopItemWidth();
273
                 ImGui::PopItemWidth();
278
                 ImGui::SameLine();
274
                 ImGui::SameLine();
279
                 if (ImGui::Button("+##tileplus", ImVec2(0, 0), true)) {
275
                 if (ImGui::Button("+##tileplus", ImVec2(0, 0), true)) {
280
-                    if (index < (getTextureManager().numTiles() - 1))
276
+                    if (index < (TextureManager::numTiles() - 1))
281
                         index++;
277
                         index++;
282
                     else
278
                     else
283
                         index = 0;
279
                         index = 0;
287
                     if (index > 0)
283
                     if (index > 0)
288
                         index--;
284
                         index--;
289
                     else
285
                     else
290
-                        index = getTextureManager().numTiles() - 1;
286
+                        index = TextureManager::numTiles() - 1;
291
                 }
287
                 }
292
                 ImGui::SameLine();
288
                 ImGui::SameLine();
293
                 if (ImGui::Button("Show##tileshow")) {
289
                 if (ImGui::Button("Show##tileshow")) {
301
                     getRender().debugDisplayTextile();
297
                     getRender().debugDisplayTextile();
302
                     visibleTile = false;
298
                     visibleTile = false;
303
                 }
299
                 }
304
-                if (visibleTile && (index < getTextureManager().numTiles())) {
305
-                    ImGui::Text(getTextureManager().getTile(index).isTriangle() ? "Triangle" : "Rectangle");
300
+                if (visibleTile && (index < TextureManager::numTiles())) {
301
+                    ImGui::Text(TextureManager::.getTile(index).isTriangle() ? "Triangle" : "Rectangle");
306
                 }
302
                 }
307
                 if (visibleTile) {
303
                 if (visibleTile) {
308
                     getRender().debugDisplayTextile(index,
304
                     getRender().debugDisplayTextile(index,
316
         }
312
         }
317
 
313
 
318
         if (ImGui::CollapsingHeader("Animated Textile Viewer")) {
314
         if (ImGui::CollapsingHeader("Animated Textile Viewer")) {
319
-            if (getTextureManager().numAnimatedTiles() > 0) {
315
+            if (TextureManager::.numAnimatedTiles() > 0) {
320
                 static int index = 0;
316
                 static int index = 0;
321
-                static int tile = getTextureManager().getFirstTileAnimation(index);
317
+                static int tile = TextureManager::.getFirstTileAnimation(index);
322
                 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
318
                 ImGui::PushItemWidth(ImGui::GetWindowWidth() * 0.5f);
323
-                if (ImGui::SliderInt("##animslide", &index, 0, getTextureManager().numAnimatedTiles() - 1)) {
324
-                    tile = getTextureManager().getFirstTileAnimation(index);
319
+                if (ImGui::SliderInt("##animslide", &index, 0, TextureManager::.numAnimatedTiles() - 1)) {
320
+                    tile = TextureManager::.getFirstTileAnimation(index);
325
                 }
321
                 }
326
                 ImGui::PopItemWidth();
322
                 ImGui::PopItemWidth();
327
                 ImGui::SameLine();
323
                 ImGui::SameLine();
328
                 if (ImGui::Button("+##animplus", ImVec2(0, 0), true)) {
324
                 if (ImGui::Button("+##animplus", ImVec2(0, 0), true)) {
329
-                    if (index < (getTextureManager().numAnimatedTiles() - 1))
325
+                    if (index < (TextureManager::.numAnimatedTiles() - 1))
330
                         index++;
326
                         index++;
331
                     else
327
                     else
332
                         index = 0;
328
                         index = 0;
333
-                    tile = getTextureManager().getFirstTileAnimation(index);
329
+                    tile = TextureManager::.getFirstTileAnimation(index);
334
                 }
330
                 }
335
                 ImGui::SameLine();
331
                 ImGui::SameLine();
336
                 if (ImGui::Button("-##animminus", ImVec2(0, 0), true)) {
332
                 if (ImGui::Button("-##animminus", ImVec2(0, 0), true)) {
337
                     if (index > 0)
333
                     if (index > 0)
338
                         index--;
334
                         index--;
339
                     else
335
                     else
340
-                        index = getTextureManager().numAnimatedTiles() - 1;
341
-                    tile = getTextureManager().getFirstTileAnimation(index);
336
+                        index = TextureManager::.numAnimatedTiles() - 1;
337
+                    tile = TextureManager::.getFirstTileAnimation(index);
342
                 }
338
                 }
343
                 ImGui::SameLine();
339
                 ImGui::SameLine();
344
                 if (ImGui::Button("Show##animshow")) {
340
                 if (ImGui::Button("Show##animshow")) {
362
                                                         ImGui::GetWindowPos().y,
358
                                                         ImGui::GetWindowPos().y,
363
                                                         (ImGui::GetWindowWidth() / 2), (ImGui::GetWindowWidth() / 2));
359
                                                         (ImGui::GetWindowWidth() / 2), (ImGui::GetWindowWidth() / 2));
364
                         fr = RunTime::getFPS() / 2;
360
                         fr = RunTime::getFPS() / 2;
365
-                        tile = getTextureManager().getNextTileAnimation(tile);
361
+                        tile = TextureManager::.getNextTileAnimation(tile);
366
                     }
362
                     }
367
                     ImGui::Text("Current Tile: %d", tile);
363
                     ImGui::Text("Current Tile: %d", tile);
368
                 }
364
                 }
537
 
533
 
538
     imguiShader.use();
534
     imguiShader.use();
539
     imguiShader.loadUniform(0, Window::getSize());
535
     imguiShader.loadUniform(0, Window::getSize());
540
-    imguiShader.loadUniform(1, fontTex, TextureManager::TextureStorage::SYSTEM);
536
+    imguiShader.loadUniform(1, fontTex, TextureStorage::SYSTEM);
541
     vert.bindBuffer(0, 2);
537
     vert.bindBuffer(0, 2);
542
     uv.bindBuffer(1, 2);
538
     uv.bindBuffer(1, 2);
543
     col.bindBuffer(2, 4);
539
     col.bindBuffer(2, 4);

+ 5
- 5
src/loader/LoaderTR2.cpp Wyświetl plik

88
 
88
 
89
         // Convert 16bit textile to 32bit textile
89
         // Convert 16bit textile to 32bit textile
90
         unsigned char* img = argb16to32(&arr[0], 256, 256);
90
         unsigned char* img = argb16to32(&arr[0], 256, 256);
91
-        int r = getTextureManager().loadBufferSlot(img, 256, 256,
92
-                TextureManager::ColorMode::ARGB, 32,
93
-                TextureManager::TextureStorage::GAME, i);
91
+        int r = TextureManager::loadBufferSlot(img, 256, 256,
92
+                                               ColorMode::ARGB, 32,
93
+                                               TextureStorage::GAME, i);
94
         assert(r >= 0); //! \fixme properly handle error when texture could not be loaded!
94
         assert(r >= 0); //! \fixme properly handle error when texture could not be loaded!
95
         delete [] img;
95
         delete [] img;
96
     }
96
     }
134
             t->add(TextureTileVertex(xCoordinate, xPixel, yCoordinate, yPixel));
134
             t->add(TextureTileVertex(xCoordinate, xPixel, yCoordinate, yPixel));
135
         }
135
         }
136
 
136
 
137
-        getTextureManager().addTile(t);
137
+        TextureManager::addTile(t);
138
     }
138
     }
139
 
139
 
140
     if (numObjectTextures > 0)
140
     if (numObjectTextures > 0)
161
         }
161
         }
162
 
162
 
163
         for (int i = 0; i < count; i++) {
163
         for (int i = 0; i < count; i++) {
164
-            getTextureManager().addAnimatedTile(a, animatedTextures.at(pos + i + 1));
164
+            TextureManager::addAnimatedTile(a, animatedTextures.at(pos + i + 1));
165
         }
165
         }
166
 
166
 
167
         pos += count + 1;
167
         pos += count + 1;

+ 2
- 8
src/main.cpp Wyświetl plik

31
 static std::shared_ptr<Game> gGame;
31
 static std::shared_ptr<Game> gGame;
32
 static std::shared_ptr<Log> gLog;
32
 static std::shared_ptr<Log> gLog;
33
 static std::shared_ptr<MenuFolder> gMenu;
33
 static std::shared_ptr<MenuFolder> gMenu;
34
-static std::shared_ptr<TextureManager> gTextureManager;
35
 static std::shared_ptr<World> gWorld;
34
 static std::shared_ptr<World> gWorld;
36
 
35
 
37
 Game& getGame() {
36
 Game& getGame() {
46
     return *gMenu;
45
     return *gMenu;
47
 }
46
 }
48
 
47
 
49
-TextureManager& getTextureManager() {
50
-    return *gTextureManager;
51
-}
52
-
53
 World& getWorld() {
48
 World& getWorld() {
54
     return *gWorld;
49
     return *gWorld;
55
 }
50
 }
70
     gGame.reset(new Game());
65
     gGame.reset(new Game());
71
     gLog.reset(new Log());
66
     gLog.reset(new Log());
72
     gMenu.reset(new MenuFolder());
67
     gMenu.reset(new MenuFolder());
73
-    gTextureManager.reset(new TextureManager());
74
     gWorld.reset(new World());
68
     gWorld.reset(new World());
75
 
69
 
76
     Command::fillCommandList();
70
     Command::fillCommandList();
91
     }
85
     }
92
 
86
 
93
     // Initialize Texture Manager
87
     // Initialize Texture Manager
94
-    error = getTextureManager().initialize();
88
+    error = TextureManager::initialize();
95
     if (error != 0) {
89
     if (error != 0) {
96
         std::cout << "Could not initialize TextureManager (" << error << ")!" << std::endl;
90
         std::cout << "Could not initialize TextureManager (" << error << ")!" << std::endl;
97
         return -3;
91
         return -3;
111
         Command::executeFile(configFileToUse);
105
         Command::executeFile(configFileToUse);
112
     }
106
     }
113
 
107
 
114
-    error = getTextureManager().initializeSplash();
108
+    error = TextureManager::initializeSplash();
115
     if (error != 0) {
109
     if (error != 0) {
116
         std::cout << "Coult not load Splash Texture (" << error << ")!" << std::endl;
110
         std::cout << "Coult not load Splash Texture (" << error << ")!" << std::endl;
117
         return -4;
111
         return -4;

+ 21
- 20
src/system/FontSDL.cpp Wyświetl plik

37
         }
37
         }
38
 
38
 
39
         // Reserve slot
39
         // Reserve slot
40
-        mFontTexture = getTextureManager().loadBufferSlot(nullptr, 256, 256,
41
-                       TextureManager::ColorMode::RGBA, 32, TextureManager::TextureStorage::SYSTEM);
40
+        mFontTexture = TextureManager::loadBufferSlot(nullptr, 256, 256,
41
+                                                      ColorMode::RGBA, 32,
42
+                                                      TextureStorage::SYSTEM);
42
 
43
 
43
         mFontInit = true;
44
         mFontInit = true;
44
     }
45
     }
88
     int w = (int)((float)surface->w * scale);
89
     int w = (int)((float)surface->w * scale);
89
     int h = (int)((float)surface->h * scale);
90
     int h = (int)((float)surface->h * scale);
90
 
91
 
91
-    TextureManager::ColorMode textureFormat;
92
+    ColorMode textureFormat;
92
     unsigned int bpp = 0;
93
     unsigned int bpp = 0;
93
     if (surface->format->BytesPerPixel == 4) {
94
     if (surface->format->BytesPerPixel == 4) {
94
         if (surface->format->Rmask == 0x000000FF)
95
         if (surface->format->Rmask == 0x000000FF)
95
-            textureFormat = TextureManager::ColorMode::RGBA;
96
+            textureFormat = ColorMode::RGBA;
96
         else
97
         else
97
-            textureFormat = TextureManager::ColorMode::BGRA;
98
+            textureFormat = ColorMode::BGRA;
98
         bpp = 32;
99
         bpp = 32;
99
     } else {
100
     } else {
100
         if (surface->format->Rmask == 0x000000FF)
101
         if (surface->format->Rmask == 0x000000FF)
101
-            textureFormat = TextureManager::ColorMode::RGB;
102
+            textureFormat = ColorMode::RGB;
102
         else
103
         else
103
-            textureFormat = TextureManager::ColorMode::BGR;
104
+            textureFormat = ColorMode::BGR;
104
         bpp = 24;
105
         bpp = 24;
105
     }
106
     }
106
 
107
 
107
-    getTextureManager().loadBufferSlot(static_cast<unsigned char*>(surface->pixels),
108
-                                       surface->w, surface->h, textureFormat, bpp,
109
-                                       TextureManager::TextureStorage::SYSTEM, mFontTexture);
108
+    TextureManager::loadBufferSlot(static_cast<unsigned char*>(surface->pixels),
109
+                                   surface->w, surface->h, textureFormat, bpp,
110
+                                   TextureStorage::SYSTEM, mFontTexture);
110
     SDL_FreeSurface(surface);
111
     SDL_FreeSurface(surface);
111
 
112
 
112
     std::vector<glm::vec2> vertices;
113
     std::vector<glm::vec2> vertices;
131
     vertexBuffer.bufferData(vertices);
132
     vertexBuffer.bufferData(vertices);
132
     uvBuffer.bufferData(uvs);
133
     uvBuffer.bufferData(uvs);
133
     Shader::drawGL(vertexBuffer, uvBuffer, glm::vec4(1.0f, 1.0f, 1.0f, 1.0f),
134
     Shader::drawGL(vertexBuffer, uvBuffer, glm::vec4(1.0f, 1.0f, 1.0f, 1.0f),
134
-                   mFontTexture, TextureManager::TextureStorage::SYSTEM);
135
+                   mFontTexture, TextureStorage::SYSTEM);
135
 }
136
 }
136
 
137
 
137
 unsigned int FontSDL::heightText(float scale, unsigned int maxWidth, std::string s) {
138
 unsigned int FontSDL::heightText(float scale, unsigned int maxWidth, std::string s) {
173
     int w = (int)((float)surface->w * scale);
174
     int w = (int)((float)surface->w * scale);
174
     int h = (int)((float)surface->h * scale);
175
     int h = (int)((float)surface->h * scale);
175
 
176
 
176
-    TextureManager::ColorMode textureFormat;
177
+    ColorMode textureFormat;
177
     unsigned int bpp = 0;
178
     unsigned int bpp = 0;
178
     if (surface->format->BytesPerPixel == 4) {
179
     if (surface->format->BytesPerPixel == 4) {
179
         if (surface->format->Rmask == 0x000000FF)
180
         if (surface->format->Rmask == 0x000000FF)
180
-            textureFormat = TextureManager::ColorMode::RGBA;
181
+            textureFormat = ColorMode::RGBA;
181
         else
182
         else
182
-            textureFormat = TextureManager::ColorMode::BGRA;
183
+            textureFormat = ColorMode::BGRA;
183
         bpp = 32;
184
         bpp = 32;
184
     } else {
185
     } else {
185
         if (surface->format->Rmask == 0x000000FF)
186
         if (surface->format->Rmask == 0x000000FF)
186
-            textureFormat = TextureManager::ColorMode::RGB;
187
+            textureFormat = ColorMode::RGB;
187
         else
188
         else
188
-            textureFormat = TextureManager::ColorMode::BGR;
189
+            textureFormat = ColorMode::BGR;
189
         bpp = 24;
190
         bpp = 24;
190
     }
191
     }
191
 
192
 
192
-    getTextureManager().loadBufferSlot(static_cast<unsigned char*>(surface->pixels),
193
-                                       surface->w, surface->h, textureFormat, bpp,
194
-                                       TextureManager::TextureStorage::SYSTEM, mFontTexture);
193
+    TextureManager::loadBufferSlot(static_cast<unsigned char*>(surface->pixels),
194
+                                   surface->w, surface->h, textureFormat, bpp,
195
+                                   TextureStorage::SYSTEM, mFontTexture);
195
     SDL_FreeSurface(surface);
196
     SDL_FreeSurface(surface);
196
 
197
 
197
     std::vector<glm::vec2> vertices;
198
     std::vector<glm::vec2> vertices;
216
     vertexBuffer.bufferData(vertices);
217
     vertexBuffer.bufferData(vertices);
217
     uvBuffer.bufferData(uvs);
218
     uvBuffer.bufferData(uvs);
218
     Shader::drawGL(vertexBuffer, uvBuffer, glm::vec4(1.0f, 1.0f, 1.0f, 1.0f),
219
     Shader::drawGL(vertexBuffer, uvBuffer, glm::vec4(1.0f, 1.0f, 1.0f, 1.0f),
219
-                   mFontTexture, TextureManager::TextureStorage::SYSTEM);
220
+                   mFontTexture, TextureStorage::SYSTEM);
220
 }
221
 }
221
 
222
 

+ 3
- 2
src/system/FontTRLE.cpp Wyświetl plik

48
         pixels[i] = pixels[i + 1] = pixels[i + 2] = (unsigned char)y;
48
         pixels[i] = pixels[i + 1] = pixels[i + 2] = (unsigned char)y;
49
     }
49
     }
50
 
50
 
51
-    mFontTexture = getTextureManager().loadBufferSlot(pixels, 256, 256,
52
-                   TextureManager::ColorMode::BGRA, 32, TextureManager::TextureStorage::SYSTEM);
51
+    mFontTexture = TextureManager::loadBufferSlot(pixels, 256, 256,
52
+                                                  ColorMode::BGRA, 32,
53
+                                                  TextureStorage::SYSTEM);
53
     delete [] pixels;
54
     delete [] pixels;
54
 
55
 
55
     // Try to load .lps file or use default glyph positions
56
     // Try to load .lps file or use default glyph positions

+ 5
- 6
src/system/Shader.cpp Wyświetl plik

7
 
7
 
8
 #include "global.h"
8
 #include "global.h"
9
 #include "Log.h"
9
 #include "Log.h"
10
-#include "TextureManager.h"
11
 #include "system/Window.h"
10
 #include "system/Window.h"
12
 #include "system/Shader.h"
11
 #include "system/Shader.h"
13
 
12
 
88
     glUniformMatrix4fv(getUniform(uni), 1, GL_FALSE, &mat[0][0]);
87
     glUniformMatrix4fv(getUniform(uni), 1, GL_FALSE, &mat[0][0]);
89
 }
88
 }
90
 
89
 
91
-void Shader::loadUniform(int uni, int texture, TextureManager::TextureStorage store) {
92
-    glUniform1i(getUniform(uni), getTextureManager().bindTexture(texture, store));
90
+void Shader::loadUniform(int uni, int texture, TextureStorage store) {
91
+    glUniform1i(getUniform(uni), TextureManager::bindTexture(texture, store));
93
 }
92
 }
94
 
93
 
95
 void Shader::use() {
94
 void Shader::use() {
231
 }
230
 }
232
 
231
 
233
 void Shader::drawGL(ShaderBuffer& vertices, ShaderBuffer& uvs, glm::vec4 color,
232
 void Shader::drawGL(ShaderBuffer& vertices, ShaderBuffer& uvs, glm::vec4 color,
234
-                    unsigned int texture, TextureManager::TextureStorage store) {
233
+                    unsigned int texture, TextureStorage store) {
235
     assert(vertices.getSize() == uvs.getSize());
234
     assert(vertices.getSize() == uvs.getSize());
236
     assert((vertices.getSize() % 3) == 0);
235
     assert((vertices.getSize() % 3) == 0);
237
 
236
 
251
 }
250
 }
252
 
251
 
253
 void Shader::drawGL(ShaderBuffer& vertices, ShaderBuffer& uvs, unsigned int texture,
252
 void Shader::drawGL(ShaderBuffer& vertices, ShaderBuffer& uvs, unsigned int texture,
254
-                    glm::mat4 MVP, TextureManager::TextureStorage store) {
253
+                    glm::mat4 MVP, TextureStorage store) {
255
     assert(vertices.getSize() == uvs.getSize());
254
     assert(vertices.getSize() == uvs.getSize());
256
     assert((vertices.getSize() % 3) == 0);
255
     assert((vertices.getSize() % 3) == 0);
257
 
256
 
266
 }
265
 }
267
 
266
 
268
 void Shader::drawGL(ShaderBuffer& vertices, ShaderBuffer& uvs, ShaderBuffer& indices,
267
 void Shader::drawGL(ShaderBuffer& vertices, ShaderBuffer& uvs, ShaderBuffer& indices,
269
-                    unsigned int texture, glm::mat4 MVP, TextureManager::TextureStorage store) {
268
+                    unsigned int texture, glm::mat4 MVP, TextureStorage store) {
270
     assert(vertices.getSize() == uvs.getSize());
269
     assert(vertices.getSize() == uvs.getSize());
271
     assert((indices.getSize() % 3) == 0);
270
     assert((indices.getSize() % 3) == 0);
272
 
271
 

+ 2
- 2
src/utils/pcx.cpp Wyświetl plik

67
 
67
 
68
 int pcxLoad(const char* filename, unsigned char** image,
68
 int pcxLoad(const char* filename, unsigned char** image,
69
             unsigned int* width, unsigned int* height,
69
             unsigned int* width, unsigned int* height,
70
-            TextureManager::ColorMode* mode, unsigned int* bpp) {
70
+            ColorMode* mode, unsigned int* bpp) {
71
     assert(filename != nullptr);
71
     assert(filename != nullptr);
72
     assert(filename[0] != '\0');
72
     assert(filename[0] != '\0');
73
     assert(image != nullptr);
73
     assert(image != nullptr);
242
         }
242
         }
243
     }
243
     }
244
 
244
 
245
-    *mode = TextureManager::ColorMode::RGBA;
245
+    *mode = ColorMode::RGBA;
246
     *bpp = 32;
246
     *bpp = 32;
247
 
247
 
248
     delete [] buffer;
248
     delete [] buffer;

Ładowanie…
Anuluj
Zapisz