Changeset 15 in flair-src for trunk/lib/FlairSimulator/src/unexported
- Timestamp:
- Apr 8, 2016, 3:40:57 PM (9 years ago)
- Location:
- trunk/lib/FlairSimulator/src/unexported
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSimulator/src/unexported/AnimPoursuite.h
r10 r15 22 22 #include <vector3d.h> 23 23 24 namespace flair 25 { 26 namespace simulator 27 { 24 namespace flair { 25 namespace simulator { 28 26 29 class AnimPoursuite : public irr::scene::ISceneNodeAnimator 30 { 31 public:32 AnimPoursuite(const irr::scene::ISceneNode* parent,float rotateSpeed = -500.0f, float zoomSpeed = 4.0f);33 27 class AnimPoursuite : public irr::scene::ISceneNodeAnimator { 28 public: 29 AnimPoursuite(const irr::scene::ISceneNode *parent, 30 float rotateSpeed = -500.0f, float zoomSpeed = 4.0f); 31 ~AnimPoursuite(); 34 32 35 void animateNode(irr::scene::ISceneNode* node, irr::u32 timeMs); 36 ISceneNodeAnimator* createClone(irr::scene::ISceneNode* node,irr::scene::ISceneManager* newManager=0); 37 bool MouseMoved(const irr::SEvent& event,irr::core::position2df MousePos); 38 void setPositionOffset(irr::core::vector3df newpos); 39 void setTargetOffset(irr::core::vector3df newpos); 33 void animateNode(irr::scene::ISceneNode *node, irr::u32 timeMs); 34 ISceneNodeAnimator *createClone(irr::scene::ISceneNode *node, 35 irr::scene::ISceneManager *newManager = 0); 36 bool MouseMoved(const irr::SEvent &event, irr::core::position2df MousePos); 37 void setPositionOffset(irr::core::vector3df newpos); 38 void setTargetOffset(irr::core::vector3df newpos); 40 39 41 private: 42 virtual bool isEventReceiverEnabled(void) const 43 { 44 return true; 45 } 40 private: 41 virtual bool isEventReceiverEnabled(void) const { return true; } 46 42 47 irr::core::vector3df pos_offset,target_offset;48 49 50 51 const irr::scene::ISceneNode*parent;52 53 float RotY,RotZ;54 55 56 57 58 43 irr::core::vector3df pos_offset, target_offset; 44 bool LMouseKey; 45 irr::core::position2df RotateStart; 46 irr::core::position2df MousePos; 47 const irr::scene::ISceneNode *parent; 48 bool Rotating; 49 float RotY, RotZ; 50 float rotateSpeed; 51 float zoomSpeed; 52 float currentZoom; 53 float sat(float value); 54 }; 59 55 60 56 } // end namespace simulator -
trunk/lib/FlairSimulator/src/unexported/GenericObject.h
r10 r15 35 35 #include <Vector3D.h> 36 36 37 38 37 #include <aabbox3d.h> 39 38 #include <IMeshSceneNode.h> 40 39 41 namespace irr 42 { 43 class SEvent; 44 namespace scene 45 { 46 class IMesh; 47 class ISceneManager; 48 class ITriangleSelector; 49 class IMetaTriangleSelector; 50 class ISceneNodeAnimatorCollisionResponse; 51 } 40 namespace irr { 41 class SEvent; 42 namespace scene { 43 class IMesh; 44 class ISceneManager; 45 class ITriangleSelector; 46 class IMetaTriangleSelector; 47 class ISceneNodeAnimatorCollisionResponse; 48 } 52 49 } 53 50 … … 55 52 class Simulator_impl; 56 53 57 namespace flair 58 { 59 namespace core 60 { 54 namespace flair { 55 namespace core { 61 56 class ConditionVariable; 62 57 } 63 namespace simulator 64 { 58 namespace simulator { 65 59 class Simulator; 66 60 class AnimPoursuite; 67 61 68 class GenericObject : public irr::scene::IMeshSceneNode 69 { 70 friend class ::Simulator_impl; 62 class GenericObject : public irr::scene::IMeshSceneNode { 63 friend class ::Simulator_impl; 71 64 72 65 public: 73 GenericObject(Simulator* parent,std::string name, irr::scene::ISceneManager* sceneManager); 74 virtual ~GenericObject(); 66 GenericObject(Simulator *parent, std::string name, 67 irr::scene::ISceneManager *sceneManager); 68 virtual ~GenericObject(); 75 69 76 //FROM IMPL77 irr::scene::ITriangleSelector*TriangleSelector(void);78 79 //END FROM IMPL70 // FROM IMPL 71 irr::scene::ITriangleSelector *TriangleSelector(void); 72 irr::core::aabbox3d<irr::f32> box; 73 // END FROM IMPL 80 74 81 irr::scene::ISceneNode* getSceneNode(); 82 virtual const irr::core::aabbox3d<irr::f32>& getBoundingBox(void) const 83 { 84 return box; 85 } 75 irr::scene::ISceneNode *getSceneNode(); 76 virtual const irr::core::aabbox3d<irr::f32> &getBoundingBox(void) const { 77 return box; 78 } 86 79 87 void setPosition(irr::core::vector3df position); 88 void setScale(float value); 89 void setScale(irr::core::vector3df scale); 90 void setRotation(irr::core::vector3df rotation); 91 void OnRegisterSceneNode(void); 92 void setMesh(irr::scene::IMesh* mesh); 93 irr::scene::IMesh* getMesh(void); 94 void render(void); 95 virtual void setReadOnlyMaterials(bool readonly){}; 96 virtual bool isReadOnlyMaterials(void) const 97 { 98 return false; 99 } 100 virtual irr::scene::IShadowVolumeSceneNode* addShadowVolumeSceneNode(const irr::scene::IMesh* shadowMesh=0, 101 irr::s32 id=-1, bool zfailmethod=true, irr::f32 infinity=1000.0f) 102 { 103 return NULL; 104 } 80 void setPosition(irr::core::vector3df position); 81 void setScale(float value); 82 void setScale(irr::core::vector3df scale); 83 void setRotation(irr::core::vector3df rotation); 84 void OnRegisterSceneNode(void); 85 void setMesh(irr::scene::IMesh *mesh); 86 irr::scene::IMesh *getMesh(void); 87 void render(void); 88 virtual void setReadOnlyMaterials(bool readonly){}; 89 virtual bool isReadOnlyMaterials(void) const { return false; } 90 virtual irr::scene::IShadowVolumeSceneNode * 91 addShadowVolumeSceneNode(const irr::scene::IMesh *shadowMesh = 0, 92 irr::s32 id = -1, bool zfailmethod = true, 93 irr::f32 infinity = 1000.0f) { 94 return NULL; 95 } 105 96 106 97 private: 107 void UpdateFrom(core::io_data *data) {}; 108 irr::scene::IMesh *mesh; 109 irr::scene::ITriangleSelector* selector; 110 flair::core::ConditionVariable* cond; 111 irr::video::SMaterial Material; 112 98 void UpdateFrom(core::io_data *data){}; 99 irr::scene::IMesh *mesh; 100 irr::scene::ITriangleSelector *selector; 101 flair::core::ConditionVariable *cond; 102 irr::video::SMaterial Material; 113 103 }; 114 104 } // end namespace simulator -
trunk/lib/FlairSimulator/src/unexported/Gui_impl.h
r10 r15 24 24 #include <vector3d.h> 25 25 26 namespace irr 27 { 28 class IrrlichtDevice; 29 namespace scene 30 { 31 class ISceneManager; 32 class IMeshSceneNode; 33 class ITriangleSelector; 34 } 35 namespace video 36 { 37 class IVideoDriver; 38 } 39 namespace gui 40 { 41 class IGUIFont; 42 class IGUIEnvironment; 43 } 26 namespace irr { 27 class IrrlichtDevice; 28 namespace scene { 29 class ISceneManager; 30 class IMeshSceneNode; 31 class ITriangleSelector; 32 } 33 namespace video { 34 class IVideoDriver; 35 } 36 namespace gui { 37 class IGUIFont; 38 class IGUIEnvironment; 39 } 44 40 } 45 41 46 namespace flair 47 { 48 namespace core 49 { 50 class Object; 51 } 52 namespace simulator 53 { 54 class Model; 55 class GenericObject; 56 class Gui; 57 } 42 namespace flair { 43 namespace core { 44 class Object; 45 } 46 namespace simulator { 47 class Model; 48 class GenericObject; 49 class Gui; 50 } 58 51 } 59 52 60 53 class MyEventReceiver; 61 54 62 class Gui_impl 63 { 64 public: 65 Gui_impl(flair::simulator::Gui* self,int app_width, int app_height,int scene_width, int scene_height,std::string media_path,irr::video::E_DRIVER_TYPE driver_type=irr::video::EDT_OPENGL); 66 ~Gui_impl(); 67 void RunGui(std::vector<flair::simulator::Model*> modeles,std::vector<flair::simulator::GenericObject*> objects); 68 void setMesh(std::string file,irr::core::vector3df position = irr::core::vector3df(0,0,0),irr::core::vector3df rotation= irr::core::vector3df(0,0,0),irr::core::vector3df scale= irr::core::vector3df(1,1,1)); 55 class Gui_impl { 56 public: 57 Gui_impl(flair::simulator::Gui *self, int app_width, int app_height, 58 int scene_width, int scene_height, std::string media_path, 59 irr::video::E_DRIVER_TYPE driver_type = irr::video::EDT_OPENGL); 60 ~Gui_impl(); 61 void RunGui(std::vector<flair::simulator::Model *> modeles, 62 std::vector<flair::simulator::GenericObject *> objects); 63 void setMesh(std::string file, 64 irr::core::vector3df position = irr::core::vector3df(0, 0, 0), 65 irr::core::vector3df rotation = irr::core::vector3df(0, 0, 0), 66 irr::core::vector3df scale = irr::core::vector3df(1, 1, 1)); 69 67 70 irr::scene::IMeshSceneNode*node;71 72 73 irr::video::IVideoDriver*driver;74 irr::scene::ISceneManager*smgr;75 int scene_width,scene_height;68 irr::scene::IMeshSceneNode *node; 69 irr::IrrlichtDevice *device; 70 std::string media_path; 71 irr::video::IVideoDriver *driver; 72 irr::scene::ISceneManager *smgr; 73 int scene_width, scene_height; 76 74 77 78 79 irr::scene::ITriangleSelector*selector;80 irr::gui::IGUIFont*font;81 irr::gui::IGUIEnvironment*env;82 void setWindowCaption(flair::core::Object*object, int fps);83 84 hdfile_t *dbtFile_r,*dbtFile_w;85 size_t dbtSize(std::vector<flair::simulator::Model*> modeles);86 char*dbtbuf;87 75 private: 76 MyEventReceiver *receiver; 77 irr::scene::ITriangleSelector *selector; 78 irr::gui::IGUIFont *font; 79 irr::gui::IGUIEnvironment *env; 80 void setWindowCaption(flair::core::Object *object, int fps); 81 void takeScreenshot(void); 82 hdfile_t *dbtFile_r, *dbtFile_w; 83 size_t dbtSize(std::vector<flair::simulator::Model *> modeles); 84 char *dbtbuf; 85 flair::simulator::Gui *self; 88 86 }; 89 87 -
trunk/lib/FlairSimulator/src/unexported/Model_impl.h
r10 r15 23 23 #include "Quaternion.h" 24 24 25 namespace flair 26 { 27 namespace core 28 { 29 class cvmatrix; 30 class Mutex; 31 class ConditionVariable; 32 } 33 namespace gui 34 { 35 class TabWidget; 36 class CheckBox; 37 class DoubleSpinBox; 38 class SpinBox; 39 class Vector3DSpinBox; 40 } 41 namespace simulator 42 { 43 class Simulator; 44 class AnimPoursuite; 45 } 25 namespace flair { 26 namespace core { 27 class cvmatrix; 28 class Mutex; 29 class ConditionVariable; 30 } 31 namespace gui { 32 class TabWidget; 33 class CheckBox; 34 class DoubleSpinBox; 35 class SpinBox; 36 class Vector3DSpinBox; 37 } 38 namespace simulator { 39 class Simulator; 40 class AnimPoursuite; 41 } 46 42 } 47 43 … … 50 46 #include <IMeshSceneNode.h> 51 47 52 namespace irr 53 { 54 namespace scene 55 { 56 class ISceneManager; 57 class ITriangleSelector; 58 class IMetaTriangleSelector; 59 class ISceneNodeAnimatorCollisionResponse; 60 class ICameraSceneNode; 61 } 48 namespace irr { 49 namespace scene { 50 class ISceneManager; 51 class ITriangleSelector; 52 class IMetaTriangleSelector; 53 class ISceneNodeAnimatorCollisionResponse; 54 class ICameraSceneNode; 55 } 62 56 } 63 57 #endif 64 58 65 59 #ifdef GL 66 class Model_impl : public irr::scene::ISceneNode,public flair::core::Thread,private vrpn_Tracker 60 class Model_impl : public irr::scene::ISceneNode, 61 public flair::core::Thread, 62 private vrpn_Tracker 67 63 #else 68 class Model_impl : public flair::core::Thread, private vrpn_Tracker 64 class Model_impl : public flair::core::Thread, 65 private vrpn_Tracker 69 66 #endif 70 {71 67 { 68 public: 72 69 #ifdef GL 73 Model_impl(flair::simulator::Model* self,std::string name,irr::scene::ISceneManager* scenemanager,vrpn_Connection_IP* vrpn); 70 Model_impl(flair::simulator::Model *self, std::string name, 71 irr::scene::ISceneManager *scenemanager, vrpn_Connection_IP *vrpn); 74 72 #else 75 Model_impl(flair::simulator::Model* self,std::string name,vrpn_Connection_IP* vrpn); 73 Model_impl(flair::simulator::Model *self, std::string name, 74 vrpn_Connection_IP *vrpn); 76 75 #endif 77 76 ~Model_impl(); 78 77 79 78 #ifdef GL 80 void OnRegisterSceneNode(void); 81 void render(void); 82 void Draw(void){printf("CA MARCHE PAS PUNAISE\r\n");ExtraDraw();}; 83 void ExtraDraw(void){printf("nope\r\n");}; 79 void OnRegisterSceneNode(void); 80 void render(void); 81 void Draw(void) { 82 printf("CA MARCHE PAS PUNAISE\r\n"); 83 ExtraDraw(); 84 }; 85 void ExtraDraw(void) { printf("nope\r\n"); }; 84 86 85 const irr::core::aabbox3d<irr::f32>& getBoundingBox(void) const 86 { 87 return box; 88 } 89 void UpdatePos(void); 90 void CheckCollision(void); 91 irr::scene::ITriangleSelector* TriangleSelector(void); 92 irr::scene::IMetaTriangleSelector* MetaTriangleSelector(void); 93 irr::core::aabbox3d<irr::f32> box; 94 void SynchronizationPoint(); 95 irr::scene::ICameraSceneNode* camera; 96 flair::simulator::AnimPoursuite* animator; 97 irr::scene::ITriangleSelector* selector; 87 const irr::core::aabbox3d<irr::f32> &getBoundingBox(void) const { 88 return box; 89 } 90 void UpdatePos(void); 91 void CheckCollision(void); 92 irr::scene::ITriangleSelector *TriangleSelector(void); 93 irr::scene::IMetaTriangleSelector *MetaTriangleSelector(void); 94 irr::core::aabbox3d<irr::f32> box; 95 void SynchronizationPoint(); 96 irr::scene::ICameraSceneNode *camera; 97 flair::simulator::AnimPoursuite *animator; 98 irr::scene::ITriangleSelector *selector; 98 99 #endif 99 100 void mainloop(void); 100 101 101 102 102 flair::gui::TabWidget *tabwidget; 103 flair::gui::DoubleSpinBox *dT; 103 104 104 105 flair::gui::Vector3DSpinBox*pos_init;106 107 108 flair::simulator::Model*self;109 flair::core::cvmatrix*output;110 105 private: 106 flair::gui::Vector3DSpinBox *pos_init; 107 flair::gui::SpinBox *yaw_init; 108 flair::gui::CheckBox *enable_opti; 109 flair::simulator::Model *self; 110 flair::core::cvmatrix *output; 111 flair::core::Mutex *states_mutex; 111 112 112 113 114 113 struct timeval _timestamp; 114 void Run(void); 115 flair::core::Quaternion ComputeInitRotation(flair::core::Quaternion quat_in); 115 116 #ifdef GL 116 117 void CollisionHandler(void); 117 118 118 irr::scene::IMetaTriangleSelector*meta_selector;119 irr::scene::ISceneNodeAnimatorCollisionResponse*anim;119 irr::scene::IMetaTriangleSelector *meta_selector; 120 irr::scene::ISceneNodeAnimatorCollisionResponse *anim; 120 121 121 122 bool position_init; 122 123 123 flair::core::ConditionVariable*cond;124 124 flair::core::ConditionVariable *cond; 125 int sync_count; 125 126 126 127 128 127 flair::core::Mutex *collision_mutex; 128 bool collision_occured; 129 flair::core::Vector3D collision_point; 129 130 #endif 130 131 131 }; 132 132 -
trunk/lib/FlairSimulator/src/unexported/Simulator_impl.h
r10 r15 21 21 #include <Thread.h> 22 22 23 24 namespace flair 25 { 26 namespace simulator 27 { 28 class Simulator; 29 class Model; 30 class GenericObject; 31 } 23 namespace flair { 24 namespace simulator { 25 class Simulator; 26 class Model; 27 class GenericObject; 28 } 32 29 } 33 30 34 class Simulator_impl: public vrpn_Connection_IP, private flair::core::Thread 35 { 36 friend class flair::simulator::Model; 37 friend class flair::simulator::GenericObject; 31 class Simulator_impl : public vrpn_Connection_IP, private flair::core::Thread { 32 friend class flair::simulator::Model; 33 friend class flair::simulator::GenericObject; 38 34 39 public: 40 Simulator_impl(flair::simulator::Simulator* self,int optitrack_mstime=10,float yaw_deg=30); 41 ~Simulator_impl(); 35 public: 36 Simulator_impl(flair::simulator::Simulator *self, int optitrack_mstime = 10, 37 float yaw_deg = 30); 38 ~Simulator_impl(); 42 39 43 44 40 void RunSimu(void); 41 float yaw_rad; 45 42 46 47 48 flair::simulator::Simulator*self;49 std::vector<flair::simulator::Model*> models;50 std::vector<flair::simulator::GenericObject*> objects;51 43 private: 44 void Run(void); 45 flair::simulator::Simulator *self; 46 std::vector<flair::simulator::Model *> models; 47 std::vector<flair::simulator::GenericObject *> objects; 48 int optitrack_mstime; 52 49 }; 53 50
Note:
See TracChangeset
for help on using the changeset viewer.