Update shaders to use the reorganized texture cache

This commit is contained in:
mkwong98 2015-05-26 19:22:41 +08:00
parent 56e4ab7dfc
commit c57db5275b
5 changed files with 35 additions and 13 deletions

View file

@ -1,9 +1,10 @@
#version 330
uniform sampler2D textureb;
uniform sampler2D texturebBase;
uniform usampler1D flags;
smooth in vec3 texcoord;
smooth in vec2 realcoord;
smooth in vec3 realcoord;
out vec4 fColor;
void main(void)
@ -12,7 +13,13 @@ void main(void)
if(realcoord.x < (-120.0 / 128.0) && ((0x01u & f) == 0x00u)){
discard;
}
vec4 c = texture2D(textureb, texcoord.xy);
vec4 c;
if(realcoord.z == 0.0){
c = texture2D(textureb, texcoord.xy);
}
else{
c = texture2D(texturebBase, texcoord.xy);
}
c.r = c.r * texcoord.z;
c.g = c.g * texcoord.z;
c.b = c.b * texcoord.z;

View file

@ -1,16 +1,16 @@
#version 330
in vec3 position;
in vec3 textCoord;
in vec4 textCoord;
smooth out vec3 texcoord;
smooth out vec2 realcoord;
smooth out vec3 realcoord;
uniform usampler1D xOffset;
void main()
{
vec2 a;
vec2 b;
vec3 b;
if(position.z == 0 || position.z == 1){
b.y = -(position.y - 0.5) / 256.0;
}
@ -20,7 +20,8 @@ void main()
a.x = ((position.x - float(texture(xOffset, b.y).r)) / 128.0) - 1.0;
a.y = (position.y / 120.0) + 1.0;
b.x = a.x;
b.z = textCoord.w;
gl_Position = vec4(a.xy, 0.5, 1.0);
texcoord = textCoord;
texcoord = textCoord.xyz;
realcoord = b;
}

View file

@ -1,9 +1,10 @@
#version 330
uniform sampler2D textureb;
uniform sampler2D texturebBase;
uniform usampler1D flagsSP1;
smooth in vec4 texcoord;
smooth in vec2 realcoord;
smooth in vec3 realcoord;
out vec4 fColor;
void main(void)
@ -13,7 +14,13 @@ void main(void)
if((realcoord.x < (-120.0 / 128.0)) && ((0x02u & f) == 0x00u)){
discard;
}
vec4 c = texture2D(textureb, texcoord.xy);
vec4 c;
if(realcoord.z == 0.0){
c = texture2D(textureb, texcoord.xy);
}
else{
c = texture2D(texturebBase, texcoord.xy);
}
c.r = c.r * texcoord.w;
c.g = c.g * texcoord.w;
c.b = c.b * texcoord.w;

View file

@ -1,9 +1,10 @@
#version 330
uniform sampler2D textureb;
uniform sampler2D texturebBase;
uniform usampler1D flagsSP2;
smooth in vec4 texcoord;
smooth in vec2 realcoord;
smooth in vec3 realcoord;
out vec4 fColor;
void main(void)
@ -14,7 +15,13 @@ void main(void)
if((realcoord.x < (-120.0 / 128.0)) && ((0x02u & f) == 0x00u)){
discard;
}
vec4 c = texture2D(textureb, texcoord.xy);
vec4 c;
if(realcoord.z == 0.0){
c = texture2D(textureb, texcoord.xy);
}
else{
c = texture2D(texturebBase, texcoord.xy);
}
c.r = c.r * texcoord.w;
c.g = c.g * texcoord.w;
c.b = c.b * texcoord.w;

View file

@ -2,11 +2,11 @@
in vec3 position;
in vec3 textCoord;
in vec4 textCoord;
smooth out vec4 texcoord;
smooth out vec2 realcoord;
smooth out vec3 realcoord;
void main()
{
@ -16,5 +16,5 @@ void main()
gl_Position = vec4(a.xy, position.z / 20.0, 1.0);
texcoord = vec4(textCoord.xy, position.z / 20.0, textCoord.z);
realcoord = vec2(a.x, -position.y / 256.0);
realcoord = vec3(a.x, -position.y / 256.0, textCoord.w);
}