Lugdunum  0.1.0
Texture.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 
9 
10 namespace lug {
11 namespace Graphics {
12 
13 class Renderer;
14 
15 namespace Builder {
16 
19 
20  struct Layer {
21  const unsigned char* data{nullptr};
22  };
23 
24 public:
25  enum class Type {
26  Texture2D,
27  CubeMap
28  };
29 
30 public:
31  explicit Texture(Renderer& renderer);
32 
33  Texture(const Texture&) = delete;
34  Texture(Texture&&) = delete;
35 
36  Texture& operator=(const Texture&) = delete;
37  Texture& operator=(Texture&&) = delete;
38 
39  ~Texture();
40 
45  void setName(const std::string& name);
46 
47  void setType(Type type);
48 
49  void setMipLevels(uint32_t mipLevels);
50 
51  void setMagFilter(Render::Texture::Filter magFilter);
52  void setMinFilter(Render::Texture::Filter minFilter);
53  void setMipMapFilter(Render::Texture::Filter mipMapFilter);
54  void setWrapS(Render::Texture::WrappingMode wrapS);
55  void setWrapT(Render::Texture::WrappingMode wrapT);
56  void setWrapW(Render::Texture::WrappingMode wrapW);
57 
58  bool addLayer(const std::string& filename, bool hdr = false);
59  bool addLayer(uint32_t width, uint32_t height, Render::Texture::Format format, const unsigned char* data = nullptr);
60 
62 
63 protected:
65 
66  std::string _name;
67 
68  Type _type{Type::Texture2D};
69 
70  uint32_t _width{0};
71  uint32_t _height{0};
73 
74  uint32_t _mipLevels{1};
75 
79 
83 
84  std::vector<Layer> _layers;
85 };
86 
88 
89 } // Builder
90 } // Graphics
91 } // lug
#define LUG_GRAPHICS_API
Definition: Export.hpp:11
Resource::SharedPtr< lug::Graphics::Render::Texture > build(const ::lug::Graphics::Builder::Texture &builder)
Definition: Texture.cpp:17
std::vector< Layer > _layers
Definition: Texture.hpp:84