osg::ref_ptr<osg::Camera> rttCamera =createRTTCamera(osg::Camera::DEPTH_BUFFER, tex2D.get()); rttCamera->addChild( scene.get() ); osg::ref_ptr<osg::Camera> hudCamera =createHUDCamera(0.0,1.0,0.0,1.0); hudCamera->addChild(createScreenQuad(0.5f,1.0f) ); hudCamera->getOrCreateSta...
osg::ref_ptr<RttCamera>createSSAOCamera(osg::Texture* postionTex,osg::Texture* normalTex,osg::Matrix& projMat,osg::Camera::BufferComponent buffer,osg::Texture* tex,int width,int height) { osg::ref_ptr<RttCamera> camera=newRttCamera(width,height); camera->setRenderTargetImplementation(osg::Ca...
//osg::ref_ptr<osg::Geode> lightPoint = new osg::Geode; osg::ref_ptr<osg::Geode>lightPoint=createLightPoint(); { osg::ref_ptr<osg::MatrixTransform>mt=newosg::MatrixTransform; //osg::Matrix 没有继承Referenced 所以不能用智能指针 osg::Matrixm; osg::ref_ptr<RefMatrix>refM=newosg::R...
2)ref_ptr类:模板类ref_ptr为其模板内容提供了一个智能指针,模板内容必须继承自Referenced类或提供一个类似的接口,当对象的地址分配给ref_ptr<>时,对象的引用计数将自动增加,同样删除该模板类对象时,对象的引用计数也会自动减少。 3)Object:纯虚类Object类是OSG中一切需要I/O支持、拷贝和引用计数的对象的基类。...
osg::ref_ptr<osg::TessellationHints> hints = new osg::TessellationHints; //设置精度 hints->setDetailRatio(0.1); osg::ref_ptr<osg::ShapeDrawable> shape = new osg::ShapeDrawable(new osg::Box(osg::Vec3(x,y,z),长,宽,高),hints.get()); ...
osg::ref_ptr<osg::Node> pNode = 0; // 添加模型 { // osgDB::Options* a = new osgDB::Options(std::string("noTriStripPolygons")); // osg::ref_ptr<osg::Node> node1 = osgDB::readNodeFile("D:/qtProject/osgDemo/modelData/grass.obj", a); ...
(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()...
();//获取视景体(frustrum)6参数doubleleft(0),right(0),top(0),bottom(0),znear(0),zfar(0);view->getCamera()->getProjectionMatrixAsFrustum(left,right,bottom,top,znear,zfar);//获取窗口参数intwinWid=ea.getWindowWidth();intwinHei=ea.getWindowHeight();//鼠标屏幕坐标,屏幕左下角为原点,向上...
osg::ref_ptr root=new osg::Group();osg::ref_ptr osgcool=osgDB::readNodeFile("cow.osg");osg::ref_ptr trans=new osg::MatrixTransform();trans->setMatrix(osg::Matrix::translate(0,0,20));trans->addChild(osgcool.get());root->addChild(trans.get());其中 trans->setMatrix(osg::Matrix...
//设置纹理着色 static void TextureShader(osg::ref_ptr<osg::Node> node) { const char * vertexShader = { "void main(void ){\n" " gl_TexCoord[0] = gl_MultiTexCoord0;\n" " gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex;\n" "}\n" }; const char * fragShader = { "uniform...