netAspect.h

Go to the documentation of this file.
00001 /*
00002  * netAspect.h
00003  *
00004  */
00005 
00006 #ifndef NETASPECT_H_
00007 #define NETASPECT_H_
00008 
00009 #include <messages.h>
00010 #include <aspect.h>
00011 #include <OgreVector3.h>
00012 #include <OgreQuaternion.h>
00013 #include <utils.h>
00014 
00015 namespace FastEcslent {
00016         class Entity;
00017 
00018         class NetAspect : public UnitAspect {
00019                 private:
00020                         int id;
00021 
00022                         Ogre::Vector3 remoteVel;
00023                         Ogre::Vector3 remotePos;
00024                         Ogre::Vector3 nextRemotePos;
00025                         Ogre::Vector3 nextPos;
00026                         Ogre::Vector3 diffPos;
00027                         Ogre::Vector3 diffPosFrac;
00028 
00029                         Ogre::Quaternion remoteQuat;
00030                         Ogre::Quaternion destOrie;
00031                         Ogre::Quaternion srcOrie;
00032                         Ogre::Quaternion finalDestOrie;
00033                         float rotFactor;
00034                         float rotProgress;
00035 
00036                         int oldTime;
00037                         float latency;
00038                         float nSteps;
00039 
00040                         Ogre::Quaternion qDelta;
00041                         float deltaYaw;
00042 
00043                         bool firstTick;
00044 
00045                         State statusData;
00046 
00047                         void initNetworking();
00048                         void updateServer(float newDS, float newDH);
00049                     bool withinSpeedTolerance(float a, float b);
00050                     bool withinHeadingTolerance(float a, float b);
00051                     void squalchOtherClients();
00052                     bool isValid(State *state);
00053                     void clearQueue(std::deque<State*> * queue, int size);
00054                 protected:
00055 
00056                 public:
00057                     NetAspect (Entity* ent, UnitAspectType at): UnitAspect(ent, at) {};
00058 
00059                         void init();
00060                         void tick(double dt);
00061                         void lerpPos();
00062                         void lerpRot();
00063                         void updateEcslent(double dt);
00064                         void squalch();
00065 
00066                         float ds;
00067                         float dh;
00068 
00069                         float SPEED_TOLERANCE;
00070                         float HEADING_TOLERANCE;
00071 
00072                         std::deque<State *> updateQueue;
00073         };
00074 
00075 }
00076 
00077 #endif /* NETASPECT_H_ */

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