mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-21 11:31:41 +00:00
- more uniforms moved.
(not working yet.)
This commit is contained in:
parent
43e1a2d249
commit
d5af939119
7 changed files with 33 additions and 22 deletions
|
@ -114,8 +114,6 @@ public:
|
||||||
|
|
||||||
float mSceneClearColor[3];
|
float mSceneClearColor[3];
|
||||||
|
|
||||||
float mGlobVis = 0.0f;
|
|
||||||
|
|
||||||
FGLRenderer(OpenGLFrameBuffer *fb);
|
FGLRenderer(OpenGLFrameBuffer *fb);
|
||||||
~FGLRenderer() ;
|
~FGLRenderer() ;
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,6 @@ void gl_SetTextureMode(int type);
|
||||||
FRenderState gl_RenderState;
|
FRenderState gl_RenderState;
|
||||||
|
|
||||||
CVAR(Bool, gl_direct_state_change, true, 0)
|
CVAR(Bool, gl_direct_state_change, true, 0)
|
||||||
CVAR(Bool, gl_bandedswlight, false, CVAR_ARCHIVE)
|
|
||||||
|
|
||||||
|
|
||||||
static VSMatrix identityMatrix(1);
|
static VSMatrix identityMatrix(1);
|
||||||
|
@ -159,8 +158,6 @@ bool FRenderState::ApplyShader()
|
||||||
|
|
||||||
activeShader->muDesaturation.Set(mDesaturation / 255.f);
|
activeShader->muDesaturation.Set(mDesaturation / 255.f);
|
||||||
activeShader->muFogEnabled.Set(fogset);
|
activeShader->muFogEnabled.Set(fogset);
|
||||||
activeShader->muPalLightLevels.Set(static_cast<int>(gl_bandedswlight) | (static_cast<int>(gl_fogmode) << 8));
|
|
||||||
activeShader->muGlobVis.Set(GLRenderer->mGlobVis / 32.0f);
|
|
||||||
activeShader->muTextureMode.Set(mTextureMode == TM_MODULATE && mTempTM == TM_OPAQUE ? TM_OPAQUE : mTextureMode);
|
activeShader->muTextureMode.Set(mTextureMode == TM_MODULATE && mTempTM == TM_OPAQUE ? TM_OPAQUE : mTextureMode);
|
||||||
activeShader->muLightParms.Set(mLightParms);
|
activeShader->muLightParms.Set(mLightParms);
|
||||||
activeShader->muFogColor.Set(mFogColor);
|
activeShader->muFogColor.Set(mFogColor);
|
||||||
|
|
|
@ -487,8 +487,6 @@ sector_t * FGLRenderer::RenderViewpoint (FRenderViewpoint &mainvp, AActor * came
|
||||||
{
|
{
|
||||||
R_SetupFrame (mainvp, r_viewwindow, camera);
|
R_SetupFrame (mainvp, r_viewwindow, camera);
|
||||||
|
|
||||||
mGlobVis = R_GetGlobVis(r_viewwindow, r_visibility);
|
|
||||||
|
|
||||||
// Render (potentially) multiple views for stereo 3d
|
// Render (potentially) multiple views for stereo 3d
|
||||||
float viewShift[3];
|
float viewShift[3];
|
||||||
const s3d::Stereo3DMode& stereo3dMode = mainview && toscreen? s3d::Stereo3DMode::getCurrentMode() : s3d::Stereo3DMode::getMonoMode();
|
const s3d::Stereo3DMode& stereo3dMode = mainview && toscreen? s3d::Stereo3DMode::getCurrentMode() : s3d::Stereo3DMode::getMonoMode();
|
||||||
|
|
|
@ -308,8 +308,6 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
|
|
||||||
muDesaturation.Init(hShader, "uDesaturationFactor");
|
muDesaturation.Init(hShader, "uDesaturationFactor");
|
||||||
muFogEnabled.Init(hShader, "uFogEnabled");
|
muFogEnabled.Init(hShader, "uFogEnabled");
|
||||||
muPalLightLevels.Init(hShader, "uPalLightLevels");
|
|
||||||
muGlobVis.Init(hShader, "uGlobVis");
|
|
||||||
muTextureMode.Init(hShader, "uTextureMode");
|
muTextureMode.Init(hShader, "uTextureMode");
|
||||||
muLightParms.Init(hShader, "uLightAttr");
|
muLightParms.Init(hShader, "uLightAttr");
|
||||||
muClipSplit.Init(hShader, "uClipSplit");
|
muClipSplit.Init(hShader, "uClipSplit");
|
||||||
|
@ -345,6 +343,8 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
||||||
quadmode_index = glGetUniformLocation(hShader, "uQuadMode");
|
quadmode_index = glGetUniformLocation(hShader, "uQuadMode");
|
||||||
viewheight_index = glGetUniformLocation(hShader, "uViewHeight");
|
viewheight_index = glGetUniformLocation(hShader, "uViewHeight");
|
||||||
camerapos_index = glGetUniformLocation(hShader, "uCameraPos");
|
camerapos_index = glGetUniformLocation(hShader, "uCameraPos");
|
||||||
|
pallightlevels_index = glGetUniformLocation(hShader, "uPalLightLevels");
|
||||||
|
globvis_index = glGetUniformLocation(hShader, "uGlobVis");
|
||||||
|
|
||||||
if (!(gl.flags & RFL_SHADER_STORAGE_BUFFER))
|
if (!(gl.flags & RFL_SHADER_STORAGE_BUFFER))
|
||||||
{
|
{
|
||||||
|
@ -444,6 +444,8 @@ void FShader::ApplyMatrices(HWViewpointUniforms *u)
|
||||||
|
|
||||||
glUniform4fv(camerapos_index, 1, &u->mCameraPos[0]);
|
glUniform4fv(camerapos_index, 1, &u->mCameraPos[0]);
|
||||||
glUniform1i(viewheight_index, u->mViewHeight);
|
glUniform1i(viewheight_index, u->mViewHeight);
|
||||||
|
glUniform1i(pallightlevels_index, u->mPalLightLevels);
|
||||||
|
glUniform1f(globvis_index, u->mGlobVis);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -243,8 +243,6 @@ class FShader
|
||||||
|
|
||||||
FBufferedUniform1f muDesaturation;
|
FBufferedUniform1f muDesaturation;
|
||||||
FBufferedUniform1i muFogEnabled;
|
FBufferedUniform1i muFogEnabled;
|
||||||
FBufferedUniform1i muPalLightLevels;
|
|
||||||
FBufferedUniform1f muGlobVis;
|
|
||||||
FBufferedUniform1i muTextureMode;
|
FBufferedUniform1i muTextureMode;
|
||||||
FBufferedUniform4f muLightParms;
|
FBufferedUniform4f muLightParms;
|
||||||
FBufferedUniform2f muClipSplit;
|
FBufferedUniform2f muClipSplit;
|
||||||
|
@ -277,6 +275,8 @@ class FShader
|
||||||
int normalviewmatrix_index;
|
int normalviewmatrix_index;
|
||||||
int viewheight_index;
|
int viewheight_index;
|
||||||
int camerapos_index;
|
int camerapos_index;
|
||||||
|
int pallightlevels_index;
|
||||||
|
int globvis_index;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int vertexmatrix_index;
|
int vertexmatrix_index;
|
||||||
|
|
|
@ -35,6 +35,9 @@
|
||||||
#include "hwrenderer/utility/hw_clock.h"
|
#include "hwrenderer/utility/hw_clock.h"
|
||||||
#include "hwrenderer/utility/hw_cvars.h"
|
#include "hwrenderer/utility/hw_cvars.h"
|
||||||
|
|
||||||
|
EXTERN_CVAR(Float, r_visibility)
|
||||||
|
CVAR(Bool, gl_bandedswlight, false, CVAR_ARCHIVE)
|
||||||
|
|
||||||
sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool back);
|
sector_t * hw_FakeFlat(sector_t * sec, sector_t * dest, area_t in_area, bool back);
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -211,3 +214,19 @@ angle_t HWDrawInfo::FrustumAngle()
|
||||||
return a1;
|
return a1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void HWViewpointUniforms::SetDefaults()
|
||||||
|
{
|
||||||
|
mProjectionMatrix.loadIdentity();
|
||||||
|
mViewMatrix.loadIdentity();
|
||||||
|
mNormalViewMatrix.loadIdentity();
|
||||||
|
mViewHeight = viewheight;
|
||||||
|
mGlobVis = R_GetGlobVis(r_viewwindow, r_visibility) / 32.f;
|
||||||
|
mPalLightLevels = static_cast<int>(gl_bandedswlight) | (static_cast<int>(gl_fogmode) << 8);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -11,18 +11,15 @@ struct HWViewpointUniforms
|
||||||
FVector4 mCameraPos;
|
FVector4 mCameraPos;
|
||||||
FVector4 mClipLine;
|
FVector4 mClipLine;
|
||||||
|
|
||||||
|
float mGlobVis;
|
||||||
|
int mPalLightLevels;
|
||||||
int mViewHeight;
|
int mViewHeight;
|
||||||
|
|
||||||
void CalcDependencies()
|
void CalcDependencies()
|
||||||
{
|
{
|
||||||
mNormalViewMatrix.computeNormalMatrix(mViewMatrix);
|
mNormalViewMatrix.computeNormalMatrix(mViewMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetDefaults()
|
void SetDefaults();
|
||||||
{
|
|
||||||
mProjectionMatrix.loadIdentity();
|
|
||||||
mViewMatrix.loadIdentity();
|
|
||||||
mNormalViewMatrix.loadIdentity();
|
|
||||||
mViewHeight = viewheight;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue