mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-02 23:11:51 +00:00
- moved alpha threshold determination for sprites to the setup pass.
Overall this is not much, but it can be easily offloaded to a worker thread later.
This commit is contained in:
parent
37e7f92182
commit
899ced50aa
2 changed files with 8 additions and 6 deletions
|
@ -341,6 +341,7 @@ public:
|
||||||
VSMatrix rotmat;
|
VSMatrix rotmat;
|
||||||
};
|
};
|
||||||
int dynlightindex;
|
int dynlightindex;
|
||||||
|
float alphaThreshold;
|
||||||
|
|
||||||
FGameTexture *texture;
|
FGameTexture *texture;
|
||||||
DRotator Angles;
|
DRotator Angles;
|
||||||
|
|
|
@ -69,9 +69,7 @@ void HWSprite::DrawSprite(HWDrawInfo* di, FRenderState& state, bool translucent)
|
||||||
|
|
||||||
state.SetRenderStyle(RenderStyle);
|
state.SetRenderStyle(RenderStyle);
|
||||||
state.SetTextureMode(RenderStyle);
|
state.SetTextureMode(RenderStyle);
|
||||||
|
state.AlphaFunc(Alpha_Greater, alphaThreshold);
|
||||||
if (texture && (hw_int_useindexedcolortextures || !checkTranslucentReplacement(texture->GetID(), palette))) state.AlphaFunc(Alpha_GEqual, texture->alphaThreshold);
|
|
||||||
else state.AlphaFunc(Alpha_Greater, 0.f);
|
|
||||||
|
|
||||||
if (RenderStyle.BlendOp == STYLEOP_Add && RenderStyle.DestAlpha == STYLEALPHA_One)
|
if (RenderStyle.BlendOp == STYLEOP_Add && RenderStyle.DestAlpha == STYLEALPHA_One)
|
||||||
{
|
{
|
||||||
|
@ -79,12 +77,14 @@ void HWSprite::DrawSprite(HWDrawInfo* di, FRenderState& state, bool translucent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (dynlightindex == -1) // only set if we got no light buffer index. This covers all cases where sprite lighting is used.
|
if (dynlightindex == -1) // only set if we got no light buffer index. This covers all cases where sprite lighting is used.
|
||||||
{
|
{
|
||||||
float out[3] = {};
|
float out[3] = {};
|
||||||
//di->GetDynSpriteLight(gl_light_sprites ? actor : nullptr, gl_light_particles ? particle : nullptr, out);
|
//di->GetDynSpriteLight(gl_light_sprites ? actor : nullptr, gl_light_particles ? particle : nullptr, out);
|
||||||
//state.SetDynLight(out[0], out[1], out[2]);
|
//state.SetDynLight(out[0], out[1], out[2]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (RenderStyle.Flags & STYLEF_FadeToBlack)
|
if (RenderStyle.Flags & STYLEF_FadeToBlack)
|
||||||
|
@ -287,7 +287,9 @@ void HWSprite::CreateVertices(HWDrawInfo* di)
|
||||||
|
|
||||||
inline void HWSprite::PutSprite(HWDrawInfo* di, bool translucent)
|
inline void HWSprite::PutSprite(HWDrawInfo* di, bool translucent)
|
||||||
{
|
{
|
||||||
// That's a lot of checks...
|
if (translucent && texture && (hw_int_useindexedcolortextures || !checkTranslucentReplacement(texture->GetID(), palette))) alphaThreshold = texture->alphaThreshold;
|
||||||
|
else alphaThreshold = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if (modelframe == 1 && gl_light_sprites)
|
if (modelframe == 1 && gl_light_sprites)
|
||||||
{
|
{
|
||||||
|
@ -297,6 +299,7 @@ inline void HWSprite::PutSprite(HWDrawInfo* di, bool translucent)
|
||||||
else*/
|
else*/
|
||||||
dynlightindex = -1;
|
dynlightindex = -1;
|
||||||
|
|
||||||
|
rendered_sprites++;
|
||||||
vertexindex = -1;
|
vertexindex = -1;
|
||||||
if (!screen->BuffersArePersistent())
|
if (!screen->BuffersArePersistent())
|
||||||
{
|
{
|
||||||
|
@ -435,7 +438,6 @@ void HWSprite::Process(HWDrawInfo* di, tspritetype* spr, sectortype* sector, int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PutSprite(di, true);
|
PutSprite(di, true);
|
||||||
rendered_sprites++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -534,6 +536,5 @@ bool HWSprite::ProcessVoxel(HWDrawInfo* di, voxmodel_t* vox, tspritetype* spr, s
|
||||||
auto vp = di->Viewpoint;
|
auto vp = di->Viewpoint;
|
||||||
depth = (float)((x - vp.Pos.X) * vp.TanCos + (y - vp.Pos.Y) * vp.TanSin);
|
depth = (float)((x - vp.Pos.X) * vp.TanCos + (y - vp.Pos.Y) * vp.TanSin);
|
||||||
PutSprite(di, spriteHasTranslucency(Sprite));
|
PutSprite(di, spriteHasTranslucency(Sprite));
|
||||||
rendered_sprites++;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue