![]() |
This post was updated on .
I have a mapnode that is shared between multiple viewers, and I would like to update the brightness and contrast of each viewer individually. When I install the brightness contrast color filter and manipulate these values, it updates both viewers because the layers are shared between them.
I was hoping to install multiple earth layers on top of each other (1 set for each viewer) in the scenegraph and cull the layers not specific to the viewer. However, culling layers is different from culling nodes in a scenegraph and I'm having difficulty figuring out how to do it. I noticed from other threads on the forums that you can generate a node from the map layers, however when I do that, I get null values. I know that if I could make my map layers into nodes, I could simply just install a Callback to ignore the traversal. I've noticed there are LayerCallbacks for the VisibleLayer but I've played around with it and haven't found a way to generate the calls to the functions I'm overriding. How can I cull layers per viewer? This post is similar to what I'm trying to do, and it was answered back in 2012. I was wondering if there was any update on this. |
![]() |
Josiah,
In osgEarth 2.10 there is a method called Layer::setCullCallback that might help you.
Glenn Waldron / Pelican Mapping
|
![]() |
Hey Glenn,
I don't know why, but I don't see that function in the layer header file. I realize on GitHub, the Layer::setCullCallback exists, but in my layer header on my machine I don't see it anywhere and can't access it through a layer object. This is not the first time this has happened to me with functions appearing in the codebase, but not on my machine. I am definitely using osgEarth 2.10. Has osgEarth 2.10 been updated since 6 months ago? If so, how often would I have to pull the version to ensure I have it up-to-date? |
![]() |
Not sure. I believe that method is indeed in the 2.10 tag. Try going into your repository folder and running these:
git status git log -1 to verify that you have the code you think you have.
Glenn Waldron / Pelican Mapping
|
![]() |
I now have 2.10, apparently I had 2.9 even though I thought it was 2.10. I'm still having an issue with the layer callback. Does it work the same way as a node callback? I don't have a visitor to get the camera and I don't see the operator() overloaded in the header file. I need to know which viewer is being traversed during the callback.
Is there an example I can see that shows how the layer call back works? Thanks for the help. |
![]() |
I figured out a work around solution for now,
Basically I copy the initial layers of the map and store them in a vector, for every viewer I spawn I generate a copy of the vector and put the copy in the map. These layers get a user value set for whether or not they will be culled. Then I install the Layer call back and check if the user value for the viewer name is culled or not (viewer name is set on the camera's name which I can get from the nodevisitor when cast to a cullvisitor). This causes the desired effect, but can be inefficient when loading a lot of data on the terrain (especially with memory). Now I can install brightness and contrast filters on layers and have them manipulate each earth independently. If I find a better solution I'll post a better response in the future. |
Free forum by Nabble | Edit this page |