Jump to content

Build Polys From Existing Points


Recommended Posts

This should be simple, just can't find the right thing in the hdk.

I have a gdp that's simply a cloud of points. I want to build triangles based using those existing points. I have all the point indice info I need to do it, I just can't find the class/method I need.

I see the GU_PolyKnit, that may do it.. but it I can't get it to work.. I'm guessing it's something I'm doing wrong since I'm just guessing at the data it needs (the .h file isn't very descriptive)

I know how to make new poly's with new verts.. but I want to use my existing points

Thanks for any pointers

d

Link to comment
Share on other sites

I believe that you create a new polygon (I can't remember how) then set the vertices to the points with prim->setVertex(i, pointNum); but this is not clear I'm sure. :blink:

Dave

Thanks Dave, just enough info to get me on the right track. I knew I could do

poly = GU_PrimPoly::build(gdp, 3, GU_POLY_CLOSED);
poly->getVertex(0).getPt()->getPos() = pos;

I didn't realize I could add a prim without any verts like:

poly = GU_PrimPoly::build(gdp, 0, GU_POLY_CLOSED);
poly->appendVertex(gdp->points()[index0]);
poly->appendVertex(gdp->points()[index1]);
poly->appendVertex(gdp->points()[index2]);

Anyway, that works. Thanks

d

Edited by Daniel
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...