Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
Texture.h
Go to the documentation of this file.
1#pragma once
2
3#include <GL/glew.h>
4#include <memory>
5#include <string>
6#include <unordered_map>
7
8namespace eng
9{
10 class Texture
11 {
12 public:
13 Texture(int width, int height, int numChannels, unsigned char* data);
14 ~Texture();
15 GLuint GetID() const;
16 void Init(int width, int height, int numChannels, unsigned char* data);
17
18 static std::shared_ptr<Texture> Load(const std::string& path);
19
20 private:
21 int m_width = 0;
22 int m_height = 0;
23 int m_numChannels = 0;
24 GLuint m_textureID = 0;
25 };
26
28 {
29 public:
30 std::shared_ptr<Texture> GetOrLoadTexture(const std::string& path);
31
32 private:
33 std::unordered_map<std::string, std::shared_ptr<Texture>> m_textures;
34 };
35}
unsigned int GLuint
Definition GLForward.h:11
std::shared_ptr< Texture > GetOrLoadTexture(const std::string &path)
Definition Texture.cpp:78
GLuint GetID() const
Definition Texture.cpp:23
static std::shared_ptr< Texture > Load(const std::string &path)
Definition Texture.cpp:53
void Init(int width, int height, int numChannels, unsigned char *data)
Definition Texture.cpp:28