Flock Class Reference

Many Boid make one Flock. Implements a complete irr::ISceneNode. More...

#include <flock.h>

List of all members.

Public Member Functions

 Flock (irr::IrrlichtDevice *d, irr::f32 size, const irr::c8 *boidMeshFile, irr::scene::ISceneNode *parent, irr::s32 id=0, const irr::core::vector3df &position=irr::core::vector3df(0, 0, 0))
 ~Flock ()
void update (irr::u32 deltaTime)
BoidaddBoid (irr::core::vector3df position, const irr::c8 *boidMeshFile)
void removeBoid (Boid *b)
void removeBoids (void)
irr::s32 getBoidCount (void)
virtual void OnPreRender ()
 Is called by scenemanager right in front of render().
virtual void render ()
virtual const irr::core::aabbox3d<
irr::f32 > & 
getBoundingBox () const
virtual irr::video::SMaterial & getMaterial (irr::s32 i)
virtual irr::s32 getMaterialCount (void)
void setScale (irr::f32 scale)
irr::core::list< Boid * > & getBoidList (void)
void setSeparationWeight (irr::s32 weight)
irr::s32 getSeparationWeight (void)
void setAlignmentWeight (irr::s32 weight)
irr::s32 getAlignmentWeight (void)
void setCohesionWeight (irr::s32 weight)
irr::s32 getCohesionWeight (void)
void setNeighborRadius (irr::s32 radius)
irr::s32 getNeighborRadius (void)
void setTarget (irr::core::vector3df target)
irr::core::vector3df getTarget (void)
void setSeekTargetWeight (irr::s32 weight)
irr::s32 getSeekTargetWeight (void)
void setTornadoWeight (irr::s32 weight)
irr::s32 getTornadoWeight (void)


Detailed Description

Many Boid make one Flock. Implements a complete irr::ISceneNode.

FlockAnimators can do funny things with Flock. Animators are attached and detached at runtime. Multiple Animators can be attached at same time. Every active Animator will add a little amount of velocity to each Boid of a Flock.

Definition at line 13 of file flock.h.


Constructor & Destructor Documentation

Flock::Flock irr::IrrlichtDevice *  d,
irr::f32  size,
const irr::c8 *  boidMeshFile,
irr::scene::ISceneNode *  parent,
irr::s32  id = 0,
const irr::core::vector3df &  position = irr::core::vector3df(0, 0, 0)
 

Constructor.

Parameters:
d : An IrrlichDevice*, needed to access media.
size : A float, defines how many Boid will create this Flock.
Todo:
change to unsinged integer.
Parameters:
boidMeshFile : A string (path and name) of a config file.
Todo:
it is only a *.3ds file, change to real config file.
Parameters:
parent : As class Flock is inheritanced from ISceneNode you must assign this object to another ISceneNode object. Use device->getSceneManager()->getRootSceneNode().
id : A signed integer, sets the unique ID of this Flock (default=0).
position : A vector (type float), defines point of Flock creation in 3d space (default is 0,0,0).
Note:
Because this is a ISceneNode, you must use "flock->drop();" instead of "delete flock;" in your application!

Flock::~Flock  ) 
 

Destructor. Removes Flock and all its Boid from scene. Also attached Animators are deleted.

Definition at line 37 of file flock.cpp.

References Debug::log(), and removeBoids().


Member Function Documentation

Boid* Flock::addBoid irr::core::vector3df  position,
const irr::c8 *  boidMeshFile
 

Adds an additional Boid to this Flock.

Todo:
check if can be called on runtime.
Parameters:
position : A vector (type float), defines point of Boid creation in 3D space.
boidMeshFile : A string (path and name) of *.3ds file.
Returns:
Returns pointer to new created Boid.

s32 Flock::getAlignmentWeight void   ) 
 

Gets weight of Flock separation behavior.

Returns:
Returns signed integer as how much seperation is mixed with other behavior rules.

Definition at line 161 of file flock.cpp.

s32 Flock::getBoidCount void   ) 
 

Returns:
Returns size of this Flock as signed integer.

Definition at line 91 of file flock.cpp.

list< Boid * > & Flock::getBoidList void   ) 
 

Used by FlockAnimators to iterate through all Boid.

Returns:
Returns Flock own list of Boid.

Definition at line 96 of file flock.cpp.

const aabbox3d< f32 > & Flock::getBoundingBox  )  const [virtual]
 

Implementation of IsceneNode interface.

Returns:
Returns the axis aligned bounding box of this node.

Definition at line 109 of file flock.cpp.

s32 Flock::getCohesionWeight void   ) 
 

Gets weight of Flock separation behavior.

Returns:
Returns signed integer as how much seperation is mixed with other behavior rules.

Definition at line 171 of file flock.cpp.

