mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-14 11:50:49 +00:00
- fixed some of the issues with palette emulation
* the palette shader was not bound. * the palette textures were not bound. * palette mode still used regular lighting on top of the palette emulation This works a lot better than before but is still not complete.
This commit is contained in:
parent
9187577719
commit
9e81fa89a8
7 changed files with 26 additions and 16 deletions
|
@ -329,7 +329,9 @@ void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translatio
|
|||
|
||||
if (base->BindOrCreate(tex->GetTexture(), 0, clampmode, translation, layer->scaleFlags))
|
||||
{
|
||||
for (int i = 1; i<numLayers; i++)
|
||||
if (!(layer->scaleFlags & CTF_Indexed))
|
||||
{
|
||||
for (int i = 1; i < numLayers; i++)
|
||||
{
|
||||
auto systex = static_cast<FHardwareTexture*>(mat->GetLayer(i, 0, &layer));
|
||||
// fixme: Upscale flags must be disabled for certain layers.
|
||||
|
@ -337,6 +339,16 @@ void FGLRenderState::ApplyMaterial(FMaterial *mat, int clampmode, int translatio
|
|||
maxbound = i;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 1; i < 3; i++)
|
||||
{
|
||||
auto systex = static_cast<FHardwareTexture*>(mat->GetLayer(i, 0, &layer));
|
||||
systex->Bind(i, false);
|
||||
maxbound = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
// unbind everything from the last texture that's still active
|
||||
for (int i = maxbound + 1; i <= maxBoundMaterial; i++)
|
||||
{
|
||||
|
|
|
@ -277,7 +277,7 @@ const FDefaultShader defaultshaders[] =
|
|||
{"Warp 2", "shaders/glsl/func_warp2.fp", "shaders/glsl/material_normal.fp", ""},
|
||||
{"Specular", "shaders/glsl/func_spec.fp", "shaders/glsl/material_specular.fp", "#define SPECULAR\n#define NORMALMAP\n"},
|
||||
{"PBR","shaders/glsl/func_pbr.fp", "shaders/glsl/material_pbr.fp", "#define PBR\n#define NORMALMAP\n"},
|
||||
{"Paletted", "shaders/glsl/func_paletted.fp", "shaders/glsl/material_nolight.fp", ""},
|
||||
{"Paletted", "shaders/glsl/func_paletted.fp", "shaders/glsl/material_nolight.fp", "#define PALETTE_EMULATION"},
|
||||
{"No Texture", "shaders/glsl/func_notexture.fp", "shaders/glsl/material_normal.fp", "#define NO_LAYERS\n"},
|
||||
{"Basic Fuzz", "shaders/glsl/fuzz_standard.fp", "shaders/glsl/material_normal.fp", ""},
|
||||
{"Smooth Fuzz", "shaders/glsl/fuzz_smooth.fp", "shaders/glsl/material_normal.fp", ""},
|
||||
|
|
|
@ -1002,7 +1002,7 @@ void videoInit()
|
|||
|
||||
PolymostProcessVoxels();
|
||||
GLInterface.Init(screen->GetWidth());
|
||||
GLInterface.InitGLState(4, 4/*glmultisample*/);
|
||||
screen->BeginFrame();
|
||||
screen->SetTextureFilterMode();
|
||||
setViewport(hud_size);
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ bool GLInstance::SetTexture(int picnum, FGameTexture* tex, int paletteid, int sa
|
|||
mat.mMaterial = FMaterial::ValidateTexture(texpick.texture, flags); // todo allow scaling
|
||||
mat.mClampMode = sampler;
|
||||
mat.mTranslation = texpick.translation;
|
||||
mat.mOverrideShader = 0;
|
||||
mat.mOverrideShader = -1;
|
||||
mat.mChanged = true;
|
||||
if (TextureType == TT_INDEXED) renderState.Flags |= RF_UsePalette;
|
||||
else renderState.Flags &= ~RF_UsePalette;
|
||||
|
|
|
@ -96,13 +96,6 @@ void GLInstance::Init(int ydim)
|
|||
new(&renderState) PolymostRenderState; // reset to defaults.
|
||||
}
|
||||
|
||||
void GLInstance::InitGLState(int fogmode, int multisample)
|
||||
{
|
||||
// This is a bad place to call this but without deconstructing the entire render loops in all front ends there is no way to have a well defined spot for this stuff.
|
||||
// Before doing that the backend needs to work in some fashion, so we have to make sure everything is set up when the first render call is performed.
|
||||
screen->BeginFrame();
|
||||
}
|
||||
|
||||
void GLInstance::Deinit()
|
||||
{
|
||||
palmanager.DeleteAll();
|
||||
|
@ -241,6 +234,7 @@ void PolymostRenderState::Apply(FRenderState& state, GLState& oldState)
|
|||
state.EnableFog(1);
|
||||
}
|
||||
else state.EnableFog(0);
|
||||
|
||||
state.SetFog((GLInterface.useMapFog) ? PalEntry(0x999999) : FogColor, 350.f); // Fixme: The real density still needs to be implemented. 350 is a reasonable default only.
|
||||
|
||||
state.SetSoftLightLevel(ShadeDiv >= 1 / 1000.f ? 255 - Scale(Shade, 255, numshades) : 255);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <algorithm>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include "c_cvars.h"
|
||||
#include "gl_samplers.h"
|
||||
#include "gl_hwtexture.h"
|
||||
#include "matrix.h"
|
||||
|
@ -94,7 +95,6 @@ public:
|
|||
glinfo_t glinfo;
|
||||
|
||||
void Init(int y);
|
||||
void InitGLState(int fogmode, int multisample);
|
||||
|
||||
void Deinit();
|
||||
|
||||
|
|
|
@ -298,6 +298,7 @@ float R_DoomColormap(float light, float z)
|
|||
//===========================================================================
|
||||
float R_DoomLightingEquation(float light)
|
||||
{
|
||||
#ifndef PALETTE_EMULATION
|
||||
// z is the depth in view space, positive going into the screen
|
||||
float z;
|
||||
if (((uPalLightLevels >> 8) & 0xff) == 2)
|
||||
|
@ -326,6 +327,9 @@ float R_DoomLightingEquation(float light)
|
|||
|
||||
// Result is the normalized colormap index (0 bright .. 1 dark)
|
||||
return clamp(colormap, 0.0, 31.0) / 32.0;
|
||||
#else
|
||||
return 0.0; // with palette emulation we do not want real lighting.
|
||||
#endif
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
Loading…
Reference in a new issue