本文整理汇总了C++中tdogl::Camera::pitch方法的典型用法代码示例。如果您正苦于以下问题:C++ Camera::pitch方法的具体用法?C++ Camera::pitch怎么用?C++ Camera::pitch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tdogl::Camera
的用法示例。
在下文中一共展示了Camera::pitch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
// update the scene based on the time elapsed since last update
static void Update(float secondsElapsed) {
//constantly move position of camera forward
gCamera.fly(secondsElapsed * flyingSpeed);
//accelerate flying speed based on XZ keys
const GLfloat accelerateFlyingPerSecond = 1.3f; //units per second
if(glfwGetKey(gWindow, 'X')){
flyingSpeed += secondsElapsed * accelerateFlyingPerSecond;
} else if(glfwGetKey(gWindow, 'Z')){
flyingSpeed -= secondsElapsed * accelerateFlyingPerSecond;
}
//rotate camera based on WASDQE keys
const GLfloat pitchDegreesPerSecond = 25.0f; //degrees per second
const GLfloat yawDegreesPerSecond = 25.0f; //degrees per second
const GLfloat rollDegreesPerSecond = 25.0f; //degrees per second
if(glfwGetKey(gWindow, 'S')){
gCamera.pitch(secondsElapsed * -pitchDegreesPerSecond);
} else if(glfwGetKey(gWindow, 'W')){
gCamera.pitch(secondsElapsed * pitchDegreesPerSecond);
}
if(glfwGetKey(gWindow, 'A')){
gCamera.yaw(secondsElapsed * yawDegreesPerSecond);
} else if(glfwGetKey(gWindow, 'D')){
gCamera.yaw(secondsElapsed * -yawDegreesPerSecond);
}
if(glfwGetKey(gWindow, 'Q')){
gCamera.roll(secondsElapsed * -rollDegreesPerSecond);
} else if(glfwGetKey(gWindow, 'E')){
gCamera.roll(secondsElapsed * rollDegreesPerSecond);
}
}