[10] | 1 | // %flair:license{
|
---|
[15] | 2 | // This file is part of the Flair framework distributed under the
|
---|
| 3 | // CECILL-C License, Version 1.0.
|
---|
[10] | 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>
|
---|
[69] | 27 | #include <IEventReceiver.h>
|
---|
[15] | 28 | namespace irr {
|
---|
| 29 | class SEvent;
|
---|
| 30 | namespace scene {
|
---|
| 31 | class ISceneManager;
|
---|
| 32 | class ISceneNode;
|
---|
| 33 | class ITriangleSelector;
|
---|
[8] | 34 | }
|
---|
[15] | 35 | }
|
---|
[8] | 36 | #endif
|
---|
| 37 |
|
---|
[15] | 38 | namespace flair {
|
---|
| 39 | namespace gui {
|
---|
| 40 | class TabWidget;
|
---|
[8] | 41 | }
|
---|
[15] | 42 | namespace sensor {
|
---|
| 43 | class SensorGL;
|
---|
| 44 | }
|
---|
| 45 | }
|
---|
[8] | 46 |
|
---|
| 47 | class Gui_impl;
|
---|
| 48 | class Simulator_impl;
|
---|
| 49 | class Model_impl;
|
---|
| 50 |
|
---|
[15] | 51 | namespace flair {
|
---|
| 52 | namespace simulator {
|
---|
[69] | 53 | class FollowMeCamera;
|
---|
[8] | 54 |
|
---|
[69] | 55 | class Model : public core::IODevice
|
---|
| 56 | #ifdef GL
|
---|
| 57 | , public irr::IEventReceiver
|
---|
| 58 | #endif
|
---|
| 59 | {
|
---|
[15] | 60 | friend class ::Gui_impl;
|
---|
| 61 | friend class ::Simulator_impl;
|
---|
| 62 | friend class ::Model_impl;
|
---|
| 63 | friend class sensor::SensorGL;
|
---|
[8] | 64 |
|
---|
[15] | 65 | public:
|
---|
[158] | 66 | Model(std::string name,uint32_t modelId);
|
---|
[15] | 67 | virtual ~Model();
|
---|
[8] | 68 |
|
---|
[15] | 69 | typedef struct simu_state {
|
---|
| 70 | core::Quaternion Quat;
|
---|
[167] | 71 | core::Vector3Df W;
|
---|
| 72 | core::Vector3D<double> Pos;
|
---|
| 73 | core::Vector3D<double> Vel;
|
---|
[15] | 74 | } simu_state_t;
|
---|
[8] | 75 |
|
---|
[15] | 76 | #ifdef GL
|
---|
| 77 | irr::scene::ISceneNode *getSceneNode() const;
|
---|
| 78 | irr::core::aabbox3d<irr::f32> *Box() const;
|
---|
[8] | 79 |
|
---|
[15] | 80 | virtual size_t dbtSize(void) const = 0;
|
---|
| 81 | virtual void Draw(void){};
|
---|
| 82 | virtual void ExtraDraw(void){};
|
---|
| 83 | virtual void WritedbtBuf(char *dbtbuf) = 0;
|
---|
| 84 | virtual void ReaddbtBuf(char *dbtbuf) = 0;
|
---|
[8] | 85 |
|
---|
[69] | 86 | //default event handling
|
---|
| 87 | bool OnEvent(const irr::SEvent &event) { return false;};
|
---|
| 88 |
|
---|
[15] | 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;
|
---|
[158] | 94 | int GetId(void) const;
|
---|
[8] | 95 |
|
---|
[15] | 96 | protected:
|
---|
| 97 | DiscreteTimeVariable<simu_state_t, 3> state;
|
---|
[167] | 98 | double dT(void) const;
|
---|
[15] | 99 | virtual void CalcModel(void) = 0;
|
---|
[361] | 100 | core::Vector3Df InitialPosition(void);
|
---|
[15] | 101 | #ifdef GL
|
---|
[69] | 102 | FollowMeCamera *getFollowMeCamera(void) const;
|
---|
[15] | 103 | virtual void AnimateModel(void) = 0;
|
---|
| 104 | // void setPosition(core::Vector3D pos);
|
---|
| 105 | void setScale(float value);
|
---|
| 106 | void setTriangleSelector(irr::scene::ITriangleSelector *selector);
|
---|
| 107 | #endif
|
---|
[8] | 108 |
|
---|
[15] | 109 | private:
|
---|
| 110 | void UpdateFrom(const core::io_data *data){};
|
---|
| 111 | class Model_impl *pimpl_;
|
---|
| 112 | };
|
---|
[8] | 113 | } // end namespace simulator
|
---|
| 114 | } // end namespace flair
|
---|
| 115 | #endif // MODEL_H
|
---|