00001 /* 00002 * distance.h 00003 * 00004 * Created on: Jan 27, 2012 00005 * Author: sushil 00006 */ 00007 00008 #ifndef DISTANCE_H_ 00009 #define DISTANCE_H_ 00010 00011 #include <OgreVector3.h> 00012 00013 #include<options.h> 00014 #include <const.h> 00015 #include <mgr.h> 00016 #include <ent.h> 00017 00018 00019 namespace FastEcslent { 00020 00021 class Engine; 00022 00023 class DistanceMgr: public Mgr { 00024 00025 00026 private: 00027 Entity* ent; 00028 Entity* other; 00029 00030 00031 public: 00032 Options options; 00033 00034 struct CPA { 00035 00036 float cpaTime; 00037 float cpaSquaredDistance; 00038 }; 00039 00040 CPA cpa[MaxEnts][MaxEnts]; 00041 Ogre::Vector3 distanceVec[MaxEnts][MaxEnts]; 00042 Ogre::Vector3 normalizedDistanceVec[MaxEnts][MaxEnts]; 00043 00044 double distance[MaxEnts][MaxEnts]; 00045 int collisions[MaxEnts]; 00046 //int closestEnt[MaxEnts]; 00047 double closestEnemyDistance[MaxEnts]; 00048 //int closestFriend[MaxEnts]; 00049 int closestEnemy[MaxEnts]; 00050 00051 int furthestEnt[MaxEnts]; 00052 double furthestDistance[MaxEnts]; 00053 00054 int collisionTotal; 00055 double potential[MaxEnts][MaxEnts]; 00056 00057 DistanceMgr(Engine *eng, Options opts); 00058 DistanceMgr(); 00059 void init(); 00060 void tick(double dtime); 00061 void dumpAll(); 00062 void dumpOne(int i); 00063 00064 float cpaTime(const Entity *ent1, const Entity *ent2); 00065 float cpaSquaredDistance(const Entity *ent1, const Entity *ent2); 00066 00067 }; 00068 00069 } 00070 00071 00072 00073 #endif /* DISTANCE_H_ */