- renamed FRenderState to FGLRenderState.

This commit is contained in:
Christoph Oelckers 2018-10-20 13:05:36 +02:00
parent 5f838d52b9
commit 9a03ba3cc5
4 changed files with 13 additions and 14 deletions

View file

@ -40,7 +40,7 @@
void gl_SetTextureMode(int type); void gl_SetTextureMode(int type);
FRenderState gl_RenderState; FGLRenderState gl_RenderState;
CVAR(Bool, gl_direct_state_change, true, 0) 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; mTextureEnabled = true;
mSplitEnabled = mBrightmapEnabled = mFogEnabled = mGlowEnabled = false; mSplitEnabled = mBrightmapEnabled = mFogEnabled = mGlowEnabled = false;
@ -114,7 +114,7 @@ void FRenderState::Reset()
// //
//========================================================================== //==========================================================================
bool FRenderState::ApplyShader() bool FGLRenderState::ApplyShader()
{ {
static uint64_t firstFrame = 0; static uint64_t firstFrame = 0;
// if firstFrame is not yet initialized, initialize it to current time // 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) if (!gl_direct_state_change)
{ {
@ -266,7 +266,7 @@ void FRenderState::Apply()
void FRenderState::ApplyColorMask() void FGLRenderState::ApplyColorMask()
{ {
if ((mColorMask[0] != currentColorMask[0]) || if ((mColorMask[0] != currentColorMask[0]) ||
(mColorMask[1] != currentColorMask[1]) || (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) 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) if (mat->tex->bHasCanvas)
{ {
@ -306,7 +306,7 @@ void FRenderState::SetMaterial(FMaterial *mat, int clampmode, int translation, i
{ {
mTempTM = TM_MODULATE; mTempTM = TM_MODULATE;
} }
mEffectState = overrideshader >= 0 ? overrideshader : mat->mShaderIndex; mEffectState = overrideshader >= 0 ? overrideshader : mat->GetShaderIndex();
mShaderTimer = mat->tex->shaderspeed; mShaderTimer = mat->tex->shaderspeed;
SetSpecular(mat->tex->Glossiness, mat->tex->SpecularLevel); SetSpecular(mat->tex->Glossiness, mat->tex->SpecularLevel);

View file

@ -72,7 +72,7 @@ enum EPassType
MAX_PASS_TYPES MAX_PASS_TYPES
}; };
class FRenderState class FGLRenderState
{ {
friend void gl_SetTextureMode(int type); friend void gl_SetTextureMode(int type);
bool mTextureEnabled; bool mTextureEnabled;
@ -136,7 +136,7 @@ public:
VSMatrix mModelMatrix; VSMatrix mModelMatrix;
VSMatrix mTextureMatrix; VSMatrix mTextureMatrix;
FRenderState() FGLRenderState()
{ {
Reset(); Reset();
} }
@ -464,6 +464,6 @@ public:
}; };
extern FRenderState gl_RenderState; extern FGLRenderState gl_RenderState;
#endif #endif

View file

@ -234,7 +234,7 @@ public:
class FShader class FShader
{ {
friend class FShaderCollection; friend class FShaderCollection;
friend class FRenderState; friend class FGLRenderState;
unsigned int hShader; unsigned int hShader;
unsigned int hVertProg; unsigned int hVertProg;

View file

@ -50,8 +50,6 @@ struct FTexCoordInfo
class FMaterial class FMaterial
{ {
friend class FRenderState;
// This array is needed because not all textures are managed by the texture manager // 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. // but some code needs to discard all hardware dependent data attached to any created texture.
// Font characters are not, for example. // Font characters are not, for example.
@ -86,6 +84,7 @@ public:
void SetSpriteRect(); void SetSpriteRect();
void Precache(); void Precache();
void PrecacheList(SpriteHits &translations); void PrecacheList(SpriteHits &translations);
int GetShaderIndex() const { return mShaderIndex; }
IHardwareTexture * ValidateSysTexture(FTexture * tex, bool expand); IHardwareTexture * ValidateSysTexture(FTexture * tex, bool expand);
void AddTextureLayer(FTexture *tex) void AddTextureLayer(FTexture *tex)
{ {