[8] | 1 | // created: 2013/03/25
|
---|
| 2 | // filename: Model.cpp
|
---|
| 3 | //
|
---|
| 4 | // author: Guillaume Sanahuja
|
---|
| 5 | // Copyright Heudiasyc UMR UTC/CNRS 7253
|
---|
| 6 | //
|
---|
| 7 | // version: $Id: $
|
---|
| 8 | //
|
---|
| 9 | // purpose: classe definissant un modele a simuler
|
---|
| 10 | //
|
---|
| 11 | /*********************************************************************/
|
---|
| 12 |
|
---|
| 13 | #include "Model.h"
|
---|
| 14 | #include "Model_impl.h"
|
---|
| 15 | #include "Simulator.h"
|
---|
| 16 | #include "Simulator_impl.h"
|
---|
| 17 | #include <DoubleSpinBox.h>
|
---|
| 18 |
|
---|
| 19 | #ifdef GL
|
---|
| 20 | #include "Gui.h"
|
---|
| 21 | #include <ICameraSceneNode.h>
|
---|
| 22 | using namespace irr;
|
---|
| 23 | using namespace irr::scene;
|
---|
| 24 | using namespace irr::core;
|
---|
| 25 | #endif
|
---|
| 26 |
|
---|
| 27 | using namespace flair::core;
|
---|
| 28 | using namespace flair::gui;
|
---|
| 29 |
|
---|
| 30 | namespace flair
|
---|
| 31 | {
|
---|
| 32 | namespace simulator
|
---|
| 33 | {
|
---|
| 34 |
|
---|
| 35 | Model::Model(const Simulator* parent,std::string name) : IODevice(parent,name)
|
---|
| 36 | {
|
---|
| 37 | #ifdef GL
|
---|
| 38 | pimpl_=new Model_impl(this,name,getGui()->getSceneManager(),parent->pimpl_);
|
---|
| 39 | #else
|
---|
| 40 | pimpl_=new Model_impl(this,name,parent->pimpl_);
|
---|
| 41 | #endif
|
---|
| 42 | parent->pimpl_->models.push_back(this);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | Model::~Model()
|
---|
| 46 | {
|
---|
| 47 | delete pimpl_;
|
---|
| 48 | }
|
---|
| 49 | #ifdef GL
|
---|
| 50 | ISceneNode* Model::getSceneNode() const
|
---|
| 51 | {
|
---|
| 52 | return pimpl_;
|
---|
| 53 | }
|
---|
| 54 | /*
|
---|
| 55 | only used by dbt, to rewrite using conversion functions (irrlicht <-> simulator)
|
---|
| 56 | void Model::setPosition(Vector3D pos)
|
---|
| 57 | {
|
---|
| 58 | //note that irrlicht frame is left handed
|
---|
| 59 | pimpl_->setPosition(ToIrrlichtScale(1)*vector3df(pos.y,pos.z,-pos.x));
|
---|
| 60 | }
|
---|
| 61 | */
|
---|
| 62 | void Model::setScale(float value)
|
---|
| 63 | {
|
---|
| 64 | pimpl_->setScale(vector3df(value,value,value));
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | aabbox3d<f32> *Model::Box() const
|
---|
| 68 | {
|
---|
| 69 | return &(pimpl_->box);
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | AnimPoursuite* Model::getCamera(void) const
|
---|
| 73 | {
|
---|
| 74 | return pimpl_->animator;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | void Model::setTriangleSelector(ITriangleSelector* selector) {
|
---|
| 78 |
|
---|
| 79 | pimpl_->selector=selector;
|
---|
| 80 | pimpl_->setTriangleSelector(selector);
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | void Model::setCameraFarValue(float zf) {
|
---|
| 84 | pimpl_->camera->setFarValue(zf);
|
---|
| 85 | }
|
---|
| 86 | #endif
|
---|
| 87 |
|
---|
| 88 | TabWidget* Model::GetTabWidget(void) const
|
---|
| 89 | {
|
---|
| 90 | return pimpl_->tabwidget;
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 | float Model::dT(void) const
|
---|
| 94 | {
|
---|
| 95 | return pimpl_->dT->Value();
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | } // end namespace simulator
|
---|
| 99 | } // end namespace flair
|
---|