Fix decal vertical position being wrong

This commit is contained in:
Magnus Norddahl 2016-11-20 16:43:13 +01:00
parent bd9ec843dd
commit ebd810d843

View file

@ -118,7 +118,7 @@ void RenderPolyDecal::Render(const TriMatrix &worldToClip, DBaseDecal *decal, co
vertices[i].x = (float)p.X; vertices[i].x = (float)p.X;
vertices[i].y = (float)p.Y; vertices[i].y = (float)p.Y;
vertices[i].z = (float)(zpos + spriteHeight * offsets[i].second); vertices[i].z = (float)(zpos + spriteHeight * offsets[i].second - spriteHeight * 0.5);
vertices[i].w = 1.0f; vertices[i].w = 1.0f;
vertices[i].varying[0] = (float)(offsets[i].first * tex->Scale.X); vertices[i].varying[0] = (float)(offsets[i].first * tex->Scale.X);
vertices[i].varying[1] = (float)((1.0f - offsets[i].second) * tex->Scale.Y); vertices[i].varying[1] = (float)((1.0f - offsets[i].second) * tex->Scale.Y);
@ -140,7 +140,15 @@ void RenderPolyDecal::Render(const TriMatrix &worldToClip, DBaseDecal *decal, co
uniforms.flags = 0; uniforms.flags = 0;
} }
uniforms.subsectorDepth = subsectorDepth; uniforms.subsectorDepth = subsectorDepth;
uniforms.color = decal->AlphaColor;
if (r_swtruecolor)
{
uniforms.color = 0xff000000 | decal->AlphaColor;
}
else
{
uniforms.color = ((uint32_t)decal->AlphaColor) >> 24;
}
PolyDrawArgs args; PolyDrawArgs args;
args.uniforms = uniforms; args.uniforms = uniforms;
@ -152,7 +160,7 @@ void RenderPolyDecal::Render(const TriMatrix &worldToClip, DBaseDecal *decal, co
args.stenciltestvalue = 0; args.stenciltestvalue = 0;
args.stencilwritevalue = 1; args.stencilwritevalue = 1;
args.SetTexture(tex); args.SetTexture(tex);
args.SetColormap(line->frontsector->ColorMap); args.SetColormap(front->ColorMap);
//mode = R_SetPatchStyle (decal->RenderStyle, (float)decal->Alpha, decal->Translation, decal->AlphaColor); //mode = R_SetPatchStyle (decal->RenderStyle, (float)decal->Alpha, decal->Translation, decal->AlphaColor);
PolyTriangleDrawer::draw(args, TriDrawVariant::DrawSubsector, TriBlendMode::Shaded); PolyTriangleDrawer::draw(args, TriDrawVariant::DrawSubsector, TriBlendMode::Shaded);
} }