View difference between Paste ID: DAPihpkH and 94aAncRz
SHOW: | | - or go back to the newest paste.
1-
struct PSInput 
1+
struct Joint
2-
{ 
2+
3-
    float4 Pos : SV_POSITION;
3+
	float4x4 local;
4
	uint parentIndex;
5
};
6-
// Vertex shader takes two inputs: vertex position and color.
6+
7-
// By convention, Diligent Engine expects vertex shader inputs to 
7+
cbuffer Constants
8-
// be labeled as ATTRIBn, where n is the attribute number
8+
9-
PSInput main(float dummy : ATTRIB0)
9+
	float4x4 g_WorldViewProj;
10
	Joint g_Joints[255];
11-
	/*CONST FLOAT f = 1.0f / 255.0f;
11+
	uint count;
12-
	r = f * (FLOAT)(unsigned char) (dw >> 16);
12+
13-
	g = f * (FLOAT)(unsigned char) (dw >> 8);
13+
14-
	b = f * (FLOAT)(unsigned char) (dw >> 0);
14+
struct PSInput
15-
	a = f * (FLOAT)(unsigned char) (dw >> 24);*/
15+
16-
	PSInput ps;
16+
	float4 Pos : SV_POSITION;
17-
    ps.Pos = float4(dummy, dummy, dummy, dummy);
17+
18-
    return ps;
18+
19
[maxvertexcount(256)]
20
void main(
21
	line PSInput points[2],
22
	inout LineStream< PSInput > stream
23
)
24
{
25
	PSInput v[2];
26
27
	uint i, j;
28
	for (i = 0; i < count; ++i)
29
	{
30
		j = g_Joints[i].parentIndex;
31
		if (j != 255)
32
		{
33
			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);
34
			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);
35
			stream.Append(v[0]); //EmitVertex
36
			stream.Append(v[1]); //EmitVertex
37
			stream.RestartStrip(); //EndPrimitive
38
		}
39
		else
40
		{
41
			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);
42
			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);
43
			stream.Append(v[0]); //EmitVertex
44
			stream.Append(v[1]); //EmitVertex
45
			stream.RestartStrip(); //EndPrimitive
46
		}
47
	}
48
49
50
}