hi all,
    It seems that there is a problem with 
CullVisitor::updateCalculatedNearFar,I have the code like this:
 
osgViewer::Viewer viewer;
 
class MCallBack : public osg::NodeCallback 
{
public:
 virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
 { 
     osg::PositionAttitudeTransform *pat = 
dynamic_cast<osg::PositionAttitudeTransform *>(node);
     if( pat != NULL )
     {
         osg::Camera *camera=viewer.getCamera();
         osg::Matrixd pMatrix = camera->getViewMatrix();
         pat ->setAttitude(pMatrix.getRotate());
     }
  }
};
 
osg::Node* fun()
{  
 osg::Geode* geode=new osg::Geode;
 geode->addDrawable(new osg::ShapeDrawable(new 
osg::Sphere(osg::Vec3(0,0,0),0.1)));
 
 osg::MatrixTransform *mt=new osg::MatrixTransform ;
 Matrix matrix;
 matrix.setTrans(osg::Vec3(1,0,0));
 mt->setMatrix(matrix);
 mt->addChild(geode);
 
 osg::PositionAttitudeTransform * tran = new osg::PositionAttitudeTransform;
 tran->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
 tran->setPosition(osg::Vec3(5,5,0));
 tran->addChild(mt);
 tran->setUpdateCallback(new MCallBack());
 
 osg::Projection* ProjectionMatrix = new osg::Projection;
 ProjectionMatrix->setMatrix(osg::Matrix::ortho2D(0,10,0,10)); 
 ProjectionMatrix->addChild(tran);
 
 return ProjectionMatrix;
}

int _tmain(int argc, _TCHAR* argv[])
{
 osg::Node* mRoot  =fun();
 viewer.setSceneData(mRoot);
 return viewer.run();
}
 
  when i rotate the scene,the scene is culled not exactly.
  Is there a bug with osg or something wrong with my code?
 
   thanks for any advice.
 
  best regards
 
forest
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to