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
commit fb49a919cb

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
@ -83,6 +91,14 @@ void FHWModelRenderer::BeginDrawHUDModel(FRenderStyle style, const VSMatrix &obj
{
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.
// TO-DO: Implement proper depth sorting.