HDK deleting points

   2704   5   2
User Avatar
Member
7 posts
Joined: 3月 2012
Offline
Hey all,
I have been having issues with deleting dead particles in a GEO_PrimParticle system. I will refer to the SOP_SParticle.C example file. When using this node as the particles reach the end of their life they are marked for deletion by use of deadParticle(). All of these marked particles are then deleted by deleteDead(). The issue I have run into is that this only deletes the vertex not the point. The points still show up in the viewport and just stop moving. I am trying to figure out how the points and verticies can be deleted. I have been searching and trying to figure this out for a bit now so I am posting on here because I have been unable to figure it out. Any help or suggestions would be greatly appreciated. Thank you much.
-Nate
Nate Usiak
Effects Artist
www.usiak.com
nateusiak@usiak.com
www.vimeo.com/nateusiak
User Avatar
Member
1743 posts
Joined: 3月 2012
Offline
I might just forgo dealing with the particle system's interface and create a point group with all of the points to be deleted, and then call
gdp->destroyPointOffsets(GA_Range(*pointgroup))
It'll automatically remove any vertices using the points too, so the particle system should be fine with it, though I don't know if it would remove them from the dead list if you've already added vertices to it. Also, if you can avoid using the particle system altogether and just use orphaned points as if they were a particle system, it'd be even faster.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
7 posts
Joined: 3月 2012
Offline
Ok awesome. Thank you much. One question though how does one go about adding points to a point group? Would declair a pointer to a pointgroup then add each point as a *GEO_Point? Does it act like a vector as far as data structure goes?
Nate Usiak
Effects Artist
www.usiak.com
nateusiak@usiak.com
www.vimeo.com/nateusiak
User Avatar
Member
1743 posts
Joined: 3月 2012
Offline
nateusiak
how does one go about adding points to a point group?

Since you just want the group to be temporary, it doesn't even need to have a name anymore if you build it with:
GA_PointGroup* pointgroup = gdp->createInternalElementGroup(GA_ATTRIB_POINT);
You can then add points to it by adding the point offsets:
pointgroup->addOffset(pointoffset)
For example, if you wanted to add all of the points used by some primitive, you could do:
GA_Size n = prim->getVertexCount();
for (GA_Size i = 0; i < n; ++i) {
pointgroup->addOffset(gdp->vertexPoint(prim->getVertexOffset(i)));
}
You can delete the point group by doing:
gdp->destroyElementGroup(pointgroup);

GEO_Point?
NOOOOOOOOOOOOOOOOOOOooooooooo……….. Haha, I've just spent months trying to replace as many uses of GEO_Point as possible with GA_Offset. :wink:

Does it act like a vector as far as data structure goes?
(If it's an unordered, element group), the structure is a paged bit-array (GA_DataBitArray) where if a full page of GA_PAGE_SIZE bits has the same value (0 or 1), the page is marked constant, to avoid wasting space/time. In pages that aren't constant, they can be skipped-over 64 at a time, since there are 64-bits in a general CPU register, so that's fairly quick too.

All that said, if you're only deleting a few points each time, you're better off deleting them one by one by calling gdp->destroyPointOffset(pointoffset);
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
1743 posts
Joined: 3月 2012
Offline
Oops, the example of the points of a primitive could have been:
GA_Size n = prim->getVertexCount();
for (GA_Size i = 0; i < n; ++i) {
pointgroup->addOffset(prim->getPointOffset(i));
}
They should be about the same performance, but it's less text to work with this way.
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
7 posts
Joined: 3月 2012
Offline
Ok thank you so much! I will work with all of this info. Really helps thank you again
Nate Usiak
Effects Artist
www.usiak.com
nateusiak@usiak.com
www.vimeo.com/nateusiak
  • Quick Links