Rotating a pinhole camera in 3D
问题 I am trying to rotate a pinhole camera in 3D space. I have previously raytraced a room. As good practice I have first done the maths and the tried to program the maths in c++. // Camera position vec3 cameraPos(0, 0, -19); // Rotate camera float& yaw; vec3 c1(cos(yaw), 0, sin(yaw)); vec3 c2(0, 1, 0); vec3 c3(-sin(yaw), 0, cos(yaw)); glm::mat3 R(c1, c2, c3); What I have done to rotate the camera is this: if (keystate[SDLK_LEFT]) { //cameraPos.x -= translation; if (yaw > 0) { yaw = 0.01; } cout