Hi Forest,
Do you expect people to really follow this? Just throw the code out
there and expect people to know what effect your are trying to do?
Please remember that everyone will be busy with their own work and
just scan emails. You need to convey what you are trying to do in a
digestable form otherwise people will just ignore it.
The best I can do is say that use of Projection node has long been
deprecated, it just kept around for backwards compatibility. Use an
in scene graph osg::Camera when you want to over the projection and
view matrix.
Robert.
2008/10/28 forest37 <[EMAIL PROTECTED]>:
>
> 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
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org