raze/source/glbackend/gl_shader.h
Christoph Oelckers cf30f5560b - upgraded the polymost fragment shader to GLSL 3.3 as well, removing all legacy features from it.
The only compatibility mode feature left is the main drawer function using glBegin/glEnd but changing that is not as urgent as the rest.
This also cleans up the fog application and adds the exponential fog mode again that somehow got lost over time.
2019-10-06 12:42:35 +02:00

75 lines
1.9 KiB
C++

#pragma once;
#include "gl_uniform.h"
class FShader
{
friend class FShaderManager;
friend class FRenderState;
unsigned int hVertProg = 0;
unsigned int hFragProg = 0;
protected:
unsigned int hShader = 0;
#if 0
FName mName;
int projectionmatrix_index;
int viewmatrix_index;
int modelmatrix_index;
int texturematrix_index;
bool currentTextureMatrixState = false;
bool currentModelMatrixState = false;
#endif
public:
FShader() = default;
virtual ~FShader();
virtual bool Load(const char * name, const char * vert_prog_lump, const char * fragprog); //, const char * fragprog2, const char *defines);
bool Bind();
unsigned int GetHandle() const { return hShader; }
};
class PolymostShader : public FShader
{
public:
FBufferedUniform2f PalswapPos;
FBufferedUniform2f PalswapSize;
FBufferedUniform2f Clamp;
FBufferedUniform1f Shade;
FBufferedUniform1f NumShades;
FBufferedUniform1f VisFactor;
FBufferedUniform1f FogEnabled;
FBufferedUniform1f UseColorOnly;
FBufferedUniform1f UsePalette;
FBufferedUniform1f UseDetailMapping;
FBufferedUniform1f UseGlowMapping;
FBufferedUniform1f NPOTEmulation;
FBufferedUniform1f NPOTEmulationFactor;
FBufferedUniform1f NPOTEmulationXOffset;
FBufferedUniform1f Brightness;
FBufferedUniform4f Fog;
FBufferedUniform4f FogColor;
FBufferedUniform1f ShadeInterpolate;
FUniformMatrix4f RotMatrix;
FUniformMatrix4f ModelMatrix;
FUniformMatrix4f ProjectionMatrix;
FUniformMatrix4f DetailMatrix;
FUniformMatrix4f GlowMatrix;
public:
PolymostShader() = default;
virtual bool Load(const char * name, const char * vert_prog_lump, const char * fragprog); //, const char * fragprog2, const char *defines);
};
class SurfaceShader : public FShader
{
public:
SurfaceShader() = default;
virtual bool Load(const char* name, const char* vert_prog_lump, const char* fragprog); //, const char * fragprog2, const char *defines);
};