virtual irr::video::SMaterial& Flock::getMaterial irr::s32  i  )  [virtual]
 

Implementation of IsceneNode interface.

Parameters:
i : A signed integer as index of matrial you want to get.
Returns:
Returns the material based on the zero based index i. To get the amount of materials used by this scene node, use getMaterialCount(). This function is needed for inserting the node into the scene hirachy on a optimal position for minimizing renderstate changes, but can also be used to directly modify the material of a scene node.

s32 Flock::getMaterialCount void   )  [virtual]
 

Implementation of IsceneNode interface.

Returns:
Returns amount of materials used by this scene node. Currently it returns always 1 (one).

Definition at line 132 of file flock.cpp.

s32 Flock::getNeighborRadius void   ) 
 

Gets radius where Boid can search other Boid as neighbors.

Returns:
Returns signed integer as radius from center of this Boid.

Definition at line 181 of file flock.cpp.

s32 Flock::getSeekTargetWeight void   ) 
 

Gets weight of Flock seekness behavior.

Returns:
Returns signed integer as how much seekness is mixed with other behavior rules.

Definition at line 201 of file flock.cpp.

s32 Flock::getSeparationWeight void   ) 
 

Gets weight of Flock separation behavior.

Returns:
Returns signed integer as how much seperation is mixed with other behavior rules.

Definition at line 151 of file flock.cpp.

vector3df Flock::getTarget void   ) 
 

Gets target where Boid should seek to.

Returns:
Returns vector (type = float) as target.

Definition at line 191 of file flock.cpp.

s32 Flock::getTornadoWeight void   ) 
 

Gets weight of Flock tornado behavior.

Returns:
Returns signed integer as how much tornadoness is mixed with other behavior rules.

Definition at line 211 of file flock.cpp.

void Flock::OnPreRender  )  [virtual]
 

Is called by scenemanager right in front of render().

Implementation of IsceneNode interface.

Definition at line 114 of file flock.cpp.

void Flock::removeBoid Boid b  ) 
 

Removes a Boid from this Flock.

Todo:
We never received a reference to any Boid. So how can we pass it as argument? But removing must be done here in case of Boid dies.
Parameters:
b : A Boid which should be deleted.

Definition at line 66 of file flock.cpp.

void Flock::removeBoids void   ) 
 

Removes all Boid from this Flock. This is called from Destructor, you do not have to do this.

Todo:
change to private?

Definition at line 81 of file flock.cpp.

Referenced by ~Flock().

void Flock::render  )  [virtual]
 

Implementation of IsceneNode interface. Renders the node.

Definition at line 101 of file flock.cpp.

void Flock::setAlignmentWeight irr::s32  weight  ) 
 

Sets weight of Flock alignment behavior.

Parameters:
weight : A signed integer defines how much alignment is mixed with other behavior rules.

Referenced by StateTerrain::entry().

void Flock::setCohesionWeight irr::s32  weight  ) 
 

Sets weight of Flock cohesion behavior.

Parameters:
weight : A signed integer defines how much cohesion is mixed with other behavior rules.

Referenced by StateTerrain::entry().

void Flock::setNeighborRadius irr::s32  radius  ) 
 

Sets radius where Boid can search other Boid as neighbors.

Parameters:
radius : A signed integer defines radius of search.

Referenced by StateTerrain::entry().

void Flock::setScale irr::f32  scale  ) 
 

Rescales mesh aof all Boid.

Parameters:
scale : A vector3d (type = float), defines new size of boid mesh.

Referenced by StateTerrain::entry().

void Flock::setSeekTargetWeight irr::s32  weight  ) 
 

Sets weight of target seekness behavior.

Parameters:
weight : A signed integer defines weight of seek behavior.

Referenced by StateTerrain::entry().

void Flock::setSeparationWeight irr::s32  weight  ) 
 

Sets weight of Flock separation behavior.

Parameters:
weight : A signed integer defines how much seperation is mixed with other behavior rules.

Referenced by StateTerrain::entry().

void Flock::setTarget irr::core::vector3df  target  ) 
 

Sets target where Boid should seek to.

Parameters:
target : A vector (type = float) defines new target.

Referenced by StateTerrain::entry().

void Flock::setTornadoWeight irr::s32  weight  ) 
 

Sets weight of tornado behavior.

Parameters:
weight : A signed integer defines weight of tornadoness.

Referenced by StateTerrain::entry().

void Flock::update irr::u32  deltaTime  ) 
 

Call this every frame to update each Boid of this Flock. Also the bounding box of this Flock will be calculated.

Parameters:
deltaTime : An unsigned integer representing milliseconds since last call.

Definition at line 45 of file flock.cpp.


The documentation for this class was generated from the following files:
Generated on Sun Dec 2 17:09:58 2007 for Swarm by  doxygen 1.4.6-NO