Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float4x4 World;
- float4x4 View;
- float4x4 Projection;
- Texture ModelTexture;
- sampler2D TexSampler = sampler_state
- {
- Texture = (ModelTexture);
- MinFilter = Linear;
- MagFilter = Linear;
- AddressU = Wrap;
- AddressV = Wrap;
- };
- struct A2V
- {
- float4 Position : POSITION0;
- float4 Normal : NORMAL0;
- float2 TexCoords : TEXCOORD0;
- };
- struct V2P
- {
- float4 Position : POSITION0;
- float2 TexCoords : TEXCOORD0;
- float4 Lighting : TEXCOORD1;
- };
- float4 AmbientLight = float4(1.0f, 1.0f, 1.0f, 1.0f);
- float AmbientLightIntensity = -0.2f;
- float4 DiffuseLight = float4(1.0f, 1.0f, 0.6f, 1.0f);
- float4 DiffuseLightSource = float4(0.0f, 0.0f, 50.0f, 1.0f);
- float DiffuseLightIntensity = 0.5f;
- float4x4 WorldTransposedInverse;
- bool EnableLighting = true;
- V2P LOLVS(A2V Input)
- {
- V2P Output = (V2P)0;
- Output.TexCoords = Input.TexCoords;
- float4 iTransformed = mul(Input.Position, World);
- float4 iView = mul(iTransformed, View);
- float4 iProjection = mul(iView, Projection);
- Output.Position = iProjection;
- float4 Normal = normalize(mul(Input.Normal, WorldTransposedInverse));
- float DiffuseLightVertexIntensity = dot(Normal, normalize(DiffuseLightSource));
- Output.Lighting = AmbientLight * AmbientLightIntensity + DiffuseLight * DiffuseLightIntensity * DiffuseLightVertexIntensity;
- return Output;
- }
- float4 LOLPS(V2P Input) : COLOR
- {
- float4 TextureColor = float4(tex2D(TexSampler, Input.TexCoords).rgb, 1.0f);
- if(EnableLighting)
- return saturate(TextureColor + Input.Lighting);
- else
- return TextureColor;
- }
- technique LOL
- {
- Pass lmfao
- {
- VertexShader = compile vs_2_0 LOLVS();
- PixelShader = compile ps_2_0 LOLPS();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement