bool VehicleRenderable::loadSceneNodes(TinyXml::TiXmlElement* ele)
{
	TinyXml::TiXmlElement* nodeEle = ele->FirstChildElement("node");
	while (nodeEle)
	{
		Ogre::String name = getAttrib(nodeEle, "name");
		Ogre::SceneNode* node = NULL;

		if (name.empty())
			node = mAttachNode->createChildSceneNode();
		else
			node = mAttachNode->createChildSceneNode(name);

		mSceneNodes.push_back(node);

		Ogre::LogManager::getSingleton().
			logMessage("VehicleRenderable : parsing <" + name + "> node...");

		//process position
		TinyXml::TiXmlElement* pos = nodeEle->FirstChildElement("position");
		node->setPosition(parseVector3(pos));
		node->setInitialState();

		//process scale
		TinyXml::TiXmlElement* scale = nodeEle->FirstChildElement("scale");
		node->setScale(parseVector3(scale));
		node->setInitialState();

		//process rotate
		TinyXml::TiXmlElement* rotate = nodeEle->FirstChildElement("rotation");
		node->setOrientation(parseQuaternion(rotate));
		node->setInitialState();

		//process entities
		TinyXml::TiXmlElement* entity = nodeEle->FirstChildElement("entity");
		while (entity)
		{
			if (!loadEntity(entity, node))
				return false;

			entity = entity->NextSiblingElement("entity");
		}

		nodeEle = nodeEle->NextSiblingElement("node");
	}

	return true;
}
Esempio n. 2
0
void GameElements::ConfigurationLoader::parseWeapons( TinyXML::TiXmlElement * root )
{
	::std::cout<<"-- Loading weapons"<<::std::endl ;
	TinyXML::TiXmlElement * rootWeapons = root->FirstChildElement("weapons") ;
	for(TinyXML::TiXmlElement * element = rootWeapons->FirstChildElement("weapon") ; element!=NULL ; element = element->NextSiblingElement("weapon") )
	{
		::std::cout<<element->Attribute("name")<<::std::endl ;
		m_weaponsArchetypes.addArchetype(element) ;
	}
}
Esempio n. 3
0
void GameElements::ConfigurationLoader::parseMaps( TinyXML::TiXmlElement * root, Ogre::SceneManager * sceneManager )
{
	::std::cout<<"-- Loading maps"<<::std::endl; 
	TinyXML::TiXmlElement * rootUnits = root->FirstChildElement("maps") ;
	for(TinyXML::TiXmlElement * element = rootUnits->FirstChildElement("map") ; element!=NULL ; element = element->NextSiblingElement("map") )
	{
		::std::cout<<element->Attribute("name")<<::std::endl ;
		Map * map = new Map(sceneManager, element) ;
		m_maps.insert(::std::make_pair(map->getName(), map)) ;
	}
}