Project

General

Profile

SO3Engine
OgreNewt::CollisionPrimitives::TreeCollision Class Reference

TreeCollision - complex polygonal collision. More...

#include <OgreNewt_CollisionPrimitives.h>

Inheritance diagram for OgreNewt::CollisionPrimitives::TreeCollision:
OgreNewt::Collision OgreNewt::CollisionPrimitives::TreeCollisionSceneParser

Public Member Functions

 TreeCollision (const World *world)
 constructor
 
 TreeCollision (const World *world, Ogre::Entity *ent, bool optimize, int id, FaceWinding fw=FW_DEFAULT, const Ogre::Vector3 &scale=Ogre::Vector3::UNIT_SCALE)
 constructor
 
 TreeCollision (const World *world, const Ogre::SceneNode *node, bool optimize, int id, FaceWinding fw=FW_DEFAULT, const Ogre::Vector3 &scale=Ogre::Vector3::UNIT_SCALE)
 
void AddEntities (const Ogre::SceneNode *node, const Ogre::SceneNode *mainNode, const Ogre::Vector3 scale, FaceWinding fw=FW_DEFAULT)
 
 TreeCollision (const World *world, int numVertices, int numIndices, const float *vertices, const int *indices, bool optimize, int id, FaceWinding fw=FW_DEFAULT)
 constructor
 
 TreeCollision (const World *world, int numVertices, Ogre::Vector3 *vertices, Ogre::IndexData *indexData, bool optimize, int id, FaceWinding fw=FW_DEFAULT)
 constructor
 
 ~TreeCollision ()
 destructor
 
void start (int id)
 start a tree collision creation
 
void addPoly (Ogre::Vector3 *polys, unsigned int ID)
 add a poly to the tree collision
 
void finish (bool optimize)
 finish the tree collision
 
void setRayCastCallbackactive (bool active=true)
 set RayCastCallback active/disabled
 
- Public Member Functions inherited from OgreNewt::Collision
 Collision (const World *world)
 constructor
 
 Collision (const Collision &shape)
 constructor
 
 Collision (const NewtonCollision *collision, const World *world)
 constructor
 
virtual ~Collision ()
 destructor
 
NewtonCollision *const getNewtonCollision () const
 retrieve the Newton pointer
 
const WorldgetWorld () const
 
Ogre::AxisAlignedBox getAABB (const Ogre::Quaternion &orient=Ogre::Quaternion::IDENTITY, const Ogre::Vector3 &pos=Ogre::Vector3::ZERO) const
 
CollisionPrimitiveType getCollisionPrimitiveType () const
 Returns the Collisiontype for this Collision.
 
NewtonCollisionInfoRecord * getInfo ()
 Returns collision info record for this collision.
 

Static Public Member Functions

static dFloat _CDECL newtonRayCastCallback (const NewtonBody *const body, const NewtonCollision *const treeCollision, dFloat distance, dFloat *normal, int faceId, void *userData)
 used internally
 
- Static Public Member Functions inherited from OgreNewt::Collision
static CollisionPrimitiveType getCollisionPrimitiveType (const NewtonCollision *col)
 Returns the Collisiontype for the given Newton-Collision.
 
static NewtonCollisionInfoRecord * getInfo (const NewtonCollision *col)
 Returns collision info record for given collision.
 

Additional Inherited Members

- Protected Attributes inherited from OgreNewt::Collision
NewtonCollision * m_col
 
const Worldm_world
 

Detailed Description

TreeCollision - complex polygonal collision.

TreeCollision objects are general polygon collision objects. TreeCollision objects have a requirement that their mass must = 0 (aka are have infinite mass)

Definition at line 304 of file OgreNewt_CollisionPrimitives.h.

Constructor & Destructor Documentation

◆ TreeCollision() [1/5]

OgreNewt::CollisionPrimitives::TreeCollision::TreeCollision ( const World world)

constructor

Create a 'blank' tree collision object. Can be used for manual TreeCollision creation, or to be used with TreeCollisionSerializer::importTreeCollision

Parameters
worldpointer to the OgreNewt::World

Definition at line 463 of file OgreNewt_CollisionPrimitives.cpp.

◆ TreeCollision() [2/5]

OgreNewt::CollisionPrimitives::TreeCollision::TreeCollision ( const World world,
Ogre::Entity *  ent,
bool  optimize,
int  id,
FaceWinding  fw = FW_DEFAULT,
const Ogre::Vector3 &  scale = Ogre::Vector3::UNIT_SCALE 
)

constructor

Create a tree collision object.

