[Plib-devel] Problem with ssgRangeSelector
Brought to you by:
sjbaker
From: Paolo L. <p.l...@ci...> - 2005-11-28 14:29:26
|
Dear all, In the rewrite of the useful lodmaker utility in order to make it work = "by single leaf" instead of "by full model" (assuming that two LOD models = has the same scene graph structure) I noticed that all the houndreds RangeSelectors put in the combined result ssg model all suddenly switch = at the same time during visualization, thus resembling the original = lodmaker bekavior. By going into the code of ssgRangeSelector::cull, it seems to me too = simple and thus not general. Infact assuming the camera matrix is passed as second parameter to ssgRangeSelector::cull (is it?), the current code basically only tests = which depth range is the camera position in, thus select'ing the corresponding child subgraph. I could have misunderstood the code, or the purpose of the subject class itself, yet I expected it would compare the actual position of an object (e.g. by its Bsphere center) with the current camera position instead. I got a much better behavior by changing the way of calculating float range =3D sgLengthVec3 ( m [ 3 ] ) ; With const float *center =3D this->getKid(0)->getBSphere()->getCenter(); = // just refer to the first LOD // = for center information float range =3D sgDistanceVec3 ( center, m[3] ) ; Of course this doesn't still keep into account the transformation path = of the node within the graph, which could require a getNetTransform() to further transform the center. Is that roughly right? How to proceed? Could it be a topic for the = upcoming release? Do I proceed improving and testing it rapidly? Greetings - Paolo Leoncini -------------------------------------------------------------------------= Paolo Leoncini phone: +39 (0823) 623134 Visualization & Virtual Reality fax: +39 (0823) 623126 CIRA - Italian Center for Aerospace Researches mailto:p.l...@ci... Via Maiorise - 81043 Capua (CE) Italy http://www.cira.it |