Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actual~Helgon

Posted 28 November 2012 - 11:19 AM

Ah thanks for the answer. it helped me a bit to understand better what happens

so i changed the topology to:

md3dImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);


and if i expand one point in the GS it works.. for testing reasons i expended one point to 20

[maxvertexcount(20)]
void GS(point VertexOut gin[1],
		inout LineStream<GeoOut> stream)
{
float3 up = float3(0.0f, 1.0f, 0.0f);
float3 look = gEyePosW - gin[0].CenterW;
look.y = 0.0f; // y-axis aligned, so project to xz-plane
look = normalize(look);
float3 right = cross(up, look);

float4 v[20];
for(int i = 0; i < 20; ++i)
{
  if(i%2 == 0)
  {
   v[i] = float4(gin[0].CenterW + i*1.0f, 1.0f);
  }
  else
  {
   v[i] = float4(gin[0].CenterW - i*1.0f, 1.0f);
  }
}
GeoOut gout;
[unroll]
for(int i = 0; i < 20; ++i)
{
  gout.PosH	 = mul(v[i], gViewProj);
  gout.PosW	 = v[i].xyz;
  gout.NormalW  = look;

  stream.Append(gout);
}
}

it works fine.. if i set the inout in the GS to PointStream directx draws all the single points and if i set it to LineStream i get single lines, but that is the problem. what i in fact want are connected lines (like the LINESTRIP topology) so how can i achieve that?

my thought was that maybe something like stream.ContinueStrip() exists (like RestartStrip()) but i didn't found anything

would be happy if u can give me another hint or short give me a snippet how to implement a LineStrip (with the points generated by the GS)


regards helgon

#1~Helgon

Posted 28 November 2012 - 11:18 AM

Ah thanks for the answer. it helped me a bit to understand better what happens

so i changed the topology to:

md3dImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);


and if i expand one point in the GS i works.. for testing reasons i expended one point to 20

[maxvertexcount(20)]
void GS(point VertexOut gin[1],
		inout LineStream<GeoOut> stream)
{
float3 up = float3(0.0f, 1.0f, 0.0f);
float3 look = gEyePosW - gin[0].CenterW;
look.y = 0.0f; // y-axis aligned, so project to xz-plane
look = normalize(look);
float3 right = cross(up, look);

float4 v[20];
for(int i = 0; i < 20; ++i)
{
  if(i%2 == 0)
  {
   v[i] = float4(gin[0].CenterW + i*1.0f, 1.0f);
  }
  else
  {
   v[i] = float4(gin[0].CenterW - i*1.0f, 1.0f);
  }
}
GeoOut gout;
[unroll]
for(int i = 0; i < 20; ++i)
{
  gout.PosH	 = mul(v[i], gViewProj);
  gout.PosW	 = v[i].xyz;
  gout.NormalW  = look;

  stream.Append(gout);
}
}

it works fine.. if i set the inout in the GS to PointStream directx draws all the single points and if i set it to LineStream i get single lines, but that is the problem. what i in fact want are connected lines (like the LINESTRIP topology) so how can i achieve that?

my thought was that maybe something like stream.ContinueStrip() exists (like RestartStrip()) but i didn't found anything

would be happy if u can give me another hint or short give me a snippet how to implement a LineStrip (with the points generated by the GS)


regards helgon

PARTNERS