- fixed: The software renderer was accessing the global viewpoint in several places.

Aside from using incorrect values this could crash the renderer if used in the very first rendering frame because the software renderer always operates on a copy.
This commit is contained in:
Christoph Oelckers 2019-05-12 09:16:17 +02:00
parent 16fe0f3902
commit cf58666708
5 changed files with 9 additions and 9 deletions

View file

@ -53,7 +53,7 @@ void PolyRenderModel(PolyRenderThread *thread, const Mat4f &worldToClip, uint32_
renderer.Translation = actor->Translation;
renderer.AddLights(actor);
renderer.RenderModel(x, y, z, smf, actor, r_viewpoint.TicFrac);
renderer.RenderModel(x, y, z, smf, actor, PolyRenderer::Instance()->Viewpoint.TicFrac);
PolyTriangleDrawer::SetModelVertexShader(thread->DrawQueue, -1, -1, 0.0f);
PolyTriangleDrawer::SetTransform(thread->DrawQueue, thread->FrameMemory->NewObject<Mat4f>(worldToClip), nullptr);
}

View file

@ -34,8 +34,8 @@ EXTERN_CVAR(Int, gl_particles_style)
void RenderPolyParticle::Render(PolyRenderThread *thread, particle_t *particle, subsector_t *sub, uint32_t stencilValue)
{
double timefrac = r_viewpoint.TicFrac;
if (paused || r_viewpoint.ViewLevel->isFrozen())
double timefrac = PolyRenderer::Instance()->Viewpoint.TicFrac;
if (paused || PolyRenderer::Instance()->Viewpoint.ViewLevel->isFrozen())
timefrac = 0.;
DVector3 pos = particle->Pos + (particle->Vel * timefrac);
double psize = particle->size / 8.0;

View file

@ -316,8 +316,8 @@ void PolySkySetup::Update()
skyiscale = float(r_Yaspect / freelookviewheight);
skyscale = freelookviewheight / r_Yaspect;
skyiscale *= float(r_viewpoint.FieldOfView.Degrees / 90.);
skyscale *= float(90. / r_viewpoint.FieldOfView.Degrees);
skyiscale *= float(PolyRenderer::Instance()->Viewpoint.FieldOfView.Degrees / 90.);
skyscale *= float(90. / PolyRenderer::Instance()->Viewpoint.FieldOfView.Degrees);
}
if (Level->skystretch)

View file

@ -96,8 +96,8 @@ namespace swrenderer
skyiscale = float(r_Yaspect / freelookviewheight);
skyscale = freelookviewheight / r_Yaspect;
skyiscale *= float(r_viewpoint.FieldOfView.Degrees / 90.);
skyscale *= float(90. / r_viewpoint.FieldOfView.Degrees);
skyiscale *= float(thread->Viewport->viewpoint.FieldOfView.Degrees / 90.);
skyscale *= float(90. / thread->Viewport->viewpoint.FieldOfView.Degrees);
}
if (Level->skystretch)

View file

@ -78,8 +78,8 @@ namespace swrenderer
int x1, x2, y1, y2;
sector_t* heightsec = NULL;
double timefrac = r_viewpoint.TicFrac;
if (paused || r_viewpoint.ViewLevel->isFrozen())
double timefrac = thread->Viewport->viewpoint.TicFrac;
if (paused || thread->Viewport->viewpoint.ViewLevel->isFrozen())
timefrac = 0.;
double ippx = particle->Pos.X + particle->Vel.X * timefrac;