mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 05:31:00 +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;
|
mTextureEnabled = true;
|
||||||
mBrightmapEnabled = mFogEnabled = mGlowEnabled = mLightEnabled = false;
|
mBrightmapEnabled = mFogEnabled = mGlowEnabled = mLightEnabled = false;
|
||||||
ffTextureEnabled = ffFogEnabled = false;
|
mFogColor.d = -1;
|
||||||
mSpecialEffect = ffSpecialEffect = EFF_NONE;
|
mTextureMode = -1;
|
||||||
mFogColor.d = ffFogColor.d = -1;
|
|
||||||
ffFogDensity = 0;
|
|
||||||
mTextureMode = ffTextureMode = -1;
|
|
||||||
mDesaturation = 0;
|
mDesaturation = 0;
|
||||||
mSrcBlend = GL_SRC_ALPHA;
|
mSrcBlend = GL_SRC_ALPHA;
|
||||||
mDstBlend = GL_ONE_MINUS_SRC_ALPHA;
|
mDstBlend = GL_ONE_MINUS_SRC_ALPHA;
|
||||||
|
@ -85,6 +82,7 @@ void FRenderState::Reset()
|
||||||
mVertexBuffer = mCurrentVertexBuffer = NULL;
|
mVertexBuffer = mCurrentVertexBuffer = NULL;
|
||||||
mColormapState = CM_DEFAULT;
|
mColormapState = CM_DEFAULT;
|
||||||
mLightParms[3] = -1.f;
|
mLightParms[3] = -1.f;
|
||||||
|
mSpecialEffect = EFF_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,6 +142,7 @@ bool FRenderState::ApplyShader()
|
||||||
activeShader->muFogColor.Set(mFogColor);
|
activeShader->muFogColor.Set(mFogColor);
|
||||||
activeShader->muObjectColor.Set(mObjectColor);
|
activeShader->muObjectColor.Set(mObjectColor);
|
||||||
activeShader->muDynLightColor.Set(mDynColor);
|
activeShader->muDynLightColor.Set(mDynColor);
|
||||||
|
activeShader->muInterpolationFactor.Set(mInterpolationFactor);
|
||||||
|
|
||||||
if (mGlowEnabled)
|
if (mGlowEnabled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,6 +56,7 @@ class FRenderState
|
||||||
bool mAlphaTest;
|
bool mAlphaTest;
|
||||||
int mBlendEquation;
|
int mBlendEquation;
|
||||||
bool m2D;
|
bool m2D;
|
||||||
|
float mInterpolationFactor;
|
||||||
|
|
||||||
FVertexBuffer *mVertexBuffer, *mCurrentVertexBuffer;
|
FVertexBuffer *mVertexBuffer, *mCurrentVertexBuffer;
|
||||||
FStateVec4 mColor;
|
FStateVec4 mColor;
|
||||||
|
@ -75,13 +76,6 @@ class FRenderState
|
||||||
bool glAlphaTest;
|
bool glAlphaTest;
|
||||||
int glBlendEquation;
|
int glBlendEquation;
|
||||||
|
|
||||||
bool ffTextureEnabled;
|
|
||||||
bool ffFogEnabled;
|
|
||||||
int ffTextureMode;
|
|
||||||
int ffSpecialEffect;
|
|
||||||
PalEntry ffFogColor;
|
|
||||||
float ffFogDensity;
|
|
||||||
|
|
||||||
bool ApplyShader();
|
bool ApplyShader();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -290,6 +284,11 @@ public:
|
||||||
{
|
{
|
||||||
m2D = on;
|
m2D = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetInterpolationFactor(float fac)
|
||||||
|
{
|
||||||
|
mInterpolationFactor = fac;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern FRenderState gl_RenderState;
|
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");
|
muGlowBottomPlane.Init(hShader, "uGlowBottomPlane");
|
||||||
muGlowTopPlane.Init(hShader, "uGlowTopPlane");
|
muGlowTopPlane.Init(hShader, "uGlowTopPlane");
|
||||||
muFixedColormap.Init(hShader, "uFixedColormap");
|
muFixedColormap.Init(hShader, "uFixedColormap");
|
||||||
|
muInterpolationFactor.Init(hShader, "uInterpolationFactor");
|
||||||
|
|
||||||
timer_index = glGetUniformLocation(hShader, "timer");
|
timer_index = glGetUniformLocation(hShader, "timer");
|
||||||
lights_index = glGetUniformLocation(hShader, "lights");
|
lights_index = glGetUniformLocation(hShader, "lights");
|
||||||
|
|
||||||
|
glBindAttribLocation(hShader, VATTR_VERTEX2, "aVertex2");
|
||||||
|
|
||||||
glUseProgram(hShader);
|
glUseProgram(hShader);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,12 @@
|
||||||
|
|
||||||
extern bool gl_shaderactive;
|
extern bool gl_shaderactive;
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
VATTR_VERTEX2 = 15
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -186,6 +192,7 @@ class FShader
|
||||||
FUniform4f muGlowTopColor;
|
FUniform4f muGlowTopColor;
|
||||||
FUniform4f muGlowBottomPlane;
|
FUniform4f muGlowBottomPlane;
|
||||||
FUniform4f muGlowTopPlane;
|
FUniform4f muGlowTopPlane;
|
||||||
|
FBufferedUniform1f muInterpolationFactor;
|
||||||
|
|
||||||
int timer_index;
|
int timer_index;
|
||||||
int lights_index;
|
int lights_index;
|
||||||
|
|
|
@ -386,6 +386,11 @@ FNativePalette *OpenGLFrameBuffer::CreatePalette(FRemapTable *remap)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
bool OpenGLFrameBuffer::Begin2D(bool)
|
bool OpenGLFrameBuffer::Begin2D(bool)
|
||||||
{
|
{
|
||||||
|
glActiveTexture(GL_TEXTURE7);
|
||||||
|
glMatrixMode(GL_TEXTURE);
|
||||||
|
glLoadIdentity();
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glLoadIdentity();
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
|
|
||||||
|
in vec4 aVertex2;
|
||||||
out vec4 pixelpos;
|
out vec4 pixelpos;
|
||||||
out vec2 glowdist;
|
out vec2 glowdist;
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 worldcoord = ModelMatrix * gl_Vertex;
|
vec4 worldcoord = /* ModelMatrix * */ mix(gl_Vertex, aVertex2, uInterpolationFactor);
|
||||||
vec4 eyeCoordPos = ViewMatrix * worldcoord;
|
vec4 eyeCoordPos = ViewMatrix * worldcoord;
|
||||||
|
|
||||||
gl_FrontColor = gl_Color;
|
gl_FrontColor = gl_Color;
|
||||||
|
|
|
@ -9,6 +9,7 @@ uniform vec4 uObjectColor;
|
||||||
uniform vec4 uDynLightColor;
|
uniform vec4 uDynLightColor;
|
||||||
uniform vec4 uFogColor;
|
uniform vec4 uFogColor;
|
||||||
uniform float uDesaturationFactor;
|
uniform float uDesaturationFactor;
|
||||||
|
uniform float uInterpolationFactor;
|
||||||
|
|
||||||
// Fixed colormap stuff
|
// 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
|
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