You.i Engine
YiRenderTarget.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2017. All rights reserved.
2 #ifndef _YI_RENDER_TARGET_H_
3 #define _YI_RENDER_TARGET_H_
4 
6 #include "renderer/YiViewport.h"
7 #include "utility/YiColor.h"
8 
9 #include <glm/fwd.hpp>
10 
13 
50 {
51 public:
52 
54  {
57  CLEAR = CLEAR_COLOR_BUFFER | CLEAR_DEPTH_BUFFER // The rest should go 4, 8, 16, etc...
58  };
59 
64  {
65  SCREEN = 1,
69  };
70 
76  static std::unique_ptr<CYIScreenRenderTarget> CreateScreenTarget(const CYIViewport &viewport);
77 
84  static std::unique_ptr<CYIOffscreenRenderTarget> CreateOffscreenTarget(RENDER_TARGET_TYPE eTargetType, uint32_t uTargetWidth, uint32_t uTargetHeight);
85 
86  virtual ~CYIRenderTarget();
87 
97  void SetViewport(const CYIViewport &viewport);
98 
102  const CYIViewport &GetViewport() const;
103 
107  std::shared_ptr<IYIGPUObject> GetFramebuffer() const;
108 
112  std::shared_ptr<CYIAssetFramebuffer> GetFramebufferAsset() const;
113 
118 
126  void SetDeviceHorizontalPixelRatio(float fDevicePixelRatio);
127 
135  void SetDeviceVerticalPixelRatio(float fDevicePixelRatio);
136 
144  void SetDeviceDiagonalPixelRatio(float fDevicePixelRatio);
145 
153  float GetDeviceHorizontalPixelRatio() const;
154 
162  float GetDeviceVerticalPixelRatio() const;
163 
171  float GetDeviceDiagonalPixelRatio() const;
172 
176  void SetClearColor(const CYIColor &clearColor);
177 
181  const CYIColor &GetClearColor() const;
182 
186  void SetAttribute(RENDER_TARGET_ATTRIBUTE eAttribute, bool bValue);
187  bool GetAttribute(RENDER_TARGET_ATTRIBUTE eAttribute) const;
188 
189 protected:
190  CYIRenderTarget();
191 
192  std::shared_ptr<CYIAssetFramebuffer> m_pFramebuffer;
193 
194 private:
195  float m_fDeviceHorizontalPixelRatio;
196  float m_fDeviceVerticalPixelRatio;
197  float m_fDeviceDiagonalPixelRatio;
198 
199  CYIViewport m_Viewport;
200  CYIColor m_ClearColor;
201 
202  RENDER_TARGET_TYPE m_Type;
203 
204  uint32_t m_AttributeFlags;
205 
207 };
208 
211 #endif // _YI_RENDER_TARGET_H_
void SetViewport(const CYIViewport &viewport)
std::shared_ptr< CYIAssetFramebuffer > m_pFramebuffer
Definition: YiRenderTarget.h:192
std::shared_ptr< CYIAssetFramebuffer > GetFramebufferAsset() const
static std::unique_ptr< CYIScreenRenderTarget > CreateScreenTarget(const CYIViewport &viewport)
Rendering results are sent to an offscreen Buffer in GPU memory, no depth info.
Definition: YiRenderTarget.h:66
void SetDeviceDiagonalPixelRatio(float fDevicePixelRatio)
#define YI_TYPE_BASES(...)
Definition: YiRtti.h:350
float GetDeviceVerticalPixelRatio() const
Definition: YiRenderTarget.h:55
const CYIColor & GetClearColor() const
void SetClearColor(const CYIColor &clearColor)
const CYIViewport & GetViewport() const
std::shared_ptr< IYIGPUObject > GetFramebuffer() const
Definition: YiViewport.h:12
Definition: YiRenderTarget.h:57
Defines a target for the rendering results to be sent to.
Definition: YiRenderTarget.h:49
Rendering results are sent to an offscreen Buffer in GPU memory, no color info.
Definition: YiRenderTarget.h:67
Rendering results are sent to an offscreen Buffer in GPU memory, both depth and color info...
Definition: YiRenderTarget.h:68
void SetDeviceVerticalPixelRatio(float fDevicePixelRatio)
Defines an offscreen target for the rendering results to be sent to.
Definition: YiOffscreenRenderTarget.h:26
float GetDeviceDiagonalPixelRatio() const
Definition: YiScreenRenderTarget.h:17
void SetDeviceHorizontalPixelRatio(float fDevicePixelRatio)
Rendering results are sent to the Display Back Buffer.
Definition: YiRenderTarget.h:65
RENDER_TARGET_TYPE GetTargetType() const
float GetDeviceHorizontalPixelRatio() const
static std::unique_ptr< CYIOffscreenRenderTarget > CreateOffscreenTarget(RENDER_TARGET_TYPE eTargetType, uint32_t uTargetWidth, uint32_t uTargetHeight)
RENDER_TARGET_ATTRIBUTE
Definition: YiRenderTarget.h:53
RENDER_TARGET_TYPE
Definition: YiRenderTarget.h:63
A class used to represent a color value.
Definition: YiColor.h:31
void SetAttribute(RENDER_TARGET_ATTRIBUTE eAttribute, bool bValue)
Definition: YiRenderTarget.h:56
bool GetAttribute(RENDER_TARGET_ATTRIBUTE eAttribute) const
virtual ~CYIRenderTarget()