Ocular Engine
Texture2D.hpp
1 
17 #pragma once
18 #ifndef __H__OCULAR_GRAPHICS_TEXTURE2D__H__
19 #define __H__OCULAR_GRAPHICS_TEXTURE2D__H__
20 
21 #include "Graphics/Texture/Texture.hpp"
22 #include "Graphics/Texture/TextureEnums.hpp"
23 
24 #include "Math/Color.hpp"
25 
26 #include <vector>
27 
28 //------------------------------------------------------------------------------------------
29 
34 namespace Ocular
35 {
40  namespace Graphics
41  {
45  class Texture2D : public Texture
46  {
47  public:
48 
52  Texture2D(TextureDescriptor const& descriptor);
53  virtual ~Texture2D();
54 
55  //----------------------------------------
56  // Inherited
57 
65  virtual void unload();
66 
74  virtual void apply();
75 
83  virtual void refresh();
84 
85  //----------------------------------------
86 
96  Core::Color getPixel(uint32_t x, uint32_t y) const;
97 
109  bool setPixel(uint32_t x, uint32_t y, Core::Color const& color);
110 
127  bool getPixels(std::vector<Core::Color>& pixels, uint32_t startX = 0, uint32_t startY = 0, uint32_t width = 0, uint32_t height = 0) const;
128 
146  bool setPixels(std::vector<Core::Color> const& pixels, uint32_t startX = 0, uint32_t startY = 0, uint32_t width = 0, uint32_t height = 0);
147 
151  unsigned getWidth() const;
152 
157  void setWidth(uint32_t const& width);
158 
162  unsigned getHeight() const;
163 
168  void setHeight(uint32_t const& height);
169 
170  protected:
171 
172  void getTrueDimensions(uint32_t startX, uint32_t startY, uint32_t& trueWidth, uint32_t& trueHeight) const;
173 
174  //----------------------------------------
175 
176  std::vector<Core::Color> m_Pixels;
177 
178  private:
179  };
180  }
184 }
189 //------------------------------------------------------------------------------------------
190 
191 #endif
Definition: Texture2D.hpp:45
bool getPixels(std::vector< Core::Color > &pixels, uint32_t startX=0, uint32_t startY=0, uint32_t width=0, uint32_t height=0) const
Definition: Texture2D.cpp:92
unsigned getHeight() const
Definition: Texture2D.cpp:171
Texture2D(TextureDescriptor const &descriptor)
Definition: Texture2D.cpp:34
virtual void unload()
Definition: Texture2D.cpp:49
Note: Once this library is made dynamic, this will no longer be needed.
Definition: Common.hpp:70
bool setPixel(uint32_t x, uint32_t y, Core::Color const &color)
Definition: Texture2D.cpp:78
Definition: Color.hpp:40
Definition: TextureDescriptor.hpp:45
virtual void apply()
Definition: Texture2D.cpp:56
bool setPixels(std::vector< Core::Color > const &pixels, uint32_t startX=0, uint32_t startY=0, uint32_t width=0, uint32_t height=0)
Definition: Texture2D.cpp:125
Core::Color getPixel(uint32_t x, uint32_t y) const
Definition: Texture2D.cpp:66
virtual void refresh()
Definition: Texture2D.cpp:61
unsigned getWidth() const
Definition: Texture2D.cpp:157
void setHeight(uint32_t const &height)
Definition: Texture2D.cpp:176
void setWidth(uint32_t const &width)
Definition: Texture2D.cpp:162
Base class for all texture objects.
Definition: Texture.hpp:45