mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-13 16:07:45 +00:00
Always access args.uniforms directly instead of first creating a TriUniforms variable
This commit is contained in:
parent
62188d1ea5
commit
70181f4146
5 changed files with 33 additions and 46 deletions
|
@ -70,33 +70,32 @@ void RenderPolyParticle::Render(const TriMatrix &worldToClip, particle_t *partic
|
||||||
// int color = (particle->color >> 24) & 0xff; // pal index, I think
|
// int color = (particle->color >> 24) & 0xff; // pal index, I think
|
||||||
bool fullbrightSprite = particle->bright != 0;
|
bool fullbrightSprite = particle->bright != 0;
|
||||||
|
|
||||||
TriUniforms uniforms;
|
PolyDrawArgs args;
|
||||||
|
|
||||||
if (fullbrightSprite || fixedlightlev >= 0 || fixedcolormap)
|
if (fullbrightSprite || fixedlightlev >= 0 || fixedcolormap)
|
||||||
{
|
{
|
||||||
uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
uniforms.flags = TriUniforms::fixed_light;
|
args.uniforms.flags = TriUniforms::fixed_light;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uniforms.light = (uint32_t)((sub->sector->lightlevel + actualextralight) / 255.0f * 256.0f);
|
args.uniforms.light = (uint32_t)((sub->sector->lightlevel + actualextralight) / 255.0f * 256.0f);
|
||||||
uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
}
|
}
|
||||||
uniforms.subsectorDepth = subsectorDepth;
|
args.uniforms.subsectorDepth = subsectorDepth;
|
||||||
|
|
||||||
if (r_swtruecolor)
|
if (r_swtruecolor)
|
||||||
{
|
{
|
||||||
uint32_t alpha = particle->trans;
|
uint32_t alpha = particle->trans;
|
||||||
uniforms.color = (alpha << 24) | (particle->color & 0xffffff);
|
args.uniforms.color = (alpha << 24) | (particle->color & 0xffffff);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uniforms.color = ((uint32_t)particle->color) >> 24;
|
args.uniforms.color = ((uint32_t)particle->color) >> 24;
|
||||||
uniforms.srcalpha = particle->trans;
|
args.uniforms.srcalpha = particle->trans;
|
||||||
uniforms.destalpha = 255 - particle->trans;
|
args.uniforms.destalpha = 255 - particle->trans;
|
||||||
}
|
}
|
||||||
|
|
||||||
PolyDrawArgs args;
|
|
||||||
args.uniforms = uniforms;
|
|
||||||
args.objectToClip = &worldToClip;
|
args.objectToClip = &worldToClip;
|
||||||
args.vinput = vertices;
|
args.vinput = vertices;
|
||||||
args.vcount = 4;
|
args.vcount = 4;
|
||||||
|
|
|
@ -103,12 +103,12 @@ void RenderPolyPlane::Render3DFloor(const TriMatrix &worldToClip, subsector_t *s
|
||||||
lightlevel = *light->p_lightlevel;
|
lightlevel = *light->p_lightlevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
TriUniforms uniforms;
|
PolyDrawArgs args;
|
||||||
uniforms.light = (uint32_t)(lightlevel / 255.0f * 256.0f);
|
args.uniforms.light = (uint32_t)(lightlevel / 255.0f * 256.0f);
|
||||||
if (fixedlightlev >= 0 || fixedcolormap)
|
if (fixedlightlev >= 0 || fixedcolormap)
|
||||||
uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
uniforms.subsectorDepth = subsectorDepth;
|
args.uniforms.subsectorDepth = subsectorDepth;
|
||||||
|
|
||||||
TriVertex *vertices = PolyVertexBuffer::GetVertices(sub->numlines);
|
TriVertex *vertices = PolyVertexBuffer::GetVertices(sub->numlines);
|
||||||
if (!vertices)
|
if (!vertices)
|
||||||
|
@ -131,8 +131,6 @@ void RenderPolyPlane::Render3DFloor(const TriMatrix &worldToClip, subsector_t *s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PolyDrawArgs args;
|
|
||||||
args.uniforms = uniforms;
|
|
||||||
args.objectToClip = &worldToClip;
|
args.objectToClip = &worldToClip;
|
||||||
args.vinput = vertices;
|
args.vinput = vertices;
|
||||||
args.vcount = sub->numlines;
|
args.vcount = sub->numlines;
|
||||||
|
@ -217,12 +215,12 @@ void RenderPolyPlane::Render(const TriMatrix &worldToClip, subsector_t *sub, uin
|
||||||
|
|
||||||
bool isSky = picnum == skyflatnum;
|
bool isSky = picnum == skyflatnum;
|
||||||
|
|
||||||
TriUniforms uniforms;
|
PolyDrawArgs args;
|
||||||
uniforms.light = (uint32_t)(frontsector->lightlevel / 255.0f * 256.0f);
|
args.uniforms.light = (uint32_t)(frontsector->lightlevel / 255.0f * 256.0f);
|
||||||
if (fixedlightlev >= 0 || fixedcolormap)
|
if (fixedlightlev >= 0 || fixedcolormap)
|
||||||
uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
uniforms.subsectorDepth = isSky ? RenderPolyPortal::SkySubsectorDepth : subsectorDepth;
|
args.uniforms.subsectorDepth = isSky ? RenderPolyPortal::SkySubsectorDepth : subsectorDepth;
|
||||||
|
|
||||||
TriVertex *vertices = PolyVertexBuffer::GetVertices(sub->numlines);
|
TriVertex *vertices = PolyVertexBuffer::GetVertices(sub->numlines);
|
||||||
if (!vertices)
|
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.objectToClip = &worldToClip;
|
||||||
args.vinput = vertices;
|
args.vinput = vertices;
|
||||||
args.vcount = sub->numlines;
|
args.vcount = sub->numlines;
|
||||||
|
|
|
@ -50,15 +50,12 @@ void PolySkyDome::Render(const TriMatrix &worldToClip)
|
||||||
TriMatrix objectToWorld = TriMatrix::translate((float)ViewPos.X, (float)ViewPos.Y, (float)ViewPos.Z);
|
TriMatrix objectToWorld = TriMatrix::translate((float)ViewPos.X, (float)ViewPos.Y, (float)ViewPos.Z);
|
||||||
objectToClip = worldToClip * objectToWorld;
|
objectToClip = worldToClip * objectToWorld;
|
||||||
|
|
||||||
TriUniforms uniforms;
|
|
||||||
uniforms.light = 256;
|
|
||||||
uniforms.flags = 0;
|
|
||||||
uniforms.subsectorDepth = RenderPolyPortal::SkySubsectorDepth;
|
|
||||||
|
|
||||||
int rc = mRows + 1;
|
int rc = mRows + 1;
|
||||||
|
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
args.uniforms = uniforms;
|
args.uniforms.light = 256;
|
||||||
|
args.uniforms.flags = 0;
|
||||||
|
args.uniforms.subsectorDepth = RenderPolyPortal::SkySubsectorDepth;
|
||||||
args.objectToClip = &objectToClip;
|
args.objectToClip = &objectToClip;
|
||||||
args.stenciltestvalue = 255;
|
args.stenciltestvalue = 255;
|
||||||
args.stencilwritevalue = 255;
|
args.stencilwritevalue = 255;
|
||||||
|
|
|
@ -239,13 +239,10 @@ void RenderPolyWall::Render(const TriMatrix &worldToClip)
|
||||||
ClampHeight(vertices[1], vertices[2]);
|
ClampHeight(vertices[1], vertices[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
TriUniforms uniforms;
|
|
||||||
uniforms.light = (uint32_t)(GetLightLevel() / 255.0f * 256.0f);
|
|
||||||
uniforms.flags = 0;
|
|
||||||
uniforms.subsectorDepth = SubsectorDepth;
|
|
||||||
|
|
||||||
PolyDrawArgs args;
|
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.objectToClip = &worldToClip;
|
||||||
args.vinput = vertices;
|
args.vinput = vertices;
|
||||||
args.vcount = 4;
|
args.vcount = 4;
|
||||||
|
|
|
@ -98,21 +98,19 @@ void RenderPolyWallSprite::Render(const TriMatrix &worldToClip, AActor *thing, s
|
||||||
|
|
||||||
bool fullbrightSprite = ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT));
|
bool fullbrightSprite = ((thing->renderflags & RF_FULLBRIGHT) || (thing->flags5 & MF5_BRIGHT));
|
||||||
|
|
||||||
TriUniforms uniforms;
|
PolyDrawArgs args;
|
||||||
if (fullbrightSprite || fixedlightlev >= 0 || fixedcolormap)
|
if (fullbrightSprite || fixedlightlev >= 0 || fixedcolormap)
|
||||||
{
|
{
|
||||||
uniforms.light = 256;
|
args.uniforms.light = 256;
|
||||||
uniforms.flags = TriUniforms::fixed_light;
|
args.uniforms.flags = TriUniforms::fixed_light;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uniforms.light = (uint32_t)((thing->Sector->lightlevel + actualextralight) / 255.0f * 256.0f);
|
args.uniforms.light = (uint32_t)((thing->Sector->lightlevel + actualextralight) / 255.0f * 256.0f);
|
||||||
uniforms.flags = 0;
|
args.uniforms.flags = 0;
|
||||||
}
|
}
|
||||||
uniforms.subsectorDepth = subsectorDepth;
|
args.uniforms.subsectorDepth = subsectorDepth;
|
||||||
|
|
||||||
PolyDrawArgs args;
|
|
||||||
args.uniforms = uniforms;
|
|
||||||
args.objectToClip = &worldToClip;
|
args.objectToClip = &worldToClip;
|
||||||
args.vinput = vertices;
|
args.vinput = vertices;
|
||||||
args.vcount = 4;
|
args.vcount = 4;
|
||||||
|
|
Loading…
Reference in a new issue