void CCamera::RotateY (GLfloat Angle) { RotatedY += Angle; //Rotate viewdir around the up vector: ViewDir = Normalize3dVector(ViewDir*cos(Angle*float(PIdiv180)) - RightVector*sin(Angle*float(PIdiv180))); //now compute the new RightVector (by cross product) RightVector = CrossProduct(&ViewDir, &UpVector); }
void CCamera::RotateZ (GLfloat Angle) { RotatedZ += Angle; //Rotate viewdir around the right vector: RightVector = Normalize3dVector(RightVector*cos(Angle*PIdiv180) + UpVector*sin(Angle*PIdiv180)); //now compute the new UpVector (by cross product) UpVector = CrossProduct(&ViewDir, &RightVector)*-1; }
void GlCamera::rotateX (GLfloat angle) { rotatedX += angle; //Rotate viewdir around the right vector: viewDir = Normalize3dVector(viewDir*cos(angle*PIdiv180) + upVector*sin(angle*PIdiv180)); //now compute the new UpVector (by cross product) upVector = CrossProduct(&viewDir, &rightVector)*-1; }