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