Example #1
0
void loadStatic(XMLNodePtr node)
{
   XMLNodePtr pos = node->getChild("pos");
   XMLNodePtr rot = node->getChild("pos");
   std::string model_name = (*node->getChild("model")->getChildren().begin())->getCdata();
   model_name = trim(model_name);

   // Find the corresponding model type in the model menu list
   std::cout << "Looking for model '" << model_name << "'" << std::endl;
   model mod;
   for (std::vector<model>::iterator itr = modelsInMenu.begin();
        itr != modelsInMenu.end();
        ++itr)
   {
      model old_model = *itr;
      if (old_model.name == model_name)
      {
         mod = old_model;
         std::cout << "\tSuccess" << std::endl;
      }
   }


   mod.worldX = pos->getAttribute("x").getValue<float>();
   mod.worldZ = pos->getAttribute("y").getValue<float>();
   mod.worldY = pos->getAttribute("z").getValue<float>();
   mod.name = model_name;

   std::cout << "Adding model: " << mod.name << std::endl
             << "low:  (" << mod.xlo << ", " << mod.ylo << ")" << std::endl
             << "high: (" << mod.xhi << ", " << mod.yhi << ")" << std::endl
             << "pos:  (" << mod.worldX << ", " << mod.worldZ << ", " << mod.worldY << ")" << std::endl;
   modelsInWorld.push_back(mod);
}
Example #2
0
void processObjNode(XMLNode &node)
{
   model* mModel = new model();
   std::string name = node.getName();
      
   std::cout << "This Node is a: " << name << std::endl;


   
   XMLNodePtr cNode = node.getChild(std::string("size"));
   std::cout << "node: " << cNode->getName() << std::endl;
   mModel->xhi = cNode->getAttribute("xhi").getValue<float>();
   mModel->xlo = cNode->getAttribute("xlo").getValue<float>();
   mModel->yhi = cNode->getAttribute("yhi").getValue<float>();
   mModel->ylo = cNode->getAttribute("ylo").getValue<float>();
   std::cout << "mModel.xlo: " << mModel->xlo << "  mModel.ylo: " << mModel->b << std::endl;
   std::cout << "type: " << cNode->getType() << std::endl;
   cNode = node.getChild(std::string("color"));
   mModel->r = cNode->getAttribute(std::string("r")).getValue<float>();
   mModel->g = cNode->getAttribute(std::string("g")).getValue<float>();
   mModel->b = cNode->getAttribute(std::string("b")).getValue<float>();
   cNode = node.getChild(std::string("type"));
   mModel->name = cNode->getAttribute(std::string("name")).getValue<std::string>();
   modelsInMenu.push_back(*mModel);
}