123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- // Matrizen für die einzelnen Knochen des Modells
- struct MatrixBuffer
- {
- matrix knochenMatrix[ 128 ];
- };
- // The projection and view matrix
- struct KameraBuffer
- {
- matrix view;
- matrix projection;
- };
- ConstantBuffer<KameraBuffer> Kamera : register( b0 );
- ConstantBuffer<MatrixBuffer> Skelett : register( b1 );
- struct VertexInputType
- {
- float4 position : POSITION;
- float2 tex : TEXCOORD0;
- float3 normal : NORMAL;
- uint knochen : KNOCHEN_ID;
- };
- struct PixelInputType
- {
- float4 worldPos : POSITION;
- float4 position : SV_POSITION;
- float2 tex : TEXCOORD0;
- float3 normal : TEXCOORD1;
- };
- PixelInputType main( VertexInputType input )
- {
- //return input;
- PixelInputType output;
- output.normal = normalize( mul( input.normal, ( float3x3 )Skelett.knochenMatrix[ input.knochen ] ) );
- // Change the position vector to be 4 units for proper matrix calculations.
- input.position.w = 1.0f;
- // Store the texture coordinates for the pixel shader.
- output.tex = input.tex;
- // Calculate the position of the vertex against the world, view, and projection matrices.
- output.worldPos = mul( input.position, Skelett.knochenMatrix[ input.knochen ] );
- output.position = mul( output.worldPos, Kamera.view );
- output.position = mul( output.position, Kamera.projection );
- return output;
- }
|