source: flair-src/trunk/lib/FlairSimulator/src/VisualizationCamera.cpp@ 256

Last change on this file since 256 was 70, checked in by Sanahuja Guillaume, 8 years ago

simu cameras

File size: 2.2 KB
RevLine 
[69]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: 2016/09/01
6// filename: VisualizationCamera.cpp
7//
8// author: Guillaume Sanahuja
9// Copyright Heudiasyc UMR UTC/CNRS 7253
10//
11// version: $Id: $
12//
13// purpose: class for a visualization camera in the gui
14//
15/*********************************************************************/
16#ifdef GL
17
18#include "VisualizationCamera.h"
19#include "Simulator.h"
20#include "Model.h"
21#include "Model_impl.h"
22#include "Gui.h"
[70]23#include "Gui_impl.h"
[69]24#include <ICursorControl.h>
25#include <ICameraSceneNode.h>
26#include <IrrlichtDevice.h>
27#include <ISceneManager.h>
28
29using namespace irr;
30using namespace gui;
31using namespace core;
32using namespace scene;
33
34namespace flair {
35namespace simulator {
36
[70]37VisualizationCamera::VisualizationCamera(std::string inName) {
38 name=inName;
39 currentZoom = 0;
[69]40 LMouseKey = false;
41
42 // camera
43 camera = getGui()->getSceneManager()->addCameraSceneNode();
44 camera->setAspectRatio(getGui()->getAspectRatio()); // on force a cause du view port
45 camera->setUpVector(vector3df(0, 0, 1));
46 camera->addAnimator(this);
47 camera->setFarValue(8000);
[70]48
49 getGui()->pimpl_->AddVisualizationCamera(this);
[69]50}
51
52VisualizationCamera::~VisualizationCamera() {}
53
[70]54std::string VisualizationCamera::getName(void) {
55 return name;
56}
57
[69]58ICameraSceneNode *VisualizationCamera::getCameraSceneNode(void) {
59 return camera;
60}
61
62ISceneNodeAnimator *VisualizationCamera::createClone(ISceneNode *node,
63 ISceneManager *newManager) {
64 return NULL;
65}
66
67bool VisualizationCamera::OnEvent(const irr::SEvent& event) {
68 if (event.EventType != EET_MOUSE_INPUT_EVENT)
69 return false;
70
71 switch (event.MouseInput.Event) {
72
73 case EMIE_MOUSE_WHEEL:
[70]74 currentZoom -= event.MouseInput.Wheel;
[69]75 break;
76 case EMIE_LMOUSE_PRESSED_DOWN:
77 LMouseKey = true;
78 break;
79 case EMIE_LMOUSE_LEFT_UP:
80 LMouseKey = false;
81 break;
82 case EMIE_MOUSE_MOVED:
83 MousePos = getGui()->getDevice()->getCursorControl()->getRelativePosition();
84 break;
85 default:
86 return false;
87 break;
88 }
89
90 return true;
91}
92
93} // end namespace simulator
94} // end namespace flair
95
96#endif // GL
Note: See TracBrowser for help on using the repository browser.