diff --git a/OdeWorld.cc b/OdeWorld.cc index f5460ed..e163857 100644 --- a/OdeWorld.cc +++ b/OdeWorld.cc @@ -83,6 +83,7 @@ vector OdeWorld::loadPhy(const std::string & path, bool static_data) { vector ret; + dBodyID body = 0; ifstream ifs(path.c_str()); if (ifs.is_open()) @@ -120,8 +121,53 @@ vector OdeWorld::loadPhy(const std::string & path, break; pos = pos2 + 1; } + if (type == "cube") + { + ret.push_back(addCube(name, static_data, &body, args)); + } + else if (type == "sphere") + { + ret.push_back(addSphere(name, static_data, &body, args)); + } + else if (type == "cylinder") + { + ret.push_back(addCylinder(name, static_data, &body, args)); + } + else if (type == "plane") + { + ret.push_back(addPlane(name, static_data, &body, args)); + } } } return ret; } + +dGeomID OdeWorld::addCube(const string & name, bool static_data, + dBodyID * body, const vector args) +{ + if (args.size() != 9) + return 0; +} + +dGeomID OdeWorld::addSphere(const string & name, bool static_data, + dBodyID * body, const vector args) +{ + if (args.size() != 4) + return 0; +} + +dGeomID OdeWorld::addCylinder(const string & name, bool static_data, + dBodyID * body, const vector args) +{ + if (args.size() != 8) + return 0; +} + +dGeomID OdeWorld::addPlane(const string & name, bool static_data, + dBodyID * body, const vector args) +{ + if (args.size() != 6) + return 0; +} + diff --git a/OdeWorld.h b/OdeWorld.h index 92eef0e..ac4d7a2 100644 --- a/OdeWorld.h +++ b/OdeWorld.h @@ -18,6 +18,14 @@ class OdeWorld void worldStep(); std::vector loadPhy(const std::string & path, bool static_data = false); + dGeomID addCube(const std::string & name, bool static_data, + dBodyID * body, const std::vector args); + dGeomID addSphere(const std::string & name, bool static_data, + dBodyID * body, const std::vector args); + dGeomID addCylinder(const std::string & name, bool static_data, + dBodyID * body, const std::vector args); + dGeomID addPlane(const std::string & name, bool static_data, + dBodyID * body, const std::vector args); friend void OdeWorld_collide_callback(void * data, dGeomID o1, dGeomID o2);