OGL32CTX: Replace another series of implicit declared uniforms

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14989 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
vincentlj 2014-01-10 00:30:56 +00:00
parent ba1e6465ef
commit 857f675f35
9 changed files with 58 additions and 23 deletions

View File

@ -1,7 +1,6 @@
#version 130
uniform mat4 ModelViewProjectionMatrix;
void main() {
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1;
gl_Position = (gl_ModelViewProjectionMatrix * gl_Vertex).xyww;
gl_FrontColor = gl_Color;
gl_Position = (ModelViewProjectionMatrix * gl_Vertex).xyww;
}

View File

@ -23,18 +23,21 @@
// such that the user gets to know whether the shield has several
// "layers" or whether the shield is about to break.
#version 130
uniform mat4 ModelViewMatrix;
uniform mat4 ProjectionMatrix;
uniform mat4 TransposeInverseModelView;
out vec2 uv;
noperspective out vec3 eyeVec;
noperspective out vec3 normal;
void main()
{
vec4 viewp = gl_ModelViewMatrix * gl_Vertex;
vec4 viewp = ModelViewMatrix * gl_Vertex;
eyeVec = normalize(-viewp).xyz;
normal = gl_NormalMatrix * gl_Normal;
normal = (TransposeInverseModelView * vec4(gl_Normal, 1.).xyz;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_Position = ProjectionMatrix * viewp;
uv = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st;
}

View File

@ -19,18 +19,21 @@
// Jean-manuel clemencon (C) Copyright supertuxkart
// Creates a cone lightbeam effect by smoothing edges
#version 130
uniform mat4 ModelViewMatrix;
uniform mat4 ProjectionMatrix;
uniform mat4 TransposeInverseModelView;
out vec2 uv;
noperspective out vec3 eyeVec;
noperspective out vec3 normal;
void main()
{
vec4 viewp = gl_ModelViewMatrix * gl_Vertex;
vec4 viewp = ModelViewMatrix * gl_Vertex;
eyeVec = normalize(-viewp).xyz;
normal = gl_NormalMatrix * gl_Normal;
normal = (TransposeInverseModelView * vec4(gl_Normal, 1.).xyz;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_Position = ProjectionMatrix * viewp;
uv = gl_MultiTexCoord0.st;
}

View File

@ -1,5 +1,6 @@
#version 130
varying vec4 offset[2];
in vec4 offset[2];
in vec2 uv;
uniform sampler2D colorMapG;
const float threshold = 0.1;
@ -10,7 +11,7 @@ void main() {
/**
* Luma calculation requires gamma-corrected colors:
*/
float L = dot(texture2D(colorMapG, gl_TexCoord[0].xy).rgb, weights);
float L = dot(texture2D(colorMapG, uv).rgb, weights);
float Lleft = dot(texture2D(colorMapG, offset[0].xy).rgb, weights);
float Ltop = dot(texture2D(colorMapG, offset[0].zw).rgb, weights);
float Lright = dot(texture2D(colorMapG, offset[1].xy).rgb, weights);

View File

@ -1,12 +1,13 @@
#version 130
varying vec4 offset[2];
in vec4 offset[2];
in vec2 uv;
uniform sampler2D blendMap;
uniform sampler2D colorMap;
void main() {
// Fetch the blending weights for current pixel:
vec4 topLeft = texture2D(blendMap, gl_TexCoord[0].xy);
vec4 topLeft = texture2D(blendMap, uv);
float bottom = texture2D(blendMap, offset[1].zw).g;
float right = texture2D(blendMap, offset[1].xy).a;
vec4 a = vec4(topLeft.r, bottom, topLeft.b, right);
@ -24,7 +25,7 @@ void main() {
vec4 color = vec4(0.0);
// Add the contributions of the possible 4 lines that can cross this pixel:
vec4 C = texture2D(colorMap, gl_TexCoord[0].xy);
vec4 C = texture2D(colorMap, uv);
vec4 Cleft = texture2D(colorMap, offset[0].xy);
vec4 Ctop = texture2D(colorMap, offset[0].zw);
vec4 Cright = texture2D(colorMap, offset[1].xy);

View File

@ -1,12 +1,15 @@
#version 130
varying vec4 offset[2];
uniform vec2 PIXEL_SIZE;
uniform mat4 ModelViewProjectionMatrix;
out vec4 offset[2];
out vec2 uv;
void main() {
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_Position = ModelViewProjectionMatrix * gl_Vertex;
vec4 invy = gl_MultiTexCoord0;
// invy.y = 1.0 - invy.y;
gl_TexCoord[0] = invy;
uv = invy.st;
offset[0] = invy.xyxy + PIXEL_SIZE.xyxy * vec4(-1.0, 0.0, 0.0, 1.0);
offset[1] = invy.xyxy + PIXEL_SIZE.xyxy * vec4( 1.0, 0.0, 0.0, -1.0);

View File

@ -18,6 +18,7 @@
// Creates a bubble (wave) effect by distorting the texture depending on time
#version 130
uniform mat4 ModelViewProjectionMatrix;
uniform float time;
out vec2 uv;
@ -30,8 +31,8 @@ out vec3 vertex;
void main()
{
uv = (gl_TextureMatrix[0] * gl_MultiTexCoord0).st;
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
uv = gl_MultiTexCoord0.st;
gl_Position = ModelViewProjectionMatrix * gl_Vertex;
float delta_x = cos(time*3.0) * sin( 4.0 * gl_TexCoord[0].st.s * 6.28318531 );

View File

@ -16,6 +16,8 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#version 130
uniform mat4 ModelViewProjectionMatrix;
uniform mat4 TransposeInverseModelView;
uniform vec3 lightdir;
noperspective out vec3 normal;
@ -25,7 +27,7 @@ noperspective out vec3 lightVec;
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
gl_Position = ModelViewProjectionMatrix * gl_Vertex;
vertex_color = gl_Color;
//vec3 normal3 = normalize(gl_Normal);
@ -33,11 +35,11 @@ void main()
//normal = normal4.xyz;
eyeVec = normalize(-gl_Position).xyz; // we are in Eye Coordinates, so EyePos is (0,0,0)
normal = normalize(gl_NormalMatrix*gl_Normal);
normal = normalize((TransposeInverseModelView * vec4(gl_Normal, 1.)).xyz);
// Building the matrix Eye Space -> Tangent Space
// gl_MultiTexCoord1.xyz
vec3 t = normalize (gl_NormalMatrix * vec3(0.0, 0.0, 1.0)); // tangent
vec3 t = normalize ((TransposeInverseModelView * vec4(0.0, 0.0, 1.0, 1.)).xyz); // tangent
vec3 b = cross (normal, t);
// transform light and half angle vectors by tangent basis

View File

@ -182,6 +182,11 @@ void SkyboxProvider::OnSetConstants(IMaterialRendererServices *srv, int)
vector3df sun_pos = m_sunpos;
srv->setVertexShaderConstant("sun_pos", &sun_pos.X, 3);
core::matrix4 ModelViewProjectionMatrix = srv->getVideoDriver()->getTransform(ETS_PROJECTION);
ModelViewProjectionMatrix *= srv->getVideoDriver()->getTransform(ETS_VIEW);
ModelViewProjectionMatrix *= srv->getVideoDriver()->getTransform(ETS_WORLD);
srv->setVertexShaderConstant("ModelViewProjectionMatrix", ModelViewProjectionMatrix.pointer(), 16);
if (!firstdone)
{
s32 tex = 0;
@ -357,6 +362,11 @@ void MipVizProvider::OnSetConstants(IMaterialRendererServices *srv, int)
void ColorizeProvider::OnSetConstants(IMaterialRendererServices *srv, int)
{
core::matrix4 ModelViewProjectionMatrix = srv->getVideoDriver()->getTransform(ETS_PROJECTION);
ModelViewProjectionMatrix *= srv->getVideoDriver()->getTransform(ETS_VIEW);
ModelViewProjectionMatrix *= srv->getVideoDriver()->getTransform(ETS_WORLD);
srv->setVertexShaderConstant("ModelViewProjectionMatrix", ModelViewProjectionMatrix.pointer(), 16);
srv->setVertexShaderConstant("col", m_color, 3);
}
@ -498,6 +508,12 @@ void BloomProvider::OnSetConstants(IMaterialRendererServices *srv, int)
void MLAAColor1Provider::OnSetConstants(IMaterialRendererServices *srv, int)
{
core::matrix4 ModelViewProjectionMatrix = srv->getVideoDriver()->getTransform(ETS_PROJECTION);
ModelViewProjectionMatrix *= srv->getVideoDriver()->getTransform(ETS_VIEW);
ModelViewProjectionMatrix *= srv->getVideoDriver()->getTransform(ETS_WORLD);
srv->setVertexShaderConstant("ModelViewProjectionMatrix", ModelViewProjectionMatrix.pointer(), 16);
if (!firstdone)
{
const float pixels[2] = {
@ -540,6 +556,12 @@ void MLAABlend2Provider::OnSetConstants(IMaterialRendererServices *srv, int)
void MLAANeigh3Provider::OnSetConstants(IMaterialRendererServices *srv, int)
{
core::matrix4 ModelViewProjectionMatrix = srv->getVideoDriver()->getTransform(ETS_PROJECTION);
ModelViewProjectionMatrix *= srv->getVideoDriver()->getTransform(ETS_VIEW);
ModelViewProjectionMatrix *= srv->getVideoDriver()->getTransform(ETS_WORLD);
srv->setVertexShaderConstant("ModelViewProjectionMatrix", ModelViewProjectionMatrix.pointer(), 16);
if (!firstdone)
{
const float pixels[2] = {