Skip to content
Permalink
Browse files

- 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.
  • Loading branch information...
coelckers authored and madame-rachelle committed May 12, 2019
1 parent 98c88d2 commit e1f2e342e320f517cac50ae25dc22e07818c2e63
@@ -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);
}
@@ -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;
@@ -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)
@@ -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)
@@ -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;

0 comments on commit e1f2e34

Please sign in to comment.
You can’t perform that action at this time.