TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
tb_render_target.hpp
1 
9 #ifndef TurtleBrains_RenderTarget_hpp
10 #define TurtleBrains_RenderTarget_hpp
11 
12 #include <turtle_brains/graphics/tb_texture_manager.hpp> //For PixelSpace and TextureHandle types.
13 #include <turtle_brains/graphics/tb_color.hpp>
14 
15 #include <memory>
16 
17 namespace TurtleBrains::Graphics
18 {
19  namespace Implementation { struct RenderTargetData; }
20 
26  {
27  public:
32  static void CreateGraphicsContext(void);
33 
37  static void DestroyGraphicsContext(void);
38 
54  explicit RenderTarget(const PixelSpace& targetWidth, const PixelSpace& targetHeight,
55  TextureFormat colorFormat = TextureFormat::ColorARGB8, TextureFormat depthFormat = TextureFormat::InvalidFormat);
56 
69  explicit RenderTarget(const PixelSpace& targetWidth, const PixelSpace& targetHeight,
70  std::vector<TextureFormat> colorFormats, TextureFormat depthFormat = TextureFormat::InvalidFormat);
71 
76 
93  void BindRenderTarget(const tbCore::uint16 mipLevel = 0) const;
94 
101  void UnbindRenderTarget(void) const;
102 
114  void BindPartialRenderTarget(const tbCore::uint8 attachmentIndex = 0, const tbCore::uint16 mipLevel = 0) const;
115 
125  void UnbindPartialRenderTarget(const tbCore::uint8 attachmentIndex = 0) const;
126 
132  void ClearRenderTarget(const Color clearColor = ColorPalette::White) const;
133 
148  void ManagePixelData(const bool managePixelData);
149 
162  void SetMipmap(bool doMipmaps, bool manualMipmaps = false);
163 
170 
180  void BlitBetweenMipLevels(const tbCore::uint8 attachmentLayer, const tbCore::uint16 destinationMipLevel, const tbCore::uint16 sourceMipLevel);
181 
189  bool IsTextureValid(void) const;
190 
201 
208 
212  PixelSpace GetWidth(void) const;
213 
217  PixelSpace GetHeight(void) const;
218 
222  float GetAspectRatio(void) const;
223 
224  private:
225  std::unique_ptr<Implementation::RenderTargetData> mData;
226  };
227 
228 }; /* namespace TurtleBrains::Graphics */
229 
231 
232 #endif /* TurtleBrains_RenderTarget_hpp */
Definition: tb_noncopyable.hpp:21
Definition: tb_color.hpp:24
Definition: tb_render_target.hpp:26
PixelSpace GetHeight(void) const
RenderTarget(const PixelSpace &targetWidth, const PixelSpace &targetHeight, std::vector< TextureFormat > colorFormats, TextureFormat depthFormat=TextureFormat::InvalidFormat)
void BlitBetweenMipLevels(const tbCore::uint8 attachmentLayer, const tbCore::uint16 destinationMipLevel, const tbCore::uint16 sourceMipLevel)
PixelSpace GetWidth(void) const
tbGraphics::TextureHandle GetDepthTextureHandle(void) const
void BindPartialRenderTarget(const tbCore::uint8 attachmentIndex=0, const tbCore::uint16 mipLevel=0) const
tbGraphics::TextureHandle GetColorTextureHandle(const tbCore::uint8 attachmentIndex=0) const
void BindRenderTarget(const tbCore::uint16 mipLevel=0) const
void ManagePixelData(const bool managePixelData)
RenderTarget(const PixelSpace &targetWidth, const PixelSpace &targetHeight, TextureFormat colorFormat=TextureFormat::ColorARGB8, TextureFormat depthFormat=TextureFormat::InvalidFormat)
void ClearRenderTarget(const Color clearColor=ColorPalette::White) const
void SetMipmap(bool doMipmaps, bool manualMipmaps=false)
static void DestroyGraphicsContext(void)
void UnbindPartialRenderTarget(const tbCore::uint8 attachmentIndex=0) const
tbCore::uint32 GetNumberOfMipmapLevels(void) const
std::uint8_t uint8
Unsigned integer with a size of 8 bits. Supports values from 0 to 255.
Definition: tb_types.hpp:22
std::uint16_t uint16
Unsigned integer with a size of 16 bits. Supports values from 0 to 65535.
Definition: tb_types.hpp:25
std::uint32_t uint32
Unsigned integer with a size of 32 bits. Supports values from 0 to 4294967295, (2^32 - 1).
Definition: tb_types.hpp:27
Give the GameScene and Entities something to display, Text, Sprites and AnimatedSprites help bring th...
TextureFormat
Definition: tb_texture_manager.hpp:59
@ ColorARGB8
32 bits per pixel, colored texture with alpha, red, green, blue channels each having 8 bits.
tbCore::uint16 PixelSpace
Definition: tb_texture_manager.hpp:34