Abstract class (interface) for obstacles. More...
#include <abstractobstacle.h>
Inherited by AbstractGround, Boxpile, DummyObstacle, MeshGround, MeshObstacle, PassiveBox, PassiveCapsule, PassiveMesh, PassiveSphere, RandomObstacles, Seesaw, and TerrainGround.
Public Member Functions | |
AbstractObstacle (const OdeHandle &odeHandle, const OsgHandle &osgHandle) | |
Constructor. | |
virtual | ~AbstractObstacle () |
virtual void | update () |
updates the position if the scenegraph nodes the default implementation calls update on all primitive on "obst" | |
virtual void | setPos (const osg::Vec3 &pos) |
sets position of the obstacle and creates/recreates obstacle if necessary | |
virtual void | setPosition (const osg::Vec3 &pos) |
sets position of the obstacle and creates/recreates obstacle if necessary | |
virtual osg::Vec3 | getPos () |
gives actual position of the obstacle | |
virtual osg::Matrix | getPose () |
gives actual pose of the obstacle | |
virtual void | setPose (const osg::Matrix &pose)=0 |
sets position of the obstacle and creates/recreates obstacle if necessary | |
virtual void | setColor (const Color &color) |
sets the obstacle color | |
virtual void | setColor (const std::string &color) |
virtual void | setTexture (const std::string &texturefilename) |
assigns a texture to the all primitives of this obstactle with repeat -1,-1 | |
virtual void | setTexture (const TextureDescr &texture) |
assigns a texture to the all primitives of this obstactle | |
virtual void | setTexture (int surface, const TextureDescr &texture) |
assigns a texture to the x-th surface of each primitive, | |
virtual void | setTexture (int primitive, int surface, const TextureDescr &texture) |
assigns a texture to the x-th surface of the k-th primitive, (The texture setting of the last primitve is repeated for the remaining ones) | |
virtual TextureDescr | getTexture (int primitive, int surface) const |
returns the texture of the given surface on the given primitive | |
virtual std::vector< TextureDescr > | getTextures (int primitive) const |
returns the textures of the given primitive | |
virtual Primitive * | getMainPrimitive () const =0 |
return the "main" primitive of the obtactle. The meaning of "main" is arbitrary | |
virtual void | setSubstance (const Substance &substance) |
sets the substance of the obtactle. | |
virtual const Substance & | getSubstance () |
returns the substance of this obstacle | |
virtual Position | getPosition () const |
returns position of the object | |
virtual Position | getSpeed () const |
returns linear speed vector of the object | |
virtual Position | getAngularSpeed () const |
returns angular velocity vector of the object | |
virtual matrix::Matrix | getOrientation () const |
returns the orientation of the object | |
Protected Member Functions | |
virtual void | destroy () |
is called to destroy the object. The default implementation is to delete all primitives in "obst". | |
virtual void | create ()=0 |
overload this function to create the obstactle. All primitives should go into the list "obst" | |
Protected Attributes | |
std::vector< Primitive * > | obst |
primitives which belong to this obstacle | |
std::vector< std::vector < TextureDescr > > | textures |
for each primitive the texture settings per surface | |
osg::Matrix | pose |
bool | obstacle_exists |
OdeHandle | odeHandle |
OsgHandle | osgHandle |
Abstract class (interface) for obstacles.
AbstractObstacle | ( | const OdeHandle & | odeHandle, | |
const OsgHandle & | osgHandle | |||
) |
Constructor.
odeHandle | containing ODE stuff like world, space and jointgroup | |
osgHandle | containing OSG stuff like scene, color... be used for creation of obstacles |
~AbstractObstacle | ( | ) | [virtual] |
virtual void create | ( | ) | [protected, pure virtual] |
overload this function to create the obstactle. All primitives should go into the list "obst"
Implemented in Boxpile, ClosedPlayground, ComplexPlayground, DummyGround, DummyObstacle, MeshGround, MeshObstacle, OctaPlayground, PassiveBox, PassiveCapsule, PassiveMesh, PassiveSphere, Playground, RandomObstacles, Seesaw, and TerrainGround.
void destroy | ( | ) | [protected, virtual] |
is called to destroy the object. The default implementation is to delete all primitives in "obst".
Reimplemented in ClosedPlayground, MeshGround, MeshObstacle, PassiveMesh, and TerrainGround.
Position getAngularSpeed | ( | ) | const [virtual] |
returns angular velocity vector of the object
virtual Primitive* getMainPrimitive | ( | ) | const [pure virtual] |
return the "main" primitive of the obtactle. The meaning of "main" is arbitrary
Implemented in AbstractGround, Boxpile, DummyObstacle, PassiveBox, PassiveCapsule, PassiveMesh, PassiveSphere, RandomObstacles, Seesaw, and TerrainGround.
matrix::Matrix getOrientation | ( | ) | const [virtual] |
returns the orientation of the object
osg::Vec3 getPos | ( | ) | [virtual] |
gives actual position of the obstacle
osg::Matrix getPose | ( | ) | [virtual] |
gives actual pose of the obstacle
Position getPosition | ( | ) | const [virtual] |
returns position of the object
Position getSpeed | ( | ) | const [virtual] |
returns linear speed vector of the object
const Substance & getSubstance | ( | ) | [virtual] |
returns the substance of this obstacle
TextureDescr getTexture | ( | int | primitive, | |
int | surface | |||
) | const [virtual] |
returns the texture of the given surface on the given primitive
std::vector< TextureDescr > getTextures | ( | int | primitive | ) | const [virtual] |
returns the textures of the given primitive
virtual void setColor | ( | const std::string & | color | ) | [virtual] |
void setColor | ( | const Color & | color | ) | [virtual] |
sets the obstacle color
color | values in RGBA |
void setPos | ( | const osg::Vec3 & | pos | ) | [virtual] |
sets position of the obstacle and creates/recreates obstacle if necessary
virtual void setPose | ( | const osg::Matrix & | pose | ) | [pure virtual] |
sets position of the obstacle and creates/recreates obstacle if necessary
Implemented in AbstractGround, Boxpile, DummyObstacle, MeshGround, MeshObstacle, PassiveBox, PassiveCapsule, PassiveMesh, PassiveSphere, RandomObstacles, Seesaw, and TerrainGround.
void setPosition | ( | const osg::Vec3 & | pos | ) | [virtual] |
sets position of the obstacle and creates/recreates obstacle if necessary
void setSubstance | ( | const Substance & | substance | ) | [virtual] |
sets the substance of the obtactle.
It is applied to all objects in obj
substance | description of the substance |
void setTexture | ( | int | primitive, | |
int | surface, | |||
const TextureDescr & | texture | |||
) | [virtual] |
assigns a texture to the x-th surface of the k-th primitive, (The texture setting of the last primitve is repeated for the remaining ones)
void setTexture | ( | int | surface, | |
const TextureDescr & | texture | |||
) | [virtual] |
assigns a texture to the x-th surface of each primitive,
void setTexture | ( | const TextureDescr & | texture | ) | [virtual] |
assigns a texture to the all primitives of this obstactle
void setTexture | ( | const std::string & | texturefilename | ) | [virtual] |
assigns a texture to the all primitives of this obstactle with repeat -1,-1
Reimplemented in PassiveCapsule, and PassiveSphere.
void update | ( | ) | [virtual] |
updates the position if the scenegraph nodes the default implementation calls update on all primitive on "obst"
Reimplemented in MeshGround, MeshObstacle, PassiveCapsule, PassiveMesh, and TerrainGround.
bool obstacle_exists [protected] |
osg::Matrix pose [protected] |
std::vector<std::vector<TextureDescr> > textures [protected] |
for each primitive the texture settings per surface