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