Allow gl_texture to affect models. Aids in debugging lightmap contribution on models.

This commit is contained in:
nashmuhandes 2023-04-08 05:58:15 +08:00 committed by Christoph Oelckers
parent da1b0530b9
commit 447f825831

View file

@ -45,6 +45,7 @@
#include "hw_models.h"
CVAR(Bool, gl_light_models, true, CVAR_ARCHIVE)
EXTERN_CVAR(Bool, gl_texture);
VSMatrix FHWModelRenderer::GetViewToWorldMatrix()
{
@ -57,6 +58,13 @@ void FHWModelRenderer::BeginDrawModel(FRenderStyle style, FSpriteModelFrame *smf
{
state.SetDepthFunc(DF_LEqual);
state.EnableTexture(true);
if (!gl_texture)
{
state.SetTextureMode(TM_STENCIL);
state.SetRenderStyle(STYLE_Stencil);
}
// [BB] In case the model should be rendered translucent, do back face culling.
// This solves a few of the problems caused by the lack of depth sorting.
// [Nash] Don't do back face culling if explicitly specified in MODELDEF
@ -84,6 +92,14 @@ void FHWModelRenderer::BeginDrawHUDModel(FRenderStyle style, const VSMatrix &obj
state.SetDepthFunc(DF_LEqual);
state.SetDepthClamp(true);
state.EnableTexture(true);
if (!gl_texture)
{
state.SetTextureMode(TM_STENCIL);
state.SetRenderStyle(STYLE_Stencil);
}
// [BB] In case the model should be rendered translucent, do back face culling.
// This solves a few of the problems caused by the lack of depth sorting.
// TO-DO: Implement proper depth sorting.