18 Jul 2012 22:49
Re: Lines not showing when zoomed in orthographic projection
UPDATE: Let me start by saying Paul was right 8) . It is the AutoTransform! The 'x' did not show when I turned off AutoTransform because it may have been obscured by another object, so I falsely thought it was not the AutoTransform. I spent the day debugging the bound speheres for culling and I found the problem. Here is what happens: 1) I add the new 'x' to my scene with an AutoTransform and AutoScaleToScreen=true 2) frame() is called 3) OSG prepares for culling and calls scene->getSceneData()->getBound() to calculate the bounding sphere of the scene (ViewerBase.cpp line #760) 4) The graph gets traversed in a depth-first manner, recursevly computing the spheres 5) At some point our AutoTransform is reached, and computeBound() is called (Node line #366) 6) But allas, AutoTransform::computeBound() returns an invalid bound since the _firstTimeToInitEyePoint flag is true! (AutoTransform.cpp line #389) 7) The _firstTimeToInitEyePoint flag gets a false value only after the first CullVisitor has visited the AutoTransform, which happens only AFTER the computation of the bound returns (AutoTransform.cpp lines 199 - 229). 8 ) But at that time it is too late since the value of _boundingSphereComputed is set to true (Node line #370) so the invalid AutoTransform sphere does not get recalculated until later. What I did is set a breakpoint in AutoTransform::computeBound(), and set _firstTimeToInitEyePoint to false inside the debugger, and then the 'x' showed. So to summarize the problem - the implementation of AutoTransform::computeBound()will return a valid spehere only if the AutoTransform node was visited by the CullVisitor at least once, but since it is called before the culling, it caches an invalid transform. I am not sure if this is a bug or because I may not be seeing the whole picture. Our plan to solve this is writing our own BoundCallback and set it on the AutoTransform of our 'x'.(Continue reading)
RSS Feed