Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Joint
- {
- float4x4 local;
- uint parentIndex;
- };
- cbuffer Constants
- {
- float4x4 g_WorldViewProj;
- Joint g_Joints[255];
- uint count;
- };
- struct PSInput
- {
- float4 Pos : SV_POSITION;
- };
- [maxvertexcount(256)]
- void main(
- line PSInput points[2],
- inout LineStream< PSInput > stream
- )
- {
- PSInput v[2];
- uint i, j;
- for (i = 0; i < count; ++i)
- {
- j = g_Joints[i].parentIndex;
- if (j != 255)
- {
- v[0].Pos = mul(float4(g_Joints[i].local[0][3], g_Joints[i].local[1][3], g_Joints[i].local[2][3], g_Joints[i].local[3][3]), g_WorldViewProj);
- v[1].Pos = mul(float4(g_Joints[j].local[0][3], g_Joints[j].local[1][3], g_Joints[j].local[2][3], g_Joints[j].local[3][3]), g_WorldViewProj);
- stream.Append(v[0]); //EmitVertex
- stream.Append(v[1]); //EmitVertex
- stream.RestartStrip(); //EndPrimitive
- }
- else
- {
- v[0].Pos = mul(float4(g_Joints[i].local[0][3], g_Joints[i].local[1][3], g_Joints[i].local[2][3], g_Joints[i].local[3][3]), g_WorldViewProj);
- v[1].Pos = mul(float4(g_Joints[i].local[0][3], g_Joints[i].local[1][3], g_Joints[i].local[2][3], g_Joints[i].local[3][3]) + float4(0.0, 1.0, 0.0, 0.0), g_WorldViewProj);
- stream.Append(v[0]); //EmitVertex
- stream.Append(v[1]); //EmitVertex
- stream.RestartStrip(); //EndPrimitive
- }
- }
- }
Add Comment
Please, Sign In to add comment