1 | // created: 2013/03/25
|
---|
2 | // filename: Model_impl.h
|
---|
3 | //
|
---|
4 | // author: Guillaume Sanahuja
|
---|
5 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
6 | //
|
---|
7 | // version: $Id: $
|
---|
8 | //
|
---|
9 | // purpose: classe definissant un modele a simuler
|
---|
10 | //
|
---|
11 | /*********************************************************************/
|
---|
12 |
|
---|
13 | #ifndef MODEL_IMPL_H
|
---|
14 | #define MODEL_IMPL_H
|
---|
15 |
|
---|
16 | #include <Thread.h>
|
---|
17 | #include <vrpn_Tracker.h>
|
---|
18 | #include "Model.h"
|
---|
19 | #include "Quaternion.h"
|
---|
20 |
|
---|
21 | namespace flair
|
---|
22 | {
|
---|
23 | namespace core
|
---|
24 | {
|
---|
25 | class cvmatrix;
|
---|
26 | class Mutex;
|
---|
27 | class ConditionVariable;
|
---|
28 | }
|
---|
29 | namespace gui
|
---|
30 | {
|
---|
31 | class TabWidget;
|
---|
32 | class CheckBox;
|
---|
33 | class DoubleSpinBox;
|
---|
34 | class SpinBox;
|
---|
35 | class Vector3DSpinBox;
|
---|
36 | }
|
---|
37 | namespace simulator
|
---|
38 | {
|
---|
39 | class Simulator;
|
---|
40 | class AnimPoursuite;
|
---|
41 | }
|
---|
42 | }
|
---|
43 |
|
---|
44 | #ifdef GL
|
---|
45 | #include <Vector3D.h>
|
---|
46 | #include <IMeshSceneNode.h>
|
---|
47 |
|
---|
48 | namespace irr
|
---|
49 | {
|
---|
50 | namespace scene
|
---|
51 | {
|
---|
52 | class ISceneManager;
|
---|
53 | class ITriangleSelector;
|
---|
54 | class IMetaTriangleSelector;
|
---|
55 | class ISceneNodeAnimatorCollisionResponse;
|
---|
56 | class ICameraSceneNode;
|
---|
57 | }
|
---|
58 | }
|
---|
59 | #endif
|
---|
60 |
|
---|
61 | #ifdef GL
|
---|
62 | class Model_impl : public irr::scene::ISceneNode,public flair::core::Thread,private vrpn_Tracker
|
---|
63 | #else
|
---|
64 | class Model_impl : public flair::core::Thread, private vrpn_Tracker
|
---|
65 | #endif
|
---|
66 | {
|
---|
67 | public:
|
---|
68 | #ifdef GL
|
---|
69 | Model_impl(flair::simulator::Model* self,std::string name,irr::scene::ISceneManager* scenemanager,vrpn_Connection_IP* vrpn);
|
---|
70 | #else
|
---|
71 | Model_impl(flair::simulator::Model* self,std::string name,vrpn_Connection_IP* vrpn);
|
---|
72 | #endif
|
---|
73 | ~Model_impl();
|
---|
74 |
|
---|
75 | #ifdef GL
|
---|
76 | void OnRegisterSceneNode(void);
|
---|
77 | void render(void);
|
---|
78 | void Draw(void){printf("CA MARCHE PAS PUNAISE\r\n");ExtraDraw();};
|
---|
79 | void ExtraDraw(void){printf("nope\r\n");};
|
---|
80 |
|
---|
81 | const irr::core::aabbox3d<irr::f32>& getBoundingBox(void) const
|
---|
82 | {
|
---|
83 | return box;
|
---|
84 | }
|
---|
85 | void UpdatePos(void);
|
---|
86 | void CheckCollision(void);
|
---|
87 | irr::scene::ITriangleSelector* TriangleSelector(void);
|
---|
88 | irr::scene::IMetaTriangleSelector* MetaTriangleSelector(void);
|
---|
89 | irr::core::aabbox3d<irr::f32> box;
|
---|
90 | void SynchronizationPoint();
|
---|
91 | irr::scene::ICameraSceneNode* camera;
|
---|
92 | flair::simulator::AnimPoursuite* animator;
|
---|
93 | irr::scene::ITriangleSelector* selector;
|
---|
94 | #endif
|
---|
95 | void mainloop(void);
|
---|
96 |
|
---|
97 | flair::gui::TabWidget *tabwidget;
|
---|
98 | flair::gui::DoubleSpinBox *dT;
|
---|
99 |
|
---|
100 | private:
|
---|
101 | flair::gui::Vector3DSpinBox* pos_init;
|
---|
102 | flair::gui::SpinBox *yaw_init;
|
---|
103 | flair::gui::CheckBox *enable_opti;
|
---|
104 | flair::simulator::Model* self;
|
---|
105 | flair::core::cvmatrix* output;
|
---|
106 | flair::core::Mutex *states_mutex;
|
---|
107 |
|
---|
108 | struct timeval _timestamp;
|
---|
109 | void Run(void);
|
---|
110 | flair::core::Quaternion ComputeInitRotation(flair::core::Quaternion quat_in);
|
---|
111 | #ifdef GL
|
---|
112 | void CollisionHandler(void);
|
---|
113 |
|
---|
114 | irr::scene::IMetaTriangleSelector* meta_selector;
|
---|
115 | irr::scene::ISceneNodeAnimatorCollisionResponse* anim;
|
---|
116 |
|
---|
117 | bool position_init;
|
---|
118 |
|
---|
119 | flair::core::ConditionVariable* cond;
|
---|
120 | int sync_count;
|
---|
121 |
|
---|
122 | flair::core::Mutex *collision_mutex;
|
---|
123 | bool collision_occured;
|
---|
124 | flair::core::Vector3D collision_point;
|
---|
125 | #endif
|
---|
126 |
|
---|
127 | };
|
---|
128 |
|
---|
129 | #endif // MODEL_IMPL_H
|
---|