mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
- fixed voxel rendering in indexed color mode.
This commit is contained in:
parent
f743b22661
commit
6ba04e7a09
2 changed files with 6 additions and 3 deletions
|
@ -189,10 +189,8 @@ bool GLInstance::SetTextureInternal(int picnum, FTexture* tex, int palette, int
|
||||||
auto sampler = (method & DAMETH_CLAMPED) ? (sampleroverride != -1 ? sampleroverride : SamplerClampXY) : SamplerRepeat;
|
auto sampler = (method & DAMETH_CLAMPED) ? (sampleroverride != -1 ? sampleroverride : SamplerClampXY) : SamplerRepeat;
|
||||||
if (TextureType == TT_INDEXED)
|
if (TextureType == TT_INDEXED)
|
||||||
{
|
{
|
||||||
renderState.Flags |= RF_UsePalette;
|
|
||||||
sampler = sampler + SamplerNoFilterRepeat - SamplerRepeat;
|
sampler = sampler + SamplerNoFilterRepeat - SamplerRepeat;
|
||||||
}
|
}
|
||||||
else renderState.Flags &= ~RF_UsePalette;
|
|
||||||
UseDetailMapping(false);
|
UseDetailMapping(false);
|
||||||
UseGlowMapping(false);
|
UseGlowMapping(false);
|
||||||
UseBrightmaps(false);
|
UseBrightmaps(false);
|
||||||
|
@ -326,7 +324,6 @@ bool GLInstance::SetNamedTexture(FTexture* tex, int palette, int sampler)
|
||||||
auto mtex = LoadTexture(tex, palette>= 0? TT_TRUECOLOR : TT_HICREPLACE, palette);
|
auto mtex = LoadTexture(tex, palette>= 0? TT_TRUECOLOR : TT_HICREPLACE, palette);
|
||||||
if (!mtex) return false;
|
if (!mtex) return false;
|
||||||
|
|
||||||
renderState.Flags &= ~RF_UsePalette;
|
|
||||||
BindTexture(0, mtex, sampler);
|
BindTexture(0, mtex, sampler);
|
||||||
GLInterface.SetAlphaThreshold(tex->isTranslucent()? 0.f : 0.5f);
|
GLInterface.SetAlphaThreshold(tex->isTranslucent()? 0.f : 0.5f);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -284,6 +284,12 @@ void GLInstance::Draw(EDrawType type, size_t start, size_t count)
|
||||||
void GLInstance::BindTexture(int texunit, FHardwareTexture *tex, int sampler)
|
void GLInstance::BindTexture(int texunit, FHardwareTexture *tex, int sampler)
|
||||||
{
|
{
|
||||||
if (!tex) return;
|
if (!tex) return;
|
||||||
|
if (texunit == 0 && tex->isIndexed())
|
||||||
|
{
|
||||||
|
renderState.Flags |= RF_UsePalette;
|
||||||
|
}
|
||||||
|
else renderState.Flags &= ~RF_UsePalette;
|
||||||
|
|
||||||
if (texunit != 0) glActiveTexture(GL_TEXTURE0 + texunit);
|
if (texunit != 0) glActiveTexture(GL_TEXTURE0 + texunit);
|
||||||
glBindTexture(GL_TEXTURE_2D, tex->GetTextureHandle());
|
glBindTexture(GL_TEXTURE_2D, tex->GetTextureHandle());
|
||||||
mSamplers->Bind(texunit, sampler == NoSampler? tex->GetSampler() : sampler, 0);
|
mSamplers->Bind(texunit, sampler == NoSampler? tex->GetSampler() : sampler, 0);
|
||||||
|
|
Loading…
Reference in a new issue