mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- mirror clip planes moved - not working yet.
This commit is contained in:
parent
e7531bb579
commit
80a9028938
9 changed files with 30 additions and 49 deletions
|
@ -80,8 +80,6 @@ void FRenderState::Reset()
|
|||
mLightParms[0] = mLightParms[1] = mLightParms[2] = 0.0f;
|
||||
mLightParms[3] = -1.f;
|
||||
mSpecialEffect = EFF_NONE;
|
||||
mClipHeight = 0.f;
|
||||
mClipHeightDirection = 0.f;
|
||||
mGlossiness = 0.0f;
|
||||
mSpecularLevel = 0.0f;
|
||||
mShaderTimer = 0.0f;
|
||||
|
@ -165,8 +163,6 @@ bool FRenderState::ApplyShader()
|
|||
activeShader->muObjectColor2.Set(mObjectColor2);
|
||||
activeShader->muDynLightColor.Set(mDynColor.vec);
|
||||
activeShader->muInterpolationFactor.Set(mInterpolationFactor);
|
||||
activeShader->muClipHeight.Set(mClipHeight);
|
||||
activeShader->muClipHeightDirection.Set(mClipHeightDirection);
|
||||
activeShader->muTimer.Set((double)(screen->FrameTime - firstFrame) * (double)mShaderTimer / 1000.);
|
||||
activeShader->muAlphaThreshold.Set(mAlphaThreshold);
|
||||
activeShader->muLightIndex.Set(-1);
|
||||
|
@ -304,20 +300,3 @@ void FRenderState::ApplyLightIndex(int index)
|
|||
}
|
||||
activeShader->muLightIndex.Set(index);
|
||||
}
|
||||
|
||||
void FRenderState::SetClipHeight(float height, float direction)
|
||||
{
|
||||
mClipHeight = height;
|
||||
mClipHeightDirection = direction;
|
||||
|
||||
if (gl.flags & RFL_NO_CLIP_PLANES) return;
|
||||
|
||||
if (direction != 0.f)
|
||||
{
|
||||
glEnable(GL_CLIP_DISTANCE0);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable(GL_CLIP_DISTANCE0); // GL_CLIP_PLANE0 is the same value so no need to make a distinction
|
||||
}
|
||||
}
|
||||
|
|
|
@ -196,8 +196,6 @@ public:
|
|||
return mClipLineShouldBeActive;
|
||||
}
|
||||
|
||||
void SetClipHeight(float height, float direction);
|
||||
|
||||
void SetNormal(FVector3 norm)
|
||||
{
|
||||
mNormal.Set(norm.X, norm.Y, norm.Z, 0.f);
|
||||
|
|
|
@ -745,29 +745,13 @@ void GLPlaneMirrorPortal::DrawContents(FDrawInfo *di)
|
|||
|
||||
di->UpdateCurrentMapSection();
|
||||
|
||||
gl_RenderState.SetClipHeight(planez, PlaneMirrorMode < 0 ? -1.f : 1.f);
|
||||
di->SetClipHeight(planez, PlaneMirrorMode < 0 ? -1.f : 1.f);
|
||||
di->DrawScene(DM_PORTAL);
|
||||
gl_RenderState.SetClipHeight(0.f, 0.f);
|
||||
PlaneMirrorFlag--;
|
||||
PlaneMirrorMode = old_pm;
|
||||
std::swap(screen->instack[sector_t::floor], screen->instack[sector_t::ceiling]);
|
||||
}
|
||||
|
||||
void GLPlaneMirrorPortal::PushState()
|
||||
{
|
||||
planestack.Push(gl_RenderState.GetClipHeight());
|
||||
planestack.Push(gl_RenderState.GetClipHeightDirection());
|
||||
gl_RenderState.SetClipHeight(0.f, 0.f);
|
||||
}
|
||||
|
||||
void GLPlaneMirrorPortal::PopState()
|
||||
{
|
||||
float d, f;
|
||||
planestack.Pop(d);
|
||||
planestack.Pop(f);
|
||||
gl_RenderState.SetClipHeight(f, d);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Common code for line to line and mirror portals
|
||||
|
|
|
@ -302,8 +302,6 @@ protected:
|
|||
virtual void DrawContents(FDrawInfo *di);
|
||||
virtual void * GetSource() const { return origin; }
|
||||
virtual const char *GetName();
|
||||
virtual void PushState();
|
||||
virtual void PopState();
|
||||
secplane_t * origin;
|
||||
|
||||
public:
|
||||
|
|
|
@ -76,6 +76,18 @@ void FDrawInfo::ApplyVPUniforms()
|
|||
{
|
||||
VPUniforms.CalcDependencies();
|
||||
GLRenderer->mShaderManager->ApplyMatrices(&VPUniforms, NORMAL_PASS);
|
||||
|
||||
if (!(gl.flags & RFL_NO_CLIP_PLANES))
|
||||
{
|
||||
if (VPUniforms.mClipHeightDirection != 0.f)
|
||||
{
|
||||
glEnable(GL_CLIP_DISTANCE0);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable(GL_CLIP_DISTANCE0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -324,8 +324,6 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
muSplitTopPlane.Init(hShader, "uSplitTopPlane");
|
||||
muClipLine.Init(hShader, "uClipLine");
|
||||
muInterpolationFactor.Init(hShader, "uInterpolationFactor");
|
||||
muClipHeight.Init(hShader, "uClipHeight");
|
||||
muClipHeightDirection.Init(hShader, "uClipHeightDirection");
|
||||
muAlphaThreshold.Init(hShader, "uAlphaThreshold");
|
||||
muSpecularMaterial.Init(hShader, "uSpecularMaterial");
|
||||
muTimer.Init(hShader, "timer");
|
||||
|
@ -345,6 +343,8 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
camerapos_index = glGetUniformLocation(hShader, "uCameraPos");
|
||||
pallightlevels_index = glGetUniformLocation(hShader, "uPalLightLevels");
|
||||
globvis_index = glGetUniformLocation(hShader, "uGlobVis");
|
||||
clipheight_index = glGetUniformLocation(hShader, "uClipHeight");
|
||||
clipheightdirection_index = glGetUniformLocation(hShader, "uClipHeightDirection");
|
||||
|
||||
if (!(gl.flags & RFL_SHADER_STORAGE_BUFFER))
|
||||
{
|
||||
|
@ -446,6 +446,8 @@ void FShader::ApplyMatrices(HWViewpointUniforms *u)
|
|||
glUniform1i(viewheight_index, u->mViewHeight);
|
||||
glUniform1i(pallightlevels_index, u->mPalLightLevels);
|
||||
glUniform1f(globvis_index, u->mGlobVis);
|
||||
glUniform1f(clipheight_index, u->mClipHeight);
|
||||
glUniform1f(clipheightdirection_index, u->mClipHeightDirection);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -259,8 +259,6 @@ class FShader
|
|||
FUniform4f muSplitTopPlane;
|
||||
FUniform4f muClipLine;
|
||||
FBufferedUniform1f muInterpolationFactor;
|
||||
FBufferedUniform1f muClipHeight;
|
||||
FBufferedUniform1f muClipHeightDirection;
|
||||
FBufferedUniform1f muAlphaThreshold;
|
||||
FBufferedUniform2f muSpecularMaterial;
|
||||
FBufferedUniform1f muTimer;
|
||||
|
@ -277,6 +275,8 @@ class FShader
|
|||
int camerapos_index;
|
||||
int pallightlevels_index;
|
||||
int globvis_index;
|
||||
int clipheight_index;
|
||||
int clipheightdirection_index;
|
||||
|
||||
public:
|
||||
int vertexmatrix_index;
|
||||
|
|
|
@ -158,6 +158,12 @@ public:
|
|||
VPUniforms.mCameraPos = { (float)pos.X, (float)pos.Z, (float)pos.Y, 0.f };
|
||||
}
|
||||
|
||||
void SetClipHeight(float h, float d)
|
||||
{
|
||||
VPUniforms.mClipHeight = h;
|
||||
VPUniforms.mClipHeightDirection = d;
|
||||
}
|
||||
|
||||
void RenderBSPNode(void *node);
|
||||
|
||||
void ClearBuffers();
|
||||
|
|
|
@ -11,9 +11,11 @@ struct HWViewpointUniforms
|
|||
FVector4 mCameraPos;
|
||||
FVector4 mClipLine;
|
||||
|
||||
float mGlobVis;
|
||||
int mPalLightLevels;
|
||||
int mViewHeight;
|
||||
float mGlobVis = 1.f;
|
||||
int mPalLightLevels = 0;
|
||||
int mViewHeight = 0;
|
||||
float mClipHeight = 0.f;
|
||||
float mClipHeightDirection = 0.f;
|
||||
|
||||
void CalcDependencies()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue