Shape.
More...
#include <Shape.h>
|
|
eShape | m_eShapeType = eShape::Unknown |
| | Type of shape.
|
| |
|
eMotion | m_eMotionType = eMotion::Static |
| | How shape moves.
|
| |
|
float | m_fElasticity = 1.0f |
| | Elasticity, aka restitution, bounciness.
|
| |
|
bool | m_bIsSensor = false |
| | Sensor only, no rebound on collision.
|
| |
|
CAabb2D | m_cAABB |
| | Axially aligned bounding box in World Space.
|
| |
|
bool | m_bCanCollide = true |
| | Can collide with other shapes.
|
| |
|
float | m_fOrientation = 0.0f |
| | Orientation angle.
|
| |
|
void * | m_pUser |
| | Spare pointer for user in case they might need one.
|
| |
|
Vector2 | m_vRotCenter |
| | Center of rotation.
|
| |
|
float | m_fRotSpeed = 0.0f |
| | Rotation speed.
|
| |
|
bool | m_bRotating = false |
| | Whether rotating.
|
| |
|
|
Vector2 | m_vPos |
| | Position, access ONLY through get and set functions.
|
| |
|
CAabb2D | m_cObjSpaceAABB |
| | Axially aligned bounding box in object space.
|
| |
|
|
static float | m_fGravity = 0.0f |
| | Gravitational constant.
|
| |
|
static float | m_fTimeStep = 0.0f |
| | Time step per animation frame (fictional).
|
| |
CShape is the base class for all shapes.
◆ CShape()
Constructs a shape described by a shape descriptor. It is assumed that the shape is collidable.
- Parameters
-
◆ ~CShape()
This is needed because virtual functions. Otherwise you risk memory leaks. Apparently.
◆ AddAABBPoint()
| void CShape::AddAABBPoint |
( |
const Vector2 & | p | ) |
|
Extend m_cObjSpaceAABB and m_cAABB to cover a new point.
- Parameters
-
| p | A point in Object Space. |
◆ CollisionDetected()
| const bool CShape::CollisionDetected |
( |
CContactDesc & | c | ) |
const |
|
virtual |
Collision detection with a dynamic circle. This virtual function is a stub that will be overridden by the appropriate functions that do collision detection for various specific shapes.
- Parameters
-
| c | [in, out] Contact descriptor for this collision. |
- Returns
- true is there was a collision.
Reimplemented in Shapes::CArc, Shapes::CCircle, Shapes::CLineSeg, and Shapes::CPoint.
◆ GetAABB()
| const CAabb2D & CShape::GetAABB |
( |
| ) |
const |
Reader function for the axially aligned bounding box.
- Returns
- Axially aligned bounding box.
◆ GetCanCollide()
| const bool CShape::GetCanCollide |
( |
| ) |
const |
Reader function for the collidable flag.
- Returns
- true if shape can collide.
◆ GetElasticity()
| const float CShape::GetElasticity |
( |
| ) |
const |
Reader function for the elasticity.
- Returns
- Elasticity.
◆ GetMotionType()
| const eMotion CShape::GetMotionType |
( |
| ) |
const |
Reader function for the motion type.
- Returns
- Motion type.
◆ GetOrientation()
| const float CShape::GetOrientation |
( |
| ) |
const |
Reader function for orientation.
- Returns
- Orientation.
◆ GetPos()
| const Vector2 & CShape::GetPos |
( |
| ) |
const |
Reader function for the position.
- Returns
- Position.
◆ GetRotating()
| const bool CShape::GetRotating |
( |
| ) |
const |
Reader function for rotation flag.
- Returns
- true if rotating.
◆ GetRotCenter()
| const Vector2 & CShape::GetRotCenter |
( |
| ) |
const |
Reader function for the center of rotation.
- Returns
- Center of rotation.
◆ GetRotSpeed()
| const float CShape::GetRotSpeed |
( |
| ) |
const |
Reader function for rotation speed.
- Returns
- Rotation speed.
◆ GetSensor()
| const bool CShape::GetSensor |
( |
| ) |
const |
Reader function for the sensor setting.
- Returns
- true if this shape is a sensor.
◆ GetShapeType()
| const eShape CShape::GetShapeType |
( |
| ) |
const |
Reader function for the shape type.
- Returns
- Shape type.
◆ GetUserPtr()
| void * CShape::GetUserPtr |
( |
| ) |
const |
Reader function for the user pointer.
- Returns
- User pointer.
◆ move()
Virtual move function. This is for shapes that move, obviously not static ones. Kinematic shapes are handled here. Dynamic shapes get handled by a virtual function in CDynamicCircle.
Reimplemented in Shapes::CDynamicCircle.
◆ Reset()
◆ Rotate()
| void CShape::Rotate |
( |
const Vector2 & | v, |
|
|
float | a ) |
|
virtual |
◆ SetAABBPoint()
| void CShape::SetAABBPoint |
( |
const Vector2 & | p | ) |
|
Set m_cObjSpaceAABB and m_cAABB to a single point.
- Parameters
-
| p | A point in Object Space. |
◆ SetCanCollide()
| void CShape::SetCanCollide |
( |
bool | b = true | ) |
|
This function should be used to enable or disable collisions at run-time.
- Parameters
-
| b | true if collisions are enabled, false if disabled. |
◆ SetOrientation()
| void CShape::SetOrientation |
( |
float | a | ) |
|
◆ SetPos()
| void CShape::SetPos |
( |
const Vector2 & | p | ) |
|
Writer function for the position. This both changes the shape's position and translates its AABB.
- Parameters
-
◆ SetRotating()
| void CShape::SetRotating |
( |
bool | b | ) |
|
- Parameters
-
| b | true to start rotating, false to stop rotating. |
◆ SetRotCenter()
| void CShape::SetRotCenter |
( |
const Vector2 & | p | ) |
|
◆ SetRotSpeed()
| void CShape::SetRotSpeed |
( |
float | s | ) |
|
◆ SetUserPtr()
| void CShape::SetUserPtr |
( |
void * | p | ) |
|
Writer function for the user pointer.
- Parameters
-