From d234e0147f0c27a6197b123556dd66136e7760b8 Mon Sep 17 00:00:00 2001 From: josh Date: Mon, 28 Sep 2009 01:32:51 +0000 Subject: [PATCH] added skeleton add{Cube,Sphere,Cylinder,Plane} methods to OdeWorld git-svn-id: svn://anubis/misc/OdeWorld@149 bd8a9e45-a331-0410-811e-c64571078777 --- OdeWorld.cc | 46 ++++++++++++++++++++++++++++++++++++++++++++++ OdeWorld.h | 8 ++++++++ 2 files changed, 54 insertions(+) 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);