diff --git a/demo/demo/rollball.cpp b/demo/demo/rollball.cpp index 4f810142fe50e837e14c00fb33b73569b626c526..6b4f0dfb53f2b38b237c8478802b373ce230ad9b 100644 --- a/demo/demo/rollball.cpp +++ b/demo/demo/rollball.cpp @@ -128,15 +128,6 @@ static void setupCamera(fggl::ecs3::World& world) { // setup camera components world.add<fggl::gfx::Camera>(prototype); - auto* cameraKeys = world.add<fggl::input::FreeCamKeys>(prototype); - if ( cameraKeys != nullptr ) { - cameraKeys->forward = glfwGetKeyScancode(GLFW_KEY_W); - cameraKeys->backward = glfwGetKeyScancode(GLFW_KEY_S); - cameraKeys->left = glfwGetKeyScancode(GLFW_KEY_A); - cameraKeys->right = glfwGetKeyScancode(GLFW_KEY_D); - cameraKeys->rotate_cw = glfwGetKeyScancode(GLFW_KEY_Q); - cameraKeys->rotate_ccw = glfwGetKeyScancode(GLFW_KEY_E); - } } static fggl::ecs3::entity_t setupEnvironment(fggl::ecs3::World& world, const Prefabs prefabs, fggl::math::vec2& size) { @@ -195,33 +186,6 @@ static fggl::ecs3::entity_t setupEnvironment(fggl::ecs3::World& world, const Pre return player; } -enum camera_type { cam_free, cam_arcball }; -static camera_type cam_mode = cam_free; - -static void process_camera(fggl::ecs3::World& ecs, const fggl::input::Input& input) { - auto cameras = ecs.findMatching<fggl::gfx::Camera>(); - fggl::ecs3::entity_t cam = cameras[0]; - - auto camTransform = ecs.get<fggl::math::Transform>(cam); - auto camComp = ecs.get<fggl::gfx::Camera>(cam); - - const glm::vec3 dir = ( camTransform->origin() - camComp->target ); - const glm::vec3 forward = glm::normalize( dir ); - - // scroll wheel - glm::vec3 motion(0.0f); - float delta = input.mouse.axis( fggl::input::MouseAxis::SCROLL_Y ); - if ( (glm::length( dir ) < 25.0f && delta < 0.0f) || (glm::length( dir ) > 2.5f && delta > 0.0f) ) - motion -= (forward * delta); - camTransform->origin( camTransform->origin() + motion ); - - if ( input.mouse.down( fggl::input::MouseButton::MIDDLE ) ) { - fggl::input::process_arcball(ecs, input, cam); - } else { - fggl::input::process_freecam(ecs, input, cam); - } - fggl::input::process_edgescroll( ecs, input, cam ); -} namespace demo { @@ -246,9 +210,6 @@ namespace demo { Game::update(); auto& input = this->input(); - if ( input.keyboard.down(glfwGetKeyScancode(GLFW_KEY_F1))) { - process_camera(world(), input); - } else { if ( player != fggl::ecs3::NULL_ENTITY ) { auto &world = this->world(); @@ -295,7 +256,6 @@ namespace demo { camTransform->origin( camComp->target - (fggl::math::FORWARD * 15.0F) + (fggl::math::UP * 15.0F) ); } - } } }