Copperfield Engine 0.1
C++ Game Engine
Loading...
Searching...
No Matches
texture.hpp
1#pragma once
2#include <optional>
3#include "globals.hpp"
4#include "GL/glew.h"
5#include "GLFW/glfw3.h"
6
7
8
9
10class Texture {
11 public:
12 ~Texture();
13 Texture(int width, int height);
14 Texture(unsigned int id, std::string name, Format internal_format,
15 ColorFormat color_format,
16 Filter min_filter,
17 Filter mag_filte, Wrap wrap_s,
18 Wrap wrap_t, Wrap wrap_r,
19 DataType data_type);
20
35 static std::optional<Texture> LoadTexture(
36 const std::string& path, const std::string& name,
37 Format internal_format = Format::T_2D,
38 ColorFormat color_format = ColorFormat::F_RGBA,
39 Filter min_filter = Filter::F_NEAREST,
40 Filter mag_filter = Filter::F_NEAREST, Wrap wrap_s = Wrap::W_REPEAT,
41 Wrap wrap_t = Wrap::W_REPEAT, Wrap wrap_r = Wrap::W_REPEAT,
42 DataType data_type = DataType::T_UBYTE_1);
43
44 bool CreateTexture(class ResourceManager& e);
45
46 void Bind() const;
47 Texture(const Texture& other) = delete;
48 Texture(Texture&& other) noexcept;
49 Texture& operator=(Texture& other) = delete;
50 Texture& operator=(Texture&& other) noexcept;
51
52 unsigned int texture_id() const {return texture_id_;}
53
54 private:
55
56 std::string name_;
57
58 unsigned char* data_;
59 unsigned int texture_id_;
60
61 int width_;
62 int height_;
63 int nrChannels_;
64
65 Format format_;
66 Filter min_filter_;
67 Filter mag_filter_;
68 Wrap wrap_r_;
69 Wrap wrap_t_;
70 Wrap wrap_s_;
71 DataType data_type_;
72 ColorFormat color_format_;
73
74};
Stores and offers access to all meshes, textures, and sounds of the engine.
Definition: resource_manager.hpp:27
contains globally accessible enums