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}
|
---|
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 "FollowMeCamera.h"
|
---|
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 |
|
---|
35 | namespace flair {
|
---|
36 | namespace simulator {
|
---|
37 |
|
---|
38 | Model::Model(const Simulator *parent, std::string name)
|
---|
39 | : IODevice(parent, name) {
|
---|
40 | #ifdef GL
|
---|
41 | pimpl_ =
|
---|
42 | 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() { delete pimpl_; }
|
---|
50 | #ifdef GL
|
---|
51 | ISceneNode *Model::getSceneNode() const { return pimpl_; }
|
---|
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 | */
|
---|
60 | void Model::setScale(float value) {
|
---|
61 | pimpl_->setScale(vector3df(value, value, value));
|
---|
62 | }
|
---|
63 |
|
---|
64 | aabbox3d<f32> *Model::Box() const { return &(pimpl_->box); }
|
---|
65 |
|
---|
66 | FollowMeCamera *Model::getFollowMeCamera(void) const { return pimpl_->camera; }
|
---|
67 |
|
---|
68 | void Model::setTriangleSelector(ITriangleSelector *selector) {
|
---|
69 |
|
---|
70 | pimpl_->selector = selector;
|
---|
71 | pimpl_->setTriangleSelector(selector);
|
---|
72 | }
|
---|
73 |
|
---|
74 | void Model::setCameraFarValue(float zf) { pimpl_->camera->getCameraSceneNode()->setFarValue(zf); }
|
---|
75 | #endif
|
---|
76 |
|
---|
77 | TabWidget *Model::GetTabWidget(void) const { return pimpl_->tabwidget; }
|
---|
78 |
|
---|
79 | float Model::dT(void) const { return pimpl_->dT->Value(); }
|
---|
80 |
|
---|
81 | } // end namespace simulator
|
---|
82 | } // end namespace flair
|
---|