[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 <DoubleSpinBox.h>
|
---|
[361] | 21 | #include <Vector3DSpinBox.h>
|
---|
[8] | 22 |
|
---|
| 23 | #ifdef GL
|
---|
[70] | 24 | #include "FollowMeCamera.h"
|
---|
[8] | 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 |
|
---|
[158] | 37 | Model::Model(std::string name,uint32_t modelId)
|
---|
| 38 | : IODevice(getSimulator(), name) {
|
---|
| 39 | pimpl_ = new Model_impl(this, name,modelId);
|
---|
[8] | 40 | }
|
---|
| 41 |
|
---|
[15] | 42 | Model::~Model() { delete pimpl_; }
|
---|
[8] | 43 | #ifdef GL
|
---|
[15] | 44 | ISceneNode *Model::getSceneNode() const { return pimpl_; }
|
---|
[8] | 45 | /*
|
---|
| 46 | only used by dbt, to rewrite using conversion functions (irrlicht <-> simulator)
|
---|
| 47 | void Model::setPosition(Vector3D pos)
|
---|
| 48 | {
|
---|
| 49 | //note that irrlicht frame is left handed
|
---|
| 50 | pimpl_->setPosition(ToIrrlichtScale(1)*vector3df(pos.y,pos.z,-pos.x));
|
---|
| 51 | }
|
---|
| 52 | */
|
---|
[15] | 53 | void Model::setScale(float value) {
|
---|
| 54 | pimpl_->setScale(vector3df(value, value, value));
|
---|
[8] | 55 | }
|
---|
| 56 |
|
---|
[15] | 57 | aabbox3d<f32> *Model::Box() const { return &(pimpl_->box); }
|
---|
[8] | 58 |
|
---|
[69] | 59 | FollowMeCamera *Model::getFollowMeCamera(void) const { return pimpl_->camera; }
|
---|
[8] | 60 |
|
---|
[15] | 61 | void Model::setTriangleSelector(ITriangleSelector *selector) {
|
---|
[8] | 62 |
|
---|
[15] | 63 | pimpl_->selector = selector;
|
---|
| 64 | pimpl_->setTriangleSelector(selector);
|
---|
[8] | 65 | }
|
---|
| 66 |
|
---|
[69] | 67 | void Model::setCameraFarValue(float zf) { pimpl_->camera->getCameraSceneNode()->setFarValue(zf); }
|
---|
[8] | 68 | #endif
|
---|
| 69 |
|
---|
[15] | 70 | TabWidget *Model::GetTabWidget(void) const { return pimpl_->tabwidget; }
|
---|
[8] | 71 |
|
---|
[167] | 72 | double Model::dT(void) const { return pimpl_->dT->Value(); }
|
---|
[8] | 73 |
|
---|
[158] | 74 | int Model::GetId(void) const {
|
---|
| 75 | return pimpl_->modelId;
|
---|
| 76 | }
|
---|
| 77 |
|
---|
[361] | 78 | core::Vector3Df Model::InitialPosition(void) {
|
---|
| 79 | return pimpl_->pos_init->Value();
|
---|
| 80 | }
|
---|
| 81 |
|
---|
[8] | 82 | } // end namespace simulator
|
---|
| 83 | } // end namespace flair
|
---|