void CameraSettings::reset() { pilotMode_ = false; cameraPosition_ = defaultCameraPosition_; cameraRotation_ = Matrix4f::IDENTITY; modelRotation_ = Matrix4f::IDENTITY; setCameraLookAt( defaultCameraLookAt_ ); setDirty( DIRTY_ALL ); }
void Renderer::updateCamera(const glm::vec3 &delta) { glm::mat4 viewMat = glm::inverse(camera_.calculateViewMatrix()); glm::vec3 forward = applyMatrix(viewMat, glm::vec3(0, 1, 0), false); forward = glm::normalize(glm::vec3(forward.x, forward.y, 0)); glm::vec3 right = applyMatrix(viewMat, glm::vec3(1, 0, 0), false); right = glm::normalize(glm::vec3(right.x, right.y, 0)); auto transformedDelta = delta.x * right + delta.y * forward; setCameraLookAt(camera_.getLookAt() + transformedDelta); }
void CameraSettings::setDefaultCameraLookAt( const Vector3f& lookAt ) { defaultCameraLookAt_ = lookAt; setCameraLookAt( lookAt ); }