removed placeable parameter to setupGeom as it is only called with placeable objects
git-svn-id: svn://anubis/misc/OdeWorld@153 bd8a9e45-a331-0410-811e-c64571078777
This commit is contained in:
parent
e56b943003
commit
834b846755
26
OdeWorld.cc
26
OdeWorld.cc
@ -152,7 +152,7 @@ dGeomID OdeWorld::addCube(const string & name, bool static_data,
|
|||||||
dMass mass;
|
dMass mass;
|
||||||
dMassSetBox(&mass, 1.0, args[0], args[1], args[2]);
|
dMassSetBox(&mass, 1.0, args[0], args[1], args[2]);
|
||||||
dMassTranslate(&mass, args[3], args[4], args[5]);
|
dMassTranslate(&mass, args[3], args[4], args[5]);
|
||||||
setupGeom(name, static_data, body, id, true, &mass,
|
setupGeom(name, static_data, body, id, &mass,
|
||||||
args[3], args[4], args[5],
|
args[3], args[4], args[5],
|
||||||
args[6], args[7], args[8]);
|
args[6], args[7], args[8]);
|
||||||
return id;
|
return id;
|
||||||
@ -167,7 +167,7 @@ dGeomID OdeWorld::addSphere(const string & name, bool static_data,
|
|||||||
dMass mass;
|
dMass mass;
|
||||||
dMassSetSphere(&mass, 1.0, args[0]);
|
dMassSetSphere(&mass, 1.0, args[0]);
|
||||||
dMassTranslate(&mass, args[1], args[2], args[3]);
|
dMassTranslate(&mass, args[1], args[2], args[3]);
|
||||||
setupGeom(name, static_data, body, id, true, &mass,
|
setupGeom(name, static_data, body, id, &mass,
|
||||||
args[1], args[2], args[3],
|
args[1], args[2], args[3],
|
||||||
0.0, 0.0, 0.0);
|
0.0, 0.0, 0.0);
|
||||||
return id;
|
return id;
|
||||||
@ -182,7 +182,7 @@ dGeomID OdeWorld::addCylinder(const string & name, bool static_data,
|
|||||||
dMass mass;
|
dMass mass;
|
||||||
dMassSetCylinder(&mass, 1.0, 3, args[0], args[1]);
|
dMassSetCylinder(&mass, 1.0, 3, args[0], args[1]);
|
||||||
dMassTranslate(&mass, args[2], args[3], args[4]);
|
dMassTranslate(&mass, args[2], args[3], args[4]);
|
||||||
setupGeom(name, static_data, body, id, true, &mass,
|
setupGeom(name, static_data, body, id, &mass,
|
||||||
args[2], args[3], args[4],
|
args[2], args[3], args[4],
|
||||||
args[5], args[6], args[7]);
|
args[5], args[6], args[7]);
|
||||||
return id;
|
return id;
|
||||||
@ -195,9 +195,9 @@ dGeomID OdeWorld::addCCylinder(const string & name, bool static_data,
|
|||||||
return 0;
|
return 0;
|
||||||
dGeomID id = dCreateCCylinder(m_space, args[0], args[1]);
|
dGeomID id = dCreateCCylinder(m_space, args[0], args[1]);
|
||||||
dMass mass;
|
dMass mass;
|
||||||
dMassSetCylinder(&mass, 1.0, 3, args[0], args[1]);
|
dMassSetCappedCylinder(&mass, 1.0, 3, args[0], args[1]);
|
||||||
dMassTranslate(&mass, args[2], args[3], args[4]);
|
dMassTranslate(&mass, args[2], args[3], args[4]);
|
||||||
setupGeom(name, static_data, body, id, true, &mass,
|
setupGeom(name, static_data, body, id, &mass,
|
||||||
args[2], args[3], args[4],
|
args[2], args[3], args[4],
|
||||||
args[5], args[6], args[7]);
|
args[5], args[6], args[7]);
|
||||||
return id;
|
return id;
|
||||||
@ -211,23 +211,21 @@ dGeomID OdeWorld::addPlane(const string & name, bool static_data,
|
|||||||
float a, b, c, d;
|
float a, b, c, d;
|
||||||
/* TODO: find a, b, c, d from args */
|
/* TODO: find a, b, c, d from args */
|
||||||
dGeomID id = dCreatePlane(m_space, a, b, c, d);
|
dGeomID id = dCreatePlane(m_space, a, b, c, d);
|
||||||
setupGeom(name, static_data, body, id, false, NULL,
|
|
||||||
0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OdeWorld::setupGeom(const std::string & name, bool static_data,
|
void OdeWorld::setupGeom(const std::string & name, bool static_data,
|
||||||
dBodyID * body, dGeomID geom, bool placeable, dMass * mass,
|
dBodyID * body, dGeomID geom, dMass * mass,
|
||||||
float locx, float locy, float locz,
|
float locx, float locy, float locz,
|
||||||
float rotx, float roty, float rotz)
|
float rotx, float roty, float rotz)
|
||||||
{
|
{
|
||||||
if (placeable && !static_data && *body == 0)
|
if (!static_data)
|
||||||
*body = dBodyCreate(m_world);
|
|
||||||
if (placeable)
|
|
||||||
dGeomSetBody(geom, *body);
|
|
||||||
/* TODO: set up mass, location, and rotation */
|
|
||||||
if (placeable)
|
|
||||||
{
|
{
|
||||||
|
if (*body == 0)
|
||||||
|
*body = dBodyCreate(m_world);
|
||||||
|
|
||||||
|
dGeomSetBody(geom, *body);
|
||||||
|
|
||||||
dMatrix3 rot;
|
dMatrix3 rot;
|
||||||
dRFromEulerAngles(rot, rotx, roty, rotz);
|
dRFromEulerAngles(rot, rotx, roty, rotz);
|
||||||
dGeomSetRotation(geom, rot);
|
dGeomSetRotation(geom, rot);
|
||||||
|
@ -40,7 +40,7 @@ class OdeWorld
|
|||||||
std::map<std::string, dGeomID> m_objects;
|
std::map<std::string, dGeomID> m_objects;
|
||||||
|
|
||||||
void setupGeom(const std::string & name, bool static_data,
|
void setupGeom(const std::string & name, bool static_data,
|
||||||
dBodyID * body, dGeomID geom, bool placeable, dMass * mass,
|
dBodyID * body, dGeomID geom, dMass * mass,
|
||||||
float locx, float locy, float locz,
|
float locx, float locy, float locz,
|
||||||
float rotx, float roty, float rotz);
|
float rotx, float roty, float rotz);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user