本文整理汇总了C++中readerwriter::ReadResult::getNode方法的典型用法代码示例。如果您正苦于以下问题:C++ ReadResult::getNode方法的具体用法?C++ ReadResult::getNode怎么用?C++ ReadResult::getNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类readerwriter::ReadResult
的用法示例。
在下文中一共展示了ReadResult::getNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
osg::ref_ptr<osg::Node> osgDB::readRefNodeFile(const std::string& filename,const Options* options)
{
ReaderWriter::ReadResult rr = Registry::instance()->readNode(filename,options);
if (rr.validNode()) return osg::ref_ptr<osg::Node>(rr.getNode());
if (rr.error()) OSG_WARN << rr.message() << std::endl;
return NULL;
}
示例2: preFrame
void TouchDesigner::preFrame() {
string data = "";
// cerr << "painting\t" << endl;
if (ComController::instance()->isMaster()) // head node
{
data = st->getSerializedScene();
dsize = data.size();
// cerr << "in master doing nothing" << endl;
ComController::instance()->sendSlaves(&dsize, sizeof(int));
ComController::instance()->sendSlaves(&data[0], dsize);
ComController::instance()->sendSlaves(&received, sizeof(bool));
} else // rendering nodes
{
// cerr<<"slave node"<<endl;
ComController::instance()->readMaster(&dsize, sizeof(int));
recvData.resize(dsize);
ComController::instance()->readMaster(&recvData[0], dsize);
data = recvData;
ComController::instance()->readMaster(&received, sizeof(bool));
}
//cerr << "data size\t" << dsize << endl;
std::stringstream ss(data);
osgDB::ReaderWriter * readerwriter =
Registry::instance()->getReaderWriterForExtension("ive");
ReaderWriter::ReadResult result = readerwriter->readNode(ss);
if (result.validNode()) {
//printf("Node valid\n");
//cerr<<"Valid Node"<<endl;
Node * node = result.getNode();
/*
osg::Geode * geode = dynamic_cast<osg::Geode* > (node);
if( geode )
{
for(int i = 0; i < geode->getNumDrawables(); i++)
{
osg::Geometry* geom = dynamic_cast<osg::Geometry*> (geode->getDrawable(i));
if( geom )
{
osg::Vec3Array* array = dynamic_cast<osg::Vec3Array *> (geom->getVertexArray());
for(int j =0; j < array->size(); j++)
{
cerr << array->at(0)[0] << " " << array->at(0)[1] << " " << array->at(0)[2] << endl;
}
}
}
}
*/
osg::Group * objectRoot = SceneManager::instance()->getObjectsRoot();
// remove all children and add new node
objectRoot->addChild(node);
if (prevNode)
objectRoot->removeChild(prevNode);
prevNode = node;
// lets see if directly reassigning the entire thing works?
// TODO err, is there a way to assign the root object as node?
//SceneManager::instance()->getObjectsRoot() = node->asGroup();
}
//cerr << "" << endl;
}