Hi

You can set ComputeBoundingBoxCallback on a geometry to specify whatever bounds 
you want. In your case to ignore earth geometry bound you can set its bound to 
uninitialized bounding box, and it will not make any difference to near\far 
calculations. Note that this thing completely disable view frustum culling on a 
geometry! In order to get it working you should write your cull callback and do 
check vs actual bounds there, if you need it.

Code looks like:

class UseInitialBoundsCallback : public 
osg::Drawable::ComputeBoundingBoxCallback
{
public:
        osg::BoundingBox computeBound (const osg::Drawable & drawable)
        {
                osg::BoundingBox brand_new_uninitialized_bbox;
                return brand_new_uninitialized_bbox;
        }
};

geometry->setComputeBoundingBoxCallback(new UseInitialBoundsCallback);

Cheers, Sergey.

05.10.2012, 05:11, "Preet" <[email protected]>:
> On Thu, Oct 4, 2012 at 5:37 PM, Chris Hanson <[email protected]> wrote:
>
>>  I wanted to avoid specifying the near/far planes manually since the
>>>  behaviour without the Earth surface geometry is perfect as is. I don't
>>>  care about the overhead of drawing the surface geometry since its so
>>>  simple, and I don't want the scene graph to account for the surface
>>>  geometry (outside of rendering it); the other objects in the scene
>>>  should determine the camera frustum.
>>    Due to the way OGL works with near/far, if you want it drawn, you need it
>>  taken into account when computing the near/far planes.
>>
>>    Are you just worried about the far plane being set too far?
>>>  Including geometry for the
>>  Earth's surface makes the other stuff disappear (and reappear at
>>  certain angles).
>>
>>    It sounds to me like you're not trying to solve the right problem. You
>>  should first determine WHY these other items aren't displayed at times.
>
> Sorry if it wasn't clear; the items aren't being displayed because the
> near and far planes that osg sets creates a frustum that doesn't
> include them. I need to manually set the near and far planes to see
> everything.
>
> The near and far planes that osg sets without the earth surface
> geometry is fine. Once you add the surface geometry though, the near
> and far planes are set such that the items are no long in the view
> frustum.
>
> I was looking for a flag or something that basically tells osg "hey,
> don't include this node when you do your view frustum calculations"
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to