added skeleton add{Cube,Sphere,Cylinder,Plane} methods to OdeWorld

git-svn-id: svn://anubis/misc/OdeWorld@149 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
josh 2009-09-28 01:32:51 +00:00
parent 25ef8f61d7
commit d234e0147f
2 changed files with 54 additions and 0 deletions

View File

@ -83,6 +83,7 @@ vector<dGeomID> OdeWorld::loadPhy(const std::string & path,
bool static_data) bool static_data)
{ {
vector<dGeomID> ret; vector<dGeomID> ret;
dBodyID body = 0;
ifstream ifs(path.c_str()); ifstream ifs(path.c_str());
if (ifs.is_open()) if (ifs.is_open())
@ -120,8 +121,53 @@ vector<dGeomID> OdeWorld::loadPhy(const std::string & path,
break; break;
pos = pos2 + 1; 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; return ret;
} }
dGeomID OdeWorld::addCube(const string & name, bool static_data,
dBodyID * body, const vector<float> args)
{
if (args.size() != 9)
return 0;
}
dGeomID OdeWorld::addSphere(const string & name, bool static_data,
dBodyID * body, const vector<float> args)
{
if (args.size() != 4)
return 0;
}
dGeomID OdeWorld::addCylinder(const string & name, bool static_data,
dBodyID * body, const vector<float> args)
{
if (args.size() != 8)
return 0;
}
dGeomID OdeWorld::addPlane(const string & name, bool static_data,
dBodyID * body, const vector<float> args)
{
if (args.size() != 6)
return 0;
}

View File

@ -18,6 +18,14 @@ class OdeWorld
void worldStep(); void worldStep();
std::vector<dGeomID> loadPhy(const std::string & path, std::vector<dGeomID> loadPhy(const std::string & path,
bool static_data = false); bool static_data = false);
dGeomID addCube(const std::string & name, bool static_data,
dBodyID * body, const std::vector<float> args);
dGeomID addSphere(const std::string & name, bool static_data,
dBodyID * body, const std::vector<float> args);
dGeomID addCylinder(const std::string & name, bool static_data,
dBodyID * body, const std::vector<float> args);
dGeomID addPlane(const std::string & name, bool static_data,
dBodyID * body, const std::vector<float> args);
friend void OdeWorld_collide_callback(void * data, friend void OdeWorld_collide_callback(void * data,
dGeomID o1, dGeomID o2); dGeomID o1, dGeomID o2);