Parameters
worldpointer to the OgreNewt::World
entpointer to an Ogre::Entitiy, if it is attached to a node, the scale of the parent node is used
optimizebool whether you want to optimize the collision or not.
idan id for this shape, can be received with collision->getUserId()

Definition at line 468 of file OgreNewt_CollisionPrimitives.cpp.

◆ TreeCollision() [3/5]

OgreNewt::CollisionPrimitives::TreeCollision::TreeCollision ( const World world,
const Ogre::SceneNode *  node,
bool  optimize,
int  id,
FaceWinding  fw = FW_DEFAULT,
const Ogre::Vector3 &  scale = Ogre::Vector3::UNIT_SCALE 
)

Definition at line 636 of file OgreNewt_CollisionPrimitives.cpp.

◆ TreeCollision() [4/5]

OgreNewt::CollisionPrimitives::TreeCollision::TreeCollision ( const World world,
int  numVertices,
int  numIndices,
const float *  vertices,
const int *  indices,
bool  optimize,
int  id,
FaceWinding  fw = FW_DEFAULT 
)

constructor

build a TreeCollision from vertice and index information. This can be used with the dotScene scene manager for building TreeCollision objects from each mesh in the scene.

Parameters
worldpointer to OgreNewt::World
numVerticesnumber of vertices passed in the array.
numIndicesnumber of indices passed in the array.
verticespointer to array of vertices (positions only).
indicespointer to array of indices.
optimizebool whether you want to optimize the collision or not.
idan id for this shape, can be received with collision->getUserId()

Definition at line 643 of file OgreNewt_CollisionPrimitives.cpp.

◆ TreeCollision() [5/5]

OgreNewt::CollisionPrimitives::TreeCollision::TreeCollision ( const World world,
int  numVertices,
Ogre::Vector3 *  vertices,
Ogre::IndexData *  indexData,
bool  optimize,
int  id,
FaceWinding  fw = FW_DEFAULT 
)

constructor

build a TreeCollision from vertice and index information. This can be used with the ogre Paging Landscape SceneManager, or other custom solutions.

Parameters
worldpointer to OgreNewt::World
numVerticesnumber of vertices in the array.
verticespointer to array of Ogre::Vector3 vertices (positions only)
indexDatapointer to Ogre::IndexData for the mesh
optimizebool whether you want to optimize the collision or not.
idan id for this shape, can be received with collision->getUserId()

Definition at line 684 of file OgreNewt_CollisionPrimitives.cpp.

◆ ~TreeCollision()

OgreNewt::CollisionPrimitives::TreeCollision::~TreeCollision ( )
inline

destructor

Definition at line 353 of file OgreNewt_CollisionPrimitives.h.

Member Function Documentation

◆ AddEntities()

void OgreNewt::CollisionPrimitives::TreeCollision::AddEntities ( const Ogre::SceneNode *  node,
const Ogre::SceneNode *  mainNode,
const Ogre::Vector3  scale,
FaceWinding  fw = FW_DEFAULT 
)

Definition at line 747 of file OgreNewt_CollisionPrimitives.cpp.

◆ addPoly()

void OgreNewt::CollisionPrimitives::TreeCollision::addPoly ( Ogre::Vector3 *  polys,
unsigned int  ID 
)

add a poly to the tree collision

Add a single poly to the tree collision.

Parameters
polyspointer to an array of 3 Vector3D objects representing the global position of each poly.
IDand identifier to assign to this poly, that can be retrieved later upon collision detection.

Definition at line 904 of file OgreNewt_CollisionPrimitives.cpp.

◆ finish()

void OgreNewt::CollisionPrimitives::TreeCollision::finish ( bool  optimize)

finish the tree collision

Definition at line 909 of file OgreNewt_CollisionPrimitives.cpp.

◆ newtonRayCastCallback()

dFloat _CDECL OgreNewt::CollisionPrimitives::TreeCollision::newtonRayCastCallback ( const NewtonBody *const  body,
const NewtonCollision *const  treeCollision,
dFloat  distance,
dFloat *  normal,
int  faceId,
void *  userData 
)
static

used internally

TODO: what do we need to return here?

Definition at line 932 of file OgreNewt_CollisionPrimitives.cpp.

◆ setRayCastCallbackactive()

void OgreNewt::CollisionPrimitives::TreeCollision::setRayCastCallbackactive ( bool  active = true)
inline

set RayCastCallback active/disabled

Parameters
activetrue = Callback active; false = Callback disabled

Definition at line 373 of file OgreNewt_CollisionPrimitives.h.

◆ start()

void OgreNewt::CollisionPrimitives::TreeCollision::start ( int  id)

start a tree collision creation

Definition at line 889 of file OgreNewt_CollisionPrimitives.cpp.


The documentation for this class was generated from the following files: