Hi,
Usually we do something like this when updating geometry.
FOR_ALL_GPOINTS(gdp, ppt)
{
UT_Vector4& p = ppt->getPos();
//do some magic with p…..
}
Which of course is really slow in the case of the gdp being large.
My question is, is there a better (faster) way of updating the points? Perhaps a way to use multithreading, which in this case would be several loops each in its own thread going through individual parts of the gdp. Just simple threading of a loop (where iterations are independent of each other) in other words….
How can this be done using HDK? If there is nothing built in, then I’m just interested in how to split up “FOR_ALL_GPOINTS” into several smaller parts and I can do the threading myself.
Thanks!
HDK: threading FOR_ALL_GPOINTS
3643 3 1- burnie
- Member
- 23 posts
- Joined: July 2008
- Offline
- edward
- Member
- 7737 posts
- Joined: July 2005
- Online
gdp->points() returns a GEO_PointList which is ultimately just derived from UT_PtrArray<GEO_Point *>. So you can easily divide up the work yourself using gdp->points().entries(). To play nicely with everything else in Houdini, use of UT_ThreadedAlgorithm is recommended since that will obey HOUDINI_MAXTHREADS, nested UT_ThreadedAlgorithms, cross-platform, etc.
- burnie
- Member
- 23 posts
- Joined: July 2008
- Offline
- xiondebra
- Member
- 543 posts
- Joined: July 2005
- Offline
-
- Quick Links