mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 23:01:59 +00:00
- enable model rendering in the software renderer
This commit is contained in:
parent
1fdcacc337
commit
85f5f897d7
15 changed files with 31 additions and 18 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "st_stuff.h"
|
||||
#include "r_data/r_translate.h"
|
||||
#include "r_data/r_interpolate.h"
|
||||
#include "r_data/models/models.h"
|
||||
#include "poly_renderer.h"
|
||||
#include "d_net.h"
|
||||
#include "po_man.h"
|
||||
|
@ -41,6 +42,9 @@
|
|||
|
||||
EXTERN_CVAR(Int, screenblocks)
|
||||
EXTERN_CVAR(Float, r_visibility)
|
||||
EXTERN_CVAR(Bool, r_models)
|
||||
|
||||
extern bool r_modelscene;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -156,6 +160,8 @@ void PolyRenderer::RenderActorView(AActor *actor, bool dontmaplines)
|
|||
|
||||
ScreenTriangle::FuzzStart = (ScreenTriangle::FuzzStart + 14) % FUZZTABLE;
|
||||
|
||||
r_modelscene = r_models && Models.Size() > 0;
|
||||
|
||||
ClearBuffers();
|
||||
SetSceneViewport();
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
EXTERN_CVAR(Bool, r_drawplayersprites)
|
||||
EXTERN_CVAR(Bool, r_deathcamera)
|
||||
EXTERN_CVAR(Bool, r_fullbrightignoresectorcolor)
|
||||
EXTERN_CVAR(Bool, r_models)
|
||||
extern bool r_modelscene;
|
||||
|
||||
void RenderPolyPlayerSprites::Render(PolyRenderThread *thread)
|
||||
{
|
||||
|
@ -60,7 +60,7 @@ void RenderPolyPlayerSprites::Render(PolyRenderThread *thread)
|
|||
(r_deathcamera && viewpoint.camera->health <= 0))
|
||||
return;
|
||||
|
||||
renderHUDModel = r_models && IsHUDModelForPlayerAvailable(players[consoleplayer].camera->player);
|
||||
renderHUDModel = r_modelscene && IsHUDModelForPlayerAvailable(players[consoleplayer].camera->player);
|
||||
|
||||
PolyTransferHeights fakeflat(viewpoint.camera->subsector);
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ bool RenderPolySprite::GetLine(AActor *thing, DVector2 &left, DVector2 &right)
|
|||
|
||||
void RenderPolySprite::Render(PolyRenderThread *thread, AActor *thing, subsector_t *sub, uint32_t stencilValue, float t1, float t2)
|
||||
{
|
||||
if (r_models)
|
||||
if (r_modelscene)
|
||||
{
|
||||
int spritenum = thing->sprite;
|
||||
bool isPicnumOverride = thing->picnum.isValid();
|
||||
|
|
|
@ -267,7 +267,7 @@ namespace swrenderer
|
|||
drawerargs.SetTextureVStep(sampler.uv_step);
|
||||
drawerargs.SetTextureVPos(sampler.uv_pos);
|
||||
drawerargs.DrawColumn(Thread);
|
||||
if (r_models)
|
||||
if (r_modelscene)
|
||||
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_models)
|
||||
if (r_modelscene)
|
||||
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_models)
|
||||
if (r_modelscene)
|
||||
drawerargs.DrawDepthColumn(Thread, zbufferdepth);
|
||||
|
||||
y += count;
|
||||
|
|
|
@ -284,7 +284,7 @@ namespace swrenderer
|
|||
drawerargs.SetDestX2(x2);
|
||||
|
||||
drawerargs.DrawSpan(Thread);
|
||||
if (r_models)
|
||||
if (r_modelscene)
|
||||
drawerargs.DrawDepthSpan(Thread, zbufferdepth, zbufferdepth);
|
||||
}
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ namespace swrenderer
|
|||
else
|
||||
drawerargs.DrawDoubleSkyColumn(Thread);
|
||||
|
||||
if (r_models)
|
||||
if (r_modelscene)
|
||||
drawerargs.DrawDepthSkyColumn(Thread, 1.0f / 65536.0f);
|
||||
}
|
||||
|
||||
|
|
|
@ -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_models)
|
||||
if (r_modelscene)
|
||||
{
|
||||
double viewZ = 1.0;
|
||||
double viewX1 = Thread->Viewport->ScreenToViewX(x1, viewZ);
|
||||
|
|
|
@ -31,6 +31,7 @@ class RenderMemory;
|
|||
class ADynamicLight;
|
||||
|
||||
EXTERN_CVAR(Bool, r_models);
|
||||
extern bool r_modelscene;
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
|
|
|
@ -954,7 +954,7 @@ namespace swrenderer
|
|||
{
|
||||
RenderVoxel::Project(Thread, thing, sprite.pos, sprite.voxel, sprite.spriteScale, sprite.renderflags, fakeside, fakefloor, fakeceiling, sec, thingShade, foggy, thingColormap);
|
||||
}
|
||||
else if (!r_models)
|
||||
else if (!r_modelscene)
|
||||
{
|
||||
RenderSprite::Project(Thread, thing, sprite.pos, sprite.tex, sprite.spriteScale, sprite.renderflags, fakeside, fakefloor, fakeceiling, sec, thingShade, foggy, thingColormap);
|
||||
}
|
||||
|
|
|
@ -67,7 +67,9 @@ EXTERN_CVAR(Int, r_clearbuffer)
|
|||
EXTERN_CVAR(Int, r_debug_draw)
|
||||
|
||||
CVAR(Bool, r_scene_multithreaded, false, 0);
|
||||
CVAR(Bool, r_models, false, 0);
|
||||
CVAR(Bool, r_models, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
|
||||
|
||||
bool r_modelscene = false;
|
||||
|
||||
namespace swrenderer
|
||||
{
|
||||
|
@ -101,7 +103,9 @@ namespace swrenderer
|
|||
float trueratio;
|
||||
ActiveRatio(width, height, &trueratio);
|
||||
viewport->SetViewport(MainThread(), width, height, trueratio);
|
||||
if (r_models)
|
||||
|
||||
r_modelscene = r_models && Models.Size() > 0;
|
||||
if (r_modelscene)
|
||||
PolyTriangleDrawer::ClearBuffers(viewport->RenderTarget);
|
||||
|
||||
if (r_clearbuffer != 0 || r_debug_draw != 0)
|
||||
|
@ -156,7 +160,7 @@ namespace swrenderer
|
|||
|
||||
R_UpdateFuzzPosFrameStart();
|
||||
|
||||
if (r_models)
|
||||
if (r_modelscene)
|
||||
MainThread()->Viewport->SetupPolyViewport(MainThread());
|
||||
|
||||
FRenderViewpoint origviewpoint = MainThread()->Viewport->viewpoint;
|
||||
|
@ -172,7 +176,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_models)
|
||||
if (r_modelscene)
|
||||
MainThread()->Viewport->SetupPolyViewport(MainThread());
|
||||
|
||||
RenderPSprites();
|
||||
|
@ -371,7 +375,7 @@ namespace swrenderer
|
|||
viewwindowy = y;
|
||||
viewactive = true;
|
||||
viewport->SetViewport(MainThread(), width, height, MainThread()->Viewport->viewwindow.WidescreenRatio);
|
||||
if (r_models)
|
||||
if (r_modelscene)
|
||||
PolyTriangleDrawer::ClearBuffers(viewport->RenderTarget);
|
||||
|
||||
// Render:
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace swrenderer
|
|||
(r_deathcamera && Thread->Viewport->viewpoint.camera->health <= 0))
|
||||
return;
|
||||
|
||||
renderHUDModel = r_models && IsHUDModelForPlayerAvailable(players[consoleplayer].camera->player);
|
||||
renderHUDModel = r_modelscene && IsHUDModelForPlayerAvailable(players[consoleplayer].camera->player);
|
||||
|
||||
FDynamicColormap *basecolormap;
|
||||
CameraLight *cameraLight = CameraLight::Instance();
|
||||
|
|
|
@ -315,7 +315,7 @@ namespace swrenderer
|
|||
RenderPortal *renderportal = thread->Portal.get();
|
||||
|
||||
// Render draw segments behind sprite
|
||||
if (r_models)
|
||||
if (r_modelscene)
|
||||
{
|
||||
int subsectordepth = spr->SubsectorDepth;
|
||||
for (unsigned int index = 0; index != segmentlist->TranslucentSegmentsCount(); index++)
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace swrenderer
|
|||
SortedSprites[i] = Sprites[first + count - i - 1];
|
||||
}
|
||||
|
||||
if (r_models) // To do: only do this if models are spotted - just in case there's some lame renderhack somewhere that relies on Carmacks algorithm
|
||||
if (r_modelscene)
|
||||
{
|
||||
for (unsigned int i = 0; i < count; i++)
|
||||
{
|
||||
|
|
|
@ -1818,6 +1818,7 @@ DSPLYMNU_ATTACHEDSURFACES = "Use attached surfaces"; // Not used
|
|||
DSPLYMNU_SKYMODE = "Sky render mode";
|
||||
DSPLYMNU_LINEARSKY = "Linear skies";
|
||||
DSPLYMNU_GZDFULLBRIGHT = "Fullbright overrides sector color";
|
||||
DSPLYMNU_MODELS = "Models";
|
||||
DSPLYMNU_SCALEFUZZ = "Scale fuzz effect";
|
||||
DSPLYMNU_DRAWFUZZ = "Use fuzz effect";
|
||||
DSPLYMNU_OLDTRANS = "Classic Transparency";
|
||||
|
|
|
@ -724,6 +724,7 @@ OptionMenu "SWROptions" protected
|
|||
Option "$DSPLYMNU_LINEARSKY", "r_linearsky", "OnOff"
|
||||
Option "$DSPLYMNU_GZDFULLBRIGHT", "r_fullbrightignoresectorcolor", "OnOff"
|
||||
Option "$DSPLYMNU_SCALEFUZZ", "r_fuzzscale", "OnOff"
|
||||
Option "$DSPLYMNU_MODELS", "r_models", "OnOff"
|
||||
}
|
||||
|
||||
OptionMenu "VideoOptions" protected
|
||||
|
|
Loading…
Reference in a new issue