diff --git a/src/r_poly_particle.cpp b/src/r_poly_particle.cpp index e69803e1e..8151d4888 100644 --- a/src/r_poly_particle.cpp +++ b/src/r_poly_particle.cpp @@ -70,33 +70,32 @@ void RenderPolyParticle::Render(const TriMatrix &worldToClip, particle_t *partic // int color = (particle->color >> 24) & 0xff; // pal index, I think bool fullbrightSprite = particle->bright != 0; - TriUniforms uniforms; + PolyDrawArgs args; + if (fullbrightSprite || fixedlightlev >= 0 || fixedcolormap) { - uniforms.light = 256; - uniforms.flags = TriUniforms::fixed_light; + args.uniforms.light = 256; + args.uniforms.flags = TriUniforms::fixed_light; } else { - uniforms.light = (uint32_t)((sub->sector->lightlevel + actualextralight) / 255.0f * 256.0f); - uniforms.flags = 0; + args.uniforms.light = (uint32_t)((sub->sector->lightlevel + actualextralight) / 255.0f * 256.0f); + args.uniforms.flags = 0; } - uniforms.subsectorDepth = subsectorDepth; + args.uniforms.subsectorDepth = subsectorDepth; if (r_swtruecolor) { uint32_t alpha = particle->trans; - uniforms.color = (alpha << 24) | (particle->color & 0xffffff); + args.uniforms.color = (alpha << 24) | (particle->color & 0xffffff); } else { - uniforms.color = ((uint32_t)particle->color) >> 24; - uniforms.srcalpha = particle->trans; - uniforms.destalpha = 255 - particle->trans; + args.uniforms.color = ((uint32_t)particle->color) >> 24; + args.uniforms.srcalpha = particle->trans; + args.uniforms.destalpha = 255 - particle->trans; } - PolyDrawArgs args; - args.uniforms = uniforms; args.objectToClip = &worldToClip; args.vinput = vertices; args.vcount = 4; diff --git a/src/r_poly_plane.cpp b/src/r_poly_plane.cpp index e64d085e7..8d4067be0 100644 --- a/src/r_poly_plane.cpp +++ b/src/r_poly_plane.cpp @@ -103,12 +103,12 @@ void RenderPolyPlane::Render3DFloor(const TriMatrix &worldToClip, subsector_t *s lightlevel = *light->p_lightlevel; } - TriUniforms uniforms; - uniforms.light = (uint32_t)(lightlevel / 255.0f * 256.0f); + PolyDrawArgs args; + args.uniforms.light = (uint32_t)(lightlevel / 255.0f * 256.0f); if (fixedlightlev >= 0 || fixedcolormap) - uniforms.light = 256; - uniforms.flags = 0; - uniforms.subsectorDepth = subsectorDepth; + args.uniforms.light = 256; + args.uniforms.flags = 0; + args.uniforms.subsectorDepth = subsectorDepth; TriVertex *vertices = PolyVertexBuffer::GetVertices(sub->numlines); if (!vertices) @@ -131,8 +131,6 @@ void RenderPolyPlane::Render3DFloor(const TriMatrix &worldToClip, subsector_t *s } } - PolyDrawArgs args; - args.uniforms = uniforms; args.objectToClip = &worldToClip; args.vinput = vertices; args.vcount = sub->numlines; @@ -217,12 +215,12 @@ void RenderPolyPlane::Render(const TriMatrix &worldToClip, subsector_t *sub, uin bool isSky = picnum == skyflatnum; - TriUniforms uniforms; - uniforms.light = (uint32_t)(frontsector->lightlevel / 255.0f * 256.0f); + PolyDrawArgs args; + args.uniforms.light = (uint32_t)(frontsector->lightlevel / 255.0f * 256.0f); if (fixedlightlev >= 0 || fixedcolormap) - uniforms.light = 256; - uniforms.flags = 0; - uniforms.subsectorDepth = isSky ? RenderPolyPortal::SkySubsectorDepth : subsectorDepth; + args.uniforms.light = 256; + args.uniforms.flags = 0; + args.uniforms.subsectorDepth = isSky ? RenderPolyPortal::SkySubsectorDepth : subsectorDepth; TriVertex *vertices = PolyVertexBuffer::GetVertices(sub->numlines); if (!vertices) @@ -245,8 +243,6 @@ void RenderPolyPlane::Render(const TriMatrix &worldToClip, subsector_t *sub, uin } } - PolyDrawArgs args; - args.uniforms = uniforms; args.objectToClip = &worldToClip; args.vinput = vertices; args.vcount = sub->numlines; diff --git a/src/r_poly_sky.cpp b/src/r_poly_sky.cpp index ad8d4b861..97f8203fa 100644 --- a/src/r_poly_sky.cpp +++ b/src/r_poly_sky.cpp @@ -50,15 +50,12 @@ void PolySkyDome::Render(const TriMatrix &worldToClip) TriMatrix objectToWorld = TriMatrix::translate((float)ViewPos.X, (float)ViewPos.Y, (float)ViewPos.Z); objectToClip = worldToClip * objectToWorld; - TriUniforms uniforms; - uniforms.light = 256; - uniforms.flags = 0; - uniforms.subsectorDepth = RenderPolyPortal::SkySubsectorDepth; - int rc = mRows + 1; PolyDrawArgs args; - args.uniforms = uniforms; + args.uniforms.light = 256; + args.uniforms.flags = 0; + args.uniforms.subsectorDepth = RenderPolyPortal::SkySubsectorDepth; args.objectToClip = &objectToClip; args.stenciltestvalue = 255; args.stencilwritevalue = 255; diff --git a/src/r_poly_wall.cpp b/src/r_poly_wall.cpp index d6ade7279..6e09faa8a 100644 --- a/src/r_poly_wall.cpp +++ b/src/r_poly_wall.cpp @@ -239,13 +239,10 @@ void RenderPolyWall::Render(const TriMatrix &worldToClip) ClampHeight(vertices[1], vertices[2]); } - TriUniforms uniforms; - uniforms.light = (uint32_t)(GetLightLevel() / 255.0f * 256.0f); - uniforms.flags = 0; - uniforms.subsectorDepth = SubsectorDepth; - PolyDrawArgs args; - args.uniforms = uniforms; + args.uniforms.light = (uint32_t)(GetLightLevel() / 255.0f * 256.0f); + args.uniforms.flags = 0; + args.uniforms.subsectorDepth = SubsectorDepth; args.objectToClip = &worldToClip; args.vinput = vertices; args.vcount = 4; diff --git a/src/r_poly_wallsprite.cpp b/src/r_poly_wallsprite.cpp index 553235957..c8e0abcc4 100644 --- a/src/r_poly_wallsprite.cpp +++ b/src/r_poly_wallsprite.cpp @@ -98,21 +98,19 @@ void RenderPolyWallSprite::Render(const TriMatrix &worldToClip, AActor *thing, s bool fullbrightSprite = ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT)); - TriUniforms uniforms; + PolyDrawArgs args; if (fullbrightSprite || fixedlightlev >= 0 || fixedcolormap) { - uniforms.light = 256; - uniforms.flags = TriUniforms::fixed_light; + args.uniforms.light = 256; + args.uniforms.flags = TriUniforms::fixed_light; } else { - uniforms.light = (uint32_t)((thing->Sector->lightlevel + actualextralight) / 255.0f * 256.0f); - uniforms.flags = 0; + args.uniforms.light = (uint32_t)((thing->Sector->lightlevel + actualextralight) / 255.0f * 256.0f); + args.uniforms.flags = 0; } - uniforms.subsectorDepth = subsectorDepth; + args.uniforms.subsectorDepth = subsectorDepth; - PolyDrawArgs args; - args.uniforms = uniforms; args.objectToClip = &worldToClip; args.vinput = vertices; args.vcount = 4;