source: flair-src/trunk/lib/FlairSimulator/src/GenericObject.cpp@ 409

Last change on this file since 409 was 286, checked in by Sanahuja Guillaume, 6 years ago

draw vrpn axis in simulator

File size: 2.1 KB
RevLine 
[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: GenericObject.cpp
7//
8// author: Cesar Richard
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: classe definissant un modele a simuler
14//
15/*********************************************************************/
16
17#ifdef GL
18#include "GenericObject.h"
[134]19#include "Simulator.h"
[8]20#include "Simulator_impl.h"
[134]21#include "Gui.h"
[8]22
23#include "Quaternion.h"
[134]24#include "Euler.h"
[8]25#include <ISceneManager.h>
[134]26#include <IMeshSceneNode.h>
[69]27
[8]28using namespace irr;
29using namespace video;
30using namespace scene;
31using namespace core;
32
33using namespace flair::core;
34using namespace flair::simulator;
35
[15]36namespace flair {
37namespace simulator {
[8]38
[158]39GenericObject::GenericObject(IMesh *mesh)
[8]40{
[134]41 meshSceneNode=getGui()->getSceneManager()->addMeshSceneNode(mesh);
[286]42 /*
[134]43 selector = getGui()->getSceneManager()->createTriangleSelector(mesh, meshSceneNode);
44 meshSceneNode->setTriangleSelector(selector);
[286]45 */
[134]46 meshSceneNode->setMaterialFlag(EMF_LIGHTING, false);
[8]47
[158]48 getSimulator()->pimpl_->objects.push_back(this);
[8]49}
50
[15]51GenericObject::~GenericObject() {}
[8]52
[15]53ITriangleSelector *GenericObject::TriangleSelector(void) { return selector; }
[8]54
[286]55void GenericObject::setVisible(bool isVisible) {
56 meshSceneNode->setVisible(isVisible);
57}
[134]58void GenericObject::setScale(float value) {
59 meshSceneNode->setScale(vector3df(value, value, value));
[8]60}
61
[134]62void GenericObject::setScale(const vector3df& scale) {
63 meshSceneNode->setScale(scale);
[8]64}
65
[134]66void GenericObject::setPosition(const vector3df& pos) {
67 meshSceneNode->setPosition(ToIrrlichtCoordinates(pos));
[8]68}
69
[134]70void GenericObject::setRotation(const vector3df& rotation) {
[15]71 Euler eulerA(rotation.X, rotation.Y, rotation.Z);
72 Euler eulerB;
73 Quaternion quatA, quatB;
74 eulerA.ToQuaternion(quatA);
75 quatB = ToIrrlichtOrientation(quatA);
76 quatB.ToEuler(eulerB);
[8]77
[134]78 meshSceneNode->setRotation(Euler::ToDegree(1) *
[15]79 vector3df(eulerB.roll, eulerB.pitch, eulerB.yaw));
[8]80}
81
82} // end namespace simulator
83} // end namespace flair
84#endif
Note: See TracBrowser for help on using the repository browser.