void update() { wzy::Engine& eng = wzy::Engine::singleton(); auto cam = wzy::Engine::singleton().rootView()->camera(); constexpr float sensitivity = 10.0; constexpr float speed = 10.0; float rat = eng.timeRatio(); auto rot = cam->orientation(); cam->setFovY(70.0); if (wzy::Engine::singleton().isPressed(wzy::Window::Key::w)) cam->setPosition(cam->position() + rot * wzy::Vector3f(-speed, 0.0, 0.0) * rat); if (wzy::Engine::singleton().isPressed(wzy::Window::Key::e)) cam->setPosition(cam->position() + rot * wzy::Vector3f(0.0, 0.0, -speed) * rat); if (wzy::Engine::singleton().isPressed(wzy::Window::Key::r)) cam->setPosition(cam->position() + rot * wzy::Vector3f(speed, 0.0, 0.0) * rat); if (wzy::Engine::singleton().isPressed(wzy::Window::Key::d)) cam->setPosition(cam->position() + rot * wzy::Vector3f(0.0, 0.0, speed) * rat); if (eng.isPressed(wzy::Engine::MouseButton::Left)) { wzy::Quaternionf toRotate(-wzy::Degree(sensitivity) * eng.timeRatio() * eng.mouseForce().y(), -wzy::Degree(sensitivity) * eng.timeRatio() * eng.mouseForce().x(), wzy::Degree(0.0)); cam->setOrientation(cam->orientation() * toRotate); } }
//----------------------------------------------------------------------------// RenderTarget::RenderTarget(): d_activationCounter(0), d_area(0, 0, 0, 0), d_matrixValid(false), d_matrix(1.0f), d_viewDistance(0), d_fovY(glm::radians(30.0f)) { // Call the setter function to ensure that the half-angle tangens value is set correctly setFovY(d_fovY); }