MobileRT  1.0
A multi platform C++ CPU progressive Ray Tracer.
Texture.hpp
Go to the documentation of this file.
1 #ifndef MOBILERT_TEXTURE_HPP
2 #define MOBILERT_TEXTURE_HPP
3 
4 #include <glm/glm.hpp>
5 #include <memory>
6 #include <string>
7 #include <vector>
8 
9 namespace MobileRT {
16  class Texture {
17  private:
18  ::std::shared_ptr<::std::uint8_t> pointer_ {};
19  ::std::uint8_t *image_ {};
20  ::std::int32_t width_ {};
21  ::std::int32_t height_ {};
22  ::std::int32_t channels_ {};
23 
24  public:
25  explicit Texture() = default;
26 
27  explicit Texture(
28  ::std::shared_ptr<::std::uint8_t> pointer,
29  ::std::int32_t width,
30  ::std::int32_t height,
31  ::std::int32_t channels
32  );
33 
34  Texture(const Texture &texture) = default;
35 
36  Texture(Texture &&texture) noexcept = default;
37 
38  ~Texture() = default;
39 
40  Texture &operator=(const Texture &texture) = default;
41 
42  Texture &operator=(Texture &&texture) noexcept = default;
43 
44  ::glm::vec3 loadColor(const ::glm::vec2 &texCoords) const;
45 
46  bool isValid() const;
47 
48  bool operator==(const Texture &texture) const;
49 
50  static Texture createTexture(::std::string &&texture, long size);
51 
52  static Texture createTexture(const ::std::string &texturePath);
53  };
54 }//namespace MobileRT
55 
56 #endif //MOBILERT_TEXTURE_HPP
bool isValid() const
Definition: Texture.cpp:137
::glm::vec3 loadColor(const ::glm::vec2 &texCoords) const
Definition: Texture.cpp:37
::std::int32_t width_
Definition: Texture.hpp:20
::std::int32_t height_
Definition: Texture.hpp:21
Definition: Texture.hpp:16
::std::shared_ptr<::std::uint8_t > pointer_
Definition: Texture.hpp:18
Texture & operator=(const Texture &texture)=default
::std::int32_t channels_
Definition: Texture.hpp:22
~Texture()=default
::std::uint8_t * image_
Definition: Texture.hpp:19
static Texture createTexture(::std::string &&texture, long size)
bool operator==(const Texture &texture) const
Definition: Texture.cpp:123
Definition: AABB.cpp:105