Changeset 87 in flair-src for trunk/lib/FlairSimulator/src/FixedCamera.cpp
- Timestamp:
- 09/28/16 08:41:02 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairSimulator/src/FixedCamera.cpp
r70 r87 35 35 namespace simulator { 36 36 37 FixedCamera::FixedCamera(std::string name,core::Vector3D position,float inRotateSpeed,float inZoomSpeed):VisualizationCamera(name) { 38 RotY = -90; 39 RotZ = 0; 37 FixedCamera::FixedCamera(std::string name,core::Vector3D position,core::Vector3D lookat,float inRotateSpeed,float inZoomSpeed):VisualizationCamera(name) { 40 38 Rotating = false; 41 39 rotateSpeed=inRotateSpeed; 42 40 zoomSpeed=inZoomSpeed; 41 42 camera->bindTargetAndRotation(true); 43 43 camera->setPosition(vector3df(ToIrrlichtCoordinates(position))); 44 camera->setTarget(vector3df(ToIrrlichtCoordinates(lookat))); 45 init=false; 46 rotation=camera->getRotation(); 47 printf("%f %f %f\n",rotation.X,rotation.Y,rotation.Z); 44 48 fov=camera->getFOV(); 45 49 } … … 57 61 void FixedCamera::animateNode(ISceneNode *node, u32 timeMs) { 58 62 ICameraSceneNode *camera = static_cast<ICameraSceneNode *>(node); 63 vector3df newRotation=rotation; 59 64 60 float nRotY = RotY; 61 float nRotZ = RotZ; 65 if(init==false) { 66 rotation=camera->getRotation(); 67 printf("%f %f %f\n",rotation.X,rotation.Y,rotation.Z); 68 init=true; 69 } 70 float nRotY = 0;//rotation.Y; 71 float nRotZ = rotation.Z; 62 72 63 73 if (LMouseKey == true) { … … 65 75 RotateStart = MousePos; 66 76 Rotating = true; 67 nRotY = RotY;68 nRotZ = RotZ;77 //nRotY = rotation.Y; 78 nRotZ = rotation.Z; 69 79 } else { 70 nRotY += (RotateStart.Y - MousePos.Y) * rotateSpeed;80 nRotY = (RotateStart.Y - MousePos.Y) * rotateSpeed; 71 81 nRotZ += (RotateStart.X - MousePos.X) * rotateSpeed; 72 nRotY = sat(nRotY); 82 newRotation.rotateXZBy(-nRotY); 83 //nRotY = sat(nRotY); 73 84 } 74 85 } else if (Rotating) { 75 RotY += (RotateStart.Y - MousePos.Y) * rotateSpeed;76 RotZ += (RotateStart.X - MousePos.X) * rotateSpeed;77 RotY = sat(RotY);78 nRotY = RotY;79 nRotZ = RotZ;86 //rotation.Y += (RotateStart.Y - MousePos.Y) * rotateSpeed; 87 //rotation.Z += (RotateStart.X - MousePos.X) * rotateSpeed; 88 //rotation.Y = sat(rotation.Y); 89 //nRotY = rotation.Y; 90 nRotZ = rotation.Z; 80 91 Rotating = false; 81 92 } … … 91 102 } 92 103 93 camera->setRotation(vector3df(0,nRotY,nRotZ)); 94 camera->bindTargetAndRotation(true); 104 105 106 //camera->setRotation(vector3df(rotation.X,-180-nRotY,nRotZ)); 107 //camera->setRotation(vector3df(rotation.X,nRotY,0)); 108 //camera->bindTargetAndRotation(true); 109 camera->setRotation(rotation); 110 //camera->setTarget(vector3df(ToIrrlichtCoordinates(core::Vector3D(0,0,-2)))); 111 //rotation=camera->getRotation(); 112 //printf("%f %f %f\n",rotation.X,rotation.Y,rotation.Z); 113 95 114 camera->setFOV(newFov); 96 115 }
Note:
See TracChangeset
for help on using the changeset viewer.