OGL32CTX: Attempt to replace implicitly defined uniforms for objectpass
This breaks animated textures in xr591... git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14990 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
857f675f35
commit
90f701c42d
@ -5,22 +5,25 @@ uniform int hastex;
|
||||
uniform int haslightmap;
|
||||
|
||||
noperspective in vec3 nor;
|
||||
in vec4 color;
|
||||
in vec2 uv0;
|
||||
in vec2 uv1;
|
||||
|
||||
void main() {
|
||||
vec4 light = vec4(1.0);
|
||||
vec4 color;
|
||||
vec4 col;
|
||||
|
||||
if (haslightmap != 0) {
|
||||
light = texture2D(lighttex, gl_TexCoord[1].xy);
|
||||
light = texture2D(lighttex, uv1);
|
||||
}
|
||||
|
||||
if (hastex != 0)
|
||||
color = texture2D(tex, gl_TexCoord[0].xy) * light;
|
||||
col = texture2D(tex, uv0) * light;
|
||||
else
|
||||
color = gl_Color;
|
||||
col = color;
|
||||
|
||||
gl_FragData[0] = vec4(color.xyz, 1.);
|
||||
gl_FragData[0] = vec4(col.xyz, 1.);
|
||||
gl_FragData[1] = vec4(0.5 * normalize(nor) + 0.5, gl_FragCoord.z);
|
||||
gl_FragData[2] = vec4(1. - color.a);
|
||||
gl_FragData[2] = vec4(1. - col.a);
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,19 @@
|
||||
#version 130
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 TransposeInverseModelView;
|
||||
uniform mat4 TextureMatrix0;
|
||||
uniform mat4 TextureMatrix1;
|
||||
|
||||
noperspective out vec3 nor;
|
||||
out vec4 color;
|
||||
out vec2 uv0;
|
||||
out vec2 uv1;
|
||||
|
||||
void main() {
|
||||
|
||||
nor = gl_NormalMatrix * gl_Normal;
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1;
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
gl_FrontColor = gl_Color;
|
||||
nor = (TransposeInverseModelView * vec4(gl_Normal, 1.)).xyz;
|
||||
uv0 = (TextureMatrix0 * gl_MultiTexCoord0).st;
|
||||
uv1 = (TextureMatrix1 * gl_MultiTexCoord1).st;
|
||||
gl_Position = ModelViewProjectionMatrix * gl_Vertex;
|
||||
color = gl_Color;
|
||||
}
|
||||
|
@ -4,11 +4,13 @@ uniform int hastex;
|
||||
uniform float objectid;
|
||||
|
||||
noperspective in vec3 nor;
|
||||
in vec2 uv0;
|
||||
in vec2 uv1;
|
||||
|
||||
void main() {
|
||||
|
||||
//if (hastex != 0) {
|
||||
vec4 col = texture2D(tex, gl_TexCoord[0].xy);
|
||||
vec4 col = texture2D(tex, uv0);
|
||||
|
||||
if (col.a < 0.5)
|
||||
discard;
|
||||
|
@ -381,6 +381,19 @@ void GlowProvider::OnSetConstants(IMaterialRendererServices *srv, int)
|
||||
|
||||
void ObjectPassProvider::OnSetConstants(IMaterialRendererServices *srv, int)
|
||||
{
|
||||
core::matrix4 ModelViewProjectionMatrix = srv->getVideoDriver()->getTransform(ETS_PROJECTION);
|
||||
ModelViewProjectionMatrix *= srv->getVideoDriver()->getTransform(ETS_VIEW);
|
||||
ModelViewProjectionMatrix *= srv->getVideoDriver()->getTransform(ETS_WORLD);
|
||||
core::matrix4 TransposeInverseModelView = srv->getVideoDriver()->getTransform(ETS_VIEW);
|
||||
TransposeInverseModelView *= srv->getVideoDriver()->getTransform(ETS_WORLD);
|
||||
TransposeInverseModelView.makeInverse();
|
||||
TransposeInverseModelView = TransposeInverseModelView.getTransposed();
|
||||
|
||||
srv->setVertexShaderConstant("ModelViewProjectionMatrix", ModelViewProjectionMatrix.pointer(), 16);
|
||||
srv->setVertexShaderConstant("TransposeInverseModelView", TransposeInverseModelView.pointer(), 16);
|
||||
srv->setVertexShaderConstant("TextureMatrix0", mat.getTextureMatrix(0).pointer(), 16);
|
||||
srv->setVertexShaderConstant("TextureMatrix1", mat.getTextureMatrix(1).pointer(), 16);
|
||||
|
||||
const int hastex = mat.TextureLayer[0].Texture != NULL;
|
||||
srv->setVertexShaderConstant("hastex", &hastex, 1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user