Add OpenGLRenderTargetView and OpenGLDepthStencilView
This commit is contained in:
35
engine/include/XCEngine/RHI/OpenGL/OpenGLDepthStencilView.h
Normal file
35
engine/include/XCEngine/RHI/OpenGL/OpenGLDepthStencilView.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
enum class DepthStencilFormat {
|
||||
D16_UNORM,
|
||||
D24_UNORM_S8_UINT,
|
||||
D32_FLOAT,
|
||||
D32_FLOAT_S8X24_UINT
|
||||
};
|
||||
|
||||
class OpenGLDepthStencilView {
|
||||
public:
|
||||
OpenGLDepthStencilView();
|
||||
~OpenGLDepthStencilView();
|
||||
|
||||
bool Initialize(unsigned int texture, int mipLevel = 0);
|
||||
void Shutdown();
|
||||
|
||||
void Bind();
|
||||
void Unbind();
|
||||
|
||||
unsigned int GetID() const { return m_texture; }
|
||||
|
||||
private:
|
||||
unsigned int m_texture;
|
||||
unsigned int m_framebuffer;
|
||||
int m_mipLevel;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
28
engine/include/XCEngine/RHI/OpenGL/OpenGLRenderTargetView.h
Normal file
28
engine/include/XCEngine/RHI/OpenGL/OpenGLRenderTargetView.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace RHI {
|
||||
|
||||
class OpenGLRenderTargetView {
|
||||
public:
|
||||
OpenGLRenderTargetView();
|
||||
~OpenGLRenderTargetView();
|
||||
|
||||
bool Initialize(unsigned int texture, int mipLevel = 0);
|
||||
void Shutdown();
|
||||
|
||||
void Bind(unsigned int slot);
|
||||
void Unbind();
|
||||
|
||||
unsigned int GetID() const { return m_texture; }
|
||||
|
||||
private:
|
||||
unsigned int m_texture;
|
||||
unsigned int m_framebuffer;
|
||||
int m_mipLevel;
|
||||
};
|
||||
|
||||
} // namespace RHI
|
||||
} // namespace XCEngine
|
||||
Reference in New Issue
Block a user