Query about clamp callback

classic Classic list List threaded Threaded
4 messages Options
Sumit Pandey Sumit Pandey
Reply | Threaded
Open this post in threaded view
|

Query about clamp callback


hi,

I want to implement a callback, which clamps an object if terrain-tile on which it is placed is switched.Like when LOD is switched. then i stumbled around the clampcallback. From previous topics,
 
Jason wrote this,

"Right now the clamping is done on each frame in the callback if the
Node has been culled recently. "

So what "Node has been culled recently" means?
AFAIK when lod is switched then object is not culled. It will happen if it goes out of frustum in previous frames, or when it is loaded. Correct me if it is wrong.

Is there any way to implement this in existing infrastructure. Is there anyway i can implement it without changing main codebase of osgearth.

Thanks in advance

Cheers
Sumit Pandey
jasonbeverage jasonbeverage
Reply | Threaded
Open this post in threaded view
|

Re: Query about clamp callback

Hi Sumit,

The ClampCallback was just a little experiment I was toying with.  By
"Node has recently been culled" means that it will only clamp a node
if it is within the view frustum, avoiding doing clamping when the
Node isn't visible.

If you only want to update the Node's when the LOD changes, you can
look at installing a ReadFileCallback and updating the intersections
when something new is loaded.  See the osgcallback example for a
simple example on how to install and use a ReadFileCallback.

Thanks,

Jason

On Sun, Jul 4, 2010 at 6:53 PM, Sumit Pandey [via osgEarth]
<[hidden email]> wrote:

>
> hi,
>
> I want to implement a callback, which clamps an object if terrain-tile on
> which it is placed is switched.Like when LOD is switched. then i stumbled
> around the clampcallback. From previous topics,
>
> Jason wrote this,
>
> "Right now the clamping is done on each frame in the callback if the
> Node has been culled recently. "
>
> So what "Node has been culled recently" means?
> AFAIK when lod is switched then object is not culled. It will happen if it
> goes out of frustum in previous frames, or when it is loaded. Correct me if
> it is wrong.
>
> Is there any way to implement this in existing infrastructure. Is there
> anyway i can implement it without changing main codebase of osgearth.
>
> Thanks in advance
>
> Cheers
> Sumit Pandey
>
> ________________________________
> View message @
> http://forum.osgearth.org/Query-about-clamp-callback-tp5254412p5254412.html
> To start a new topic under osgEarth, email
> [hidden email]
> To unsubscribe from osgEarth, click here.
>
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Query about clamp callback

In reply to this post by Sumit Pandey
Sumit,

What Jason meant was that the node will be re-clamped each frame in which it is visited by the cull traversal. So if it is "un-switched", or outside the view frustum, the clamping will not occur.

There isn't any functionality in ClampCallback right now to only re-clamp when the underlying terrain LOD changes. Good idea though. One approach might be to use MapNode::addTerrainCallback() to listen for terrain changes, then test the clamp points against these changes.

Glenn.
Glenn Waldron / Pelican Mapping
Sumit Pandey Sumit Pandey
Reply | Threaded
Open this post in threaded view
|

Re: Query about clamp callback



Clamp callback doesn't seems to suffice my purpose. Since it will incur huge performance hit. I will try to implement a callback for this purpose based on your suggestions.

Thanks
Sumit Pandey