本文整理汇总了C++中osg::NodeRecPtr::clearChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeRecPtr::clearChildren方法的具体用法?C++ NodeRecPtr::clearChildren怎么用?C++ NodeRecPtr::clearChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osg::NodeRecPtr
的用法示例。
在下文中一共展示了NodeRecPtr::clearChildren方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateScene
//.........这里部分代码省略.........
break;
case OSG::Image::OSG_RGB_DXT1:
statElem->set("OSG_RGB_DXT1");
break;
case OSG::Image::OSG_RGBA_DXT1:
statElem->set("OSG_RGBA_DXT1");
break;
case OSG::Image::OSG_RGBA_DXT3:
statElem->set("OSG_RGBA_DXT3");
break;
case OSG::Image::OSG_RGBA_DXT5:
statElem->set("OSG_RGBA_DXT5");
break;
default:
statElem->set("???");
break;
}
statElem = statfg->editCollector()->getElem(textureDataTypeDesc);
switch (imagePtr->getDataType())
{
case OSG::Image::OSG_UINT8_IMAGEDATA:
statElem->set("OSG_UINT8_IMAGEDATA");
break;
case OSG::Image::OSG_UINT16_IMAGEDATA:
statElem->set("OSG_UINT16_IMAGEDATA");
break;
case OSG::Image::OSG_UINT32_IMAGEDATA:
statElem->set("OSG_UINT32_IMAGEDATA");
break;
case OSG::Image::OSG_FLOAT16_IMAGEDATA:
statElem->set("OSG_FLOAT16_IMAGEDATA");
break;
case OSG::Image::OSG_FLOAT32_IMAGEDATA:
statElem->set("OSG_FLOAT32_IMAGEDATA");
break;
case OSG::Image::OSG_INT16_IMAGEDATA:
statElem->set("OSG_INT16_IMAGEDATA");
break;
case OSG::Image::OSG_INT32_IMAGEDATA:
statElem->set("OSG_INT32_IMAGEDATA");
break;
default:
statElem->set("???");
break;
}
ostringstream os;
os << imagePtr->getWidth() << 'x' << imagePtr->getHeight() << 'x' << imagePtr->getDepth();
statfg->editCollector()->getElem(textureSizeDesc)->set(os.str());
statfg->editCollector()->getElem(textureDimensionDesc)->set(imagePtr->getDimension());
statfg->editCollector()->getElem(textureBPPDesc)->set(imagePtr->getBpp());
statfg->editCollector()->getElem(textureMipMapCountDesc)->set(imagePtr->getMipMapCount());
statfg->editCollector()->getElem(textureFrameCountDesc)->set(imagePtr->getFrameCount());
// Put it all together into a Geometry NodeCore.
OSG::GeometryRecPtr geo = OSG::makePlaneGeo(imagePtr->getWidth(), imagePtr->getHeight(), 1, 1);
OSG::NodeRecPtr imageNode = OSG::Node::create();
imageNode->setCore(geo);
OSG::NodeRecPtr transNodePtr = OSG::Node::create();
OSG::TransformRecPtr transPtr = OSG::Transform::create();
OSG::Matrix transMatrix;
transMatrix.setTranslate(0.f, 0.f, -1.f);
transPtr->setMatrix(transMatrix);
transNodePtr->setCore(transPtr);
transNodePtr->addChild(imageNode);
OSG::TextureObjChunkRecPtr texObjChunk = OSG::TextureObjChunk::create();
texObjChunk->setImage(imagePtr);
texObjChunk->setWrapS(GL_CLAMP);
texObjChunk->setWrapT(GL_CLAMP);
texObjChunk->setMagFilter(GL_NEAREST);
texObjChunk->setMinFilter(GL_NEAREST);
OSG::TextureEnvChunkRecPtr texEnvChunk = OSG::TextureEnvChunk::create();
texEnvChunk->setEnvMode(GL_MODULATE);
OSG::MaterialChunkRecPtr matChunk = OSG::MaterialChunk::create();
matChunk->setAmbient(OSG::Color4f(1.f, 1.f, 1.f, 1.f));
matChunk->setDiffuse(OSG::Color4f(1.f, 1.f, 1.f, 1.f));
matChunk->setEmission(OSG::Color4f(0.f, 0.f, 0.f, 1.f));
matChunk->setSpecular(OSG::Color4f(0.f, 0.f, 0.f, 1.f));
matChunk->setShininess(0);
OSG::ChunkMaterialRecPtr m = OSG::ChunkMaterial::create();
m->addChunk(texObjChunk);
m->addChunk(texEnvChunk);
m->addChunk(matChunk);
geo->setMaterial(m);
scene->clearChildren();
scene->addChild(transNodePtr);
if(compressTo != OSG::Image::OSG_INVALID_PF)
{
OSG::SceneFileHandler::the()->write(scene->getChild(0),
"/tmp/comp.osb");
OSG::SceneFileHandler::the()->write(scene->getChild(0),
"/tmp/comp.osg");
}
}