flock.h

Go to the documentation of this file.
00001 /*
00002  * flock.h
00003  *
00004  *  Created on: Jan 24, 2012
00005  *      Author: sushil
00006  */
00007 
00008 #ifndef FLOCK_H_
00009 #define FLOCK_H_
00010 
00011 #include <OgreVector3.h>
00012 
00013 #include <distanceMgr.h>
00014 #include <entityMgr.h>
00015 #include <utils.h>
00016 #include <const.h>
00017 
00018 #include<command.h>
00019 #include<group.h>
00020 
00021 
00022 namespace FastEcslent {
00023 
00024         class Flock: public Tactic {
00025         private:
00026                 bool valid (Group *grp){return true;};
00027                 Ogre::Vector3 avgPos;
00028                 Ogre::Vector3 avgVel;
00029                 Ogre::Vector3 force;
00030                 Ogre::Vector3 cohesion(int i);
00031                 float CohesionParameter;
00032                 Ogre::Vector3 alignment(int i);
00033                 float AlignmentParameter;
00034                 void computeSeparation( int leaderIndex);
00035                 float SeparationParameter;
00036                 float SeparationThreshold;
00037                 void applyForces(int leaderIndex);
00038                 float maxSpeedByAngle[MaxEnts];
00039 
00040                 void bringWithinNeighborhood();
00041                 Entity *nonNeighbors[MaxEnts];
00042                 int     nNonNeighbors;
00043 
00044 
00045                 Ogre::Vector3 forces[MaxEnts];
00046                 Entity **members;
00047                 int    nMembers;
00048                 int    nEnts;
00049                 DistanceMgr* distanceMgr;
00050                 EntityMgr*   entityMgr;
00051 
00052         public:
00053                 Flock (Group *grp, GroupTarget *tgt);
00054                 bool done();
00055                 void init();
00056                 void tick(double dt);
00057                 void postProcess(){};
00058                 virtual Command* clone() {};
00059 
00060                 int closestToTarget(bool closest);       // closest (closest==true) or furthest (closest = false)
00061                 int mostMassive(bool massivest); // most (massivest == true) and least massive (massivest == false)
00062 
00063         };
00064 
00065 }
00066 
00067 
00068 
00069 #endif /* FLOCK_H_ */

Generated on Fri Dec 13 14:54:16 2013 for FastECSLent by  doxygen 1.5.4