osg::Node* child = dynamic_cast<osg::Node*>( is.readObject() ); if ( child ) node.addChild( child ); } is >> osgDB::END_BRACKET; return true; 1. 2. 3. 4. 5. 6. 7. 8. OutputStream 接受<< 重载操作,因此需要对类定义 writeObject(), writeImage(), writePrimitiveSet() 和 wri...
if (numProcessors >= static_cast<int>(cameras.size()+contexts.size())) { return CullThreadPerCameraDrawThreadPerContext; } #endif return DrawThreadPerContext; } OSG 选择使用哪种线程模型是以窗口和相机数为准则,再考虑CPU物理核心数给出结果。 如果是单窗口应用 CPU 是单核, 返回 SingleThreaded,这...
0f, static_cast<double>(traits->width)/static_cast<double>(traits->height), 1.0f, 10000.0f ); view->setSceneData( scene ); view->addEventHandler( new osgViewer::StatsHandler ); view->setCameraManipulator( new osgGA::MultiTouchTrackballManipulator ); gw->setTouchEventsEnabled( true ); ...
virtualvoidoperator()(osg::Node* node, osg::NodeVisitor*nv){ osg::PositionAttitudeTransform* pat =dynamic_cast<osg::PositionAttitudeTransform*>(node);if(pat){doubleangle =0.0; osg::Vec3 axis; pat->getAttitude().getRotate(angle, axis); std::cout<<"Node is rotate around the axis("<< ax...
osg::Node* child = dynamic_cast<osg::Node*>( is.readObject() ); if ( child ) node.addChild( child ); } is >> osgDB::END_BRACKET; return true; OutputStream接受<<重载操作,因此需要对类定义writeObject(),writeImage(),writePrimitiveSet()和writeArray()。同样InputStream重载>>需要对类定义rea...
mMapNode = dynamic_cast<osgEarth::MapNode*>(mRoot->getChild(0)); mMapPtr = mMapNode->getMap(); osgEarth::Drivers::GDALOptions imageryGDAL; imageryGDAL.url() = IMAGERY_URL; osgEarth::Drivers::ImageLayer* tempImageLayer = new osgEarth::Drivers::ImageLayer( osgEarth::Drivers::ImageLayer...
(loadedModel);//增加宽高比设置QSize size=widget.size();float aspectRatio=static_cast<float>(size.width())/static_cast<float>(size.height());widget.getOsgViewer()->getCamera()->setProjectionMatrixAsPerspective(60.f,aspectRatio,1.f,1000.f);return0;});widget.resize(200,600);widget.show()...
osgViewer::GraphicsWindow* graphWin = dynamic_cast<osgViewer::GraphicsWindow*>(viewer->getCamera()->getGraphicsContext()); graphWin->setWindowRectangle(200, 200, 500, 500); } osg::ref_ptr<osg::Node> buildShapeBox(double x, double y, double z, bool ifAnimation) ...
OSG master osgearth master Environment: MacBook Pro (Retina, 13-inch, Mid 2014) macOS Sierra 10.12.4 (16E195) errors: osgearth_viewerd[69855:10712897] dynamic_cast error 1: Both of the following type_info's should have public visibility...
transform1->setMatrix(osg::Matrix::rotate(static_cast<double>(phi), osg::Vec3(0.0f, 0.0f, 1.0f))); viewer.frame(); phi += delta; } 最终我们得到一个有趣的结果: 在此示例中,我们实现了一些场景动画,但请记住,从组织对不同流的数据访问的角度来看,在渲染帧之前或之后扩展run()循环并更改渲染...