CSEngine
|
#include <SFrameBuffer.h>
Public Member Functions | |
void | GenerateFramebuffer (BufferDimension dimension, int width, int height) |
unsigned int | GenerateRenderbuffer (BufferType type, int internalFormat) |
STexture * | GenerateTexturebuffer (BufferType type, int channel, int level=0) |
void | RasterizeFramebuffer () |
void | AttachCubeBuffer (int index, int level=0) const |
void | AttachFrameBuffer (int target=GL_FRAMEBUFFER) const |
void | DetachFrameBuffer () const |
void | ResizeFrameBuffer (int width, int height) |
void | Exterminate () override |
void | BlitFrameBuffer (const SFrameBuffer &dst, BlitType type=IN_ORDER) |
int | GetWidth () const |
int | GetHeight () const |
const ivec2 & | GetSize () const |
BufferStatus | GetBufferStatus () const |
STexture * | GetTexture (int index) const |
STexture * | GetTexture (const char *id) const |
unsigned int | GetRenderbufferID (int index) const |
STexture * | GetMainColorTexture () const |
STexture * | GetDepthTexture () const |
Public Member Functions inherited from CSE::SResource | |
SResource (bool isRegister) | |
SResource (const SResource *resource, bool isRegister) | |
void | SetName (std::string name) |
void | SetAbsoluteID (std::string id) |
std::string | GetName () const |
std::string | GetAbsoluteID () const |
AssetMgr::AssetReference * | GetAssetReference (std::string hash="") const |
void | LinkResource (AssetMgr::AssetReference *asset) |
void | LinkResource (std::string name) |
void | SetHash (std::string &hash) override |
Public Member Functions inherited from CSE::SObject | |
SObject (bool isRegister) | |
virtual void | SetUndestroyable (bool enable) |
virtual void | Destroy () |
virtual void | __FORCE_DESTROY__ () |
virtual std::string | GenerateMeta () |
std::string | GetHash () const |
Protected Member Functions | |
void | Init (const AssetMgr::AssetReference *asset) override |
Additional Inherited Members | |
Static Public Member Functions inherited from CSE::SResource | |
template<class T > | |
static T * | Create (const std::string &name) |
template<class T > | |
static T * | Create (const AssetMgr::AssetReference *asset) |
template<class T > | |
static T * | Get (std::string name) |
Protected Attributes inherited from CSE::SObject | |
std::string | m_hash |
Definition at line 31 of file SFrameBuffer.h.
enum CSE::SFrameBuffer::BlitType |
Definition at line 42 of file SFrameBuffer.h.
enum CSE::SFrameBuffer::BufferDimension |
Definition at line 36 of file SFrameBuffer.h.
enum CSE::SFrameBuffer::BufferStatus |
Definition at line 39 of file SFrameBuffer.h.
enum CSE::SFrameBuffer::BufferType |
Definition at line 33 of file SFrameBuffer.h.
SFrameBuffer::SFrameBuffer | ( | ) |
Definition at line 31 of file SFrameBuffer.cpp.
void SFrameBuffer::AttachCubeBuffer | ( | int | index, |
int | level = 0 |
||
) | const |
Definition at line 188 of file SFrameBuffer.cpp.
void SFrameBuffer::AttachFrameBuffer | ( | int | target = GL_FRAMEBUFFER | ) | const |
Definition at line 199 of file SFrameBuffer.cpp.
void SFrameBuffer::BlitFrameBuffer | ( | const SFrameBuffer & | dst, |
BlitType | type = IN_ORDER |
||
) |
Safely blit the framebuffer. Each framebuffer must be in BufferType::MULTI state, and all buffers must be in the form of STexture. For blit techniques that are not suitable for that condition, it is faster to use glBlitFramebuffer.
dst | The framebuffer to merge. |
type | Determine the order in which they will be merged. Default is IN_ORDER. |
Definition at line 234 of file SFrameBuffer.cpp.
References GenerateFramebuffer(), GenerateTexturebuffer(), and RasterizeFramebuffer().
void SFrameBuffer::DetachFrameBuffer | ( | ) | const |
Definition at line 204 of file SFrameBuffer.cpp.
|
overridevirtual |
Implements CSE::SObject.
Definition at line 37 of file SFrameBuffer.cpp.
void SFrameBuffer::GenerateFramebuffer | ( | BufferDimension | dimension, |
int | width, | ||
int | height | ||
) |
This is the first function called when creating a framebuffer. You specify the dimensions of the framebuffer through that function.
dimension | Sets the dimensions of the framebuffer. The default is SFrameBuffer::PLANE. |
width | Write the width of the render buffer. |
height | Writes the height of the render buffer. |
Definition at line 104 of file SFrameBuffer.cpp.
Referenced by BlitFrameBuffer().
unsigned int SFrameBuffer::GenerateRenderbuffer | ( | BufferType | type, |
int | internalFormat | ||
) |
Creates a render buffer in a non-texture format.
type | Specifies the type of buffer to create. The default is RENDER. |
internalFormat | Sets the internal format for the render buffer. Format details can be found at this link. |
Definition at line 113 of file SFrameBuffer.cpp.
STexture * SFrameBuffer::GenerateTexturebuffer | ( | BufferType | type, |
int | channel, | ||
int | level = 0 |
||
) |
Creates a render buffer in texture format.
type | Specifies the type of buffer to create. The default is RENDER. |
channel | Sets the channel format for the render buffer. Format details can be found at this link. |
level | Sets the texture mipmap level. Default is 0. |
Definition at line 138 of file SFrameBuffer.cpp.
Referenced by BlitFrameBuffer(), and RasterizeFramebuffer().
SFrameBuffer::BufferStatus SFrameBuffer::GetBufferStatus | ( | ) | const |
Definition at line 343 of file SFrameBuffer.cpp.
|
inline |
Get the texture assigned to the framebuffer as depth.
Definition at line 166 of file SFrameBuffer.h.
int SFrameBuffer::GetHeight | ( | ) | const |
Definition at line 280 of file SFrameBuffer.cpp.
|
inline |
Get the texture assigned to the framebuffer as GL_COLOR_ATTACHMENT0.
Definition at line 157 of file SFrameBuffer.h.
Referenced by CSE::SRenderGroup::BindSourceBuffer().
unsigned int SFrameBuffer::GetRenderbufferID | ( | int | index | ) | const |
Get renderbuffer ID that exist in the framebuffer.
index | buffer index in framebuffer |
Definition at line 365 of file SFrameBuffer.cpp.
|
inline |
Definition at line 126 of file SFrameBuffer.h.
STexture * SFrameBuffer::GetTexture | ( | const char * | id | ) | const |
Get textures that exist in the framebuffer.
id | texture id in framebuffer |
Definition at line 354 of file SFrameBuffer.cpp.
STexture * SFrameBuffer::GetTexture | ( | int | index | ) | const |
Get textures that exist in the framebuffer.
index | buffer index in framebuffer |
Definition at line 347 of file SFrameBuffer.cpp.
int SFrameBuffer::GetWidth | ( | ) | const |
Definition at line 276 of file SFrameBuffer.cpp.
|
overrideprotectedvirtual |
Implements CSE::SResource.
Definition at line 49 of file SFrameBuffer.cpp.
void SFrameBuffer::RasterizeFramebuffer | ( | ) |
Create all the render buffers to allocate to the framebuffer and proceed with rasterization. You can use the framebuffer after calling the function.
Definition at line 168 of file SFrameBuffer.cpp.
References GenerateTexturebuffer().
Referenced by BlitFrameBuffer().
void SFrameBuffer::ResizeFrameBuffer | ( | int | width, |
int | height | ||
) |
Definition at line 208 of file SFrameBuffer.cpp.