// %flair:license{ // This file is part of the Flair framework distributed under the // CECILL-C License, Version 1.0. // %flair:license} // created: 2016/09/01 // filename: FixedCamera.cpp // // author: Guillaume Sanahuja // Copyright Heudiasyc UMR UTC/CNRS 7253 // // version: $Id: $ // // purpose: class for a fixed camera in the gui // /*********************************************************************/ #ifdef GL #include "FixedCamera.h" #include "Simulator.h" #include "Model.h" #include "Model_impl.h" #include "Gui.h" #include #include #include #include using namespace irr; using namespace gui; using namespace core; using namespace scene; namespace flair { namespace simulator { FixedCamera::FixedCamera(core::Vector3D position,float rotateSpeed,float zoomSpeed):VisualizationCamera(rotateSpeed,zoomSpeed) { RotY = 020; RotZ = 0; Rotating = false; // camera camera->setPosition(vector3df(position.x,position.y,position.z)); } FixedCamera::~FixedCamera() {} void FixedCamera::animateNode(ISceneNode *node, u32 timeMs) { ICameraSceneNode *camera = static_cast(node); float nRotY = RotY; float nRotZ = RotZ; if (LMouseKey == true) { if (!Rotating) { RotateStart = MousePos; Rotating = true; nRotY = RotY; nRotZ = RotZ; } else { nRotY += (RotateStart.Y - MousePos.Y) * rotateSpeed; nRotZ += (RotateStart.X - MousePos.X) * rotateSpeed; } } else if (Rotating) { RotY += (RotateStart.Y - MousePos.Y) * rotateSpeed; RotZ += (RotateStart.X - MousePos.X) * rotateSpeed; nRotY = RotY; nRotZ = RotZ; Rotating = false; } camera->setRotation(vector3df(0,nRotY,nRotZ)); camera->bindTargetAndRotation(true); } } // end namespace simulator } // end namespace flair #endif // GL