1 | // created: 2013/03/25 |
---|
2 | // filename: Model.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_H |
---|
14 | #define MODEL_H |
---|
15 | |
---|
16 | #include <IODevice.h> |
---|
17 | #include <Quaternion.h> |
---|
18 | #include <Vector3D.h> |
---|
19 | #include <DiscreteTimeVariable.h> |
---|
20 | |
---|
21 | #ifdef GL |
---|
22 | #include <aabbox3d.h> |
---|
23 | namespace irr |
---|
24 | { |
---|
25 | class SEvent; |
---|
26 | namespace scene |
---|
27 | { |
---|
28 | class ISceneManager; |
---|
29 | class ISceneNode; |
---|
30 | class ITriangleSelector; |
---|
31 | } |
---|
32 | } |
---|
33 | #endif |
---|
34 | |
---|
35 | namespace flair |
---|
36 | { |
---|
37 | namespace gui |
---|
38 | { |
---|
39 | class TabWidget; |
---|
40 | } |
---|
41 | namespace sensor |
---|
42 | { |
---|
43 | class SensorGL; |
---|
44 | } |
---|
45 | } |
---|
46 | |
---|
47 | class Gui_impl; |
---|
48 | class Simulator_impl; |
---|
49 | class Model_impl; |
---|
50 | |
---|
51 | namespace flair |
---|
52 | { |
---|
53 | namespace simulator |
---|
54 | { |
---|
55 | class Simulator; |
---|
56 | class AnimPoursuite; |
---|
57 | |
---|
58 | class Model : public core::IODevice |
---|
59 | { |
---|
60 | friend class ::Gui_impl; |
---|
61 | friend class ::Simulator_impl; |
---|
62 | friend class ::Model_impl; |
---|
63 | friend class AnimPoursuite; |
---|
64 | friend class sensor::SensorGL; |
---|
65 | |
---|
66 | public: |
---|
67 | Model(const Simulator* parent,std::string name); |
---|
68 | virtual ~Model(); |
---|
69 | |
---|
70 | |
---|
71 | typedef struct simu_state { |
---|
72 | core::Quaternion Quat; |
---|
73 | core::Vector3D W; |
---|
74 | core::Vector3D Pos; |
---|
75 | core::Vector3D Vel; |
---|
76 | } simu_state_t; |
---|
77 | |
---|
78 | #ifdef GL |
---|
79 | irr::scene::ISceneNode* getSceneNode() const; |
---|
80 | irr::core::aabbox3d<irr::f32>* Box() const; |
---|
81 | |
---|
82 | virtual size_t dbtSize(void) const =0; |
---|
83 | virtual void Draw(void){}; |
---|
84 | virtual void ExtraDraw(void){}; |
---|
85 | virtual void WritedbtBuf(char* dbtbuf)=0; |
---|
86 | virtual void ReaddbtBuf(char* dbtbuf)=0; |
---|
87 | virtual bool OnEvent(const irr::SEvent& event)=0; |
---|
88 | |
---|
89 | //! Sets the value of the camera's far clipping plane (default: 2000.0f) |
---|
90 | /** \param zf: New z far value. */ |
---|
91 | void setCameraFarValue(float zf); |
---|
92 | #endif |
---|
93 | gui::TabWidget* GetTabWidget(void) const; |
---|
94 | |
---|
95 | protected: |
---|
96 | DiscreteTimeVariable<simu_state_t,3> state; |
---|
97 | float dT(void) const; |
---|
98 | virtual void CalcModel(void)=0; |
---|
99 | #ifdef GL |
---|
100 | AnimPoursuite* getCamera(void) const; |
---|
101 | virtual void AnimateModel(void)=0; |
---|
102 | //void setPosition(core::Vector3D pos); |
---|
103 | void setScale(float value); |
---|
104 | void setTriangleSelector(irr::scene::ITriangleSelector* selector); |
---|
105 | #endif |
---|
106 | |
---|
107 | private: |
---|
108 | void UpdateFrom(const core::io_data *data){}; |
---|
109 | class Model_impl* pimpl_; |
---|
110 | }; |
---|
111 | } // end namespace simulator |
---|
112 | } // end namespace flair |
---|
113 | #endif // MODEL_H |
---|