#include "cube.h" #include using namespace std; Cube::Cube(dWorldID world,dSpaceID space,dReal width,dReal height,dReal depth,dReal mass) { body = dBodyCreate(world); geom = dCreateBox(space,width,height,depth); dMass m; dMassSetBox(&m,1.0f,width,height,depth); dMassAdjust(&m,mass); dBodySetMass(body,&m); dGeomSetBody(geom,body); } void Cube::renderInLocalFrame() const { dVector3 lengths; dGeomBoxGetLengths(geom,lengths); glScalef(lengths[0],lengths[1],lengths[2]); glColor3ubv(color); glutSolidCube(1.0f); }