- added missing shader files.

This commit is contained in:
Christoph Oelckers 2014-05-12 22:24:26 +02:00
parent b514a815f4
commit cf45f2d718
6 changed files with 106 additions and 6 deletions

View file

@ -51,6 +51,7 @@
#include "gl/renderer/gl_lightdata.h"
#include "gl/renderer/gl_renderstate.h"
#include "gl/data/gl_data.h"
#include "gl/data/gl_vertexbuffer.h"
#include "gl/dynlights/gl_glow.h"
#include "gl/scene/gl_drawinfo.h"
#include "gl/models/gl_models.h"
@ -153,12 +154,30 @@ void FGLRenderer::DrawPSprite (player_t * player,pspdef_t *psp,fixed_t sx, fixed
gl_RenderState.EnableAlphaTest(false);
}
gl_RenderState.Apply();
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2f(fU1, fV1); glVertex2f(x1,y1);
glTexCoord2f(fU1, fV2); glVertex2f(x1,y2);
glTexCoord2f(fU2, fV1); glVertex2f(x2,y1);
glTexCoord2f(fU2, fV2); glVertex2f(x2,y2);
glEnd();
if (!gl_usevbo)
{
glBegin(GL_TRIANGLE_STRIP);
glTexCoord2f(fU1, fV1); glVertex2f(x1, y1);
glTexCoord2f(fU1, fV2); glVertex2f(x1, y2);
glTexCoord2f(fU2, fV1); glVertex2f(x2, y1);
glTexCoord2f(fU2, fV2); glVertex2f(x2, y2);
glEnd();
}
else
{
FFlatVertex *ptr = GLRenderer->mVBO->GetBuffer();
ptr->Set(x1, y1, 0, fU1, fV1);
ptr++;
ptr->Set(x1, y2, 0, fU1, fV2);
ptr++;
ptr->Set(x2, y1, 0, fU2, fV1);
ptr++;
ptr->Set(x2, y2, 0, fU2, fV2);
ptr++;
unsigned int offset;
unsigned int count = GLRenderer->mVBO->GetCount(ptr, &offset);
glDrawArrays(GL_TRIANGLE_STRIP, offset, count);
}
if (tex->GetTransparent() || OverrideShader != 0)
{
gl_RenderState.EnableAlphaTest(true);

View file

@ -0,0 +1,12 @@
uniform sampler2D tex;
uniform sampler2D texture2;
void main()
{
vec4 frag = gl_Color;
vec4 t1 = texture2D(texture2, gl_TexCoord[0].xy);
vec4 t2 = texture2D(tex, vec2(gl_TexCoord[0].x, 1.0-gl_TexCoord[0].y));
gl_FragColor = frag * vec4(t1.r, t1.g, t1.b, t2.a);
}

View file

@ -0,0 +1,7 @@
void main()
{
gl_FrontColor = gl_Color;
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_Position = ProjectionMatrix * gl_Vertex;
}

View file

@ -0,0 +1,41 @@
// This file contains common data definitions for both vertex and fragment shader
uniform vec4 uCameraPos;
uniform int uTextureMode;
// colors
uniform vec4 uObjectColor;
uniform vec4 uDynLightColor;
uniform vec4 uFogColor;
uniform float uDesaturationFactor;
// 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 vec4 uFixedColormapStart;
uniform vec4 uFixedColormapRange;
// Glowing walls stuff
uniform vec4 uGlowTopPlane;
uniform vec4 uGlowTopColor;
uniform vec4 uGlowBottomPlane;
uniform vec4 uGlowBottomColor;
// Lighting + Fog
uniform vec4 uLightAttr;
#define uLightLevel uLightAttr.a
#define uFogDensity uLightAttr.b
#define uLightFactor uLightAttr.g
#define uLightDist uLightAttr.r
uniform int uFogEnabled;
// dynamic lights
uniform ivec4 uLightRange;
// redefine the matrix names to what they actually represent.
#define ModelMatrix gl_TextureMatrix[7]
#define ViewMatrix gl_ModelViewMatrix
#define ProjectionMatrix gl_ProjectionMatrix
#define TextureMatrix gl_TextureMatrix[0]

View file

@ -0,0 +1,7 @@
in vec4 pixelpos;
void main()
{
gl_FragColor = vec4(1.0);
}

View file

@ -0,0 +1,14 @@
out vec4 pixelpos;
void main()
{
// perform exactly the same relevant steps as in the main shader to ensure matching results (that also means including the model matrix here!)
vec4 worldcoord = ModelMatrix * gl_Vertex;
vec4 eyeCoordPos = ViewMatrix * worldcoord;
pixelpos.xyz = worldcoord.xyz;
pixelpos.w = -eyeCoordPos.z/eyeCoordPos.w;
gl_Position = ProjectionMatrix * eyeCoordPos;
}