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