|
楼主 |
发表于 2009-3-19 18:29:31
|
显示全部楼层
添加数据:
int cOSG::lodLoad(void)
{
//osg:agedLOD* pagedLOD = new osg::PagedLOD;
//
////范围最大的可见层
//pagedLOD->setFileName(0, "F:\\PRJDATA\\merge1-move-2.ive");
//pagedLOD->setRange(0,4000,5000);
//
////设置次大可见层
//pagedLOD->setFileName(1, "F:\\PRJDATA\\merge2-move.ive");
//pagedLOD->setRange(0, 2000,3000);
osg::ProxyNode* proxyNode = new osg::ProxyNode;
proxyNode->setFileName(0, "F:\\PRJDATA\\merge1-move-2.ive");
proxyNode->setFileName(1, "F:\\PRJDATA\\merge2-move.ive");
proxyNode->setLoadingExternalReferenceMode(osg::ProxyNode:EFER_LOADING_TO_DATABASE_PAGER);
proxyNode->ref();
long num = proxyNode->getNumChildren();
mRoot->addChild(proxyNode);
return 0;
}
删除数据
removeNode(void)
{
unsigned int pos = 0;
osg::Node *root=NULL;
osg::Node *ptNode = NULL;
osg::Group *ptGp = NULL;
osg::ProxyNode *ptProxNode = NULL;
CStrLayer *ptLayer = NULL;
root = mOSG->mViewer->getSceneData();
ptGp = dynamic_cast<osg::Group *>(root);
long num = ptGp->getNumChildren();
for(int i= 0;i<num;i++)
{
ptProxNode =dynamic_cast<osg::ProxyNode *>(ptGp->getChild(0));
if(ptProxNode!=NULL)
{
ptGp->removeChild(ptProxNode);
ptProxNode->unref();
}
}
}
数据添加,然后删除之后内存没有恢复到初始状态。
[ 本帖最后由 baiyufan 于 2009-3-19 18:31 编辑 ] |
|