mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-01 08:31:45 +00:00
Swap front face culling for GL model drawer (CCW should be the default).
Added mirroring handling to software models.
This commit is contained in:
parent
a186677092
commit
dea1d0259d
3 changed files with 10 additions and 2 deletions
|
@ -65,7 +65,7 @@ void FGLModelRenderer::BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, con
|
||||||
if (!(actor->RenderStyle == LegacyRenderStyles[STYLE_Normal]) && !(smf->flags & MDL_DONTCULLBACKFACES))
|
if (!(actor->RenderStyle == LegacyRenderStyles[STYLE_Normal]) && !(smf->flags & MDL_DONTCULLBACKFACES))
|
||||||
{
|
{
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
glFrontFace((mirrored ^ GLPortal::isMirrored()) ? GL_CW : GL_CCW);
|
glFrontFace((mirrored ^ GLPortal::isMirrored()) ? GL_CCW : GL_CW);
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_RenderState.mModelMatrix = objectToWorldMatrix;
|
gl_RenderState.mModelMatrix = objectToWorldMatrix;
|
||||||
|
@ -91,7 +91,7 @@ void FGLModelRenderer::BeginDrawHUDModel(AActor *actor, const VSMatrix &objectTo
|
||||||
if (!(actor->RenderStyle == LegacyRenderStyles[STYLE_Normal]))
|
if (!(actor->RenderStyle == LegacyRenderStyles[STYLE_Normal]))
|
||||||
{
|
{
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
glFrontFace((mirrored ^ GLPortal::isMirrored()) ? GL_CW : GL_CCW);
|
glFrontFace((mirrored ^ GLPortal::isMirrored()) ? GL_CCW : GL_CW);
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_RenderState.mModelMatrix = objectToWorldMatrix;
|
gl_RenderState.mModelMatrix = objectToWorldMatrix;
|
||||||
|
|
|
@ -59,12 +59,14 @@ void PolyModelRenderer::BeginDrawModel(AActor *actor, FSpriteModelFrame *smf, co
|
||||||
|
|
||||||
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] || !!(smf->flags & MDL_DONTCULLBACKFACES))
|
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] || !!(smf->flags & MDL_DONTCULLBACKFACES))
|
||||||
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, true);
|
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, true);
|
||||||
|
PolyTriangleDrawer::SetCullCCW(Thread->DrawQueue, !mirrored);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyModelRenderer::EndDrawModel(AActor *actor, FSpriteModelFrame *smf)
|
void PolyModelRenderer::EndDrawModel(AActor *actor, FSpriteModelFrame *smf)
|
||||||
{
|
{
|
||||||
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] || !!(smf->flags & MDL_DONTCULLBACKFACES))
|
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] || !!(smf->flags & MDL_DONTCULLBACKFACES))
|
||||||
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, false);
|
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, false);
|
||||||
|
PolyTriangleDrawer::SetCullCCW(Thread->DrawQueue, true);
|
||||||
|
|
||||||
ModelActor = nullptr;
|
ModelActor = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -107,6 +109,7 @@ void PolyModelRenderer::BeginDrawHUDModel(AActor *actor, const VSMatrix &objectT
|
||||||
|
|
||||||
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal])
|
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal])
|
||||||
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, true);
|
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, true);
|
||||||
|
PolyTriangleDrawer::SetCullCCW(Thread->DrawQueue, !mirrored);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyModelRenderer::EndDrawHUDModel(AActor *actor)
|
void PolyModelRenderer::EndDrawHUDModel(AActor *actor)
|
||||||
|
@ -116,6 +119,7 @@ void PolyModelRenderer::EndDrawHUDModel(AActor *actor)
|
||||||
|
|
||||||
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal])
|
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal])
|
||||||
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, false);
|
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, false);
|
||||||
|
PolyTriangleDrawer::SetCullCCW(Thread->DrawQueue, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyModelRenderer::SetInterpolation(double interpolation)
|
void PolyModelRenderer::SetInterpolation(double interpolation)
|
||||||
|
|
|
@ -123,12 +123,14 @@ namespace swrenderer
|
||||||
|
|
||||||
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] || !!(smf->flags & MDL_DONTCULLBACKFACES))
|
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] || !!(smf->flags & MDL_DONTCULLBACKFACES))
|
||||||
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, true);
|
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, true);
|
||||||
|
PolyTriangleDrawer::SetCullCCW(Thread->DrawQueue, !mirrored);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SWModelRenderer::EndDrawModel(AActor *actor, FSpriteModelFrame *smf)
|
void SWModelRenderer::EndDrawModel(AActor *actor, FSpriteModelFrame *smf)
|
||||||
{
|
{
|
||||||
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] || !!(smf->flags & MDL_DONTCULLBACKFACES))
|
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal] || !!(smf->flags & MDL_DONTCULLBACKFACES))
|
||||||
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, false);
|
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, false);
|
||||||
|
PolyTriangleDrawer::SetCullCCW(Thread->DrawQueue, true);
|
||||||
|
|
||||||
ModelActor = nullptr;
|
ModelActor = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -192,6 +194,7 @@ namespace swrenderer
|
||||||
|
|
||||||
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal])
|
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal])
|
||||||
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, true);
|
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, true);
|
||||||
|
PolyTriangleDrawer::SetCullCCW(Thread->DrawQueue, !mirrored);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SWModelRenderer::EndDrawHUDModel(AActor *actor)
|
void SWModelRenderer::EndDrawHUDModel(AActor *actor)
|
||||||
|
@ -201,6 +204,7 @@ namespace swrenderer
|
||||||
|
|
||||||
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal])
|
if (actor->RenderStyle == LegacyRenderStyles[STYLE_Normal])
|
||||||
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, false);
|
PolyTriangleDrawer::SetTwoSided(Thread->DrawQueue, false);
|
||||||
|
PolyTriangleDrawer::SetCullCCW(Thread->DrawQueue, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SWModelRenderer::SetInterpolation(double interpolation)
|
void SWModelRenderer::SetInterpolation(double interpolation)
|
||||||
|
|
Loading…
Reference in a new issue