From 8b816f8296deb2daccdc84f0369742c127c84307 Mon Sep 17 00:00:00 2001 From: Seth Hamilton Date: Thu, 21 Aug 2025 13:19:42 -0500 Subject: [PATCH] getting ready to have the camera poses plotted using spheres. auto-copy pthreadVC3d.dll and poses.csv to output directory --- LivePlotter.vcxproj | 3 +++ inc/body.hpp | 1 + poses.csv | 15 +++++++++++++++ src/body.cpp | 1 + src/main.cpp | 4 +++- 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 poses.csv diff --git a/LivePlotter.vcxproj b/LivePlotter.vcxproj index e13aa13..a0df2e6 100644 --- a/LivePlotter.vcxproj +++ b/LivePlotter.vcxproj @@ -118,6 +118,9 @@ true ext\pthreads4w-code\build\Debug\pthreadVC3d.lib;glfw3.lib;opengl32.lib;%(AdditionalDependencies) + + xcopy /y "$(SolutionDir)poses.csv" "$(OutDir)" && xcopy /y "$(SolutionDir)ext\pthreads4w-code\build\Debug\pthreadVC3d.dll" "$(OutDir)" + diff --git a/inc/body.hpp b/inc/body.hpp index e27e766..37b1d3e 100644 --- a/inc/body.hpp +++ b/inc/body.hpp @@ -6,6 +6,7 @@ struct body { glm::mat4 pose; + float scale; uint ebo; uint vao; uint vbo; diff --git a/poses.csv b/poses.csv new file mode 100644 index 0000000..9c156c1 --- /dev/null +++ b/poses.csv @@ -0,0 +1,15 @@ +x,y,z,w,i,j,k +266.74169921875, 160.65499877929688, 138.2093963623047, 0.984807753012209, 3.512142734218295e-17, -0.17364817766692506, -5.0158596452676065e-17 +-266.7416687011719, 160.65499877929688, 138.2093963623047, 0.9848077530122087, 8.863269777109884e-16, 0.17364817766692614, 1.5628335990023316e-16 +266.74169921875, 447.67498779296875, 138.2093963623047, 0.984807753012209, 3.512142734218295e-17, -0.17364817766692506, -5.0158596452676065e-17 +-266.7416687011719, 447.67498779296875, 138.2093963623047, 0.9848077530122087, 8.863269777109884e-16, 0.17364817766692614, 1.5628335990023316e-16 +266.74169921875, 734.6950073242188, 138.2093963623047, 0.984807753012209, 3.512142734218295e-17, -0.17364817766692506, -5.0158596452676065e-17 +-266.7416687011719, 734.6950073242188, 138.2093963623047, 0.9848077530122087, 8.863269777109884e-16, 0.17364817766692614, 1.5628335990023316e-16 +266.74169921875, 1021.7150268554688, 138.2093963623047, 0.984807753012209, 3.512142734218295e-17, -0.17364817766692506, -5.0158596452676065e-17 +-266.7416687011719, 1021.7150268554688, 138.2093963623047, 0.9848077530122087, 8.863269777109884e-16, 0.17364817766692614, 1.5628335990023316e-16 +266.74169921875, 1308.7349853515625, 138.2093963623047, 0.984807753012209, 3.512142734218295e-17, -0.17364817766692506, -5.0158596452676065e-17 +-266.7416687011719, 1308.7349853515625, 138.2093963623047, 0.9848077530122087, 8.863269777109884e-16, 0.17364817766692614, 1.5628335990023316e-16 +266.74169921875, 1595.7550048828125, 138.2093963623047, 0.984807753012209, 3.512142734218295e-17, -0.17364817766692506, -5.0158596452676065e-17 +-266.7416687011719, 1595.7550048828125, 138.2093963623047, 0.9848077530122087, 8.863269777109884e-16, 0.17364817766692614, 1.5628335990023316e-16 +266.74169921875, 1882.7750244140625, 138.2093963623047, 0.984807753012209, 3.512142734218295e-17, -0.17364817766692506, -5.0158596452676065e-17 +-266.7416687011719, 1882.7750244140625, 138.2093963623047, 0.9848077530122087, 8.863269777109884e-16, 0.17364817766692614, 1.5628335990023316e-16 diff --git a/src/body.cpp b/src/body.cpp index ad3fb2d..eaa2096 100644 --- a/src/body.cpp +++ b/src/body.cpp @@ -101,6 +101,7 @@ bool load_body(body* out_body, const char* obj_filepath) { glEnableVertexAttribArray(0); *out_body = { .pose = glm::mat4(1), + .scale = 1.0f, .ebo = ebo, .vao = vao, .vbo = vbo, diff --git a/src/main.cpp b/src/main.cpp index ebb6572..f129519 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,9 +31,10 @@ void process_input() { } static uint shader; -void create_new_sphere(body* b) { +void create_new_sphere(body* b, float scale=1) { assert(load_body(b, "Icosphere.obj")); b->shader = shader; + b->scale = scale; b->pose = glm::translate(b->pose, glm::vec3(0, 0, 0)); } @@ -96,6 +97,7 @@ static void cursor_position_callback(GLFWwindow* window, double xpos, double ypo float dy = (ypos - prev_cursor_y); glm::mat4 camera_to_world = glm::inverse(world_to_camera); + // These could be acquired via some cross products. Don't know if that's more efficient. glm::vec4 strafe_x = camera_to_world[0]; glm::vec4 strafe_y = camera_to_world[1]; prev_cursor_x = xpos;