Beispiel #1
0
HeightField* osgDB::readHeightFieldFile(const std::string& filename,const Options* options)
{
    ReaderWriter::ReadResult rr = Registry::instance()->readHeightField(filename,options);
    if (rr.validHeightField()) return rr.takeHeightField();
    if (rr.error()) OSG_WARN << rr.message() << std::endl;
    return NULL;
}
Beispiel #2
0
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;
}
Beispiel #3
0
Node* osgDB::readNodeFile(const std::string& filename,const ReaderWriter::Options* options)
{
    ReaderWriter::ReadResult rr = Registry::instance()->readNode(filename,options);
    if (rr.validNode()) return rr.takeNode();
    if (rr.error()) notify(WARN) << rr.message() << std::endl;
    return NULL;
}
Beispiel #4
0
osg::ref_ptr<osg::HeightField> osgDB::readRefHeightFieldFile(const std::string& filename,const ReaderWriter::Options* options)
{
    ReaderWriter::ReadResult rr = Registry::instance()->readHeightField(filename,options);
    if (rr.validHeightField()) return osg::ref_ptr<osg::HeightField>(rr.getHeightField());
    if (rr.error()) notify(WARN) << rr.message() << std::endl;
    return NULL;
}
Beispiel #5
0
osgDB::Archive* osgDB::openArchive(const std::string& filename, ReaderWriter::ArchiveStatus status, unsigned int indexBlockSizeHint,Options* options)
{
    // ensure archive extension is in the registry list
    std::string::size_type dot = filename.find_last_of('.');
    if (dot != std::string::npos)
    {
        std::string ext = filename.substr(dot+1);
        Registry::instance()->addArchiveExtension(ext);
    }
    ReaderWriter::ReadResult result = osgDB::Registry::instance()->openArchive(filename, status, indexBlockSizeHint, options);
    return result.takeArchive();
}
Beispiel #6
0
Node* osgDB::readNodeFile(const std::string& filename,const Options* options)
{
    ReaderWriter::ReadResult rr = Registry::instance()->readNode(filename,options);
    if (rr.validNode()) return rr.takeNode();
    if (rr.error()) OSG_WARN << rr.message() << std::endl;
    if (rr.notEnoughMemory()) OSG_INFO << "Not enought memory to load file "<<filename << std::endl;
    return NULL;
}
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;

}