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