- Disable models by default only for the classic software renderer with the r_models_carmack CVAR. Performance is not affected in SoftPoly.

This commit is contained in:
drfrag 2019-09-15 12:54:59 +02:00
parent 2f425dbc72
commit ca537d716b
10 changed files with 17 additions and 15 deletions

View file

@ -267,7 +267,7 @@ namespace swrenderer
drawerargs.SetTextureVStep(sampler.uv_step);
drawerargs.SetTextureVPos(sampler.uv_pos);
drawerargs.DrawColumn(Thread);
if (r_modelscene)
if (r_modelscene && r_models_carmack)
drawerargs.DrawDepthColumn(Thread, zbufferdepth);
uint64_t step64 = sampler.uv_step;
@ -287,7 +287,7 @@ namespace swrenderer
drawerargs.SetTextureVStep(sampler.uv_step);
drawerargs.SetTextureVPos(sampler.uv_pos);
drawerargs.DrawColumn(Thread);
if (r_modelscene)
if (r_modelscene&& r_models_carmack)
drawerargs.DrawDepthColumn(Thread, zbufferdepth);
uint64_t step64 = sampler.uv_step;
@ -315,7 +315,7 @@ namespace swrenderer
drawerargs.SetTextureVStep(sampler.uv_step);
drawerargs.SetTextureVPos(uv_pos);
drawerargs.DrawColumn(Thread);
if (r_modelscene)
if (r_modelscene && r_models_carmack)
drawerargs.DrawDepthColumn(Thread, zbufferdepth);
y += count;

View file

@ -284,7 +284,7 @@ namespace swrenderer
drawerargs.SetDestX2(x2);
drawerargs.DrawSpan(Thread);
if (r_modelscene)
if (r_modelscene && r_models_carmack)
drawerargs.DrawDepthSpan(Thread, zbufferdepth, zbufferdepth);
}

View file

@ -225,7 +225,7 @@ namespace swrenderer
else
drawerargs.DrawDoubleSkyColumn(Thread);
if (r_modelscene)
if (r_modelscene && r_models_carmack)
drawerargs.DrawDepthSkyColumn(Thread, 1.0f / 65536.0f);
}

View file

@ -214,7 +214,7 @@ namespace swrenderer
{
drawerargs.DrawTiltedSpan(Thread, y, x1, x2, plane_sz, plane_su, plane_sv, plane_shade, planeshade, planelightfloat, pviewx, pviewy, basecolormap);
if (r_modelscene)
if (r_modelscene && r_models_carmack)
{
double viewZ = 1.0;
double viewX1 = Thread->Viewport->ScreenToViewX(x1, viewZ);

View file

@ -31,6 +31,7 @@ class RenderMemory;
struct FDynamicLight;
EXTERN_CVAR(Bool, r_models);
EXTERN_CVAR(Bool, r_models_carmack);
extern bool r_modelscene;
namespace swrenderer

View file

@ -940,7 +940,7 @@ namespace swrenderer
int spritenum = thing->sprite;
bool isPicnumOverride = thing->picnum.isValid();
FSpriteModelFrame *modelframe = isPicnumOverride ? nullptr : FindModelFrame(thing->GetClass(), spritenum, thing->frame, !!(thing->flags & MF_DROPPED));
if (r_modelscene && modelframe && (thing->Pos() - Thread->Viewport->viewpoint.Pos).LengthSquared() < model_distance_cull)
if (r_modelscene && r_models_carmack && modelframe && (thing->Pos() - Thread->Viewport->viewpoint.Pos).LengthSquared() < model_distance_cull)
{
DVector3 pos = thing->InterpolatedPosition(Thread->Viewport->viewpoint.TicFrac);
RenderModel::Project(Thread, (float)pos.X, (float)pos.Y, (float)pos.Z, modelframe, thing);

View file

@ -68,7 +68,8 @@ EXTERN_CVAR(Int, r_clearbuffer)
EXTERN_CVAR(Int, r_debug_draw)
CVAR(Int, r_scene_multithreaded, 0, 0);
CVAR(Bool, r_models, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CVAR(Bool, r_models, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
CVAR(Bool, r_models_carmack, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
bool r_modelscene = false;
@ -103,7 +104,7 @@ namespace swrenderer
viewport->SetViewport(MainThread(), width, height, trueratio);
r_modelscene = r_models && Models.Size() > 0;
if (r_modelscene)
if (r_modelscene && r_models_carmack)
PolyTriangleDrawer::ClearBuffers(viewport->RenderTarget);
if (r_clearbuffer != 0 || r_debug_draw != 0)
@ -163,7 +164,7 @@ namespace swrenderer
R_UpdateFuzzPosFrameStart();
if (r_modelscene)
if (r_modelscene && r_models_carmack)
MainThread()->Viewport->SetupPolyViewport(MainThread());
FRenderViewpoint origviewpoint = MainThread()->Viewport->viewpoint;
@ -179,7 +180,7 @@ namespace swrenderer
// Mirrors fail to restore the original viewpoint -- we need it for the HUD weapon to draw correctly.
MainThread()->Viewport->viewpoint = origviewpoint;
if (r_modelscene)
if (r_modelscene && r_models_carmack)
MainThread()->Viewport->SetupPolyViewport(MainThread());
RenderPSprites();
@ -370,7 +371,7 @@ namespace swrenderer
viewwindowy = y;
viewactive = true;
viewport->SetViewport(MainThread(), width, height, MainThread()->Viewport->viewwindow.WidescreenRatio);
if (r_modelscene)
if (r_modelscene && r_models_carmack)
PolyTriangleDrawer::ClearBuffers(viewport->RenderTarget);
RenderActorView(actor, dontmaplines);

View file

@ -95,7 +95,7 @@ namespace swrenderer
(r_deathcamera && Thread->Viewport->viewpoint.camera->health <= 0))
return;
renderHUDModel = r_modelscene && IsHUDModelForPlayerAvailable(players[consoleplayer].camera->player);
renderHUDModel = r_modelscene && r_models_carmack && IsHUDModelForPlayerAvailable(players[consoleplayer].camera->player);
FDynamicColormap *basecolormap;
CameraLight *cameraLight = CameraLight::Instance();

View file

@ -315,7 +315,7 @@ namespace swrenderer
RenderPortal *renderportal = thread->Portal.get();
// Render draw segments behind sprite
if (r_modelscene)
if (r_modelscene && r_models_carmack)
{
int subsectordepth = spr->SubsectorDepth;
for (unsigned int index = 0; index != segmentlist->TranslucentSegmentsCount(); index++)

View file

@ -83,7 +83,7 @@ namespace swrenderer
SortedSprites[i] = Sprites[first + count - i - 1];
}
if (r_modelscene)
if (r_modelscene && r_models_carmack)
{
for (unsigned int i = 0; i < count; i++)
{