Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
Mezzanine::GravityWell Class Reference

This is a gravity well implementation of the AreaEffect class. More...

#include <gravitywell.h>

+ Inheritance diagram for Mezzanine::GravityWell:
+ Collaboration diagram for Mezzanine::GravityWell:

Public Member Functions

 GravityWell (World *TheWorld)
 Blank constructor. More...
 
 GravityWell (const String &Name, World *TheWorld)
 Class constructor. More...
 
 GravityWell (const String &Name, Physics::CollisionShape *Shape, World *TheWorld)
 Class constructor. More...
 
 GravityWell (const XML::Node &SelfRoot, World *TheWorld)
 XML constructor. More...
 
virtual ~GravityWell ()
 Class destructor.
 
virtual void ApplyEffect ()
 
virtual Boole GetAllowWorldGravity () const
 Gets whether or not world gravity is is removed for objects inside this field. More...
 
virtual Real GetAttenuationAmount () const
 Gets the amount force is attenuated over distance. More...
 
virtual Mezzanine::AttenuationStyle GetAttenuationStyle () const
 Gets the Style of attenuation applied. More...
 
virtual String GetDerivedSerializableName () const
 Gets the most derived serializable name of this WorldObject. More...
 
virtual Real GetFieldStrength () const
 Gets the strength of the field. More...
 
virtual Mezzanine::WorldObjectType GetType () const
 Gets the type of the object instance. More...
 
virtual void ProtoDeSerializeProperties (const XML::Node &SelfRoot)
 Take the data stored in an XML Node and overwrite the properties of this object with it. More...
 
virtual void ProtoSerializeProperties (XML::Node &SelfRoot) const
 Convert the properties of this class to an XML::Node ready for serialization. More...
 
virtual void SetAllowWorldGravity (Boole WorldGravity)
 Sets whether or not world gravity should be removed for objects in this field. More...
 
virtual void SetAttenuation (const Real Amount, const Mezzanine::AttenuationStyle Style)
 Sets the attenuation for this field. More...
 
virtual void SetAttenuationAmount (const Real Amount)
 Sets the amount of force that is attenuated over distance. More...
 
virtual void SetAttenuationStyle (const Mezzanine::AttenuationStyle Style)
 Sets the method of attenuation of force over a distance. More...
 
virtual void SetFieldStrength (const Real FieldStrength)
 Sets the strenth of the field. More...
 
- Public Member Functions inherited from Mezzanine::AreaEffect
 AreaEffect (World *TheWorld)
 Blank constructor. More...
 
 AreaEffect (const String &Name, World *TheWorld)
 Class constructor. More...
 
 AreaEffect (const String &Name, Physics::CollisionShape *Shape, World *TheWorld)
 Class constructor. More...
 
virtual ~AreaEffect ()
 Class destructor.
 
virtual void _NotifyProxyDestroyed (WorldProxy *ToBeDestroyed)
 Notifies that a proxy belonging to this WorldObject is being forcibly destroyed, and it needs to update. More...
 
virtual void _Update ()
 Utility function for altering or checking the World Object every frame. More...
 
virtual void AddToWorld ()
 Adds the object to the World. More...
 
ObjectContainerGetAddedObjects ()
 Gets the list of objects that have been added to the list since the last simulation step. More...
 
virtual Physics::GhostProxyGetGhostProxy () const
 Gets a pointer to the physics portion of this AreaEffect. More...
 
virtual Vector3 GetLocation () const
 Gets this objects current location. More...
 
UInt32 GetNumAddedObjects () const
 Gets the number of objects added to this AE since the last update. More...
 
UInt32 GetNumOverlappingObjects () const
 Gets the number of objects currently overlapping with this AE. More...
 
UInt32 GetNumRemovedObjects () const
 Gets the number of objects removed from this AE since the last update. More...
 
virtual Quaternion GetOrientation () const
 Gets this objects current orientation. More...
 
ObjectContainerGetOverlappingObjects ()
 Gets the list of objects within this field. More...
 
virtual void GetProxies (ProxyContainer &Proxies)
 Populates a container with all of the WorldProxies being used by this WorldObject. More...
 
virtual void GetProxies (const UInt32 Types, ProxyContainer &Proxies)
 Populates a container with all the WorldProxies being used by this WorldObject specified in a provided mask. More...
 
ObjectContainerGetRemovedObjects ()
 Gets the list of objects that have been removed from the list since the last simulation step. More...
 
virtual Vector3 GetScale () const
 Gets the scaling currently being applied to this object. More...
 
