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 "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 | namespace simulator {
|
---|
36 |
|
---|
37 | Model::Model(const Simulator *parent, std::string name)
|
---|
38 | : IODevice(parent, name) {
|
---|
39 | #ifdef GL
|
---|
40 | pimpl_ =
|
---|
41 | new Model_impl(this, name, getGui()->getSceneManager(), parent->pimpl_);
|
---|
42 | #else
|
---|
43 | pimpl_ = new Model_impl(this, name, parent->pimpl_);
|
---|
44 | #endif
|
---|
45 | parent->pimpl_->models.push_back(this);
|
---|
46 | }
|
---|
47 |
|
---|
48 | Model::~Model() { delete pimpl_; }
|
---|
49 | #ifdef GL
|
---|
50 | ISceneNode *Model::getSceneNode() const { return pimpl_; }
|
---|
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 | */
|
---|
59 | void Model::setScale(float value) {
|
---|
60 | pimpl_->setScale(vector3df(value, value, value));
|
---|
61 | }
|
---|
62 |
|
---|
63 | aabbox3d<f32> *Model::Box() const { return &(pimpl_->box); }
|
---|
64 |
|
---|
65 | AnimPoursuite *Model::getCamera(void) const { return pimpl_->animator; }
|
---|
66 |
|
---|
67 | void Model::setTriangleSelector(ITriangleSelector *selector) {
|
---|
68 |
|
---|
69 | pimpl_->selector = selector;
|
---|
70 | pimpl_->setTriangleSelector(selector);
|
---|
71 | }
|
---|
72 |
|
---|
73 | void Model::setCameraFarValue(float zf) { pimpl_->camera->setFarValue(zf); }
|
---|
74 | #endif
|
---|
75 |
|
---|
76 | TabWidget *Model::GetTabWidget(void) const { return pimpl_->tabwidget; }
|
---|
77 |
|
---|
78 | float Model::dT(void) const { return pimpl_->dT->Value(); }
|
---|
79 |
|
---|
80 | } // end namespace simulator
|
---|
81 | } // end namespace flair
|
---|