Thrive
Public Types | Public Member Functions | Static Public Member Functions | List of all members
thrive::CollisionShape Class Referenceabstract

Wrapper for Bullet's collision shapes. More...

#include <collision_shape.h>

Inheritance diagram for thrive::CollisionShape:
thrive::BoxShape thrive::CapsuleShape thrive::CompoundShape thrive::ConeShape thrive::CylinderShape thrive::EmptyShape thrive::SphereShape

Public Types

enum  Axis : uint8_t { AXIS_X = 0, AXIS_Y = 1, AXIS_Z = 2 }
 Enumeration for the 3 axes. More...
 
enum  ShapeType : uint8_t {
  EMPTY_SHAPE = 0, BOX_SHAPE = 1, CAPSULE_SHAPE = 2, COMPOUND_SHAPE = 3,
  CONE_SHAPE = 4, CYLINDER_SHAPE = 5, SPHERE_SHAPE = 6
}
 Enumeration for the currently supported shape types. More...
 
using Ptr = std::shared_ptr< CollisionShape >
 Convenience typedef.
 

Public Member Functions

virtual ~CollisionShape ()=0
 Destructor.
 
virtual btCollisionShape * bulletShape () const =0
 Returns a pointer to the internal Bullet shape object. More...
 
virtual ShapeType shapeType () const =0
 The shape's type.
 
virtual StorageContainer storage () const =0
 Serializes the shape into a storage container. More...
 

Static Public Member Functions

static std::unique_ptr< CollisionShape > load (const StorageContainer &storage)
 Loads a shape from a storage container. More...
 
static luabind::scope luaBindings ()
 Lua bindings. More...
 

Detailed Description

Wrapper for Bullet's collision shapes.

Wrapping the native Bullet shape classes makes it more convenient to serialize them and bind them to scripts. It also allows us to offer a more convenient interface.

Member Enumeration Documentation

Enumeration for the 3 axes.

Some shapes require an axis for orientation, such as the cylinder shape.

Enumeration for the currently supported shape types.

Used for deserializing a shape

Member Function Documentation

virtual btCollisionShape* thrive::CollisionShape::bulletShape ( ) const
pure virtual

Returns a pointer to the internal Bullet shape object.

Returns

Implemented in thrive::SphereShape, thrive::EmptyShape, thrive::CylinderShape, thrive::ConeShape, thrive::CompoundShape, thrive::CapsuleShape, and thrive::BoxShape.

std::unique_ptr< CollisionShape > CollisionShape::load ( const StorageContainer &  storage)
static

Loads a shape from a storage container.

Parameters
storageThe storage of the shape
Returns
A new shape or an EmptyShape if the type is unknown
luabind::scope CollisionShape::luaBindings ( )
static

Lua bindings.

Returns
StorageContainer CollisionShape::storage ( ) const
pure virtual

Serializes the shape into a storage container.

Returns

Implemented in thrive::SphereShape, thrive::EmptyShape, thrive::CylinderShape, thrive::ConeShape, thrive::CompoundShape, thrive::CapsuleShape, and thrive::BoxShape.


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