Hi,

I have the same problem and decided to choose the callback solution.
My callback calculates( so far) useable values for near and far plane, but this 
values are completely ignored.

My current  (maybe wrong ;) ) implementation is:

Code:

       double cloudNear, cloudFar;
       computeNearFarClouds(cloudNear, cloudFar);
       if (cloudNear < znear) znear = cloudNear;
       if (cloudFar > zfar) zfar = cloudFar;
           if (zfar < minFar) zfar = minFar; 

       bool ret = 
stockCullVisitor->clampProjectionMatrixImplementation(projection, znear, zfar);

           if (skyDrawable)
           {
                        skyDrawable->setSkyboxSize(((zfar - znear) * 0.5 + 
znear) * 2.0);
           }

       return ret;




I install my callback with

Code:

cb = new skySilverLining_projectionMatrixCallback( atmosphere, 
viewer->getCamera(), sceneRoot);
                viewer->getCamera()->setClampProjectionMatrixCallback(cb);
                cb->setSkyDrawable(skyDrawable);





Now I question myself what I have to do in detail to use the callback.
I guess that the functions

Code:

clampProjectionMatrixImplementation(osg::Matrixf& projection, double& znear, 
double& zfar) const;
clampProjectionMatrixImplementation(osg::Matrixd& projection, double& znear, 
double& zfar) const;



are called by the callback mechanism, right?

What should I do with the three parameters? Is it sufficient to set the 
variables znear and zfar, or do I have to perform any operations on the 
projection variable?

I hope anyone can enlight my mind..


Thank you very much for your support,

Torben[/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=16371#16371





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to