- added palette shader and fixed a few things.

This commit is contained in:
Christoph Oelckers 2018-04-07 12:17:23 +02:00
parent 211a7f2569
commit 221beec979
6 changed files with 20 additions and 8 deletions

View file

@ -434,7 +434,7 @@ void FGLRenderer::RenderView(player_t* player)
gl_RenderState.SetVertexBuffer(mVBO);
mVBO->Reset();
if (currentrenderer == 0)
if (currentrenderer == 0 && 0)
{
if (swdrawer == nullptr) swdrawer = new SWSceneDrawer;
swdrawer->RenderView(player);
@ -837,11 +837,6 @@ void FGLRenderer::Draw2D(F2DDrawer *drawer)
gl_RenderState.mTextureMatrix.translate(0.f, 1.f, 0.0f);
gl_RenderState.EnableTextureMatrix(true);
}
if (cmd.mTexture->UseType == ETextureType::SWCanvas)
{
//gl_RenderState.SetTextureMode(swtruecolor ? 0 : 1);
//gl_RenderState.SetEffect(EFF_SWQUAD);
}
}
else
{

View file

@ -586,6 +586,7 @@ static const FDefaultShader defaultshaders[]=
{"SpecularBrightmap", "shaders/glsl/func_brightmap.fp", "shaders/glsl/material_specular.fp", "#define SPECULAR\n#define NORMALMAP\n"},
{"PBR","shaders/glsl/func_normal.fp", "shaders/glsl/material_pbr.fp", "#define PBR\n#define NORMALMAP\n"},
{"PBRBrightmap","shaders/glsl/func_brightmap.fp", "shaders/glsl/material_pbr.fp", "#define PBR\n#define NORMALMAP\n"},
{"Paletted", "shaders/glsl/func_paletted.fp", "shaders/glsl/material_nolight.fp", ""},
{"No Texture", "shaders/glsl/func_notexture.fp", "shaders/glsl/material_normal.fp", ""},
{"Basic Fuzz", "shaders/glsl/fuzz_standard.fp", "shaders/glsl/material_normal.fp", ""},
{"Smooth Fuzz", "shaders/glsl/fuzz_smooth.fp", "shaders/glsl/material_normal.fp", ""},

View file

@ -327,7 +327,11 @@ FMaterial::FMaterial(FTexture * tx, bool expanded)
}
else
*/
if (tx->bWarped)
if (tx->UseType == ETextureType::SWCanvas && tx->WidthBits == 0)
{
mShaderIndex = SHADER_Paletted;
}
else if (tx->bWarped)
{
mShaderIndex = tx->bWarped; // This picks SHADER_Warp1 or SHADER_Warp2
tx->shaderspeed = static_cast<FWarpTexture*>(tx)->GetSpeed();
@ -620,6 +624,7 @@ void FMaterial::Bind(int clampmode, int translation)
int usebright = false;
int maxbound = 0;
if (tex->UseType == ETextureType::SWCanvas) clampmode = CLAMP_NOFILTER;
if (tex->bHasCanvas) clampmode = CLAMP_CAMTEX;
else if (tex->bWarped && clampmode <= CLAMP_XY) clampmode = CLAMP_NONE;

View file

@ -84,8 +84,8 @@ CUSTOM_CVAR (Int, vid_renderer, 1, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINI
self = 0; // make sure to actually switch to the software renderer
break;
}
Printf("You must restart " GAMENAME " to switch the renderer\n");
}
currentrenderer = self;
}
void I_ShutdownGraphics ()

View file

@ -54,6 +54,7 @@ enum MaterialShaderIndex
SHADER_SpecularBrightmap,
SHADER_PBR,
SHADER_PBRBrightmap,
SHADER_Paletted,
SHADER_NoTexture,
SHADER_BasicFuzz,
SHADER_SmoothFuzz,

View file

@ -0,0 +1,10 @@
vec4 ProcessTexel()
{
float index = getTexel(vTexCoord.st).r;
index = ((index * 255.0) + 0.5) / 256.0;
vec4 tex = texture(texture2, vec2(index, 0.5));
tex.a = 1.0;
return tex;
}