Classes | |
class | clan::PhysicsContext |
class | clan::PhysicsDebugDraw |
PhysicsDebugDraw class. More... | |
class | clan::PhysicsQueryAssistant |
class | clan::PhysicsWorld |
Top-level world class. More... | |
class | clan::PhysicsWorldDescription |
Physics World description class. More... | |
class | clan::PhysicsWorldDescriptionData |
Enumerations | |
enum | clan::DebugFlags { clan::f_shape = 0x0001, clan::f_joint = 0x0002, clan::f_aabb = 0x0004, clan::f_pair = 0x0008, clan::f_center_of_mass = 0x0010 } |
Physic Debug Draw flags. More... | |
Functions | |
virtual | clan::PhysicsWorldDescriptionData::~PhysicsWorldDescriptionData () |
Construction | |
clan::PhysicsContext::PhysicsContext () | |
Constructs a null instance. More... | |
clan::PhysicsContext::PhysicsContext (PhysicsWorld &pw) | |
Constructs a PhysicsContext. More... | |
Attributes | |
bool | clan::PhysicsContext::is_null () const |
Returns true if this object is invalid. More... | |
int | clan::PhysicsContext::max_bodies () const |
Returns maximum amount of bodies allowed. More... | |
int | clan::PhysicsContext::max_fixtures () const |
Returns maximum amount of fixtures allowed. More... | |
int | clan::PhysicsContext::max_joints () const |
Returns maximum amount of joints allowed. More... | |
Body | clan::PhysicsContext::get_body (int id) |
Returns the Body of the given id. If the id is invalid returns a dummy Body instead. More... | |
Fixture | clan::PhysicsContext::get_fixture (int id) |
Returns the Fixture of the given id. If the id is invalid returns a dummy Fixture instead. More... | |
Joint | clan::PhysicsContext::get_joint (int id) |
Returns the joint of the given id. If the id is invalid returns a dummy joint instead. More... | |
Construction | |
clan::PhysicsDebugDraw::PhysicsDebugDraw () | |
Constructs a null instance. More... | |
clan::PhysicsDebugDraw::PhysicsDebugDraw (const PhysicsWorld &pw) | |
Constructs a debug draw object. More... | |
clan::PhysicsDebugDraw::~PhysicsDebugDraw () | |
Attributes | |
bool | clan::PhysicsDebugDraw::is_null () const |
Returns true if this object is invalid. More... | |
void | clan::PhysicsDebugDraw::throw_if_null () const |
Throw an exception if this object is invalid. More... | |
unsigned int | clan::PhysicsDebugDraw::get_flags () const |
Return currently set up draw flags. More... | |
Operations | |
void | clan::PhysicsDebugDraw::draw (Canvas &canvas) |
Draws physic objects on the canvas. More... | |
void | clan::PhysicsDebugDraw::set_flags (unsigned int flags) |
Set draw flags. More... | |
Construction | |
clan::PhysicsQueryAssistant::PhysicsQueryAssistant () | |
Constructs a null instance. More... | |
clan::PhysicsQueryAssistant::PhysicsQueryAssistant (PhysicsWorld &pw) | |
Constructs a PhysicsQueryAssistant. More... | |
clan::PhysicsQueryAssistant::~PhysicsQueryAssistant () | |
Attributes | |
bool | clan::PhysicsQueryAssistant::is_null () const |
Returns true if this object is invalid. More... | |
bool | clan::PhysicsQueryAssistant::has_query_result () |
Check if last raycast operation has yeld any results. More... | |
int | clan::PhysicsQueryAssistant::get_query_result_amount () |
Returns the amount of objects found. More... | |
QueryResult | clan::PhysicsQueryAssistant::get_query_result (int id=0) |
Returns the raycast result. More... | |
Rectf | clan::PhysicsQueryAssistant::prepare_rect (const Pointf &point, const float range=0.001f) |
An useful method that creates a rect from a given pointf that could be used for querying. More... | |
Rectf | clan::PhysicsQueryAssistant::prepare_rect (const int x, const int y, const float range=0.001f) |
An useful method that creates a rect from two given ints that could be used for querying. More... | |
Rectf | clan::PhysicsQueryAssistant::prepare_rect (const float x, const float y, const float range=0.001f) |
An useful method that creates a rect from two given floats that could be used for querying. More... | |
Operations | |
void | clan::PhysicsQueryAssistant::raycast_first (const Pointf &start, const Pointf &end) |
Raycast to find the first object on a given line segment. More... | |
void | clan::PhysicsQueryAssistant::raycast_any (const Pointf &start, const Pointf &end) |
Raycast to find any object on a given line segment. More... | |
void | clan::PhysicsQueryAssistant::raycast_all (const Pointf &start, const Pointf &end) |
Raycast to find all objects on a given line segment. More... | |
void | clan::PhysicsQueryAssistant::query_any (const Rectf &rect) |
Query the world for any fixture that potentially overlap the provided rectangle. More... | |
void | clan::PhysicsQueryAssistant::query_some (const Rectf &rect, const int amount) |
Query the world for some fixtures that potentially overlap the provided rectangle. More... | |
void | clan::PhysicsQueryAssistant::query_all (const Rectf &rect) |
Query the world for all fixtures that potentially overlap the provided rectangle. More... | |
void | clan::PhysicsQueryAssistant::raycast (const Pointf &start, const Pointf &end) |
Execute raycasting. More... | |
void | clan::PhysicsQueryAssistant::query (const Rectf &rect) |
Execute aabb querying. More... | |
Construction | |
clan::PhysicsWorld::PhysicsWorld () | |
Constructs a null instance. More... | |
clan::PhysicsWorld::PhysicsWorld (const PhysicsWorldDescription &description) | |
Constructs a world. More... | |
clan::PhysicsWorld::~PhysicsWorld () | |
Attributes | |
Signal_v1< float > & | clan::PhysicsWorld::sig_world_step () |
Signal emitted when world's step is called. More... | |
Signal_v0 & | clan::PhysicsWorld::sig_world_destroyed () |
Signal emitted when world's destroyed. More... | |
bool | clan::PhysicsWorld::is_null () const |
Returns true if this object is invalid. More... | |
bool | clan::PhysicsWorld::is_olm_enabled () const |
Returns true if the Physics world has the object lifetime management enabled. More... | |
void | clan::PhysicsWorld::throw_if_null () const |
Throw an exception if this object is invalid. More... | |
std::string | clan::PhysicsWorld::get_name () const |
Returns the name of the Physics World. More... | |
double | clan::PhysicsWorld::get_timestep () const |
Returns the timestep for every world step. More... | |
int | clan::PhysicsWorld::get_velocity_iterations () const |
Returns the amount of velocity iterations on every world tick. More... | |
int | clan::PhysicsWorld::get_position_iterations () const |
Returns the amount of position iterations on every world tick. More... | |
int | clan::PhysicsWorld::get_physic_scale () const |
Return the amount of pixels for 1 meter in the Physics World. More... | |
PhysicsContext & | clan::PhysicsWorld::get_pc () |
Return the Physics Context of the world. More... | |
PhysicsQueryAssistant & | clan::PhysicsWorld::get_qa () |
Return the Physics Query Assistant of the world. More... | |
Operations | |
void | clan::PhysicsWorld::set_olm (const bool value=true) |
Sets the object lifetime management. If enabled the physics objects are going to be removed from the Physics Context after the last API object pointing to them cease to exist. More... | |
void | clan::PhysicsWorld::step () |
Simulates one step of the physic simulation. More... | |
void | clan::PhysicsWorld::step (float timestep, int velocity_iterations=8, int position_iterations=3) |
Simulates one step of the physic simulation. More... | |
Construction | |
clan::PhysicsWorldDescription::PhysicsWorldDescription () | |
Constructs a world description with default values. More... | |
clan::PhysicsWorldDescription::PhysicsWorldDescription (const PhysicsWorldDescription ©) | |
Constructs a PhysicsWorldDescription. More... | |
virtual | clan::PhysicsWorldDescription::~PhysicsWorldDescription () |
Attributes | |
bool | clan::PhysicsWorldDescription::is_sleep_enabled () const |
Returns if bodies are allowed to sleep when they come to rest. More... | |
bool | clan::PhysicsWorldDescription::is_olm_enabled () const |
Returns true if the Physics world has the object lifetime management enabled. More... | |
Vec2f | clan::PhysicsWorldDescription::get_gravity () const |
Returns the world gravity. More... | |
float | clan::PhysicsWorldDescription::get_timestep () const |
Returns the tick timestep. More... | |
int | clan::PhysicsWorldDescription::get_velocity_iterations () const |
Returns the amount of velocity iterations on every world tick. More... | |
int | clan::PhysicsWorldDescription::get_position_iterations () const |
Returns the amount of position iterations on every world tick. More... | |
int | clan::PhysicsWorldDescription::get_physic_scale () const |
Return the amount of pixels for 1 meter in the Physics World. More... | |
std::shared_ptr < PhysicsWorldDescriptionData > | clan::PhysicsWorldDescription::get_data (const std::string &data_name) const |
Returns the object stored in the given data name. More... | |
Operations | |
PhysicsWorldDescription & | clan::PhysicsWorldDescription::operator= (const PhysicsWorldDescription ©) |
Copy assignment operator. More... | |
void | clan::PhysicsWorldDescription::set_sleep (bool value=true) |
toggles whether the bodies are able to sleep when they come to rest. More... | |
void | clan::PhysicsWorldDescription::set_gravity (double xAcceleration, double yAcceleration) |
sets the world gravity More... | |
void | clan::PhysicsWorldDescription::set_timestep (float timestep) |
sets the tick timestep. More... | |
void | clan::PhysicsWorldDescription::set_velocity_iterations (int iterations) |
sets the amount of velocity iterations on every world tick. More... | |
void | clan::PhysicsWorldDescription::set_position_iterations (int iterations) |
sets the amount of position iterations on every world tick. More... | |
void | clan::PhysicsWorldDescription::set_physic_scale (int pixels) |
Change the amount of pixels for 1 meter in the Physics World. Simulation works best for objects that are larger than 0.1 meter but smaller than 10 meters. More... | |
void | clan::PhysicsWorldDescription::set_olm (const bool value=true) |
Sets the object lifetime management. If enabled the physics objects are going to be removed from the Physics Context after the last API object pointing to them cease to exist. More... | |
void | clan::PhysicsWorldDescription::set_data (const std::string &data_name, const std::shared_ptr< PhysicsWorldDescriptionData > &ptr) |
Store object in description. More... | |
enum clan::DebugFlags |
clan::PhysicsContext::PhysicsContext | ( | ) |
Constructs a null instance.
clan::PhysicsContext::PhysicsContext | ( | PhysicsWorld & | pw | ) |
Constructs a PhysicsContext.
pw | = Physics World. |
clan::PhysicsDebugDraw::PhysicsDebugDraw | ( | ) |
Constructs a null instance.
clan::PhysicsDebugDraw::PhysicsDebugDraw | ( | const PhysicsWorld & | pw | ) |
Constructs a debug draw object.
pw | = Physics World. |
clan::PhysicsQueryAssistant::PhysicsQueryAssistant | ( | ) |
Constructs a null instance.
clan::PhysicsQueryAssistant::PhysicsQueryAssistant | ( | PhysicsWorld & | pw | ) |
Constructs a PhysicsQueryAssistant.
pw | = Physics World. |
clan::PhysicsWorld::PhysicsWorld | ( | ) |
Constructs a null instance.
clan::PhysicsWorld::PhysicsWorld | ( | const PhysicsWorldDescription & | description | ) |
Constructs a world.
description | = Structure that describes how to create the Physics World. |
clan::PhysicsWorldDescription::PhysicsWorldDescription | ( | ) |
Constructs a world description with default values.
clan::PhysicsWorldDescription::PhysicsWorldDescription | ( | const PhysicsWorldDescription & | copy | ) |
Constructs a PhysicsWorldDescription.
copy | = Physics World Description |
clan::PhysicsDebugDraw::~PhysicsDebugDraw | ( | ) |
clan::PhysicsQueryAssistant::~PhysicsQueryAssistant | ( | ) |
clan::PhysicsWorld::~PhysicsWorld | ( | ) |
|
virtual |
|
inlinevirtual |
void clan::PhysicsDebugDraw::draw | ( | Canvas & | canvas | ) |
Draws physic objects on the canvas.
Body clan::PhysicsContext::get_body | ( | int | id | ) |
std::shared_ptr<PhysicsWorldDescriptionData> clan::PhysicsWorldDescription::get_data | ( | const std::string & | data_name | ) | const |
Returns the object stored in the given data name.
Fixture clan::PhysicsContext::get_fixture | ( | int | id | ) |
unsigned int clan::PhysicsDebugDraw::get_flags | ( | ) | const |
Return currently set up draw flags.
Vec2f clan::PhysicsWorldDescription::get_gravity | ( | ) | const |
Returns the world gravity.
Joint clan::PhysicsContext::get_joint | ( | int | id | ) |
Returns the joint of the given id. If the id is invalid returns a dummy joint instead.
std::string clan::PhysicsWorld::get_name | ( | ) | const |
Returns the name of the Physics World.
PhysicsContext& clan::PhysicsWorld::get_pc | ( | ) |
Return the Physics Context of the world.
int clan::PhysicsWorldDescription::get_physic_scale | ( | ) | const |
Return the amount of pixels for 1 meter in the Physics World.
int clan::PhysicsWorld::get_physic_scale | ( | ) | const |
Return the amount of pixels for 1 meter in the Physics World.
int clan::PhysicsWorldDescription::get_position_iterations | ( | ) | const |
Returns the amount of position iterations on every world tick.
int clan::PhysicsWorld::get_position_iterations | ( | ) | const |
Returns the amount of position iterations on every world tick.
PhysicsQueryAssistant& clan::PhysicsWorld::get_qa | ( | ) |
Return the Physics Query Assistant of the world.
QueryResult clan::PhysicsQueryAssistant::get_query_result | ( | int | id = 0 | ) |
Returns the raycast result.
int clan::PhysicsQueryAssistant::get_query_result_amount | ( | ) |
Returns the amount of objects found.
float clan::PhysicsWorldDescription::get_timestep | ( | ) | const |
Returns the tick timestep.
double clan::PhysicsWorld::get_timestep | ( | ) | const |
Returns the timestep for every world step.
int clan::PhysicsWorldDescription::get_velocity_iterations | ( | ) | const |
Returns the amount of velocity iterations on every world tick.
int clan::PhysicsWorld::get_velocity_iterations | ( | ) | const |
Returns the amount of velocity iterations on every world tick.
bool clan::PhysicsQueryAssistant::has_query_result | ( | ) |
Check if last raycast operation has yeld any results.
|
inline |
Returns true if this object is invalid.
|
inline |
Returns true if this object is invalid.
|
inline |
Returns true if this object is invalid.
|
inline |
Returns true if this object is invalid.
bool clan::PhysicsWorldDescription::is_olm_enabled | ( | ) | const |
Returns true if the Physics world has the object lifetime management enabled.
bool clan::PhysicsWorld::is_olm_enabled | ( | ) | const |
Returns true if the Physics world has the object lifetime management enabled.
bool clan::PhysicsWorldDescription::is_sleep_enabled | ( | ) | const |
Returns if bodies are allowed to sleep when they come to rest.
int clan::PhysicsContext::max_bodies | ( | ) | const |
Returns maximum amount of bodies allowed.
int clan::PhysicsContext::max_fixtures | ( | ) | const |
Returns maximum amount of fixtures allowed.
int clan::PhysicsContext::max_joints | ( | ) | const |
Returns maximum amount of joints allowed.
PhysicsWorldDescription& clan::PhysicsWorldDescription::operator= | ( | const PhysicsWorldDescription & | copy | ) |
Copy assignment operator.
Rectf clan::PhysicsQueryAssistant::prepare_rect | ( | const Pointf & | point, |
const float | range = 0.001f |
||
) |
An useful method that creates a rect from a given pointf that could be used for querying.
Rectf clan::PhysicsQueryAssistant::prepare_rect | ( | const int | x, |
const int | y, | ||
const float | range = 0.001f |
||
) |
An useful method that creates a rect from two given ints that could be used for querying.
Rectf clan::PhysicsQueryAssistant::prepare_rect | ( | const float | x, |
const float | y, | ||
const float | range = 0.001f |
||
) |
An useful method that creates a rect from two given floats that could be used for querying.
|
inlineprotected |
Execute aabb querying.
void clan::PhysicsQueryAssistant::query_all | ( | const Rectf & | rect | ) |
Query the world for all fixtures that potentially overlap the provided rectangle.
void clan::PhysicsQueryAssistant::query_any | ( | const Rectf & | rect | ) |
Query the world for any fixture that potentially overlap the provided rectangle.
void clan::PhysicsQueryAssistant::query_some | ( | const Rectf & | rect, |
const int | amount | ||
) |
Query the world for some fixtures that potentially overlap the provided rectangle.
|
inlineprotected |
Execute raycasting.
Raycast to find all objects on a given line segment.
Raycast to find any object on a given line segment.
Raycast to find the first object on a given line segment.
void clan::PhysicsWorldDescription::set_data | ( | const std::string & | data_name, |
const std::shared_ptr< PhysicsWorldDescriptionData > & | ptr | ||
) |
Store object in description.
void clan::PhysicsDebugDraw::set_flags | ( | unsigned int | flags | ) |
Set draw flags.
void clan::PhysicsWorldDescription::set_gravity | ( | double | xAcceleration, |
double | yAcceleration | ||
) |
sets the world gravity
void clan::PhysicsWorld::set_olm | ( | const bool | value = true | ) |
Sets the object lifetime management. If enabled the physics objects are going to be removed from the Physics Context after the last API object pointing to them cease to exist.
void clan::PhysicsWorldDescription::set_olm | ( | const bool | value = true | ) |
Sets the object lifetime management. If enabled the physics objects are going to be removed from the Physics Context after the last API object pointing to them cease to exist.
void clan::PhysicsWorldDescription::set_physic_scale | ( | int | pixels | ) |
Change the amount of pixels for 1 meter in the Physics World. Simulation works best for objects that are larger than 0.1 meter but smaller than 10 meters.
void clan::PhysicsWorldDescription::set_position_iterations | ( | int | iterations | ) |
sets the amount of position iterations on every world tick.
void clan::PhysicsWorldDescription::set_sleep | ( | bool | value = true | ) |
toggles whether the bodies are able to sleep when they come to rest.
void clan::PhysicsWorldDescription::set_timestep | ( | float | timestep | ) |
sets the tick timestep.
void clan::PhysicsWorldDescription::set_velocity_iterations | ( | int | iterations | ) |
sets the amount of velocity iterations on every world tick.
Signal_v0& clan::PhysicsWorld::sig_world_destroyed | ( | ) |
Signal emitted when world's destroyed.
Signal_v1<float>& clan::PhysicsWorld::sig_world_step | ( | ) |
Signal emitted when world's step is called.
void clan::PhysicsWorld::step | ( | ) |
Simulates one step of the physic simulation.
void clan::PhysicsWorld::step | ( | float | timestep, |
int | velocity_iterations = 8 , |
||
int | position_iterations = 3 |
||
) |
Simulates one step of the physic simulation.
timestep | how much time lapse the step is going to simulate. |
velocity_iterations | How many times the velocities of the bodies are going to be iterated. Bigger amount gives better quality at a cost of speed. |
position_iterations | How many times the positions of the bodies are going to be iterated. Bigger amount gives better quality at a cost of speed. |
void clan::PhysicsWorld::throw_if_null | ( | ) | const |
Throw an exception if this object is invalid.
void clan::PhysicsDebugDraw::throw_if_null | ( | ) | const |
Throw an exception if this object is invalid.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |