NLS Engine  v0.1
The Next Logical Step in game engine design.
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Defines
ComponentLinearVelocity.h
Go to the documentation of this file.
00001 
00011 #pragma once
00012 
00013 #include <threading.h>
00014 
00015 #include "../../sharedbase/ComponentInterface.h"
00016 #include "../InterfaceUpdateable.h"
00017 
00018 #include "../Types.h"
00019 
00020 namespace Physics {
00021   struct ComponentLinearVelocityData {
00023     Vector3D velocity;
00024     
00025     mutable Threading::ReadWriteMutex mutex;
00026   };
00027   typedef std::shared_ptr<ComponentLinearVelocityData> ComponentLinearVelocityDataPointer;
00028   
00029   struct SwapMarker {
00030     bool needed;
00031     mutable Threading::ReadWriteMutex mutex;
00032   };
00033 }
00034 
00035 namespace Physics {
00036   class ComponentLinearVelocity : public InterfaceUpdateable {
00037   public:
00038     ComponentLinearVelocity(EntitySPTR, ModuleInterface*);
00039     virtual ~ComponentLinearVelocity();
00040     
00041   public: // API methods
00042     bool SetVelocity(Vector3D);
00043     
00044   private: // Overridden methods
00045     void Update(double);
00046     
00047   private: // Member methods
00048     
00049   private: // Member data
00050     ComponentLinearVelocityDataPointer primaryBuffer;
00051     ComponentLinearVelocityDataPointer secondaryBuffer;
00052     SwapMarker swap;
00053   };
00054 }