Renaved MovingPhysics to PhysicalObject.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@3338 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
30de5e36f8
commit
aca8bb39c7
@ -215,8 +215,8 @@ supertuxkart_SOURCES = \
|
|||||||
physics/btKart.hpp \
|
physics/btKart.hpp \
|
||||||
physics/btUprightConstraint.cpp \
|
physics/btUprightConstraint.cpp \
|
||||||
physics/btUprightConstraint.hpp \
|
physics/btUprightConstraint.hpp \
|
||||||
physics/moving_physics.hpp \
|
physics/physical_object.hpp \
|
||||||
physics/moving_physics.cpp \
|
physics/physical_object.cpp \
|
||||||
physics/physics.cpp \
|
physics/physics.cpp \
|
||||||
physics/physics.hpp \
|
physics/physics.hpp \
|
||||||
physics/kart_motion_state.hpp \
|
physics/kart_motion_state.hpp \
|
||||||
|
@ -489,7 +489,7 @@
|
|||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\physics\moving_physics.cpp"
|
RelativePath="..\..\physics\physical_object.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
@ -1114,6 +1114,10 @@
|
|||||||
RelativePath="..\..\physics\kart_motion_state.hpp"
|
RelativePath="..\..\physics\kart_motion_state.hpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\physics\physical_object.hpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\physics\physics.hpp"
|
RelativePath="..\..\physics\physics.hpp"
|
||||||
>
|
>
|
||||||
|
@ -245,7 +245,7 @@ bool Flyable::isOwnerImmunity(const Kart* kart_hit) const
|
|||||||
} // isOwnerImmunity
|
} // isOwnerImmunity
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void Flyable::hit(Kart *kart_hit, MovingPhysics* moving_physics)
|
void Flyable::hit(Kart *kart_hit, PhysicalObject* object)
|
||||||
{
|
{
|
||||||
// the owner of this flyable should not be hit by his own flyable
|
// the owner of this flyable should not be hit by his own flyable
|
||||||
if(m_exploded || isOwnerImmunity(kart_hit)) return;
|
if(m_exploded || isOwnerImmunity(kart_hit)) return;
|
||||||
@ -284,7 +284,7 @@ void Flyable::hit(Kart *kart_hit, MovingPhysics* moving_physics)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RaceManager::getTrack()->handleExplosion(pos_explosion, moving_physics);
|
RaceManager::getTrack()->handleExplosion(pos_explosion, object);
|
||||||
} // hit
|
} // hit
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
@ -30,7 +30,7 @@ using namespace irr;
|
|||||||
|
|
||||||
class FlyableInfo;
|
class FlyableInfo;
|
||||||
class Kart;
|
class Kart;
|
||||||
class MovingPhysics;
|
class PhysicalObject;
|
||||||
|
|
||||||
class Flyable : public Moveable, public TerrainInfo
|
class Flyable : public Moveable, public TerrainInfo
|
||||||
{
|
{
|
||||||
@ -107,7 +107,7 @@ public:
|
|||||||
void updateFromServer(const FlyableInfo &f, float dt);
|
void updateFromServer(const FlyableInfo &f, float dt);
|
||||||
|
|
||||||
virtual void hitTrack () {};
|
virtual void hitTrack () {};
|
||||||
virtual void hit (Kart* kart, MovingPhysics* moving_physics=NULL);
|
virtual void hit (Kart* kart, PhysicalObject* obj=NULL);
|
||||||
bool hasHit () { return m_has_hit_something; }
|
bool hasHit () { return m_has_hit_something; }
|
||||||
/** Indicates that something was hit and that this object must
|
/** Indicates that something was hit and that this object must
|
||||||
* be removed. */
|
* be removed. */
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "items/projectile_manager.hpp"
|
#include "items/projectile_manager.hpp"
|
||||||
#include "karts/player_kart.hpp"
|
#include "karts/player_kart.hpp"
|
||||||
#include "modes/world.hpp"
|
#include "modes/world.hpp"
|
||||||
#include "physics/moving_physics.hpp"
|
#include "physics/physical_object.hpp"
|
||||||
#include "tracks/track.hpp"
|
#include "tracks/track.hpp"
|
||||||
#include "utils/constants.hpp"
|
#include "utils/constants.hpp"
|
||||||
|
|
||||||
@ -150,9 +150,9 @@ void Plunger::update(float dt)
|
|||||||
* Instead it stays around (though not as a graphical or physical object)
|
* Instead it stays around (though not as a graphical or physical object)
|
||||||
* till the rubber band expires.
|
* till the rubber band expires.
|
||||||
* \param kart Pointer to the kart hit (NULL if not a kart).
|
* \param kart Pointer to the kart hit (NULL if not a kart).
|
||||||
* \param mp Pointer to MovingPhysics object if hit (NULL otherwise).
|
* \param obj Pointer to PhysicalObject object if hit (NULL otherwise).
|
||||||
*/
|
*/
|
||||||
void Plunger::hit(Kart *kart, MovingPhysics *mp)
|
void Plunger::hit(Kart *kart, PhysicalObject *obj)
|
||||||
{
|
{
|
||||||
if(isOwnerImmunity(kart)) return;
|
if(isOwnerImmunity(kart)) return;
|
||||||
|
|
||||||
@ -190,9 +190,9 @@ void Plunger::hit(Kart *kart, MovingPhysics *mp)
|
|||||||
m_rubber_band->hit(kart);
|
m_rubber_band->hit(kart);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(mp)
|
else if(obj)
|
||||||
{
|
{
|
||||||
Vec3 pos(mp->getBody()->getWorldTransform().getOrigin());
|
Vec3 pos(obj->getBody()->getWorldTransform().getOrigin());
|
||||||
m_rubber_band->hit(NULL, &pos);
|
m_rubber_band->hit(NULL, &pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -26,7 +26,7 @@ using namespace irr;
|
|||||||
|
|
||||||
class RubberBand;
|
class RubberBand;
|
||||||
class Kart;
|
class Kart;
|
||||||
class MovingPhysics;
|
class PhysicalObject;
|
||||||
|
|
||||||
class Plunger : public Flyable
|
class Plunger : public Flyable
|
||||||
{
|
{
|
||||||
@ -47,7 +47,7 @@ public:
|
|||||||
void setKeepAlive(float t) {m_keep_alive = t;}
|
void setKeepAlive(float t) {m_keep_alive = t;}
|
||||||
virtual void update (float dt);
|
virtual void update (float dt);
|
||||||
virtual void hitTrack ();
|
virtual void hitTrack ();
|
||||||
virtual void hit (Kart *kart, MovingPhysics *mp=NULL);
|
virtual void hit (Kart *kart, PhysicalObject *obj=NULL);
|
||||||
|
|
||||||
/** A plunger does not explode if it is removed. */
|
/** A plunger does not explode if it is removed. */
|
||||||
virtual bool needsExplosion() const {return false;}
|
virtual bool needsExplosion() const {return false;}
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
#include "material.hpp"
|
#include "material.hpp"
|
||||||
#include "graphics/moving_texture.hpp"
|
#include "graphics/moving_texture.hpp"
|
||||||
#include "io/file_manager.hpp"
|
#include "io/file_manager.hpp"
|
||||||
#include "physics/moving_physics.hpp"
|
#include "physics/physical_object.hpp"
|
||||||
|
|
||||||
Loader* loader = 0;
|
Loader* loader = 0;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: moving_physics.cpp 839 2006-10-24 00:01:56Z hiker $
|
// $Id: physical_object.cpp 839 2006-10-24 00:01:56Z hiker $
|
||||||
//
|
//
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
// Copyright (C) 2006 Joerg Henrichs
|
// Copyright (C) 2006 Joerg Henrichs
|
||||||
@ -17,7 +17,7 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#include "physics/moving_physics.hpp"
|
#include "physics/physical_object.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -36,7 +36,7 @@ using namespace irr;
|
|||||||
#include "utils/string_utils.hpp"
|
#include "utils/string_utils.hpp"
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
MovingPhysics::MovingPhysics(const XMLNode *xml_node)
|
PhysicalObject::PhysicalObject(const XMLNode *xml_node)
|
||||||
{
|
{
|
||||||
std::string model_name;
|
std::string model_name;
|
||||||
const Track *track=RaceManager::getTrack();
|
const Track *track=RaceManager::getTrack();
|
||||||
@ -91,21 +91,21 @@ MovingPhysics::MovingPhysics(const XMLNode *xml_node)
|
|||||||
if (shape=="cone" ) m_body_type = MP_CONE;
|
if (shape=="cone" ) m_body_type = MP_CONE;
|
||||||
else if(shape=="box" ) m_body_type = MP_BOX;
|
else if(shape=="box" ) m_body_type = MP_BOX;
|
||||||
else if(shape=="sphere" ) m_body_type = MP_SPHERE;
|
else if(shape=="sphere" ) m_body_type = MP_SPHERE;
|
||||||
} // MovingPhysics
|
} // PhysicalObject
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
MovingPhysics::~MovingPhysics()
|
PhysicalObject::~PhysicalObject()
|
||||||
{
|
{
|
||||||
RaceManager::getWorld()->getPhysics()->removeBody(m_body);
|
RaceManager::getWorld()->getPhysics()->removeBody(m_body);
|
||||||
delete m_body;
|
delete m_body;
|
||||||
delete m_motion_state;
|
delete m_motion_state;
|
||||||
delete m_shape;
|
delete m_shape;
|
||||||
} // ~MovingPhysics
|
} // ~PhysicalObject
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
/** Additional initialisation after loading of the model is finished.
|
/** Additional initialisation after loading of the model is finished.
|
||||||
*/
|
*/
|
||||||
void MovingPhysics::init()
|
void PhysicalObject::init()
|
||||||
{
|
{
|
||||||
// 1. Determine size of the object
|
// 1. Determine size of the object
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
@ -151,7 +151,7 @@ void MovingPhysics::init()
|
|||||||
} // init
|
} // init
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void MovingPhysics::update(float dt)
|
void PhysicalObject::update(float dt)
|
||||||
{
|
{
|
||||||
btTransform t;
|
btTransform t;
|
||||||
m_motion_state->getWorldTransform(t);
|
m_motion_state->getWorldTransform(t);
|
||||||
@ -166,7 +166,7 @@ void MovingPhysics::update(float dt)
|
|||||||
} // update
|
} // update
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void MovingPhysics::reset()
|
void PhysicalObject::reset()
|
||||||
{
|
{
|
||||||
m_body->setCenterOfMassTransform(m_init_pos);
|
m_body->setCenterOfMassTransform(m_init_pos);
|
||||||
m_body->setAngularVelocity(btVector3(0,0,0));
|
m_body->setAngularVelocity(btVector3(0,0,0));
|
||||||
@ -175,7 +175,7 @@ void MovingPhysics::reset()
|
|||||||
} // reset
|
} // reset
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void MovingPhysics::handleExplosion(const Vec3& pos, bool direct_hit) {
|
void PhysicalObject::handleExplosion(const Vec3& pos, bool direct_hit) {
|
||||||
if(direct_hit) {
|
if(direct_hit) {
|
||||||
btVector3 impulse(0.0f, 0.0f, stk_config->m_explosion_impulse_objects);
|
btVector3 impulse(0.0f, 0.0f, stk_config->m_explosion_impulse_objects);
|
||||||
m_body->applyCentralImpulse(impulse);
|
m_body->applyCentralImpulse(impulse);
|
@ -1,4 +1,4 @@
|
|||||||
// $Id: moving_physics.hpp 839 2006-10-24 00:01:56Z hiker $
|
// $Id: physical_object.hpp 839 2006-10-24 00:01:56Z hiker $
|
||||||
//
|
//
|
||||||
// SuperTuxKart - a fun racing game with go-kart
|
// SuperTuxKart - a fun racing game with go-kart
|
||||||
// Copyright (C) 2006 Joerg Henrichs
|
// Copyright (C) 2006 Joerg Henrichs
|
||||||
@ -17,8 +17,9 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef HEADER_MOVING_PHYSICS_HPP
|
#ifndef HEADER_PHYSICAL_OBJECT_HPP
|
||||||
#define HEADER_MOVING_PHYSICS_HPP
|
#define HEADER_PHYSICAL_OBJECT_HPP
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "irrlicht.h"
|
#include "irrlicht.h"
|
||||||
using namespace irr;
|
using namespace irr;
|
||||||
@ -30,7 +31,7 @@ class Vec3;
|
|||||||
class scene::IAnimatedMesh;
|
class scene::IAnimatedMesh;
|
||||||
class XMLNode;
|
class XMLNode;
|
||||||
|
|
||||||
class MovingPhysics
|
class PhysicalObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum bodyTypes {MP_NONE, MP_CONE, MP_BOX, MP_SPHERE};
|
enum bodyTypes {MP_NONE, MP_CONE, MP_BOX, MP_SPHERE};
|
||||||
@ -47,15 +48,15 @@ protected:
|
|||||||
scene::IMesh *m_mesh;
|
scene::IMesh *m_mesh;
|
||||||
scene::ISceneNode *m_node;
|
scene::ISceneNode *m_node;
|
||||||
public:
|
public:
|
||||||
MovingPhysics (const XMLNode *node);
|
PhysicalObject (const XMLNode *node);
|
||||||
~MovingPhysics ();
|
~PhysicalObject ();
|
||||||
void update (float dt);
|
void update (float dt);
|
||||||
void init ();
|
void init ();
|
||||||
virtual void reset ();
|
virtual void reset ();
|
||||||
btRigidBody *getBody () { return m_body; }
|
/** Returns the rigid body of this physical object. */
|
||||||
const char *getTypeName() { return "moving physics"; }
|
btRigidBody *getBody () { return m_body; }
|
||||||
virtual void handleExplosion(const Vec3& pos, bool directHit);
|
virtual void handleExplosion(const Vec3& pos, bool directHit);
|
||||||
}; // MovingPhysics
|
}; // PhysicalObject
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* EOF */
|
/* EOF */
|
@ -135,9 +135,9 @@ void Physics::update(float dt)
|
|||||||
{
|
{
|
||||||
p->a->getPointerFlyable()->hitTrack();
|
p->a->getPointerFlyable()->hitTrack();
|
||||||
}
|
}
|
||||||
else if(p->b->is(UserPointer::UP_MOVING_PHYSICS))
|
else if(p->b->is(UserPointer::UP_PHYSICAL_OBJECT))
|
||||||
{
|
{
|
||||||
p->a->getPointerFlyable()->hit(NULL, p->b->getPointerMovingPhysics());
|
p->a->getPointerFlyable()->hit(NULL, p->b->getPointerPhysicalObject());
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(p->b->is(UserPointer::UP_KART)) // projectile hit kart
|
else if(p->b->is(UserPointer::UP_KART)) // projectile hit kart
|
||||||
@ -270,15 +270,15 @@ btScalar Physics::solveGroup(btCollisionObject** bodies, int numBodies,
|
|||||||
// =========================
|
// =========================
|
||||||
else if(upA->is(UserPointer::UP_FLYABLE))
|
else if(upA->is(UserPointer::UP_FLYABLE))
|
||||||
{
|
{
|
||||||
if(upB->is(UserPointer::UP_TRACK ) || // 3.1) projectile hits track
|
if(upB->is(UserPointer::UP_TRACK ) || // 3.1) projectile hits track
|
||||||
upB->is(UserPointer::UP_FLYABLE ) || // 3.2) projectile hits projectile
|
upB->is(UserPointer::UP_FLYABLE ) || // 3.2) projectile hits projectile
|
||||||
upB->is(UserPointer::UP_MOVING_PHYSICS) || // 3.3) projectile hits projectile
|
upB->is(UserPointer::UP_PHYSICAL_OBJECT) || // 3.3) projectile hits projectile
|
||||||
upB->is(UserPointer::UP_KART ) ) // 3.4) projectile hits kart
|
upB->is(UserPointer::UP_KART ) ) // 3.4) projectile hits kart
|
||||||
{
|
{
|
||||||
m_all_collisions.push_back(upA, upB);
|
m_all_collisions.push_back(upA, upB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(upA->is(UserPointer::UP_MOVING_PHYSICS))
|
else if(upA->is(UserPointer::UP_PHYSICAL_OBJECT))
|
||||||
{
|
{
|
||||||
if(upB->is(UserPointer::UP_FLYABLE))
|
if(upB->is(UserPointer::UP_FLYABLE))
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include "lisp/lisp.hpp"
|
#include "lisp/lisp.hpp"
|
||||||
#include "lisp/parser.hpp"
|
#include "lisp/parser.hpp"
|
||||||
#include "modes/world.hpp"
|
#include "modes/world.hpp"
|
||||||
#include "physics/moving_physics.hpp"
|
#include "physics/physical_object.hpp"
|
||||||
#include "physics/triangle_mesh.hpp"
|
#include "physics/triangle_mesh.hpp"
|
||||||
#include "race_manager.hpp"
|
#include "race_manager.hpp"
|
||||||
#include "utils/ssg_help.hpp"
|
#include "utils/ssg_help.hpp"
|
||||||
@ -1292,15 +1292,15 @@ void Track::update(float dt)
|
|||||||
/** Handles an explosion, i.e. it makes sure that all physical objects are
|
/** Handles an explosion, i.e. it makes sure that all physical objects are
|
||||||
* affected accordingly.
|
* affected accordingly.
|
||||||
* \param pos Position of the explosion.
|
* \param pos Position of the explosion.
|
||||||
* \param mp If the hit was a physical object, this object will be affected
|
* \param obj If the hit was a physical object, this object will be affected
|
||||||
* more. Otherwise this is NULL.
|
* more. Otherwise this is NULL.
|
||||||
*/
|
*/
|
||||||
void Track::handleExplosion(const Vec3 &pos, const MovingPhysics *mp) const
|
void Track::handleExplosion(const Vec3 &pos, const PhysicalObject *obj) const
|
||||||
{
|
{
|
||||||
for(std::vector<MovingPhysics*>::const_iterator i=m_physical_objects.begin();
|
for(std::vector<PhysicalObject*>::const_iterator i=m_physical_objects.begin();
|
||||||
i!=m_physical_objects.end(); i++)
|
i!=m_physical_objects.end(); i++)
|
||||||
{
|
{
|
||||||
(*i)->handleExplosion(pos, mp==(*i));
|
(*i)->handleExplosion(pos, obj==(*i));
|
||||||
}
|
}
|
||||||
} // handleExplosion
|
} // handleExplosion
|
||||||
|
|
||||||
@ -1396,7 +1396,7 @@ void Track::loadTrackModel()
|
|||||||
if(name=="track") continue;
|
if(name=="track") continue;
|
||||||
if(name=="object")
|
if(name=="object")
|
||||||
{
|
{
|
||||||
m_physical_objects.push_back(new MovingPhysics(node));
|
m_physical_objects.push_back(new PhysicalObject(node));
|
||||||
}
|
}
|
||||||
else if(name=="water")
|
else if(name=="water")
|
||||||
{
|
{
|
||||||
@ -1449,7 +1449,7 @@ void Track::loadTrackModel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Init all physical objects
|
// Init all physical objects
|
||||||
for(std::vector<MovingPhysics*>::const_iterator i=m_physical_objects.begin();
|
for(std::vector<PhysicalObject*>::const_iterator i=m_physical_objects.begin();
|
||||||
i!=m_physical_objects.end(); i++)
|
i!=m_physical_objects.end(); i++)
|
||||||
{
|
{
|
||||||
(*i)->init();
|
(*i)->init();
|
||||||
|
@ -42,6 +42,7 @@ using namespace irr;
|
|||||||
class TriangleMesh;
|
class TriangleMesh;
|
||||||
class MovingTexture;
|
class MovingTexture;
|
||||||
class XMLNode;
|
class XMLNode;
|
||||||
|
class PhysicalObject;
|
||||||
|
|
||||||
class Track
|
class Track
|
||||||
{
|
{
|
||||||
@ -79,7 +80,7 @@ private:
|
|||||||
std::vector<MovingTexture*> m_animated_textures;
|
std::vector<MovingTexture*> m_animated_textures;
|
||||||
|
|
||||||
/** List of all physical objects. */
|
/** List of all physical objects. */
|
||||||
std::vector<MovingPhysics*> m_physical_objects;
|
std::vector<PhysicalObject*> m_physical_objects;
|
||||||
|
|
||||||
/** If a sky dome is used, the number of horizontal segments
|
/** If a sky dome is used, the number of horizontal segments
|
||||||
* the sphere should be divided in. */
|
* the sphere should be divided in. */
|
||||||
@ -221,7 +222,7 @@ public:
|
|||||||
float getTerrainHeight(const Vec3 &pos) const;
|
float getTerrainHeight(const Vec3 &pos) const;
|
||||||
void createPhysicsModel();
|
void createPhysicsModel();
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
void handleExplosion(const Vec3 &pos, const MovingPhysics *mp) const;
|
void handleExplosion(const Vec3 &pos, const PhysicalObject *mp) const;
|
||||||
void glVtx (sgVec2 v, float x_offset, float y_offset) const
|
void glVtx (sgVec2 v, float x_offset, float y_offset) const
|
||||||
{
|
{
|
||||||
glVertex2f(
|
glVertex2f(
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#ifndef HEADER_USER_POINTER_H
|
#ifndef HEADER_USER_POINTER_HPP
|
||||||
#define HEADER_USER_POINTER_H
|
#define HEADER_USER_POINTER_HPP
|
||||||
|
|
||||||
/** Some bullet objects store 'user pointers'. This is a base class
|
/** Some bullet objects store 'user pointers'. This is a base class
|
||||||
* that allows to easily determine the type of the user pointer.
|
* that allows to easily determine the type of the user pointer.
|
||||||
@ -27,34 +27,34 @@ class TriangleMesh;
|
|||||||
class Moveable;
|
class Moveable;
|
||||||
class Flyable;
|
class Flyable;
|
||||||
class Kart;
|
class Kart;
|
||||||
class MovingPhysics;
|
class PhysicalObject;
|
||||||
|
|
||||||
class UserPointer
|
class UserPointer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum UserPointerType {UP_UNDEF, UP_KART, UP_FLYABLE, UP_TRACK,
|
enum UserPointerType {UP_UNDEF, UP_KART, UP_FLYABLE, UP_TRACK,
|
||||||
UP_MOVING_PHYSICS};
|
UP_PHYSICAL_OBJECT};
|
||||||
private:
|
private:
|
||||||
void* m_pointer;
|
void* m_pointer;
|
||||||
UserPointerType m_user_pointer_type;
|
UserPointerType m_user_pointer_type;
|
||||||
public:
|
public:
|
||||||
bool is(UserPointerType t) const {return m_user_pointer_type==t; }
|
bool is(UserPointerType t) const {return m_user_pointer_type==t; }
|
||||||
TriangleMesh* getPointerTriangleMesh() const {return (TriangleMesh*)m_pointer; }
|
TriangleMesh* getPointerTriangleMesh() const {return (TriangleMesh*)m_pointer; }
|
||||||
Moveable* getPointerMoveable() const {return (Moveable*)m_pointer; }
|
Moveable* getPointerMoveable() const {return (Moveable*)m_pointer; }
|
||||||
Flyable* getPointerFlyable() const {return (Flyable*)m_pointer; }
|
Flyable* getPointerFlyable() const {return (Flyable*)m_pointer; }
|
||||||
Kart* getPointerKart() const {return (Kart*)m_pointer; }
|
Kart* getPointerKart() const {return (Kart*)m_pointer; }
|
||||||
MovingPhysics* getPointerMovingPhysics() const {return (MovingPhysics*)m_pointer; }
|
PhysicalObject *getPointerPhysicalObject() const {return (PhysicalObject*)m_pointer;}
|
||||||
void set(MovingPhysics* p) { m_user_pointer_type=UP_MOVING_PHYSICS;
|
void set(PhysicalObject* p) { m_user_pointer_type=UP_PHYSICAL_OBJECT;
|
||||||
m_pointer =p; }
|
m_pointer =p; }
|
||||||
void set(Kart* p) { m_user_pointer_type=UP_KART;
|
void set(Kart* p) { m_user_pointer_type=UP_KART;
|
||||||
m_pointer =p; }
|
m_pointer =p; }
|
||||||
void set(Flyable* p) { m_user_pointer_type=UP_FLYABLE;
|
void set(Flyable* p) { m_user_pointer_type=UP_FLYABLE;
|
||||||
m_pointer =p; }
|
m_pointer =p; }
|
||||||
void set(TriangleMesh* p) { m_user_pointer_type=UP_TRACK;
|
void set(TriangleMesh* p) { m_user_pointer_type=UP_TRACK;
|
||||||
m_pointer =p; }
|
m_pointer =p; }
|
||||||
UserPointer() { zero(); }
|
UserPointer() { zero(); }
|
||||||
void zero() { m_user_pointer_type=UP_UNDEF;
|
void zero() { m_user_pointer_type=UP_UNDEF;
|
||||||
m_pointer = NULL; }
|
m_pointer = NULL; }
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
Loading…
Reference in New Issue
Block a user