[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_impl.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_IMPL_H
|
---|
| 18 | #define MODEL_IMPL_H
|
---|
| 19 |
|
---|
| 20 | #include <Thread.h>
|
---|
| 21 | #include <vrpn_Tracker.h>
|
---|
| 22 | #include "Model.h"
|
---|
| 23 | #include "Quaternion.h"
|
---|
| 24 |
|
---|
[15] | 25 | namespace flair {
|
---|
| 26 | namespace core {
|
---|
| 27 | class cvmatrix;
|
---|
| 28 | class Mutex;
|
---|
| 29 | class ConditionVariable;
|
---|
[8] | 30 | }
|
---|
[15] | 31 | namespace gui {
|
---|
| 32 | class TabWidget;
|
---|
| 33 | class CheckBox;
|
---|
| 34 | class DoubleSpinBox;
|
---|
| 35 | class SpinBox;
|
---|
| 36 | class Vector3DSpinBox;
|
---|
| 37 | }
|
---|
| 38 | namespace simulator {
|
---|
| 39 | class Simulator;
|
---|
[69] | 40 | class FollowMeCamera;
|
---|
[15] | 41 | }
|
---|
| 42 | }
|
---|
[8] | 43 |
|
---|
| 44 | #ifdef GL
|
---|
| 45 | #include <Vector3D.h>
|
---|
| 46 | #include <IMeshSceneNode.h>
|
---|
| 47 |
|
---|
[15] | 48 | namespace irr {
|
---|
| 49 | namespace scene {
|
---|
| 50 | class ISceneManager;
|
---|
| 51 | class ITriangleSelector;
|
---|
| 52 | class IMetaTriangleSelector;
|
---|
| 53 | class ISceneNodeAnimatorCollisionResponse;
|
---|
[8] | 54 | }
|
---|
[15] | 55 | }
|
---|
[8] | 56 | #endif
|
---|
| 57 |
|
---|
| 58 | #ifdef GL
|
---|
[15] | 59 | class Model_impl : public irr::scene::ISceneNode,
|
---|
| 60 | public flair::core::Thread,
|
---|
| 61 | private vrpn_Tracker
|
---|
[8] | 62 | #else
|
---|
[15] | 63 | class Model_impl : public flair::core::Thread,
|
---|
| 64 | private vrpn_Tracker
|
---|
[8] | 65 | #endif
|
---|
[15] | 66 | {
|
---|
| 67 | public:
|
---|
| 68 | #ifdef GL
|
---|
| 69 | Model_impl(flair::simulator::Model *self, std::string name,
|
---|
| 70 | irr::scene::ISceneManager *scenemanager, vrpn_Connection_IP *vrpn);
|
---|
[8] | 71 | #else
|
---|
[15] | 72 | Model_impl(flair::simulator::Model *self, std::string name,
|
---|
| 73 | vrpn_Connection_IP *vrpn);
|
---|
[8] | 74 | #endif
|
---|
[15] | 75 | ~Model_impl();
|
---|
[8] | 76 |
|
---|
| 77 | #ifdef GL
|
---|
[15] | 78 | void OnRegisterSceneNode(void);
|
---|
| 79 | void render(void);
|
---|
| 80 | void Draw(void) {
|
---|
| 81 | printf("CA MARCHE PAS PUNAISE\r\n");
|
---|
| 82 | ExtraDraw();
|
---|
| 83 | };
|
---|
| 84 | void ExtraDraw(void) { printf("nope\r\n"); };
|
---|
[8] | 85 |
|
---|
[15] | 86 | const irr::core::aabbox3d<irr::f32> &getBoundingBox(void) const {
|
---|
| 87 | return box;
|
---|
| 88 | }
|
---|
| 89 | void UpdatePos(void);
|
---|
| 90 | void CheckCollision(void);
|
---|
| 91 | irr::scene::ITriangleSelector *TriangleSelector(void);
|
---|
| 92 | irr::scene::IMetaTriangleSelector *MetaTriangleSelector(void);
|
---|
| 93 | irr::core::aabbox3d<irr::f32> box;
|
---|
| 94 | void SynchronizationPoint();
|
---|
[69] | 95 | flair::simulator::FollowMeCamera *camera;
|
---|
[15] | 96 | irr::scene::ITriangleSelector *selector;
|
---|
[8] | 97 | #endif
|
---|
[15] | 98 | void mainloop(void);
|
---|
[8] | 99 |
|
---|
[15] | 100 | flair::gui::TabWidget *tabwidget;
|
---|
| 101 | flair::gui::DoubleSpinBox *dT;
|
---|
[8] | 102 |
|
---|
[15] | 103 | private:
|
---|
| 104 | flair::gui::Vector3DSpinBox *pos_init;
|
---|
| 105 | flair::gui::SpinBox *yaw_init;
|
---|
| 106 | flair::gui::CheckBox *enable_opti;
|
---|
| 107 | flair::simulator::Model *self;
|
---|
| 108 | flair::core::cvmatrix *output;
|
---|
| 109 | flair::core::Mutex *states_mutex;
|
---|
[8] | 110 |
|
---|
[15] | 111 | struct timeval _timestamp;
|
---|
| 112 | void Run(void);
|
---|
| 113 | flair::core::Quaternion ComputeInitRotation(flair::core::Quaternion quat_in);
|
---|
[8] | 114 | #ifdef GL
|
---|
[15] | 115 | void CollisionHandler(void);
|
---|
[8] | 116 |
|
---|
[15] | 117 | irr::scene::IMetaTriangleSelector *meta_selector;
|
---|
| 118 | irr::scene::ISceneNodeAnimatorCollisionResponse *anim;
|
---|
[8] | 119 |
|
---|
[15] | 120 | bool position_init;
|
---|
[8] | 121 |
|
---|
[15] | 122 | flair::core::ConditionVariable *cond;
|
---|
| 123 | int sync_count;
|
---|
[8] | 124 |
|
---|
[15] | 125 | flair::core::Mutex *collision_mutex;
|
---|
| 126 | bool collision_occured;
|
---|
| 127 | flair::core::Vector3D collision_point;
|
---|
[8] | 128 | #endif
|
---|
| 129 | };
|
---|
| 130 |
|
---|
| 131 | #endif // MODEL_IMPL_H
|
---|