Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ----------------------------------------------------------------------------------
- // Parameters
- // ----------------------------------------------------------------------------------
- // Global matrix paramters
- float4x4 World;
- float4x4 View;
- float4x4 Projection;
- // Ambient Light Parameters
- float4 AmbientColor = float4(1, 1, 1, 1);
- float AmbientIntensity = 0.1;
- // Diffuse Light Parameters
- // ----------------------------------------------------------------------------------
- // States
- // ----------------------------------------------------------------------------------
- RasterizerState rsSolid
- {
- FillMode = Solid;
- CullMode = NONE;
- FrontCounterClockwise = false;
- };
- // ----------------------------------------------------------------------------------
- // Inputs / Outputs
- // ----------------------------------------------------------------------------------
- struct VertexShaderInput
- {
- float4 Position : POSITION;
- float2 Texture : TEXCOORD;
- float4 Color : COLOR;
- float3 Normal : NORMAL;
- };
- struct PixelShaderInput
- {
- float4 Position : SV_POSITION;
- float2 Texture : TEXCOORD;
- float4 Color : COLOR;
- };
- // ----------------------------------------------------------------------------------
- // Shaders
- // ----------------------------------------------------------------------------------
- PixelShaderInput VS_Ambient(VertexShaderInput input)
- {
- PixelShaderInput i = (PixelShaderInput)0;
- i.Position = mul(input.Position, World);
- i.Position = mul(i.Position, View);
- i.Position = mul(i.Position, Projection);
- i.Texture = input.Texture;
- i.Color = input.Color;
- return i;
- }
- float4 PS_Ambient(PixelShaderInput input) : SV_Target
- {
- return mul(input.Color, AmbientColor * AmbientIntensity);
- }
- // ----------------------------------------------------------------------------------
- // Techniques
- // ----------------------------------------------------------------------------------
- technique10 Ambient
- {
- pass P0
- {
- SetVertexShader(CompileShader(vs_4_0, VS_Ambient()));
- SetGeometryShader(NULL);
- SetPixelShader(CompileShader(ps_4_0, PS_Ambient()));
- SetRasterizerState(rsSolid);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement