converted m_joints to an IDSet
git-svn-id: svn://anubis/anaglym/trunk@263 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
5fbc931c39
commit
d828b77c18
25
Engine.cc
25
Engine.cc
@ -89,7 +89,6 @@ Engine::Engine(const string & path, AV & av)
|
||||
: m_av(av)
|
||||
{
|
||||
m_next_object_index = 1;
|
||||
m_next_joint_index = 1;
|
||||
m_eye[0] = 0;
|
||||
m_eye[1] = -1;
|
||||
m_eye[2] = 0;
|
||||
@ -311,9 +310,7 @@ int Engine::addAMotor(Object * o1, Object * o2)
|
||||
if (o2 != NULL)
|
||||
b2 = o2->getBody();
|
||||
dJointID jid = m_world.createAMotor(b1, b2);
|
||||
int id = m_next_joint_index++;
|
||||
m_joints[id] = jid;
|
||||
return id;
|
||||
return m_joints.add(jid);
|
||||
}
|
||||
|
||||
int Engine::addHinge(Object * o1, Object * o2,
|
||||
@ -329,15 +326,13 @@ int Engine::addHinge(Object * o1, Object * o2,
|
||||
dJointID jid = m_world.createHinge(b1, b2,
|
||||
anchor_x, anchor_y, anchor_z,
|
||||
axis_x, axis_y, axis_z);
|
||||
int id = m_next_joint_index++;
|
||||
m_joints[id] = jid;
|
||||
return id;
|
||||
return m_joints.add(jid);
|
||||
}
|
||||
|
||||
void Engine::setAMotorAxis(int jid, int anum, int rel,
|
||||
dReal x, dReal y, dReal z)
|
||||
{
|
||||
if (m_joints.find(jid) != m_joints.end())
|
||||
if (m_joints.contains(jid))
|
||||
{
|
||||
m_world.setAMotorAxis(m_joints[jid], anum, rel, x, y, z);
|
||||
}
|
||||
@ -345,7 +340,7 @@ void Engine::setAMotorAxis(int jid, int anum, int rel,
|
||||
|
||||
void Engine::setAMotorNumAxes(int jid, int num_axes)
|
||||
{
|
||||
if (m_joints.find(jid) != m_joints.end())
|
||||
if (m_joints.contains(jid))
|
||||
{
|
||||
m_world.setAMotorNumAxes(m_joints[jid], num_axes);
|
||||
}
|
||||
@ -353,7 +348,7 @@ void Engine::setAMotorNumAxes(int jid, int num_axes)
|
||||
|
||||
void Engine::setAMotorAngle(int jid, int anum, dReal val)
|
||||
{
|
||||
if (m_joints.find(jid) != m_joints.end())
|
||||
if (m_joints.contains(jid))
|
||||
{
|
||||
m_world.setAMotorAngle(m_joints[jid], anum, val);
|
||||
}
|
||||
@ -361,7 +356,7 @@ void Engine::setAMotorAngle(int jid, int anum, dReal val)
|
||||
|
||||
void Engine::setAMotorLoStop(int jid, dReal val)
|
||||
{
|
||||
if (m_joints.find(jid) != m_joints.end())
|
||||
if (m_joints.contains(jid))
|
||||
{
|
||||
m_world.setAMotorLoStop(m_joints[jid], val);
|
||||
}
|
||||
@ -369,7 +364,7 @@ void Engine::setAMotorLoStop(int jid, dReal val)
|
||||
|
||||
void Engine::setAMotorHiStop(int jid, dReal val)
|
||||
{
|
||||
if (m_joints.find(jid) != m_joints.end())
|
||||
if (m_joints.contains(jid))
|
||||
{
|
||||
m_world.setAMotorHiStop(m_joints[jid], val);
|
||||
}
|
||||
@ -377,7 +372,7 @@ void Engine::setAMotorHiStop(int jid, dReal val)
|
||||
|
||||
void Engine::setAMotorVel(int jid, dReal val)
|
||||
{
|
||||
if (m_joints.find(jid) != m_joints.end())
|
||||
if (m_joints.contains(jid))
|
||||
{
|
||||
m_world.setAMotorVel(m_joints[jid], val);
|
||||
}
|
||||
@ -385,7 +380,7 @@ void Engine::setAMotorVel(int jid, dReal val)
|
||||
|
||||
void Engine::setAMotorFMax(int jid, dReal val)
|
||||
{
|
||||
if (m_joints.find(jid) != m_joints.end())
|
||||
if (m_joints.contains(jid))
|
||||
{
|
||||
m_world.setAMotorFMax(m_joints[jid], val);
|
||||
}
|
||||
@ -393,7 +388,7 @@ void Engine::setAMotorFMax(int jid, dReal val)
|
||||
|
||||
void Engine::setAMotorBounce(int jid, dReal val)
|
||||
{
|
||||
if (m_joints.find(jid) != m_joints.end())
|
||||
if (m_joints.contains(jid))
|
||||
{
|
||||
m_world.setAMotorBounce(m_joints[jid], val);
|
||||
}
|
||||
|
3
Engine.h
3
Engine.h
@ -266,9 +266,8 @@ class Engine
|
||||
OdeWorld m_world;
|
||||
std::map<int, Object *> m_objects;
|
||||
IDSet< refptr<AV::Sound> > m_sounds;
|
||||
std::map<int, dJointID> m_joints;
|
||||
IDSet<dJointID> m_joints;
|
||||
int m_next_object_index;
|
||||
int m_next_joint_index;
|
||||
GLdouble m_eye[3];
|
||||
GLdouble m_center[3];
|
||||
GLdouble m_up[3];
|
||||
|
Loading…
x
Reference in New Issue
Block a user