TestShader.hlsl 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /////////////
  2. // GLOBALS //
  3. /////////////
  4. cbuffer MatrixBuffer : register( b0 )
  5. {
  6. matrix knochenMatrix[ 128 ];
  7. };
  8. //////////////
  9. // TYPEDEFS //
  10. //////////////
  11. struct VertexInputType
  12. {
  13. float4 position : POSITION;
  14. float2 tex : TEXCOORD0;
  15. int knochen : KNOCHEN_ID;
  16. };
  17. struct PixelInputType
  18. {
  19. float4 position : SV_POSITION;
  20. float2 tex : TEXCOORD0;
  21. };
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // Vertex Shader
  24. ////////////////////////////////////////////////////////////////////////////////
  25. PixelInputType TextureVertexShader( VertexInputType input )
  26. {
  27. //return input;
  28. PixelInputType output;
  29. // Change the position vector to be 4 units for proper matrix calculations.
  30. input.position.w = 1.0f;
  31. // Store the texture coordinates for the pixel shader.
  32. output.tex = input.tex;
  33. // Calculate the position of the vertex against the world, view, and projection matrices.
  34. output.position = mul( input.position, knochenMatrix[ input.knochen ] );
  35. return output;
  36. }