CShader: Simplify initialization

This commit is contained in:
Lioncash 2020-06-11 17:26:42 -04:00
parent b8078e7419
commit 92811a9309
2 changed files with 13 additions and 19 deletions

View File

@ -16,17 +16,11 @@ int CShader::smNumShaders = 0;
CShader::CShader() CShader::CShader()
{ {
mVertexShaderExists = false;
mPixelShaderExists = false;
mProgramExists = false;
smNumShaders++; smNumShaders++;
} }
CShader::CShader(const char *pkVertexSource, const char *pkPixelSource) CShader::CShader(const char *pkVertexSource, const char *pkPixelSource)
{ {
mVertexShaderExists = false;
mPixelShaderExists = false;
mProgramExists = false;
smNumShaders++; smNumShaders++;
CompileVertexSource(pkVertexSource); CompileVertexSource(pkVertexSource);

View File

@ -6,22 +6,22 @@
class CShader class CShader
{ {
bool mVertexShaderExists; bool mVertexShaderExists = false;
bool mPixelShaderExists; bool mPixelShaderExists = false;
bool mProgramExists; bool mProgramExists = false;
GLuint mVertexShader; GLuint mVertexShader = 0;
GLuint mPixelShader; GLuint mPixelShader = 0;
GLuint mProgram; GLuint mProgram = 0;
GLuint mMVPBlockIndex; GLuint mMVPBlockIndex = 0;
GLuint mVertexBlockIndex; GLuint mVertexBlockIndex = 0;
GLuint mPixelBlockIndex; GLuint mPixelBlockIndex = 0;
GLuint mLightBlockIndex; GLuint mLightBlockIndex = 0;
GLuint mBoneTransformBlockIndex; GLuint mBoneTransformBlockIndex = 0;
// Cached uniform locations // Cached uniform locations
GLint mTextureUniforms[8]; GLint mTextureUniforms[8] = {};
GLint mNumLightsUniform; GLint mNumLightsUniform = 0;
static int smNumShaders; static int smNumShaders;
static CShader* spCurrentShader; static CShader* spCurrentShader;