Skip to content
Permalink
Browse files

Implement func_paletted shader

  • Loading branch information
dpjudas committed Dec 2, 2019
1 parent 44c2223 commit 865b7a1a2c6646900d70531fe9c6078c5a256723
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/rendering/polyrenderer/drawers/screen_triangle.cpp
@@ -425,6 +425,20 @@ static void RunShader(int x0, int x1, PolyTriangleThreadData* thread)
}*/
return;
}
else if (thread->EffectState == SHADER_Paletted) // func_paletted
{
int texWidth = thread->textures[0].width;
int texHeight = thread->textures[0].height;
const void* texPixels = thread->textures[0].pixels;
bool texBgra = thread->textures[0].bgra;

const uint32_t* lut = (const uint32_t*)thread->textures[1].pixels;

for (int x = x0; x < x1; x++)
{
fragcolor[x] = lut[RPART(sampleTexture(u[x], v[x], texPixels, texWidth, texHeight, texBgra))] | 0xff000000;
}
}
else if (thread->EffectState == SHADER_NoTexture) // func_notexture
{
uint32_t a = (int)(streamdata.uObjectColor.a * 255.0f);

0 comments on commit 865b7a1

Please sign in to comment.
You can’t perform that action at this time.