Loading src/application.cpp +10 −16 Original line number Diff line number Diff line Loading @@ -32,6 +32,10 @@ Application::Application(size_t initialWidth, size_t initialHeight) { voyager.modelMatrix() = glm::rotate(voyager.modelMatrix(), 3.14159f / 2.0f, glm::vec3(1.0, 0.0, 0.0)); voyager.modelMatrix() = glm::rotate(voyager.modelMatrix(), 3.14159f / 2.0f, glm::vec3(0.0, 0.0, 1.0)); ulysses.modelMatrix() = glm::scale(ulysses.modelMatrix(), glm::vec3(0.5f)); ulysses.modelMatrix() = glm::rotate(ulysses.modelMatrix(), 3.14159f / 4.0f, glm::vec3(0.0, 1.0, 0.0)); ulysses.modelMatrix() = glm::rotate(ulysses.modelMatrix(), -3.14159f / 2.5f, glm::vec3(1.0, 0.0, 0.0)); glCreateBuffers(1, &cameraBuffer); glNamedBufferStorage(cameraBuffer, sizeof(CameraUBO), &cameraUbo, GL_DYNAMIC_STORAGE_BIT); Loading Loading @@ -73,6 +77,7 @@ void Application::render() { // -------------------------------------------------------------------------- pioneer.update(); voyager.update(); ulysses.update(); // Camera if (followedProbe) { Loading Loading @@ -130,24 +135,10 @@ void Application::render() { glBindVertexArray(teapot.vao()); glDrawElementsInstanced(teapot.mode(), teapot.indicesCount(), GL_UNSIGNED_INT, nullptr, 2048); // Draw the probes pioneer.draw(); voyager.draw(); //drawScene(ulysses, ulyssesModelMatrix); //drawScene(galileo, galileoModelMatrix); //drawScene(cassini, cassiniModelMatrix); //drawScene(juno, junoModelMatrix); /*pioneerModelMatrix = glm::rotate(pioneerModelMatrix, 0.005f, glm::vec3(1.0f, 0.0f, 0.0f)); pioneerModelMatrix = glm::rotate(pioneerModelMatrix, 0.005f, glm::vec3(0.0f, 1.0f, 0.0f)); pioneerModelMatrix = glm::rotate(pioneerModelMatrix, 0.005f, glm::vec3(0.0f, 0.0f, 1.0f)); for (auto& mesh : pioneer.meshes()) { GLuint program = mesh->material() && mesh->material()->normalTexture() ? normalMappedObjectProgram.id() : texturedObjectProgram.id(); glUseProgram(program); glProgramUniformMatrix4fv(program, 0, 1, GL_FALSE, glm::value_ptr(pioneerModelMatrix)); mesh->draw(); }*/ ulysses.draw(); glUseProgram(drawLightsProgram.id()); Loading Loading @@ -197,5 +188,8 @@ void Application::onKeyPressed(GLFWwindow *window, int key, int scancode, int ac case GLFW_KEY_2: followedProbe = &voyager; break; case GLFW_KEY_3: followedProbe = &ulysses; break; } } No newline at end of file src/application.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ private: Probe pioneer = Probe("objects/pioneer/pioneer.obj", { 0.0f, 4.0f, 15.0f }, 0.2f, texturedObjectProgram, normalMappedObjectProgram); Probe voyager = Probe("objects/voyager/voyager.obj", { 20.0f, 2.0f, 0.0f }, -0.1f, texturedObjectProgram, normalMappedObjectProgram); //Probe ulysses = Probe("objects/ulysses/ulysses.obj", { 20.0f, 2.0f, 0.0f }, texturedObjectProgram, normalMappedObjectProgram); Probe ulysses = Probe("objects/ulysses/ulysses.obj", { 20.0f, -3.0f, 20.0f }, 0.15f, texturedObjectProgram, normalMappedObjectProgram); //Probe galileo = Probe("objects/galileo/galileo.obj", { 20.0f, 2.0f, 0.0f }, texturedObjectProgram, normalMappedObjectProgram); //Probe cassini = Probe("objects/cassini/cassini.obj", { 20.0f, 2.0f, 0.0f }, texturedObjectProgram, normalMappedObjectProgram); //Probe juno = Probe("objects/juno/Juno.obj", { 20.0f, 2.0f, 0.0f }, texturedObjectProgram, normalMappedObjectProgram); Loading src/main.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ int main(void) glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, true); GLFWwindow *window = glfwCreateWindow(INITIAL_WIDTH, INITIAL_HEIGHT, "PV112 Project", NULL, NULL); GLFWwindow *window = glfwCreateWindow(INITIAL_WIDTH, INITIAL_HEIGHT, "The Almighty Jupiteapot", NULL, NULL); if (!window) { glfwTerminate(); return ERR_GLFW_OTHER; Loading Loading
src/application.cpp +10 −16 Original line number Diff line number Diff line Loading @@ -32,6 +32,10 @@ Application::Application(size_t initialWidth, size_t initialHeight) { voyager.modelMatrix() = glm::rotate(voyager.modelMatrix(), 3.14159f / 2.0f, glm::vec3(1.0, 0.0, 0.0)); voyager.modelMatrix() = glm::rotate(voyager.modelMatrix(), 3.14159f / 2.0f, glm::vec3(0.0, 0.0, 1.0)); ulysses.modelMatrix() = glm::scale(ulysses.modelMatrix(), glm::vec3(0.5f)); ulysses.modelMatrix() = glm::rotate(ulysses.modelMatrix(), 3.14159f / 4.0f, glm::vec3(0.0, 1.0, 0.0)); ulysses.modelMatrix() = glm::rotate(ulysses.modelMatrix(), -3.14159f / 2.5f, glm::vec3(1.0, 0.0, 0.0)); glCreateBuffers(1, &cameraBuffer); glNamedBufferStorage(cameraBuffer, sizeof(CameraUBO), &cameraUbo, GL_DYNAMIC_STORAGE_BIT); Loading Loading @@ -73,6 +77,7 @@ void Application::render() { // -------------------------------------------------------------------------- pioneer.update(); voyager.update(); ulysses.update(); // Camera if (followedProbe) { Loading Loading @@ -130,24 +135,10 @@ void Application::render() { glBindVertexArray(teapot.vao()); glDrawElementsInstanced(teapot.mode(), teapot.indicesCount(), GL_UNSIGNED_INT, nullptr, 2048); // Draw the probes pioneer.draw(); voyager.draw(); //drawScene(ulysses, ulyssesModelMatrix); //drawScene(galileo, galileoModelMatrix); //drawScene(cassini, cassiniModelMatrix); //drawScene(juno, junoModelMatrix); /*pioneerModelMatrix = glm::rotate(pioneerModelMatrix, 0.005f, glm::vec3(1.0f, 0.0f, 0.0f)); pioneerModelMatrix = glm::rotate(pioneerModelMatrix, 0.005f, glm::vec3(0.0f, 1.0f, 0.0f)); pioneerModelMatrix = glm::rotate(pioneerModelMatrix, 0.005f, glm::vec3(0.0f, 0.0f, 1.0f)); for (auto& mesh : pioneer.meshes()) { GLuint program = mesh->material() && mesh->material()->normalTexture() ? normalMappedObjectProgram.id() : texturedObjectProgram.id(); glUseProgram(program); glProgramUniformMatrix4fv(program, 0, 1, GL_FALSE, glm::value_ptr(pioneerModelMatrix)); mesh->draw(); }*/ ulysses.draw(); glUseProgram(drawLightsProgram.id()); Loading Loading @@ -197,5 +188,8 @@ void Application::onKeyPressed(GLFWwindow *window, int key, int scancode, int ac case GLFW_KEY_2: followedProbe = &voyager; break; case GLFW_KEY_3: followedProbe = &ulysses; break; } } No newline at end of file
src/application.hpp +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ private: Probe pioneer = Probe("objects/pioneer/pioneer.obj", { 0.0f, 4.0f, 15.0f }, 0.2f, texturedObjectProgram, normalMappedObjectProgram); Probe voyager = Probe("objects/voyager/voyager.obj", { 20.0f, 2.0f, 0.0f }, -0.1f, texturedObjectProgram, normalMappedObjectProgram); //Probe ulysses = Probe("objects/ulysses/ulysses.obj", { 20.0f, 2.0f, 0.0f }, texturedObjectProgram, normalMappedObjectProgram); Probe ulysses = Probe("objects/ulysses/ulysses.obj", { 20.0f, -3.0f, 20.0f }, 0.15f, texturedObjectProgram, normalMappedObjectProgram); //Probe galileo = Probe("objects/galileo/galileo.obj", { 20.0f, 2.0f, 0.0f }, texturedObjectProgram, normalMappedObjectProgram); //Probe cassini = Probe("objects/cassini/cassini.obj", { 20.0f, 2.0f, 0.0f }, texturedObjectProgram, normalMappedObjectProgram); //Probe juno = Probe("objects/juno/Juno.obj", { 20.0f, 2.0f, 0.0f }, texturedObjectProgram, normalMappedObjectProgram); Loading
src/main.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ int main(void) glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, true); GLFWwindow *window = glfwCreateWindow(INITIAL_WIDTH, INITIAL_HEIGHT, "PV112 Project", NULL, NULL); GLFWwindow *window = glfwCreateWindow(INITIAL_WIDTH, INITIAL_HEIGHT, "The Almighty Jupiteapot", NULL, NULL); if (!window) { glfwTerminate(); return ERR_GLFW_OTHER; Loading