This is fully untested, so theres probably a spelling mistake or something in there:
Code: Select all
float4x4 mWorldViewProj;
struct a2v
{
float4 Position : POSITION;
float2 Texcoords : TEXCOORD0;
float4 Color : COLOR0;
};
struct v2p
{
float4 Position : POSITION;
float2 Texcoords : TEXCOORD0;
float4 Color : COLOR0;
};
void vertexMain( in a2v IN, out v2p OUT )
{
OUT.Position = mul(IN.Position, mWorldViewProj);
OUT.Color = IN.Color;
OUT.Texcoords = IN.Texcoords;
}
sampler Texture : register(s0);
float4 pixelMain(in v2p IN) : COLOR0
{
return tex2D(Texture , IN.Texcoords) * IN.Color;
}
IMPORTANT:
For this, you have to pass the WorldViewProj "mWorldViewProj" matrix to the shader as a shader constant, this is done in the shader example in the Irrlicht SDK, so just do what they did there. Also, you don't have to pass the texture name as a constant in GLSL so take that out of the constant callback.
Btw, this shader doesn't really do anything, you might as well just use fixed-function.