mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 15:02:39 +00:00
Implement EFF_FOGBOUNDARY
This commit is contained in:
parent
0fd964ec4f
commit
b44c40a63d
1 changed files with 13 additions and 4 deletions
|
@ -46,13 +46,22 @@ static uint32_t SampleTexture(uint32_t u, uint32_t v, const void* texPixels, int
|
||||||
|
|
||||||
static void EffectFogBoundary(int x0, int x1, PolyTriangleThreadData* thread)
|
static void EffectFogBoundary(int x0, int x1, PolyTriangleThreadData* thread)
|
||||||
{
|
{
|
||||||
|
float uFogDensity = thread->PushConstants->uFogDensity;
|
||||||
|
uint32_t fogcolor = MAKEARGB(
|
||||||
|
0,
|
||||||
|
static_cast<int>(clamp(thread->mainVertexShader.Data.uFogColor.r, 0.0f, 1.0f) * 255.0f),
|
||||||
|
static_cast<int>(clamp(thread->mainVertexShader.Data.uFogColor.g, 0.0f, 1.0f) * 255.0f),
|
||||||
|
static_cast<int>(clamp(thread->mainVertexShader.Data.uFogColor.b, 0.0f, 1.0f) * 255.0f));
|
||||||
|
|
||||||
uint32_t* fragcolor = thread->scanline.FragColor;
|
uint32_t* fragcolor = thread->scanline.FragColor;
|
||||||
for (int x = x0; x < x1; x++)
|
for (int x = x0; x < x1; x++)
|
||||||
{
|
{
|
||||||
/*float fogdist = pixelpos.w;
|
float fogdist = thread->scanline.W[x];
|
||||||
float fogfactor = exp2(uFogDensity * fogdist);
|
float fogfactor = std::exp2(uFogDensity * fogdist);
|
||||||
FragColor = vec4(uFogColor.rgb, 1.0 - fogfactor);*/
|
|
||||||
fragcolor[x] = 0;
|
// FragColor = vec4(uFogColor.rgb, 1.0 - fogfactor):
|
||||||
|
uint32_t alpha = static_cast<int>(clamp(1.0f - (1.0f / 255.0f), 0.0f, 1.0f) * 255.0f);
|
||||||
|
fragcolor[x] = fogcolor | alpha;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue