[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.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 |
|
---|
[15] | 34 | namespace flair {
|
---|
| 35 | namespace simulator {
|
---|
| 36 |
|
---|
| 37 | Model::Model(const Simulator *parent, std::string name)
|
---|
| 38 | : IODevice(parent, name) {
|
---|
[8] | 39 | #ifdef GL
|
---|
[15] | 40 | pimpl_ =
|
---|
| 41 | new Model_impl(this, name, getGui()->getSceneManager(), parent->pimpl_);
|
---|
[8] | 42 | #else
|
---|
[15] | 43 | pimpl_ = new Model_impl(this, name, parent->pimpl_);
|
---|
[8] | 44 | #endif
|
---|
[15] | 45 | parent->pimpl_->models.push_back(this);
|
---|
[8] | 46 | }
|
---|
| 47 |
|
---|
[15] | 48 | Model::~Model() { delete pimpl_; }
|
---|
[8] | 49 | #ifdef GL
|
---|
[15] | 50 | ISceneNode *Model::getSceneNode() const { return pimpl_; }
|
---|
[8] | 51 | /*
|
---|
| 52 | only used by dbt, to rewrite using conversion functions (irrlicht <-> simulator)
|
---|
| 53 | void Model::setPosition(Vector3D pos)
|
---|
| 54 | {
|
---|
| 55 | //note that irrlicht frame is left handed
|
---|
| 56 | pimpl_->setPosition(ToIrrlichtScale(1)*vector3df(pos.y,pos.z,-pos.x));
|
---|
| 57 | }
|
---|
| 58 | */
|
---|
[15] | 59 | void Model::setScale(float value) {
|
---|
| 60 | pimpl_->setScale(vector3df(value, value, value));
|
---|
[8] | 61 | }
|
---|
| 62 |
|
---|
[15] | 63 | aabbox3d<f32> *Model::Box() const { return &(pimpl_->box); }
|
---|
[8] | 64 |
|
---|
[15] | 65 | AnimPoursuite *Model::getCamera(void) const { return pimpl_->animator; }
|
---|
[8] | 66 |
|
---|
[15] | 67 | void Model::setTriangleSelector(ITriangleSelector *selector) {
|
---|
[8] | 68 |
|
---|
[15] | 69 | pimpl_->selector = selector;
|
---|
| 70 | pimpl_->setTriangleSelector(selector);
|
---|
[8] | 71 | }
|
---|
| 72 |
|
---|
[15] | 73 | void Model::setCameraFarValue(float zf) { pimpl_->camera->setFarValue(zf); }
|
---|
[8] | 74 | #endif
|
---|
| 75 |
|
---|
[15] | 76 | TabWidget *Model::GetTabWidget(void) const { return pimpl_->tabwidget; }
|
---|
[8] | 77 |
|
---|
[15] | 78 | float Model::dT(void) const { return pimpl_->dT->Value(); }
|
---|
[8] | 79 |
|
---|
| 80 | } // end namespace simulator
|
---|
| 81 | } // end namespace flair
|
---|