mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- Add r_model_distance_cull to control when models turn into sprites
This commit is contained in:
parent
b621dccb9c
commit
8cad912db1
1 changed files with 14 additions and 1 deletions
|
@ -80,6 +80,7 @@ namespace
|
|||
{
|
||||
double sprite_distance_cull = 1e16;
|
||||
double line_distance_cull = 1e16;
|
||||
double model_distance_cull = 1e16;
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Float, r_sprite_distance_cull, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
@ -106,6 +107,18 @@ CUSTOM_CVAR(Float, r_line_distance_cull, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
}
|
||||
}
|
||||
|
||||
CUSTOM_CVAR(Float, r_model_distance_cull, 1024, 0/*CVAR_ARCHIVE | CVAR_GLOBALCONFIG*/) // Experimental for the moment until a good default is chosen
|
||||
{
|
||||
if (r_model_distance_cull > 0.0)
|
||||
{
|
||||
model_distance_cull = r_model_distance_cull * r_model_distance_cull;
|
||||
}
|
||||
else
|
||||
{
|
||||
model_distance_cull = 1e16;
|
||||
}
|
||||
}
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
RenderOpaquePass::RenderOpaquePass(RenderThread *thread) : renderline(thread)
|
||||
|
@ -955,7 +968,7 @@ namespace swrenderer
|
|||
int spritenum = thing->sprite;
|
||||
bool isPicnumOverride = thing->picnum.isValid();
|
||||
FSpriteModelFrame *modelframe = isPicnumOverride ? nullptr : gl_FindModelFrame(thing->GetClass(), spritenum, thing->frame, !!(thing->flags & MF_DROPPED));
|
||||
if (modelframe)
|
||||
if (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);
|
||||
|
|
Loading…
Reference in a new issue