bool update(float delta_time) { // Accumulate time total_time += delta_time; // Update the scale - base on sin wave s = 1.0f + sinf(total_time); // Multiply by 5 s *= 5.0f; // Increment theta - half a rotation per second theta += pi<float>() * delta_time; // Check if key is pressed if (glfwGetKey(renderer::get_window(), GLFW_KEY_UP)) { pos += vec3(0.0f, 0.0f, -5.0f) * delta_time; } if (glfwGetKey(renderer::get_window(), GLFW_KEY_DOWN)) { pos += vec3(0.0f, 0.0f, 5.0f) * delta_time; } if (glfwGetKey(renderer::get_window(), GLFW_KEY_LEFT)) { pos += vec3(-5.0f, 0.0f, 0.0f) * delta_time; } if (glfwGetKey(renderer::get_window(), GLFW_KEY_RIGHT)) { pos += vec3(5.0f, 0.0f, 0.0f) * delta_time; } // Update the camera cam.update(delta_time); return true; }
bool update(float delta_time) { // Update camera static float x = 0.0f; x += delta_time; cam.set_position(vec3(10.0f * sinf(x), 10.0f, 10.0f * cosf(x))); cam.update(delta_time); return true; }
bool update(float delta_time) { cam.update(delta_time); // ********************************* // Set skybox position to camera position (camera in centre of skybox) // rotate the sphere // ********************************* return true; }
bool update(float delta_time) { // Use up an down to modify the dissolve factor if (glfwGetKey(renderer::get_window(), GLFW_KEY_UP)) dissolve_factor = clamp(dissolve_factor + 0.1f * delta_time, 0.0f, 1.0f); if (glfwGetKey(renderer::get_window(), GLFW_KEY_DOWN)) dissolve_factor = clamp(dissolve_factor - 0.1f * delta_time, 0.0f, 1.0f); // Update camera cam.update(delta_time); uv_scroll += vec2(0, delta_time * 0.05); return true; }
bool update(float delta_time) { // Accumulate time total_time += delta_time; // Update the scale - base on sin wave s = 1.0f + sinf(total_time); // Multiply by 5 s *= 5.0f; // Increment theta - half a rotation per second theta += pi<float>() * delta_time; // Update the camera cam.update(delta_time); return true; }
bool update(float delta_time) { if (glfwGetKey(renderer::get_window(), GLFW_KEY_UP)) theta -= pi<float>() * delta_time; if (glfwGetKey(renderer::get_window(), GLFW_KEY_DOWN)) theta += pi<float>() * delta_time; if (glfwGetKey(renderer::get_window(), GLFW_KEY_RIGHT)) rho -= pi<float>() * delta_time; if (glfwGetKey(renderer::get_window(), GLFW_KEY_LEFT)) rho += pi<float>() * delta_time; // Update the camera cam.update(delta_time); return true; }
bool update(float delta_time) { // Range of the point light static float range = 20.0f; // ********************************* // WSAD to move point light // O and P to change range // ********************************* // Set range light.set_range(range); // Rotate the sphere meshes["sphere"].get_transform().rotate(vec3(0.0f, half_pi<float>(), 0.0f) * delta_time); cam.update(delta_time); return true; }
bool update(float delta_time) { if (glfwGetKey(renderer::get_window(), '1')) cam.set_position(vec3(50, 10, 50)); if (glfwGetKey(renderer::get_window(), '2')) cam.set_position(vec3(-50, 10, 50)); if (glfwGetKey(renderer::get_window(), '3')) cam.set_position(vec3(-50, 10, -50)); if (glfwGetKey(renderer::get_window(), '4')) cam.set_position(vec3(50, 10, -50)); // Rotate the sphere meshes["sphere"].get_transform().rotate(vec3(0.0f, half_pi<float>(), 0.0f) * delta_time); cam.update(delta_time); return true; }
bool update(float delta_time) { if (glfwGetKey(renderer::get_window(), '1')) { cam.set_position(vec3(50, 10, 50)); } if (glfwGetKey(renderer::get_window(), '2')) { cam.set_position(vec3(-50, 10, 50)); } if (glfwGetKey(renderer::get_window(), '3')) { cam.set_position(vec3(-50, 10, -50)); } if (glfwGetKey(renderer::get_window(), '4')) { cam.set_position(vec3(50, 10, -50)); } cam.update(delta_time); return true; }
bool update(float delta_time) { // Rotate the teapot meshes["teapot"].get_transform().rotate(vec3(0.0f, 0.0f, half_pi<float>()) * delta_time); // ********************************* // Update the shadow map properties from the spot light // ********************************* // Press s to save if (glfwGetKey(renderer::get_window(), 'S') == GLFW_PRESS) shadow.buffer->save("test.png"); cam.update(delta_time); return true; }
bool update(float delta_time) { // Update the camera cam.update(delta_time); return true; }