phoenix::PhPolygonCollisionHandler Class Reference

The polygon collision handler. More...

#include <PhPolygonCollision.h>

List of all members.

Public Member Functions

 PhPolygonCollisionHandler ()
 Construct.
 ~PhPolygonCollisionHandler ()
 Destruct.
PhCollisionData isColliding (PhPolygon A, PhPolygon B)
 Is colliding (polygon to polygon).
void testObjectCollidingStatic (PhCollisionObject *A)
 Test static collisions.
bool isColliding (PhCollisionObject *A, PhCollisionObject *B)
 Is colliding (object to object).
void testCollisions ()
 Test collisions.
void addObject (PhCollisionObject *a)
 Add object.
void removeObject (PhCollisionObject *a)
 Remove object.
void addStaticGeometry (PhPolygon p, int t=1)
 Add static geometry.
void addStaticGeometry (PhStaticGeometry g)
 Add static geometry.
void removeStaticGeometry (PhStaticGeometry g)
 Remove static geometry.
vector< PhStaticGeometrygetStaticGeometry ()
 Get static geometry.
void clearStaticGeometry ()
 Clear static geometry.

Protected Attributes

vector< PhCollisionObject * > colobjs
 List of collision objects.
vector< PhStaticGeometrylevel
 List of static geometry.


Detailed Description

The polygon collision handler.

Provides a simple and effective way to test for collisions using polygons and collision objects.

See also:
phoenix::PhCollisionObject

Member Function Documentation

PhCollisionData phoenix::PhPolygonCollisionHandler::isColliding ( PhPolygon  A,
PhPolygon  B 
)

Is colliding (polygon to polygon).

polygon to polygon, can be called if you don't want to use collision objects or just want some simple tests.

Parameters:
A The polygon to test.
B The polygon to test against.
Returns:
Collision data from this test.

void phoenix::PhPolygonCollisionHandler::testObjectCollidingStatic ( PhCollisionObject A  ) 

Test static collisions.

Test a collision object against the static geometry and performs callback. Can be called directly, but this function is called by testObjectCollisions().

Parameters:
A The object to test.
See also:
isColliding(), testCollisions(), phoenix::PhStaticGeometry, phoenix::PhCollisionObject

bool phoenix::PhPolygonCollisionHandler::isColliding ( PhCollisionObject A,
PhCollisionObject B 
)

Is colliding (object to object).

Does collision testing between two objects, calls both callbacks for the objects. can be called directly, but this function is called by testObjectCollisions().

See also:
isColliding(), testCollisions(), phoenix::PhCollisionObject

void phoenix::PhPolygonCollisionHandler::testCollisions (  ) 

Test collisions.

This is the main function of the collision manager. This goes through all the collision objects and tests them against each other and the list of static geometry. It does callbacks and if used in conjuction with the scenemanager can do it nearly transparently.

See also:
phoenix::PhSceneManager::setCollisionHandler

void phoenix::PhPolygonCollisionHandler::addObject ( PhCollisionObject a  ) 

Add object.

Parameters:
a The object to be added to the list.
See also:
removeObject(), phoenix::PhCollisionObject

void phoenix::PhPolygonCollisionHandler::removeObject ( PhCollisionObject a  ) 

Remove object.

Parameters:
a The object to be removed from the list.
See also:
addObject(), phoenix::PhCollisionObject

void phoenix::PhPolygonCollisionHandler::addStaticGeometry ( PhPolygon  p,
int  t = 1 
)

Add static geometry.

Adds static geometry given a polygon and a type. Usually a type of 1 is treated as a solid block and it is the defualt for this function.

Parameters:
p The polygon to be added as static geometry.
t The type.
See also:
removeStaticGeometry(), phoenix::PhStaticGeometry

void phoenix::PhPolygonCollisionHandler::addStaticGeometry ( PhStaticGeometry  g  ) 

Add static geometry.

Parameters:
g The static geometry to be added to the list.
See also:
removeStaticGeometry(), phoenix::PhStaticGeometry

void phoenix::PhPolygonCollisionHandler::removeStaticGeometry ( PhStaticGeometry  g  ) 

Remove static geometry.

Parameters:
g The static geometry to be removed.
See also:
addStaticGeometry(), clearStaticGeometry, phoenix::PhStaticGeometry

vector<PhStaticGeometry> phoenix::PhPolygonCollisionHandler::getStaticGeometry (  ) 

Get static geometry.

This returns a list of all the static geometry. This can be used to draw all the static geometry if you really wanted to.

Returns:
a std::vector list of all the static geometry.

void phoenix::PhPolygonCollisionHandler::clearStaticGeometry (  ) 

Clear static geometry.

Removes all the static geometry from the list.


Member Data Documentation

vector<PhCollisionObject*> phoenix::PhPolygonCollisionHandler::colobjs [protected]

List of collision objects.

A list of all collision objects for testing.

See also:
addObject(), removeObject(), testCollisions(), isColliding()

vector<PhStaticGeometry> phoenix::PhPolygonCollisionHandler::level [protected]

List of static geometry.

A list of static geometry used for testing.

See also:
phoenix::PhStaticGeometry, addStaticGeometry(), removeStaticGeometry(), testCollisions(), testObjectCollidingStatic()


The documentation for this class was generated from the following file:
Generated on Tue Nov 20 21:59:24 2007 for Phoenix by  doxygen 1.5.4