Changeset 70 in flair-src for trunk/lib/FlairSimulator/src/FixedCamera.cpp
- Timestamp:
- Sep 6, 2016, 5:49:32 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSimulator/src/FixedCamera.cpp
r69 r70 25 25 #include <IrrlichtDevice.h> 26 26 #include <ISceneManager.h> 27 #include <Euler.h> 27 28 28 29 using namespace irr; … … 34 35 namespace simulator { 35 36 36 FixedCamera::FixedCamera( core::Vector3D position,float rotateSpeed,float zoomSpeed):VisualizationCamera(rotateSpeed,zoomSpeed) {37 RotY = 020;37 FixedCamera::FixedCamera(std::string name,core::Vector3D position,float inRotateSpeed,float inZoomSpeed):VisualizationCamera(name) { 38 RotY = -90; 38 39 RotZ = 0; 39 40 Rotating = false; 40 41 // camera 42 camera->setPosition(vector3df(position.x,position.y,position.z)); 41 rotateSpeed=inRotateSpeed; 42 zoomSpeed=inZoomSpeed; 43 camera->setPosition(vector3df(ToIrrlichtCoordinates(position))); 44 fov=camera->getFOV(); 43 45 } 44 46 45 47 FixedCamera::~FixedCamera() {} 48 49 float FixedCamera::sat(float value) { 50 if (value >= -1) 51 value = -1; 52 if (value <= -179) 53 value = -179; 54 return value; 55 } 46 56 47 57 void FixedCamera::animateNode(ISceneNode *node, u32 timeMs) { … … 60 70 nRotY += (RotateStart.Y - MousePos.Y) * rotateSpeed; 61 71 nRotZ += (RotateStart.X - MousePos.X) * rotateSpeed; 72 nRotY = sat(nRotY); 62 73 } 63 74 } else if (Rotating) { 64 75 RotY += (RotateStart.Y - MousePos.Y) * rotateSpeed; 65 76 RotZ += (RotateStart.X - MousePos.X) * rotateSpeed; 77 RotY = sat(RotY); 66 78 nRotY = RotY; 67 79 nRotZ = RotZ; … … 69 81 } 70 82 83 float newFov=fov+currentZoom*zoomSpeed; 84 if(newFov>fov) { 85 newFov=fov; 86 currentZoom=0; 87 } 88 if(newFov<0) { 89 newFov=zoomSpeed; 90 currentZoom=1-fov/zoomSpeed; 91 } 92 71 93 camera->setRotation(vector3df(0,nRotY,nRotZ)); 72 94 camera->bindTargetAndRotation(true); 95 camera->setFOV(newFov); 73 96 } 74 97
Note:
See TracChangeset
for help on using the changeset viewer.