mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-14 00:20:51 +00:00
- basics for using hardware clip planes to split translucent stuff by 3D floor planes.
This commit is contained in:
parent
8762ab48d3
commit
45526c2769
4 changed files with 49 additions and 0 deletions
|
@ -86,6 +86,7 @@ void FRenderState::Reset()
|
|||
mSpecialEffect = EFF_NONE;
|
||||
mClipHeightTop = 65536.f;
|
||||
mClipHeightBottom = -65536.f;
|
||||
ClearClipSplit();
|
||||
|
||||
stSrcBlend = stDstBlend = -1;
|
||||
stBlendEquation = -1;
|
||||
|
@ -141,6 +142,7 @@ bool FRenderState::ApplyShader()
|
|||
activeShader->muTimer.Set(gl_frameMS * mShaderTimer / 1000.f);
|
||||
activeShader->muAlphaThreshold.Set(mAlphaThreshold);
|
||||
activeShader->muLightIndex.Set(mLightIndex); // will always be -1 for now
|
||||
activeShader->muClipSplit.Set(mClipSplit);
|
||||
|
||||
if (mGlowEnabled)
|
||||
{
|
||||
|
|
|
@ -73,6 +73,7 @@ class FRenderState
|
|||
PalEntry mFogColor;
|
||||
PalEntry mObjectColor;
|
||||
FStateVec4 mDynColor;
|
||||
float mClipSplit[2];
|
||||
|
||||
int mEffectState;
|
||||
int mColormapState;
|
||||
|
@ -279,6 +280,28 @@ public:
|
|||
return mFogColor;
|
||||
}
|
||||
|
||||
void SetClipSplit(float bottom, float top)
|
||||
{
|
||||
mClipSplit[0] = bottom;
|
||||
mClipSplit[1] = top;
|
||||
}
|
||||
|
||||
void SetClipSplit(float *vals)
|
||||
{
|
||||
memcpy(mClipSplit, vals, 2 * sizeof(float));
|
||||
}
|
||||
|
||||
void GetClipSplit(float *out)
|
||||
{
|
||||
memcpy(out, mClipSplit, 2 * sizeof(float));
|
||||
}
|
||||
|
||||
void ClearClipSplit()
|
||||
{
|
||||
mClipSplit[0] = -1000000.f;
|
||||
mClipSplit[1] = 1000000.f;
|
||||
}
|
||||
|
||||
void BlendFunc(int src, int dst)
|
||||
{
|
||||
if (!gl_direct_state_change)
|
||||
|
|
|
@ -205,6 +205,7 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
muTextureMode.Init(hShader, "uTextureMode");
|
||||
muCameraPos.Init(hShader, "uCameraPos");
|
||||
muLightParms.Init(hShader, "uLightAttr");
|
||||
muClipSplit.Init(hShader, "uClipSplit");
|
||||
muColormapStart.Init(hShader, "uFixedColormapStart");
|
||||
muColormapRange.Init(hShader, "uFixedColormapRange");
|
||||
muLightIndex.Init(hShader, "uLightIndex");
|
||||
|
|
|
@ -103,6 +103,28 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class FBufferedUniform2f
|
||||
{
|
||||
float mBuffer[2];
|
||||
int mIndex;
|
||||
|
||||
public:
|
||||
void Init(GLuint hShader, const GLchar *name)
|
||||
{
|
||||
mIndex = glGetUniformLocation(hShader, name);
|
||||
memset(mBuffer, 0, sizeof(mBuffer));
|
||||
}
|
||||
|
||||
void Set(const float *newvalue)
|
||||
{
|
||||
if (memcmp(newvalue, mBuffer, sizeof(mBuffer)))
|
||||
{
|
||||
memcpy(mBuffer, newvalue, sizeof(mBuffer));
|
||||
glUniform2fv(mIndex, 1, newvalue);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class FBufferedUniform4f
|
||||
{
|
||||
float mBuffer[4];
|
||||
|
@ -184,6 +206,7 @@ class FShader
|
|||
FBufferedUniform1i muTextureMode;
|
||||
FBufferedUniform4f muCameraPos;
|
||||
FBufferedUniform4f muLightParms;
|
||||
FBufferedUniform2f muClipSplit;
|
||||
FUniform1i muFixedColormap;
|
||||
FUniform4f muColormapStart;
|
||||
FUniform4f muColormapRange;
|
||||
|
|
Loading…
Reference in a new issue