【发布时间】:2020-06-21 02:24:01
【问题描述】:
我正在构建一个相机类,并从在线教程中获得了构建该类的帮助。
现在我想在相机中添加滚动,但找不到任何可以解释如何在相机中添加滚动的阅读材料。
Camera(glm::vec3 position = glm::vec3(0.0f, 0.0f, 500.0f), glm::vec3 up = glm::vec3(0.0f, 1.0f, 0.0f), float yaw = YAW, float pitch = PITCH) : Front(glm::vec3(0.0f, 0.0f, -1.0f)), Zoom(ZOOM)
{
Position = position;
WorldUp = up;
Yaw = yaw;
Pitch = pitch;
updateCameraVectors();
}
glm::mat4 GetViewMatrix()
{
return glm::lookAt(Position, Position + Front , Up);
}
void updateCameraVectors()
{
glm::vec3 front;
front.x = cos(glm::radians(Yaw - 90)) * cos(glm::radians(Pitch));
front.y = sin(glm::radians(Pitch));
front.z = sin(glm::radians(Yaw - 90)) * cos(glm::radians(Pitch)) ;
Front = glm::normalize(front);
Right = glm::normalize(glm::cross(Front, WorldUp));
Up = glm::normalize(glm::cross(Right, Front));
}
如果有人能解释如何在本课程中添加 ROll 或指导我阅读一些材料,我将不胜感激。
【问题讨论】: