Started adding fixed color map back in

This commit is contained in:
Emile Belanger 2021-03-19 16:36:02 +00:00
parent 1ff5040692
commit 0a02331609
2 changed files with 18 additions and 12 deletions

View file

@ -344,7 +344,7 @@ void FGLRenderState::ApplyState()
void FGLRenderState::ApplyBuffers() void FGLRenderState::ApplyBuffers()
{ {
//if (mVertexBuffer != mCurrentVertexBuffer || mVertexOffsets[0] != mCurrentVertexOffsets[0] || mVertexOffsets[1] != mCurrentVertexOffsets[1]) if (mVertexBuffer != mCurrentVertexBuffer || mVertexOffsets[0] != mCurrentVertexOffsets[0] || mVertexOffsets[1] != mCurrentVertexOffsets[1])
{ {
assert(mVertexBuffer != nullptr); assert(mVertexBuffer != nullptr);
static_cast<GLVertexBuffer*>(mVertexBuffer)->Bind(mVertexOffsets); static_cast<GLVertexBuffer*>(mVertexBuffer)->Bind(mVertexOffsets);
@ -352,7 +352,7 @@ void FGLRenderState::ApplyBuffers()
mCurrentVertexOffsets[0] = mVertexOffsets[0]; mCurrentVertexOffsets[0] = mVertexOffsets[0];
mCurrentVertexOffsets[1] = mVertexOffsets[1]; mCurrentVertexOffsets[1] = mVertexOffsets[1];
} }
//if (mIndexBuffer != mCurrentIndexBuffer) if (mIndexBuffer != mCurrentIndexBuffer)
{ {
if (mIndexBuffer) static_cast<GLIndexBuffer*>(mIndexBuffer)->Bind(); if (mIndexBuffer) static_cast<GLIndexBuffer*>(mIndexBuffer)->Bind();
mCurrentIndexBuffer = mIndexBuffer; mCurrentIndexBuffer = mIndexBuffer;
@ -457,13 +457,13 @@ void FGLRenderState::ApplyBlendMode()
} }
// Checks must be disabled until all draw code has been converted. // Checks must be disabled until all draw code has been converted.
//if (srcblend != stSrcBlend || dstblend != stDstBlend) if (srcblend != stSrcBlend || dstblend != stDstBlend)
{ {
stSrcBlend = srcblend; stSrcBlend = srcblend;
stDstBlend = dstblend; stDstBlend = dstblend;
glBlendFunc(srcblend, dstblend); glBlendFunc(srcblend, dstblend);
} }
//if (blendequation != stBlendEquation) if (blendequation != stBlendEquation)
{ {
stBlendEquation = blendequation; stBlendEquation = blendequation;
glBlendEquation(blendequation); glBlendEquation(blendequation);
@ -481,10 +481,10 @@ static int dt2gl[] = { GL_POINTS, GL_LINES, GL_TRIANGLES, GL_TRIANGLE_FAN, GL_TR
void FGLRenderState::Draw(int dt, int index, int count, bool apply) void FGLRenderState::Draw(int dt, int index, int count, bool apply)
{ {
if (apply) if (apply)
{ {
Apply(); Apply();
} }
drawcalls.Clock(); drawcalls.Clock();
glDrawArrays(dt2gl[dt], index, count); glDrawArrays(dt2gl[dt], index, count);
drawcalls.Unclock(); drawcalls.Unclock();
@ -574,10 +574,8 @@ void FGLRenderState::Clear(int targets)
if (targets & CT_Depth) if (targets & CT_Depth)
{ {
gltarget |= GL_DEPTH_BUFFER_BIT; gltarget |= GL_DEPTH_BUFFER_BIT;
if (glClearDepthf)
glClearDepthf(1); glClearDepthf(1);
else
glClearDepth(1);
} }
if (targets & CT_Stencil) if (targets & CT_Stencil)
{ {
@ -630,6 +628,11 @@ void FGLRenderState::EnableLineSmooth(bool on)
} }
void FGLRenderState::SetSpecialColormap(int cm)
{
colorMapSpecial = cm;
}
//========================================================================== //==========================================================================
// //
// //

View file

@ -73,6 +73,8 @@ class FGLRenderState final : public FRenderState
HWViewpointUniforms* mHwUniforms = nullptr; HWViewpointUniforms* mHwUniforms = nullptr;
int colorMapSpecial = 0;
public: public:
FGLRenderState() FGLRenderState()
@ -142,6 +144,7 @@ public:
void EnableMultisampling(bool on) override; void EnableMultisampling(bool on) override;
void EnableLineSmooth(bool on) override; void EnableLineSmooth(bool on) override;
void SetSpecialColormap(int cm);
void ApplyViewport(void* data); void ApplyViewport(void* data);
}; };