virtual Boole IsInWorld () const
 Gets whether or not this object is currently in the world. More...
 
virtual Boole IsKinematic () const
 Checks of the object is kinematic. More...
 
virtual Boole IsStatic () const
 Checks of the object is static. More...
 
virtual void Pitch (const Real Angle)
 Rotate the object around the X axis. More...
 
virtual void ProtoDeSerializeProxies (const XML::Node &SelfRoot)
 Take the data stored in an XML Node and overwrite the proxies of this object with it. More...
 
virtual void ProtoSerializeProxies (XML::Node &SelfRoot) const
 Convert the proxies of this class to an XML::Node ready for serialization. More...
 
virtual void RemoveFromWorld ()
 Removes the object from the World. More...
 
virtual void Roll (const Real Angle)
 Rotate the object around the Z axis. More...
 
virtual void Rotate (const Vector3 &Axis, const Real Angle)
 Rotates the object from it's existing rotation. More...
 
virtual void Rotate (const Quaternion &Rotation)
 Rotates the object from it's existing rotation. More...
 
virtual void Scale (const Vector3 &Scale)
 Scales the object from it's current size. More...
 
virtual void Scale (const Real X, const Real Y, const Real Z)
 Scales the object from it's current size. More...
 
virtual void SetLocation (const Vector3 &Loc)
 Sets the location of this object in parent space. More...
 
virtual void SetLocation (const Real X, const Real Y, const Real Z)
 Sets the location of this object in parent space via Reals. More...
 
virtual void SetOrientation (const Quaternion &Ori)
 Sets the orientation of this object in parent space. More...
 
virtual void SetOrientation (const Real X, const Real Y, const Real Z, const Real W)
 Sets the orientation of this object in parent space via Reals. More...
 
virtual void SetScale (const Vector3 &Sc)
 Sets the scaling to be applied to this object. More...
 
virtual void SetScale (const Real X, const Real Y, const Real Z)
 Sets the scaling to be applied to this object via Reals. More...
 
virtual void Translate (const Vector3 &Trans)
 Moves this object from it's current location. More...
 
virtual void Translate (const Real X, const Real Y, const Real Z)
 Moves this object from it's current location. More...
 
virtual void Yaw (const Real Angle)
 Rotate the object around the Y axis. More...
 
- Public Member Functions inherited from Mezzanine::WorldObject
 WorldObject (World *TheWorld)
 Blank constructor. More...
 
 WorldObject (const String &Name, World *TheWorld)
 Class constructor. More...
 
virtual ~WorldObject ()
 Class destructor.
 
virtual void _NotifyCollisionState (Physics::Collision *Col, const Physics::CollisionState State)
 Notifies this World Object of a collision that is occuring with it. More...
 
virtual const StringGetName () const
 Gets the name of this object. More...
 
virtual WorldGetWorld () const
 Gets the world this object currently belongs to. More...
 
virtual void ProtoDeSerialize (const XML::Node &SelfRoot)
 Take the data stored in an XML Node and overwrite this object with it. More...
 
virtual void ProtoSerialize (XML::Node &ParentNode) const
 Convert this class to an XML::Node ready for serialization. More...
 
- Public Member Functions inherited from Mezzanine::TransformableObject
virtual ~TransformableObject ()
 Class Destructor.
 
virtual Vector3 ConvertGlobalToLocal (const Vector3 &Location) const
 Converts a point in global space to the same point in local space. More...
 
virtual Quaternion ConvertGlobalToLocal (const Quaternion &Orientation) const
 Converts a rotation in global space to the same rotation in local space. More...
 
virtual Vector3 ConvertLocalToGlobal (const Vector3 &Location) const
 Converts a point in local space to the same point in global space. More...
 
virtual Quaternion ConvertLocalToGlobal (const Quaternion &Orientation) const
 Converts a rotation in local space to the same rotation in global space. More...
 

Static Public Member Functions

static String GetSerializableName ()
 Get the name of the the XML tag the proxy class will leave behind as its instances are serialized. More...
 
- Static Public Member Functions inherited from Mezzanine::AreaEffect
static String GetSerializableName ()
 Get the name of the the XML tag the proxy class will leave behind as its instances are serialized. More...
 
- Static Public Member Functions inherited from Mezzanine::WorldObject
static String GetSerializableName ()
 Get the name of the the XML tag the proxy class will leave behind as its instances are serialized. More...
 

Protected Attributes

Boole AllowWorldGrav
 Should world gravity ne ignored.
 
