[9] | 1 | // %flair:license{
|
---|
[13] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[9] | 4 | // %flair:license}
|
---|
[8] | 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>
|
---|
[13] | 27 | namespace irr {
|
---|
| 28 | class SEvent;
|
---|
| 29 | namespace scene {
|
---|
| 30 | class ISceneManager;
|
---|
| 31 | class ISceneNode;
|
---|
| 32 | class ITriangleSelector;
|
---|
[8] | 33 | }
|
---|
[13] | 34 | }
|
---|
[8] | 35 | #endif
|
---|
| 36 |
|
---|
[13] | 37 | namespace flair {
|
---|
| 38 | namespace gui {
|
---|
| 39 | class TabWidget;
|
---|
[8] | 40 | }
|
---|
[13] | 41 | namespace sensor {
|
---|
| 42 | class SensorGL;
|
---|
| 43 | }
|
---|
| 44 | }
|
---|
[8] | 45 |
|
---|
| 46 | class Gui_impl;
|
---|
| 47 | class Simulator_impl;
|
---|
| 48 | class Model_impl;
|
---|
| 49 |
|
---|
[13] | 50 | namespace flair {
|
---|
| 51 | namespace simulator {
|
---|
| 52 | class Simulator;
|
---|
| 53 | class AnimPoursuite;
|
---|
[8] | 54 |
|
---|
[13] | 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;
|
---|
[8] | 61 |
|
---|
[13] | 62 | public:
|
---|
| 63 | Model(const Simulator *parent, std::string name);
|
---|
| 64 | virtual ~Model();
|
---|
[8] | 65 |
|
---|
[13] | 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;
|
---|
[8] | 72 |
|
---|
[13] | 73 | #ifdef GL
|
---|
| 74 | irr::scene::ISceneNode *getSceneNode() const;
|
---|
| 75 | irr::core::aabbox3d<irr::f32> *Box() const;
|
---|
[8] | 76 |
|
---|
[13] | 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;
|
---|
[8] | 83 |
|
---|
[13] | 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;
|
---|
[8] | 89 |
|
---|
[13] | 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
|
---|
[8] | 101 |
|
---|
[13] | 102 | private:
|
---|
| 103 | void UpdateFrom(const core::io_data *data){};
|
---|
| 104 | class Model_impl *pimpl_;
|
---|
| 105 | };
|
---|
[8] | 106 | } // end namespace simulator
|
---|
| 107 | } // end namespace flair
|
---|
| 108 | #endif // MODEL_H
|
---|