diff --git a/src/client/client_imgui.cpp b/src/client/client_imgui.cpp index 224ad84..6d7d481 100644 --- a/src/client/client_imgui.cpp +++ b/src/client/client_imgui.cpp @@ -112,6 +112,7 @@ int main(int argc, char** argv) int window_height, window_width; glm::mat4 projection; glm::vec3 camera_position = glm::vec3(4.f, 3.f, 3.f); + glm::vec3 camera_looking_at = glm::vec3(0.f, 0.f, 0.f); glm::mat4 view = glm::lookAt(camera_position, glm::vec3(0,0,0), glm::vec3(0,1,0)); glm::mat4 model_matrix = glm::mat4(1.0f); glm::mat4 model_default = glm::mat4(1.0f); @@ -146,10 +147,11 @@ int main(int argc, char** argv) cv_y -= camera_velocity * dt; } camera_translation = glm::vec3(cv_x, cv_y, 0.f); - auto ctm = glm::translate(glm::mat4(1.0f), camera_translation); - auto ncp = ctm * glm::vec4(camera_position[0], camera_position[1], camera_position[2], 1.0f); + auto ncp = glm::translate(glm::mat4(1.0f), camera_translation) * glm::vec4(camera_position[0], camera_position[1], camera_position[2], 1.0f); + auto ncla = glm::translate(glm::mat4(1.0f), camera_translation) * glm::vec4(camera_looking_at[0], camera_looking_at[1], camera_looking_at[2], 1.0f); camera_position = glm::vec3(ncp[0], ncp[1], ncp[2]); - view = glm::lookAt(camera_position, glm::vec3(0,0,0), glm::vec3(0,1,0)); + camera_looking_at = glm::vec3(ncla[0], ncla[1], ncla[2]); + view = glm::lookAt(camera_position, camera_looking_at, glm::vec3(0,1,0)); // Process messages int messages_treated = messager.processAll(); @@ -198,10 +200,12 @@ int main(int argc, char** argv) static int counter = 0; ImGui::Begin("Misc"); // Create a window called "Hello, world!" and append into it. - + ImGui::Text("Camera Position: %f, %f, %f", camera_position[0], camera_position[1], camera_position[2]); + ImGui::Text("Camera Looking At: %f, %f, %f", camera_looking_at[0], camera_looking_at[1], camera_looking_at[2]); ImGui::SliderFloat("Field of View (FOV)", &fov, 45.0f, 180.0f); // Edit 1 float using a slider from 0.0f to 1.0f ImGui::ColorEdit3("clear color", (float*)&clear_color); // Edit 3 floats representing a color + ImGui::Separator(); ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); ImGui::End();