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