mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 23:33:00 +00:00
- fixed a few things in the weapon drawer.
This commit is contained in:
parent
2b5019ea6e
commit
fbbf2f8346
2 changed files with 34 additions and 48 deletions
|
@ -551,6 +551,9 @@ void GLSceneDrawer::DrawEndScene2D(sector_t * viewsector)
|
|||
gl_RenderState.mViewMatrix.loadIdentity();
|
||||
gl_RenderState.mProjectionMatrix.ortho(0, screen->GetWidth(), screen->GetHeight(), 0, -1.0f, 1.0f);
|
||||
gl_RenderState.ApplyMatrices();
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glDisable(GL_MULTISAMPLE);
|
||||
|
||||
|
||||
// [BB] Only draw the sprites if we didn't render a HUD model before.
|
||||
if (renderHUDModel == false)
|
||||
|
|
|
@ -73,7 +73,7 @@ void GLSceneDrawer::DrawPSprite (player_t * player,DPSprite *psp, float sx, floa
|
|||
qd.Set(2, rc.x2, rc.y1, 0, rc.u2, rc.v1);
|
||||
qd.Set(3, rc.x2, rc.y2, 0, rc.u2, rc.v2);
|
||||
qd.Render(GL_TRIANGLE_STRIP);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.5f);
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, gl_mask_sprite_threshold);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -151,6 +151,7 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
|||
|
||||
for(DPSprite *psp = player->psprites; psp != nullptr && psp->GetID() < PSP_TARGETCENTER; psp = psp->GetNext())
|
||||
{
|
||||
if (!psp->GetState()) continue;
|
||||
WeaponRenderStyle rs = GetWeaponRenderStyle(psp, camera);
|
||||
if (rs.RenderStyle.BlendOp == STYLEOP_None) continue;
|
||||
|
||||
|
@ -164,34 +165,16 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
|||
gl_RenderState.EnableBrightmap(!(rs.RenderStyle.Flags & STYLEF_ColorIsFixed));
|
||||
|
||||
const bool bright = isBright(psp);
|
||||
const PalEntry finalcol = bright
|
||||
? ThingColor
|
||||
: ThingColor.Modulate(viewsector->SpecialColors[sector_t::sprites]);
|
||||
const PalEntry finalcol = bright? ThingColor : ThingColor.Modulate(viewsector->SpecialColors[sector_t::sprites]);
|
||||
gl_RenderState.SetObjectColor(finalcol);
|
||||
|
||||
if (psp->GetState() != nullptr)
|
||||
{
|
||||
FColormap cmc = light.cm;
|
||||
int ll = light.lightlevel;
|
||||
if (bright)
|
||||
{
|
||||
if (light.isbelow)
|
||||
{
|
||||
cmc.MakeWhite();
|
||||
}
|
||||
else
|
||||
{
|
||||
// under water areas keep most of their color for fullbright objects
|
||||
cmc.LightColor.r = (3 * cmc.LightColor.r + 0xff) / 4;
|
||||
cmc.LightColor.g = (3*cmc.LightColor.g + 0xff)/4;
|
||||
cmc.LightColor.b = (3*cmc.LightColor.b + 0xff)/4;
|
||||
}
|
||||
ll = 255;
|
||||
}
|
||||
auto ll = light;
|
||||
if (bright) ll.SetBright();
|
||||
|
||||
// set the lighting parameters
|
||||
if (rs.RenderStyle.BlendOp == STYLEOP_Shadow)
|
||||
{
|
||||
gl_RenderState.SetColor(0.2f, 0.2f, 0.2f, 0.33f, cmc.Desaturation);
|
||||
gl_RenderState.SetColor(0.2f, 0.2f, 0.2f, 0.33f, ll.cm.Desaturation);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -209,7 +192,7 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
|||
gl_RenderState.SetDynLight(out[0], out[1], out[2]);
|
||||
}
|
||||
}
|
||||
SetColor(ll, 0, cmc, rs.alpha, true);
|
||||
SetColor(ll.lightlevel, 0, ll.cm, rs.alpha, true);
|
||||
}
|
||||
|
||||
FVector2 spos = BobWeapon(weap, psp);
|
||||
|
@ -217,6 +200,7 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
|||
// [BB] In the HUD model step we just render the model and break out.
|
||||
if (hudModelStep)
|
||||
{
|
||||
gl_RenderState.AlphaFunc(GL_GEQUAL, 0.f);
|
||||
gl_RenderHUDModel(psp, spos.X, spos.Y, weapondynlightindex[psp]);
|
||||
}
|
||||
else
|
||||
|
@ -224,7 +208,6 @@ void GLSceneDrawer::DrawPlayerSprites(sector_t * viewsector, bool hudModelStep)
|
|||
DrawPSprite(player, psp, spos.X, spos.Y, rs.OverrideShader, !!(rs.RenderStyle.Flags & STYLEF_RedIsAlpha));
|
||||
}
|
||||
}
|
||||
}
|
||||
gl_RenderState.SetObjectColor(0xffffffff);
|
||||
gl_RenderState.SetDynLight(0, 0, 0);
|
||||
gl_RenderState.EnableBrightmap(false);
|
||||
|
|
Loading…
Reference in a new issue