2018-02-12 22:14:14 +00:00
|
|
|
#ifndef ENGINE_CLIENT_OPENGL_SL_PROGRAM_H
|
|
|
|
#define ENGINE_CLIENT_OPENGL_SL_PROGRAM_H
|
2017-09-02 13:24:07 +00:00
|
|
|
|
2018-02-12 22:14:14 +00:00
|
|
|
#include <GL/glew.h>
|
2017-09-02 13:24:07 +00:00
|
|
|
|
|
|
|
class CGLSL;
|
|
|
|
|
|
|
|
class CGLSLProgram {
|
|
|
|
public:
|
|
|
|
void CreateProgram();
|
|
|
|
void DeleteProgram();
|
|
|
|
|
|
|
|
bool AddShader(CGLSL* pShader);
|
|
|
|
|
|
|
|
void LinkProgram();
|
|
|
|
void UseProgram();
|
|
|
|
GLuint GetProgramID();
|
|
|
|
|
|
|
|
void DetachShader(CGLSL* pShader);
|
2017-09-14 17:34:14 +00:00
|
|
|
void DetachShaderByID(GLuint ShaderID);
|
|
|
|
void DetachAllShaders();
|
2017-09-02 13:24:07 +00:00
|
|
|
|
|
|
|
//Support various types
|
2017-09-12 18:09:40 +00:00
|
|
|
void SetUniformVec2(int Loc, int Count, const float* Value);
|
2017-09-02 13:24:07 +00:00
|
|
|
void SetUniformVec4(int Loc, int Count, const float* Value);
|
|
|
|
void SetUniform(int Loc, const int Value);
|
|
|
|
void SetUniform(int Loc, const unsigned int Value);
|
|
|
|
void SetUniform(int Loc, const bool Value);
|
|
|
|
void SetUniform(int Loc, const float Value);
|
|
|
|
|
|
|
|
//for performance reason we do not use SetUniform with using strings... save the Locations of the variables instead
|
|
|
|
int GetUniformLoc(const char* Name);
|
|
|
|
|
|
|
|
CGLSLProgram();
|
2017-09-14 17:34:14 +00:00
|
|
|
virtual ~CGLSLProgram();
|
2017-09-02 13:24:07 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
GLuint m_ProgramID;
|
|
|
|
bool m_IsLinked;
|
|
|
|
};
|
|
|
|
|
2017-09-12 18:09:40 +00:00
|
|
|
class CGLSLTWProgram : public CGLSLProgram {
|
|
|
|
public:
|
2017-09-02 13:24:07 +00:00
|
|
|
int m_LocPos;
|
|
|
|
int m_LocIsTextured;
|
|
|
|
int m_LocTextureSampler;
|
2017-09-12 18:09:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CGLSLQuadProgram : public CGLSLTWProgram {
|
|
|
|
public:
|
2017-09-02 13:24:07 +00:00
|
|
|
|
2017-09-12 18:09:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CGLSLPrimitiveProgram : public CGLSLTWProgram {
|
|
|
|
public:
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class CGLSLTileProgram : public CGLSLTWProgram {
|
|
|
|
public:
|
|
|
|
int m_LocColor;
|
2017-10-09 16:58:44 +00:00
|
|
|
int m_LocLOD;
|
2017-09-12 18:09:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class CGLSLBorderTileProgram : public CGLSLTileProgram {
|
|
|
|
public:
|
|
|
|
int m_LocOffset;
|
|
|
|
int m_LocDir;
|
|
|
|
int m_LocNum;
|
|
|
|
int m_LocJumpIndex;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CGLSLBorderTileLineProgram : public CGLSLTileProgram {
|
|
|
|
public:
|
|
|
|
int m_LocDir;
|
|
|
|
int m_LocNum;
|
2017-10-20 07:08:49 +00:00
|
|
|
};
|
2018-02-12 22:14:14 +00:00
|
|
|
|
|
|
|
#endif // ENGINE_CLIENT_OPENGL_SL_PROGRAM_H
|