mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- added second vertex coordinate attribute for model interpolation.
This commit is contained in:
parent
08054ddc34
commit
ffcb6cb70a
7 changed files with 28 additions and 13 deletions
|
@ -66,11 +66,8 @@ void FRenderState::Reset()
|
|||
{
|
||||
mTextureEnabled = true;
|
||||
mBrightmapEnabled = mFogEnabled = mGlowEnabled = mLightEnabled = false;
|
||||
ffTextureEnabled = ffFogEnabled = false;
|
||||
mSpecialEffect = ffSpecialEffect = EFF_NONE;
|
||||
mFogColor.d = ffFogColor.d = -1;
|
||||
ffFogDensity = 0;
|
||||
mTextureMode = ffTextureMode = -1;
|
||||
mFogColor.d = -1;
|
||||
mTextureMode = -1;
|
||||
mDesaturation = 0;
|
||||
mSrcBlend = GL_SRC_ALPHA;
|
||||
mDstBlend = GL_ONE_MINUS_SRC_ALPHA;
|
||||
|
@ -85,6 +82,7 @@ void FRenderState::Reset()
|
|||
mVertexBuffer = mCurrentVertexBuffer = NULL;
|
||||
mColormapState = CM_DEFAULT;
|
||||
mLightParms[3] = -1.f;
|
||||
mSpecialEffect = EFF_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -144,6 +142,7 @@ bool FRenderState::ApplyShader()
|
|||
activeShader->muFogColor.Set(mFogColor);
|
||||
activeShader->muObjectColor.Set(mObjectColor);
|
||||
activeShader->muDynLightColor.Set(mDynColor);
|
||||
activeShader->muInterpolationFactor.Set(mInterpolationFactor);
|
||||
|
||||
if (mGlowEnabled)
|
||||
{
|
||||
|
|
|
@ -56,6 +56,7 @@ class FRenderState
|
|||
bool mAlphaTest;
|
||||
int mBlendEquation;
|
||||
bool m2D;
|
||||
float mInterpolationFactor;
|
||||
|
||||
FVertexBuffer *mVertexBuffer, *mCurrentVertexBuffer;
|
||||
FStateVec4 mColor;
|
||||
|
@ -75,13 +76,6 @@ class FRenderState
|
|||
bool glAlphaTest;
|
||||
int glBlendEquation;
|
||||
|
||||
bool ffTextureEnabled;
|
||||
bool ffFogEnabled;
|
||||
int ffTextureMode;
|
||||
int ffSpecialEffect;
|
||||
PalEntry ffFogColor;
|
||||
float ffFogDensity;
|
||||
|
||||
bool ApplyShader();
|
||||
|
||||
public:
|
||||
|
@ -290,6 +284,11 @@ public:
|
|||
{
|
||||
m2D = on;
|
||||
}
|
||||
|
||||
void SetInterpolationFactor(float fac)
|
||||
{
|
||||
mInterpolationFactor = fac;
|
||||
}
|
||||
};
|
||||
|
||||
extern FRenderState gl_RenderState;
|
||||
|
|
|
@ -192,10 +192,12 @@ bool FShader::Load(const char * name, const char * vert_prog_lump, const char *
|
|||
muGlowBottomPlane.Init(hShader, "uGlowBottomPlane");
|
||||
muGlowTopPlane.Init(hShader, "uGlowTopPlane");
|
||||
muFixedColormap.Init(hShader, "uFixedColormap");
|
||||
muInterpolationFactor.Init(hShader, "uInterpolationFactor");
|
||||
|
||||
timer_index = glGetUniformLocation(hShader, "timer");
|
||||
lights_index = glGetUniformLocation(hShader, "lights");
|
||||
|
||||
glBindAttribLocation(hShader, VATTR_VERTEX2, "aVertex2");
|
||||
|
||||
glUseProgram(hShader);
|
||||
|
||||
|
|
|
@ -7,6 +7,12 @@
|
|||
|
||||
extern bool gl_shaderactive;
|
||||
|
||||
enum
|
||||
{
|
||||
VATTR_VERTEX2 = 15
|
||||
};
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -186,6 +192,7 @@ class FShader
|
|||
FUniform4f muGlowTopColor;
|
||||
FUniform4f muGlowBottomPlane;
|
||||
FUniform4f muGlowTopPlane;
|
||||
FBufferedUniform1f muInterpolationFactor;
|
||||
|
||||
int timer_index;
|
||||
int lights_index;
|
||||
|
|
|
@ -386,6 +386,11 @@ FNativePalette *OpenGLFrameBuffer::CreatePalette(FRemapTable *remap)
|
|||
//==========================================================================
|
||||
bool OpenGLFrameBuffer::Begin2D(bool)
|
||||
{
|
||||
glActiveTexture(GL_TEXTURE7);
|
||||
glMatrixMode(GL_TEXTURE);
|
||||
glLoadIdentity();
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
|
||||
in vec4 aVertex2;
|
||||
out vec4 pixelpos;
|
||||
out vec2 glowdist;
|
||||
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 worldcoord = ModelMatrix * gl_Vertex;
|
||||
vec4 worldcoord = /* ModelMatrix * */ mix(gl_Vertex, aVertex2, uInterpolationFactor);
|
||||
vec4 eyeCoordPos = ViewMatrix * worldcoord;
|
||||
|
||||
gl_FrontColor = gl_Color;
|
||||
|
|
|
@ -9,6 +9,7 @@ uniform vec4 uObjectColor;
|
|||
uniform vec4 uDynLightColor;
|
||||
uniform vec4 uFogColor;
|
||||
uniform float uDesaturationFactor;
|
||||
uniform float uInterpolationFactor;
|
||||
|
||||
// Fixed colormap stuff
|
||||
uniform int uFixedColormap; // 0, when no fixed colormap, 1 for a light value, 2 for a color blend, 3 for a fog layer
|
||||
|
|
Loading…
Reference in a new issue