You.i Engine
YiAssetFramebuffer.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_ASSET_FRAMEBUFFER_H_
3 #define _YI_ASSET_FRAMEBUFFER_H_
4 
10 #include "asset/YiAssetHardware.h"
12 
22 {
23 public:
24  enum class Attachment
25  {
26  Color0 = 0,
27  DepthStencil = 1
28  };
29 
31  virtual ~CYIAssetFramebuffer();
32 
36  void EnableAttachment(Attachment attachment);
37 
41  void DisableAttachment(Attachment attachment);
42 
46  bool HasAttachment(Attachment attachment) const;
47 
51  void SetDimensions(uint32_t width, uint32_t height);
52 
56  void GetDimensions(uint32_t &rWidth, uint32_t &rHeight) const;
57 
61  std::shared_ptr<CYIAssetTextureFramebuffer> GetAttachedTexture(Attachment attachment) const;
62 
63  virtual bool RequestInvalidate() override;
64  virtual bool RequestRestore() override;
65  virtual bool RequestHardwareLoad() override;
66  virtual bool RequestHardwareUnload() override;
67 
68  virtual std::pair<size_t, size_t> GetApproximateSize() const override;
69 
70 protected:
71  virtual std::shared_ptr<IYIGPUObject> CreateGPUObject() const override;
72 
73  static const uint32_t s_attachmentTypes = 2;
74  std::shared_ptr<CYIAssetTextureFramebuffer> m_pAttachedTextures[s_attachmentTypes]; //Corresponds to the attachments
76  uint32_t m_width;
77  uint32_t m_height;
78 
79 private:
81 };
82 
85 #endif // _YI_ASSET_FRAMEBUFFER_H_
uint32_t m_width
Definition: YiAssetFramebuffer.h:76
virtual std::shared_ptr< IYIGPUObject > CreateGPUObject() const override
bool HasAttachment(Attachment attachment) const
std::shared_ptr< CYIAssetTextureFramebuffer > GetAttachedTexture(Attachment attachment) const
void GetDimensions(uint32_t &rWidth, uint32_t &rHeight) const
void EnableAttachment(Attachment attachment)
void DisableAttachment(Attachment attachment)
static const uint32_t s_attachmentTypes
Definition: YiAssetFramebuffer.h:73
virtual bool RequestInvalidate() override
uint32_t m_height
Definition: YiAssetFramebuffer.h:77
std::shared_ptr< CYIAssetTextureFramebuffer > m_pAttachedTextures[s_attachmentTypes]
Definition: YiAssetFramebuffer.h:74
virtual bool RequestRestore() override
Hardware-mirrored asset. These assets contain IYIGPUObject counterparts.
Definition: YiAssetHardware.h:20
virtual bool RequestHardwareLoad() override
#define YI_TYPE_BASES(CLASS, BASES...)
Definition: YiRtti.h:257
virtual ~CYIAssetFramebuffer()
Wraps CYIAssetBuffers and their hardware counterparts, and an internally managed FBO.
Definition: YiAssetFramebuffer.h:21
void SetDimensions(uint32_t width, uint32_t height)
virtual std::pair< size_t, size_t > GetApproximateSize() const override
Attachment
Definition: YiAssetFramebuffer.h:24
bool m_bufferEnabled[s_attachmentTypes]
Definition: YiAssetFramebuffer.h:75
virtual bool RequestHardwareUnload() override