returnmin+static_cast<float>(xorshift32()/static_cast<float>(0xFFFFFFFF/(max-min))); } //线性插值 floatlerp(floatmin,floatmax,floatt) { returnmin*(1.0-t)+max*t; } osg::Vec3f*generateHemisphereSamples(intkernelSize) { osg::Vec3f* kernel=newosg::Vec3f[kernelSize]; for(inti =0; ...
if (numProcessors >= static_cast<int>(cameras.size()+contexts.size())) { return CullThreadPerCameraDrawThreadPerContext; } #endif return DrawThreadPerContext; } OSG 选择使用哪种线程模型是以窗口和相机数为准则,再考虑CPU物理核心数给出结果。 如果是单窗口应用 CPU 是单核, 返回 SingleThreaded,这...
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; 1. 2. 3. 4. 5. 6. 7. 8. OutputStream 接受<< 重载操作,因此需要对类定义 writeObject(), writeImage(), writePrimitiveSet() 和 wri...
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::Geode* geode=dynamic_cast<osg::Geode *>(result.nodePath.back()); if (geode) geode->removeDrawable(result.drawable); } } int test; }; /** * 节点回调类,每一帧都会执行 */ class ObserveShapeCallback : public osg::NodeCallback{ ...
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()循环并更改渲染...
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 ); ...
{osg::NodeVisitor sss=osg::NodeVisitor::TRAVERSE_ALL_CHILDREN;}voidapply(osg::Node&node){if(_am.valid())return;if(node.getUpdateCallback()){osgAnimation::AnimationManagerBase*b=dynamic_cast<osgAnimation::AnimationManagerBase*>(node.getUpdateCallback());if(b){_am=newosgAnimation::Basic...