Real AttenAmount
 how much does the Gravity attenuate.
 
Mezzanine::AttenuationStyle AttenStyle
 How does gravity.
 
Real Strength
 The amount of force exerted on other objects.
 
- Protected Attributes inherited from Mezzanine::AreaEffect
ObjectContainer AddedObjects
 Container of actors that have been added since last frame. More...
 
ProxyContainer AEProxies
 Container of proxies that representing this AE field. More...
 
Physics::GhostProxyGhost
 A pointer to the ghost powering this AE field. More...
 
ObjectContainer OverlappingObjects
 Container for actors within the field area. More...
 
ObjectContainer RemovedObjects
 Container of actors that have been removed since last frame. More...
 
- Protected Attributes inherited from Mezzanine::WorldObject
CollisionContainer CurrentCollisions
 This member stores all existing collision events referencing this object. More...
 
String ObjectName
 The name of the object. More...
 
WorldParentWorld
 This is the world this object belongs to and will be inserted in/removed from. More...
 

Additional Inherited Members

- Public Types inherited from Mezzanine::AreaEffect
typedef ObjectContainer::const_iterator ConstObjectIterator
 Const Iterator type for Object instances stored by this class.
 
typedef std::vector< WorldObject * > ObjectContainer
 Basic container type for Object storage by this class.
 
typedef ObjectContainer::iterator ObjectIterator
 Iterator type for Object instances stored by this class.
 
- Public Types inherited from Mezzanine::WorldObject
typedef std::set< Physics::Collision * > CollisionContainer
 Basic container type for the current collisions applied to this object.
 
typedef CollisionContainer::iterator CollisionIterator
 Iterator type for the current collisions applied to this object.
 
typedef CollisionContainer::const_iterator ConstCollisionIterator
 Const Iterator type for the current collisions applied to this object.
 
typedef ProxyContainer::const_iterator ConstProxyIterator
 Const Iterator type for WorldProxy instances stored by this class.
 
typedef std::vector< WorldProxy * > ProxyContainer
 Basic container type for WorldProxy storage by this class.
 
typedef ProxyContainer::iterator ProxyIterator
 Iterator type for WorldProxy instances stored by this class.
 
- Protected Member Functions inherited from Mezzanine::AreaEffect
virtual void CreateAreaEffect (Physics::CollisionShape *Shape)
 Common constructor method for AreaEffect base class. More...
 
virtual void DestroyAreaEffect ()
 Common destructor method for AreaEffect base class. More...
 

Detailed Description

This is a gravity well implementation of the AreaEffect class.

This class is not a gravity field, where gravity only pulls in one direction. Instead this class will always pull objects inside it towards the field center.
This class works best with sphere's, but can be made to work with any shape.

Definition at line 53 of file gravitywell.h.

Constructor & Destructor Documentation

Mezzanine::GravityWell::GravityWell ( World TheWorld)

Blank constructor.

Parameters
TheWorldA pointer to the world this object belongs to.

Definition at line 57 of file gravitywell.cpp.

Mezzanine::GravityWell::GravityWell ( const String Name,
World TheWorld 
)

Class constructor.

Parameters
NameThe name to be given to this object.
TheWorldA pointer to the world this object belongs to.

Definition at line 65 of file gravitywell.cpp.

Mezzanine::GravityWell::GravityWell ( const String Name,
Physics::CollisionShape Shape,
World TheWorld 
)

Class constructor.

Parameters
NameThe name to be given to this object.
ShapeA pointer to the Collision shape that will be applied to this object.
TheWorldA pointer to the world this object belongs to.

Definition at line 73 of file gravitywell.cpp.

Mezzanine::GravityWell::GravityWell ( const XML::Node SelfRoot,
World TheWorld 
)

XML constructor.

Parameters
SelfRootAn XML::Node containing the data to populate this class with.
TheWorldA pointer to the world this object belongs to.

Definition at line 81 of file gravitywell.cpp.

Member Function Documentation

void Mezzanine::GravityWell::ApplyEffect ( )
virtual

Todo:
This currently will apply this fields force uniformly to all rigid proxies contained in a WorldObject. Instead this should perhaps apply only to the ones in the field, or perhaps apply force based on the proxy position rather than the WorldObject position to get more interesting results.
Todo:
Update to allow the application of force to soft proxies.

Implements Mezzanine::AreaEffect.

Definition at line 98 of file gravitywell.cpp.

Boole Mezzanine::GravityWell::GetAllowWorldGravity ( ) const
virtual

