shp shaders
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
uniform sampler2D DiffuseTexture;
|
uniform sampler2D DiffuseTexture, Palette;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_FragColor = texture2D(DiffuseTexture,gl_TexCoord[0].st);
|
vec4 x = texture2D(DiffuseTexture, gl_TexCoord[0].st);
|
||||||
|
vec2 p = vec2( dot(x, gl_TexCoord[1]), gl_TexCoord[0].p );
|
||||||
|
gl_FragColor = texture2D(Palette,p);
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,17 @@
|
|||||||
uniform vec2 Scroll;
|
uniform vec2 r1,r2; // matrix elements
|
||||||
uniform vec2 r1;
|
|
||||||
uniform vec2 r2; // matrix elements
|
vec4 DecodeChannelMask( float x )
|
||||||
|
{
|
||||||
|
if (x > 0.0)
|
||||||
|
return (x > 0.5) ? vec4(1,0,0,0) : vec4(0,1,0,0);
|
||||||
|
else
|
||||||
|
return (x < -0.5) ? vec4(0,0,0,1) : vec4(0,0,1,0);
|
||||||
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = ftransform();
|
vec2 p = gl_Vertex.xy*r1 + r2;
|
||||||
|
gl_Position = vec4(p.x,p.y,0,1);
|
||||||
|
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||||
|
gl_TexCoord[1] = DecodeChannelMask(gl_MultiTexCoord0.w);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ uniform sampler2D DiffuseTexture, Palette;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
//float4 x = tex2D(DiffuseTexture, f.Tex0.xy);
|
vec4 x = texture2D(DiffuseTexture, gl_TexCoord[0].st);
|
||||||
//float2 p = float2( dot(x, f.ChannelMask), f.Tex0.z );
|
vec2 p = vec2( dot(x, gl_TexCoord[1]), gl_TexCoord[0].p );
|
||||||
//return tex2D(Palette, p);
|
gl_FragColor = texture2D(Palette,p);
|
||||||
//st
|
|
||||||
gl_FragColor = texture2D(Palette,gl_TexCoord[0].xy);
|
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,18 @@
|
|||||||
uniform vec2 Scroll;
|
uniform vec2 Scroll;
|
||||||
uniform vec2 r1,r2; // matrix elements
|
uniform vec2 r1,r2; // matrix elements
|
||||||
|
|
||||||
|
vec4 DecodeChannelMask( float x )
|
||||||
|
{
|
||||||
|
if (x > 0.0)
|
||||||
|
return (x > 0.5) ? vec4(1,0,0,0) : vec4(0,1,0,0);
|
||||||
|
else
|
||||||
|
return (x < -0.5) ? vec4(0,0,0,1) : vec4(0,0,1,0);
|
||||||
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec2 p = (gl_Vertex.xy - Scroll.xy)*r1 + r2;
|
vec2 p = (gl_Vertex.xy - Scroll.xy)*r1 + r2;
|
||||||
gl_Position = vec4(p.x,p.y,0,1);
|
gl_Position = vec4(p.x,p.y,0,1);
|
||||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||||
|
gl_TexCoord[1] = DecodeChannelMask(gl_MultiTexCoord0.w);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user