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