xKamuna

HLSL Example 1

May 6th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. float4x4 viewProj;
  2. float4x4 model;
  3. struct VS_INPUT
  4. {
  5. float3 pos : POSITION;
  6. float3 normal: NORMAL0;
  7. float4 color: COLOR0;
  8. float2 base: TEXCOORD0;
  9. };
  10.  
  11. struct VS_OUTPUT
  12. {
  13. float4 pos: POSITION;
  14. float2 normal: TEXCOORD1;
  15. float4 color: COLOR0;
  16. float2 base: TEXCOORD0;
  17.  
  18. };
  19. VS_OUTPUT Main(VS_INPUT input)
  20. {
  21. VS_OUTPUT output = (VS_OUTPUT)0;
  22. float4 pos = float4(input.pos.x, input.pos.y, input.pos.z, 1.0);
  23. float3 normaled = normalize(input.normal);
  24. float4 normal = float4(normaled.x, normaled.y, normaled.z, 1.0);
  25. output.pos = mul(pos, mul(model, viewProj)); // transform Position
  26. output.normal = normal;
  27. output.color = input.color;
  28. output.base = input.base;
  29. return output;
  30. }
Add Comment
Please, Sign In to add comment