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