From 0108ff89d79be0404eea8b05b2ae726ed81a8c90 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Mon, 21 Nov 2016 15:20:07 +0100 Subject: [PATCH] Bug fixes --- src/r_poly_cull.cpp | 8 ++++---- src/r_poly_sprite.cpp | 2 +- src/r_poly_triangle.cpp | 35 ++++++++++++++++++++++++++++++++++- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/r_poly_cull.cpp b/src/r_poly_cull.cpp index dff8b76889..79b8d151d9 100644 --- a/src/r_poly_cull.cpp +++ b/src/r_poly_cull.cpp @@ -181,10 +181,10 @@ bool PolyCull::CheckBBox(float *bspcoord) for (int i = 0; i < 4; i++) { int j = i < 3 ? i + 1 : 0; - int x1 = bspcoord[lines[i][0]]; - int y1 = bspcoord[lines[i][1]]; - int x2 = bspcoord[lines[i][2]]; - int y2 = bspcoord[lines[i][3]]; + float x1 = bspcoord[lines[i][0]]; + float y1 = bspcoord[lines[i][1]]; + float x2 = bspcoord[lines[i][2]]; + float y2 = bspcoord[lines[i][3]]; int sx1, sx2; if (GetSegmentRangeForLine(x1, y1, x2, y2, sx1, sx2)) { diff --git a/src/r_poly_sprite.cpp b/src/r_poly_sprite.cpp index 38ddd46dfa..87d52b98f1 100644 --- a/src/r_poly_sprite.cpp +++ b/src/r_poly_sprite.cpp @@ -190,7 +190,7 @@ void RenderPolySprite::Render(const TriMatrix &worldToClip, AActor *thing, subse else if (thing->RenderStyle == LegacyRenderStyles[STYLE_AddStencil]) { args.uniforms.destalpha = 256; - args.uniforms.srcalpha = (uint32_t)(thing->Alpha * 256) * 2; // Don't know this needs to be multiplied by two.. + args.uniforms.srcalpha = (uint32_t)(thing->Alpha * 256); args.uniforms.color = 0xff000000 | thing->fillcolor; blendmode = TriBlendMode::Stencil; } diff --git a/src/r_poly_triangle.cpp b/src/r_poly_triangle.cpp index 2ba3336d14..88ee02a36e 100644 --- a/src/r_poly_triangle.cpp +++ b/src/r_poly_triangle.cpp @@ -339,7 +339,40 @@ void DrawPolyTrianglesCommand::Execute(DrawerThread *thread) FString DrawPolyTrianglesCommand::DebugInfo() { - return "DrawPolyTriangles"; + FString variantstr; + switch (variant) + { + default: variantstr = "Unknown"; break; + case TriDrawVariant::DrawNormal: variantstr = "DrawNormal"; break; + case TriDrawVariant::FillNormal: variantstr = "FillNormal"; break; + case TriDrawVariant::DrawSubsector: variantstr = "DrawSubsector"; break; + case TriDrawVariant::FillSubsector: variantstr = "FillSubsector"; break; + case TriDrawVariant::FuzzSubsector: variantstr = "FuzzSubsector"; break; + case TriDrawVariant::Stencil: variantstr = "Stencil"; break; + } + + FString blendmodestr; + switch (blendmode) + { + default: blendmodestr = "Unknown"; break; + case TriBlendMode::Copy: blendmodestr = "Copy"; break; + case TriBlendMode::AlphaBlend: blendmodestr = "AlphaBlend"; break; + case TriBlendMode::AddSolid: blendmodestr = "AddSolid"; break; + case TriBlendMode::Add: blendmodestr = "Add"; break; + case TriBlendMode::Sub: blendmodestr = "Sub"; break; + case TriBlendMode::RevSub: blendmodestr = "RevSub"; break; + case TriBlendMode::Stencil: blendmodestr = "Stencil"; break; + case TriBlendMode::Shaded: blendmodestr = "Shaded"; break; + case TriBlendMode::TranslateCopy: blendmodestr = "TranslateCopy"; break; + case TriBlendMode::TranslateAlphaBlend: blendmodestr = "TranslateAlphaBlend"; break; + case TriBlendMode::TranslateAdd: blendmodestr = "TranslateAdd"; break; + case TriBlendMode::TranslateSub: blendmodestr = "TranslateSub"; break; + case TriBlendMode::TranslateRevSub: blendmodestr = "TranslateRevSub"; break; + } + + FString info; + info.Format("DrawPolyTriangles: variant = %s, blend mode = %s, color = %d", variantstr.GetChars(), blendmodestr.GetChars(), args.uniforms.color); + return info; } /////////////////////////////////////////////////////////////////////////////