Changeset 87 in flair-src for trunk/lib/FlairSimulator/src/Parser.cpp


Ignore:
Timestamp:
Sep 28, 2016, 8:41:02 AM (9 years ago)
Author:
Sanahuja Guillaume
Message:

camera

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSimulator/src/Parser.cpp

    r69 r87  
    1919#include "Simulator.h"
    2020#include "GenericObject.h"
     21#include "FixedCamera.h"
    2122#include <vector3d.h>
     23#include <Vector3D.h>
    2224#include <IrrlichtDevice.h>
    2325#include <IFileSystem.h>
     
    188190              getSceneVect(cur_node->children, (xmlChar *)"rotation"),
    189191              getSceneVect(cur_node->children, (xmlChar *)"scale", true));
     192    } else if (xmlStrEqual(cur_node->name, (xmlChar *)"camera")) {
     193      FixedCamera* fixedCamera=new FixedCamera(std::string((char *)xmlGetProp(cur_node, (xmlChar *)"name")),
     194                                               getMeshVector3D(cur_node->children, (xmlChar *)"position"),
     195                                               getMeshVector3D(cur_node->children, (xmlChar *)"lookat"));
    190196    }
    191197  }
     
    204210  }
    205211  return vector3df(0, 0, 0);
     212}
     213
     214Vector3D Parser::getMeshVector3D(xmlNode *mesh_node, xmlChar *param) {
     215  xmlNode *cur_node = NULL;
     216  for (cur_node = mesh_node; cur_node; cur_node = cur_node->next) {
     217    if (xmlStrEqual(cur_node->name, param)) {
     218      return Vector3D(atof((char *)xmlGetProp(cur_node, (xmlChar *)"x")),
     219                       atof((char *)xmlGetProp(cur_node, (xmlChar *)"y")),
     220                       atof((char *)xmlGetProp(cur_node, (xmlChar *)"z")));
     221    }
     222  }
     223  return Vector3D(0, 0, 0);
    206224}
    207225
Note: See TracChangeset for help on using the changeset viewer.