mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- added a few more GL state wrappers to the render state.
Not used yet.
This commit is contained in:
parent
f6d9592a45
commit
163d6be0d7
3 changed files with 97 additions and 1 deletions
|
@ -478,6 +478,82 @@ void FGLRenderState::EnableClipDistance(int num, bool state)
|
|||
}
|
||||
}
|
||||
|
||||
void FGLRenderState::Clear(int targets)
|
||||
{
|
||||
// This always clears to default values.
|
||||
int gltarget = 0;
|
||||
if (targets & CT_Depth)
|
||||
{
|
||||
gltarget |= GL_DEPTH_BUFFER_BIT;
|
||||
glClearDepth(1);
|
||||
}
|
||||
if (targets & CT_Stencil)
|
||||
{
|
||||
gltarget |= GL_STENCIL_BUFFER_BIT;
|
||||
glClearStencil(0);
|
||||
}
|
||||
if (targets & CT_Color)
|
||||
{
|
||||
gltarget |= GL_COLOR_BUFFER_BIT;
|
||||
glClearColor(screen->mSceneClearColor[0], screen->mSceneClearColor[1], screen->mSceneClearColor[2], screen->mSceneClearColor[3]);
|
||||
}
|
||||
glClear(gltarget);
|
||||
}
|
||||
|
||||
void FGLRenderState::EnableStencil(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
glEnable(GL_STENCIL_TEST);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
void FGLRenderState::SetScissor(int x, int y, int w, int h)
|
||||
{
|
||||
if (w > -1)
|
||||
{
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
glScissor(x, y, w, h);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
void FGLRenderState::SetViewport(int x, int y, int w, int h)
|
||||
{
|
||||
glViewport(x, y, w, h);
|
||||
}
|
||||
|
||||
void FGLRenderState::EnableDepthTest(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
}
|
||||
|
||||
void FGLRenderState::EnableMultisampling(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
glEnable(GL_MULTISAMPLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable(GL_MULTISAMPLE);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
|
|
@ -153,6 +153,12 @@ public:
|
|||
void SetStencil(int offs, int op, int flags) override;
|
||||
void SetCulling(int mode) override;
|
||||
void EnableClipDistance(int num, bool state) override;
|
||||
void Clear(int targets) override;
|
||||
void EnableStencil(bool on) override;
|
||||
void SetScissor(int x, int y, int w, int h) override;
|
||||
void SetViewport(int x, int y, int w, int h) override;
|
||||
void EnableDepthTest(bool on) override;
|
||||
void EnableMultisampling(bool on) override;
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -12,7 +12,14 @@ struct FColormap;
|
|||
class IVertexBuffer;
|
||||
class IIndexBuffer;
|
||||
|
||||
enum EEffect
|
||||
enum EClearTarget
|
||||
{
|
||||
CT_Depth,
|
||||
CT_Stencil,
|
||||
CT_Color
|
||||
};
|
||||
|
||||
enum ERenderEffect
|
||||
{
|
||||
EFF_NONE = -1,
|
||||
EFF_FOGBOUNDARY,
|
||||
|
@ -440,6 +447,13 @@ public:
|
|||
virtual void SetStencil(int offs, int op, int flags) = 0;
|
||||
virtual void SetCulling(int mode) = 0;
|
||||
virtual void EnableClipDistance(int num, bool state) = 0;
|
||||
virtual void Clear(int targets) = 0;
|
||||
virtual void EnableStencil(bool on) = 0;
|
||||
virtual void SetScissor(int x, int y, int w, int h) = 0;
|
||||
virtual void SetViewport(int x, int y, int w, int h) = 0;
|
||||
virtual void EnableDepthTest(bool on) = 0;
|
||||
virtual void EnableMultisampling(bool on) = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue