diff --git a/src/gl/renderer/gl_renderstate.cpp b/src/gl/renderer/gl_renderstate.cpp index e585296f68..26ee7caec3 100644 --- a/src/gl/renderer/gl_renderstate.cpp +++ b/src/gl/renderer/gl_renderstate.cpp @@ -40,7 +40,7 @@ void gl_SetTextureMode(int type); -FRenderState gl_RenderState; +FGLRenderState gl_RenderState; CVAR(Bool, gl_direct_state_change, true, 0) @@ -59,7 +59,7 @@ static void matrixToGL(const VSMatrix &mat, int loc) // //========================================================================== -void FRenderState::Reset() +void FGLRenderState::Reset() { mTextureEnabled = true; mSplitEnabled = mBrightmapEnabled = mFogEnabled = mGlowEnabled = false; @@ -114,7 +114,7 @@ void FRenderState::Reset() // //========================================================================== -bool FRenderState::ApplyShader() +bool FGLRenderState::ApplyShader() { static uint64_t firstFrame = 0; // if firstFrame is not yet initialized, initialize it to current time @@ -236,7 +236,7 @@ bool FRenderState::ApplyShader() // //========================================================================== -void FRenderState::Apply() +void FGLRenderState::Apply() { if (!gl_direct_state_change) { @@ -266,7 +266,7 @@ void FRenderState::Apply() -void FRenderState::ApplyColorMask() +void FGLRenderState::ApplyColorMask() { if ((mColorMask[0] != currentColorMask[0]) || (mColorMask[1] != currentColorMask[1]) || @@ -281,7 +281,7 @@ void FRenderState::ApplyColorMask() } } -void FRenderState::ApplyLightIndex(int index) +void FGLRenderState::ApplyLightIndex(int index) { if (index > -1 && GLRenderer->mLights->GetBufferType() == GL_UNIFORM_BUFFER) { @@ -296,7 +296,7 @@ void FRenderState::ApplyLightIndex(int index) // //=========================================================================== -void FRenderState::SetMaterial(FMaterial *mat, int clampmode, int translation, int overrideshader, bool alphatexture) +void FGLRenderState::SetMaterial(FMaterial *mat, int clampmode, int translation, int overrideshader, bool alphatexture) { if (mat->tex->bHasCanvas) { @@ -306,7 +306,7 @@ void FRenderState::SetMaterial(FMaterial *mat, int clampmode, int translation, i { mTempTM = TM_MODULATE; } - mEffectState = overrideshader >= 0 ? overrideshader : mat->mShaderIndex; + mEffectState = overrideshader >= 0 ? overrideshader : mat->GetShaderIndex(); mShaderTimer = mat->tex->shaderspeed; SetSpecular(mat->tex->Glossiness, mat->tex->SpecularLevel); diff --git a/src/gl/renderer/gl_renderstate.h b/src/gl/renderer/gl_renderstate.h index c046d3f612..9e205fffb1 100644 --- a/src/gl/renderer/gl_renderstate.h +++ b/src/gl/renderer/gl_renderstate.h @@ -72,7 +72,7 @@ enum EPassType MAX_PASS_TYPES }; -class FRenderState +class FGLRenderState { friend void gl_SetTextureMode(int type); bool mTextureEnabled; @@ -136,7 +136,7 @@ public: VSMatrix mModelMatrix; VSMatrix mTextureMatrix; - FRenderState() + FGLRenderState() { Reset(); } @@ -464,6 +464,6 @@ public: }; -extern FRenderState gl_RenderState; +extern FGLRenderState gl_RenderState; #endif diff --git a/src/gl/shaders/gl_shader.h b/src/gl/shaders/gl_shader.h index 32e1867105..2c137b5aa0 100644 --- a/src/gl/shaders/gl_shader.h +++ b/src/gl/shaders/gl_shader.h @@ -234,7 +234,7 @@ public: class FShader { friend class FShaderCollection; - friend class FRenderState; + friend class FGLRenderState; unsigned int hShader; unsigned int hVertProg; diff --git a/src/hwrenderer/textures/hw_material.h b/src/hwrenderer/textures/hw_material.h index d334ceaa1f..4274426290 100644 --- a/src/hwrenderer/textures/hw_material.h +++ b/src/hwrenderer/textures/hw_material.h @@ -50,8 +50,6 @@ struct FTexCoordInfo class FMaterial { - friend class FRenderState; - // This array is needed because not all textures are managed by the texture manager // but some code needs to discard all hardware dependent data attached to any created texture. // Font characters are not, for example. @@ -86,6 +84,7 @@ public: void SetSpriteRect(); void Precache(); void PrecacheList(SpriteHits &translations); + int GetShaderIndex() const { return mShaderIndex; } IHardwareTexture * ValidateSysTexture(FTexture * tex, bool expand); void AddTextureLayer(FTexture *tex) {