anx.framework/shader/GL3/DualTexture.fx

160 lines
3.5 KiB
HLSL
Raw Permalink Normal View History

// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
vertexglobal
{
uniform vec4 DiffuseColor;
uniform vec4 FogVector;
uniform mat4 WorldViewProj;
}
2012-01-16 13:48:21 +00:00
vertexshaders
{
shader "VSDualTexture"
2012-01-16 13:48:21 +00:00
{
attribute vec4 pos;
attribute vec2 tex;
attribute vec2 tex2;
varying vec4 diffuse;
varying vec4 specular;
varying vec2 diffuseTexCoord;
varying vec2 diffuseTexCoord2;
void main( )
{
gl_Position = WorldViewProj * pos;
diffuse = DiffuseColor;
specular = vec4(0, 0, 0, saturate(dot(pos, FogVector)));
diffuseTexCoord = tex;
diffuseTexCoord2 = tex2;
}
}
shader "VSDualTextureNoFog"
{
attribute vec4 pos;
attribute vec2 tex;
attribute vec2 tex2;
varying vec4 diffuse;
varying vec2 diffuseTexCoord;
varying vec2 diffuseTexCoord2;
void main( )
{
gl_Position = WorldViewProj * pos;
diffuse = DiffuseColor;
diffuseTexCoord = tex;
diffuseTexCoord2 = tex2;
}
}
shader "VSDualTextureVertexColor"
{
attribute vec4 pos;
attribute vec2 tex;
attribute vec2 tex2;
attribute vec4 col;
varying vec4 diffuse;
varying vec4 specular;
2012-01-16 13:48:21 +00:00
varying vec2 diffuseTexCoord;
varying vec2 diffuseTexCoord2;
2012-01-16 13:48:21 +00:00
void main( )
{
gl_Position = WorldViewProj * pos;
diffuse = DiffuseColor * col;
specular = vec4(0, 0, 0, saturate(dot(pos, FogVector)));
diffuseTexCoord = tex;
diffuseTexCoord2 = tex2;
}
}
shader "VSDualTextureVertexColorNoFog"
{
attribute vec4 pos;
attribute vec2 tex;
attribute vec2 tex2;
attribute vec4 col;
varying vec4 diffuse;
varying vec2 diffuseTexCoord;
varying vec2 diffuseTexCoord2;
void main( )
{
gl_Position = WorldViewProj * pos;
diffuse = DiffuseColor * col;
2012-01-16 13:48:21 +00:00
diffuseTexCoord = tex;
diffuseTexCoord2 = tex2;
2012-01-16 13:48:21 +00:00
}
}
}
fragmentglobal
{
uniform sampler2D Texture;
uniform sampler2D Texture2;
uniform vec3 FogColor;
}
2012-01-16 13:48:21 +00:00
fragmentshaders
{
shader "PSDualTexture"
2012-01-16 13:48:21 +00:00
{
varying vec4 diffuse;
varying vec4 specular;
2012-01-16 13:48:21 +00:00
varying vec2 diffuseTexCoord;
varying vec2 diffuseTexCoord2;
2012-01-16 13:48:21 +00:00
void main( )
{
vec4 color = texture2D(Texture, diffuseTexCoord);
vec4 overlay = texture2D(Texture2, diffuseTexCoord2);
color.rgb *= 2;
color *= overlay * diffuse;
color.rgb = lerp(color.rgb, FogColor * color.a, specular.w);
gl_FragColor = color;
}
}
shader "PSDualTextureNoFog"
{
varying vec4 diffuse;
varying vec2 diffuseTexCoord;
varying vec2 diffuseTexCoord2;
void main( )
{
vec4 color = texture2D(Texture, diffuseTexCoord);
vec4 overlay = texture2D(Texture2, diffuseTexCoord2);
color.rgb *= 2;
color *= overlay * diffuse;
gl_FragColor = color;
2012-01-16 13:48:21 +00:00
}
}
}
2012-01-16 13:48:21 +00:00
techniques
{
technique "DualTextureEffect"
2012-01-16 13:48:21 +00:00
{
vertex "VSDualTexture"
fragment "PSDualTexture"
}
technique "DualTextureEffectNoFog"
{
vertex "VSDualTextureNoFog"
fragment "PSDualTextureNoFog"
}
technique "DualTextureEffectVertexColor"
{
vertex "VSDualTextureVertexColor"
fragment "PSDualTexture"
}
technique "DualTextureEffectNoFogVertexColor"
{
vertex "VSDualTextureVertexColorNoFog"
fragment "PSDualTextureNoFog"
2012-01-16 13:48:21 +00:00
}
}