mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-06 19:01:06 +03:00
55 lines
1.2 KiB
HLSL
55 lines
1.2 KiB
HLSL
struct VertexShaderInput
|
|
{
|
|
float3 Position : POSITION0;
|
|
float3 Normal : NORMAL0;
|
|
float2 TextureCoordinate : TEXCOORD0;
|
|
float4 Color : COLOR0;
|
|
float Bone : BLENDINDICES0;
|
|
};
|
|
|
|
struct VertexShaderOutput
|
|
{
|
|
float4 Position : POSITION0;
|
|
float2 TextureCoordinate : TEXCOORD1;
|
|
};
|
|
|
|
float4x4 World;
|
|
float4x4 View;
|
|
float4x4 Projection;
|
|
|
|
texture ModelTexture;
|
|
sampler2D textureSampler = sampler_state {
|
|
Texture = (ModelTexture);
|
|
MinFilter = Linear;
|
|
MagFilter = Linear;
|
|
AddressU = Clamp;
|
|
AddressV = Clamp;
|
|
};
|
|
|
|
VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
|
|
{
|
|
VertexShaderOutput output;
|
|
|
|
float4 worldPosition = mul(float4(input.Position, 1), World);
|
|
float4 viewPosition = mul(worldPosition, View);
|
|
output.Position = mul(viewPosition, Projection);
|
|
|
|
output.TextureCoordinate = input.TextureCoordinate;
|
|
|
|
return output;
|
|
}
|
|
|
|
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
|
|
{
|
|
float4 textureColor = tex2D(textureSampler, input.TextureCoordinate);
|
|
return textureColor;
|
|
}
|
|
|
|
technique Textured
|
|
{
|
|
pass Pass1
|
|
{
|
|
VertexShader = compile vs_3_0 VertexShaderFunction();
|
|
PixelShader = compile ps_3_0 PixelShaderFunction();
|
|
}
|
|
}
|