Gets whether or not world gravity is is removed for objects inside this field.

Returns
Returns a bool indicating whether objects inside are affected by world gravity.

Definition at line 192 of file gravitywell.cpp.

Real Mezzanine::GravityWell::GetAttenuationAmount ( ) const
virtual

Gets the amount force is attenuated over distance.

Returns
Returns a Real representing the amount of force that is dropped per 1 unit of distance (with linear attenuation).

Definition at line 210 of file gravitywell.cpp.

Mezzanine::AttenuationStyle Mezzanine::GravityWell::GetAttenuationStyle ( ) const
virtual

Gets the Style of attenuation applied.

Returns
Returns the style of attenuation currently being used by this field.

Definition at line 204 of file gravitywell.cpp.

String Mezzanine::GravityWell::GetDerivedSerializableName ( ) const
virtual

Gets the most derived serializable name of this WorldObject.

Note
When creating a new WorldObject class verify this method has a valid return for it in order for serialization to work properly.
Returns
Returns the name of the XML tag from the most derived class of "this".

Reimplemented from Mezzanine::AreaEffect.

Definition at line 266 of file gravitywell.cpp.

Real Mezzanine::GravityWell::GetFieldStrength ( ) const
virtual

Gets the strength of the field.

Returns
Returns a Real representing the value that is being multiplied by the direction to determine force appied to objects.

Definition at line 186 of file gravitywell.cpp.

String Mezzanine::GravityWell::GetSerializableName ( )
static

Get the name of the the XML tag the proxy class will leave behind as its instances are serialized.

Returns
A string containing the name of this class.

Definition at line 269 of file gravitywell.cpp.

Mezzanine::WorldObjectType Mezzanine::GravityWell::GetType ( ) const
virtual

Gets the type of the object instance.

Returns
Returns the type of the object instance

Reimplemented from Mezzanine::AreaEffect.

Definition at line 95 of file gravitywell.cpp.

void Mezzanine::GravityWell::ProtoDeSerializeProperties ( const XML::Node SelfRoot)
virtual

Take the data stored in an XML Node and overwrite the properties of this object with it.

Parameters
SelfRootAn XML::Node containing the data to populate this class with.

Reimplemented from Mezzanine::AreaEffect.

Definition at line 234 of file gravitywell.cpp.

void Mezzanine::GravityWell::ProtoSerializeProperties ( XML::Node SelfRoot) const
virtual

Convert the properties of this class to an XML::Node ready for serialization.

Parameters
SelfRootThe root node containing all the serialized data for this instance.

Reimplemented from Mezzanine::AreaEffect.

Definition at line 216 of file gravitywell.cpp.

void Mezzanine::GravityWell::SetAllowWorldGravity ( Boole  WorldGravity)
virtual

Sets whether or not world gravity should be removed for objects in this field.

Remarks
Changing this value while the field is in the world and active is not recommended.
Parameters
WorldGravityIf true, then forces exerted by this field will be added to the world gravity, otherwise world gravity for objects inside will be set to zero.

Definition at line 189 of file gravitywell.cpp.

void Mezzanine::GravityWell::SetAttenuation ( const Real  Amount,
const Mezzanine::AttenuationStyle  Style 
)
virtual

Sets the attenuation for this field.

Parameters
AmountThe amount of force that is dropped off per 1 unit of distance objects are from the AE center.
StyleThe style of attenuation to apply, see the AttenuationStyle enum for more details.

Definition at line 195 of file gravitywell.cpp.

void Mezzanine::GravityWell::SetAttenuationAmount ( const Real  Amount)
virtual

Sets the amount of force that is attenuated over distance.

Parameters
AmountThe amount of force that is dropped off per 1 unit of distance objects are from the AE source.

Definition at line 207 of file gravitywell.cpp.

void Mezzanine::GravityWell::SetAttenuationStyle ( const Mezzanine::AttenuationStyle  Style)
virtual

Sets the method of attenuation of force over a distance.

Parameters
StyleThe style of attenuation to apply, see the AttenuationStyle enum for more details.

Definition at line 201 of file gravitywell.cpp.

void Mezzanine::GravityWell::SetFieldStrength ( const Real  FieldStrength)
virtual

Sets the strenth of the field.

Remarks
The direction of the field is based on the current position of the object in the field. Once that direction is calculated it will be multiplied by this value to determine the force the field will apply to the object.
Parameters
FieldStrengthThe strength the field will have when exerting force onto other objects.

Definition at line 183 of file gravitywell.cpp.


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