From a5f7522155594e13743fb6a29ea905610b2462a2 Mon Sep 17 00:00:00 2001 From: 4321ba Date: Sat, 26 Apr 2025 15:15:52 +0200 Subject: [PATCH 1/3] it compiles, but file paths are hardcoded --- CMakeLists.txt | 2 +- run_build_debug.sh | 16 ++++++++++++++++ src/imGuiUi/ImGuiUI.cpp | 2 +- src/renderer/guiRendererConcreteMediator.cpp | 4 ++-- src/renderer/guiRendererConcreteMediator.hpp | 4 ++-- src/renderer/renderer.hpp | 4 ++-- src/utils/glUtils.cpp | 2 +- src/utils/utils.cpp | 7 +++---- src/utils/utils.hpp | 14 +++++++++++--- thirdParty/imguizmo/ImGuizmo.cpp | 4 ++-- 10 files changed, 41 insertions(+), 18 deletions(-) create mode 100755 run_build_debug.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 67585e6..04c3cd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,7 +68,7 @@ if (WIN32) ${GLEW_DIR}/lib/Release/x64/glew32s.lib opengl32) else() - target_link_libraries(Mesh2Splat glfw glew GL) #todo + target_link_libraries(Mesh2Splat glfw GLEW GL stdc++fs) #todo endif() set_target_properties(Mesh2Splat PROPERTIES diff --git a/run_build_debug.sh b/run_build_debug.sh new file mode 100755 index 0000000..bcd0b77 --- /dev/null +++ b/run_build_debug.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Remove directories if they exist +[ -d build ] && rm -rf build +[ -d bin ] && rm -rf bin + +# Create build directory and navigate into it +mkdir build +cd build + +# Run CMake configuration and build +cmake .. +cmake --build . --config Debug + +# Go back to the original directory +cd .. diff --git a/src/imGuiUi/ImGuiUI.cpp b/src/imGuiUi/ImGuiUI.cpp index 693dc95..414ab6d 100644 --- a/src/imGuiUi/ImGuiUI.cpp +++ b/src/imGuiUi/ImGuiUI.cpp @@ -3,7 +3,7 @@ // Copyright (c) 2025 Electronic Arts Inc. All rights reserved. // /////////////////////////////////////////////////////////////////////////////// -#include "ImGuiUI.hpp" +#include "ImGuiUi.hpp" ImGuiUI::ImGuiUI(float defaultGaussianStd, float defaultMesh2SPlatQuality) : resolutionIndex(0), diff --git a/src/renderer/guiRendererConcreteMediator.cpp b/src/renderer/guiRendererConcreteMediator.cpp index a52f504..1b94ad4 100644 --- a/src/renderer/guiRendererConcreteMediator.cpp +++ b/src/renderer/guiRendererConcreteMediator.cpp @@ -3,7 +3,7 @@ // Copyright (c) 2025 Electronic Arts Inc. All rights reserved. // /////////////////////////////////////////////////////////////////////////////// -#include "GuiRendererConcreteMediator.hpp" +#include "guiRendererConcreteMediator.hpp" void GuiRendererConcreteMediator::notify(EventType event) { @@ -99,7 +99,7 @@ void GuiRendererConcreteMediator::notify(EventType event) break; } case EventType::SavePLY: { - renderer.getSceneManager().exportPly(imguiUI.getMeshFullFilePathDestination(), imguiUI.getFormatOption()); + renderer.getSceneManager().exportPly("concrete/path/as/test/maybe/the\character/is/a/problem", imguiUI.getFormatOption()); imguiUI.setShouldSavePly(false); break; } diff --git a/src/renderer/guiRendererConcreteMediator.hpp b/src/renderer/guiRendererConcreteMediator.hpp index d0cdda5..c8f2c17 100644 --- a/src/renderer/guiRendererConcreteMediator.hpp +++ b/src/renderer/guiRendererConcreteMediator.hpp @@ -4,8 +4,8 @@ /////////////////////////////////////////////////////////////////////////////// #pragma once -#include "Mediator.hpp" -#include "Renderer.hpp" +#include "mediator.hpp" +#include "renderer.hpp" #include "imGuiUi/ImGuiUi.hpp" class GuiRendererConcreteMediator : public IMediator { diff --git a/src/renderer/renderer.hpp b/src/renderer/renderer.hpp index ace89bd..e47ef26 100644 --- a/src/renderer/renderer.hpp +++ b/src/renderer/renderer.hpp @@ -5,7 +5,7 @@ #pragma once #include "utils/utils.hpp" -#include "ioHandler.hpp" +#include "IoHandler.hpp" #include "imGuiUi/ImGuiUi.hpp" #include "parsers/parsers.hpp" #include "utils/glUtils.hpp" @@ -72,4 +72,4 @@ class Renderer { Camera& camera; -}; \ No newline at end of file +}; diff --git a/src/utils/glUtils.cpp b/src/utils/glUtils.cpp index a4ee1c5..75e02df 100644 --- a/src/utils/glUtils.cpp +++ b/src/utils/glUtils.cpp @@ -4,7 +4,7 @@ /////////////////////////////////////////////////////////////////////////////// #include "glUtils.hpp" -#include "utils/shaderRegistry.hpp" +#include "utils/ShaderRegistry.hpp" namespace glUtils { diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index f24ca11..e0a73d8 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -450,10 +450,9 @@ namespace utils C.x * (A.y - B.y) ); } - + std::string getExecutablePath() { - char buffer[MAX_PATH]; - GetModuleFileNameA(nullptr, buffer, MAX_PATH); + char buffer[] = "/absolute/path/as/a/test"; return std::string(buffer); } @@ -484,4 +483,4 @@ namespace utils return ret; } -} \ No newline at end of file +} diff --git a/src/utils/utils.hpp b/src/utils/utils.hpp index 26b2104..c9a4cb4 100644 --- a/src/utils/utils.hpp +++ b/src/utils/utils.hpp @@ -6,7 +6,14 @@ #pragma once #define _CRTDBG_MAP_ALLOC #include -#include +#ifdef _MSC_VER +#include +#else +#define _ASSERT(expr) ((void)0) + +#define _ASSERTE(expr) ((void)0) +#endif + #include #include @@ -44,7 +51,8 @@ #ifndef NOMINMAX #define NOMINMAX #endif -#include +//#include +#include static void CheckOpenGLError(const char* stmt, const char* fname, int line) @@ -277,4 +285,4 @@ namespace utils std::string getExecutableDir(); fs::path relative(fs::path p, fs::path base); -} \ No newline at end of file +} diff --git a/thirdParty/imguizmo/ImGuizmo.cpp b/thirdParty/imguizmo/ImGuizmo.cpp index 52ac88f..f0eb18b 100644 --- a/thirdParty/imguizmo/ImGuizmo.cpp +++ b/thirdParty/imguizmo/ImGuizmo.cpp @@ -29,7 +29,7 @@ #endif #include "imgui.h" #include "imgui_internal.h" -#include "ImGuizmo.hpp" +#include "Imguizmo.hpp" #if defined(_MSC_VER) || defined(__MINGW32__) #include @@ -3141,4 +3141,4 @@ namespace IMGUIZMO_NAMESPACE // restore view/projection because it was used to compute ray ComputeContext(svgView.m16, svgProjection.m16, gContext.mModelSource.m16, gContext.mMode); } -}; \ No newline at end of file +}; From f72dd4d1b33d30ee83179fe95b6ce589c69d2b89 Mon Sep 17 00:00:00 2001 From: 4321ba Date: Sat, 26 Apr 2025 15:46:29 +0200 Subject: [PATCH 2/3] fix file paths --- run_build_release.sh | 16 ++++++++++++++++ src/imGuiUi/ImGuiUI.cpp | 2 +- src/renderer/guiRendererConcreteMediator.cpp | 2 +- src/utils/utils.cpp | 10 ---------- src/utils/utils.hpp | 15 +-------------- 5 files changed, 19 insertions(+), 26 deletions(-) create mode 100755 run_build_release.sh diff --git a/run_build_release.sh b/run_build_release.sh new file mode 100755 index 0000000..ca49f10 --- /dev/null +++ b/run_build_release.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Remove directories if they exist +[ -d build ] && rm -rf build +[ -d bin ] && rm -rf bin + +# Create build directory and navigate into it +mkdir build +cd build + +# Run CMake configuration and build +cmake .. +cmake --build . --config Release + +# Go back to the original directory +cd .. diff --git a/src/imGuiUi/ImGuiUI.cpp b/src/imGuiUi/ImGuiUI.cpp index 414ab6d..33b3cc1 100644 --- a/src/imGuiUi/ImGuiUI.cpp +++ b/src/imGuiUi/ImGuiUI.cpp @@ -118,7 +118,7 @@ void ImGuiUI::renderFileSelectorWindow() { if (ImGuiFileDialog::Instance()->IsOk()) { std::string chosenFolder = ImGuiFileDialog::Instance()->GetCurrentPath(); - destinationFilePathFolder = chosenFolder + "\\"; + destinationFilePathFolder = chosenFolder; } // Close the dialog diff --git a/src/renderer/guiRendererConcreteMediator.cpp b/src/renderer/guiRendererConcreteMediator.cpp index 1b94ad4..a99ed6c 100644 --- a/src/renderer/guiRendererConcreteMediator.cpp +++ b/src/renderer/guiRendererConcreteMediator.cpp @@ -99,7 +99,7 @@ void GuiRendererConcreteMediator::notify(EventType event) break; } case EventType::SavePLY: { - renderer.getSceneManager().exportPly("concrete/path/as/test/maybe/the\character/is/a/problem", imguiUI.getFormatOption()); + renderer.getSceneManager().exportPly(imguiUI.getMeshFullFilePathDestination(), imguiUI.getFormatOption()); imguiUI.setShouldSavePly(false); break; } diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index e0a73d8..07372d4 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -451,16 +451,6 @@ namespace utils ); } - std::string getExecutablePath() { - char buffer[] = "/absolute/path/as/a/test"; - return std::string(buffer); - } - - std::string getExecutableDir() { - std::experimental::filesystem::path exePath(getExecutablePath()); - return exePath.parent_path().string(); - } - //https://stackoverflow.com/questions/63899489/c-experimental-filesystem-has-no-relative-function fs::path relative(fs::path p, fs::path base) { diff --git a/src/utils/utils.hpp b/src/utils/utils.hpp index c9a4cb4..7b615bd 100644 --- a/src/utils/utils.hpp +++ b/src/utils/utils.hpp @@ -6,14 +6,6 @@ #pragma once #define _CRTDBG_MAP_ALLOC #include -#ifdef _MSC_VER -#include -#else -#define _ASSERT(expr) ((void)0) - -#define _ASSERTE(expr) ((void)0) -#endif - #include #include @@ -51,8 +43,7 @@ #ifndef NOMINMAX #define NOMINMAX #endif -//#include -#include +#include // for isnan static void CheckOpenGLError(const char* stmt, const char* fname, int line) @@ -280,9 +271,5 @@ namespace utils float triangleArea(const glm::vec3& A, const glm::vec3& B, const glm::vec3& C); - std::string getExecutablePath(); - - std::string getExecutableDir(); - fs::path relative(fs::path p, fs::path base); } From b5f6de2e539f48ac19fe4a71775226faa6d23b62 Mon Sep 17 00:00:00 2001 From: 4321ba Date: Sat, 26 Apr 2025 15:56:59 +0200 Subject: [PATCH 3/3] append readme with linux build instructions --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index b01a655..7c57ba6 100644 --- a/README.md +++ b/README.md @@ -110,6 +110,19 @@ To build **Mesh2Splat**, follow the following steps: > **Tip**: Use the release build if you only need the final executable in optimized (Release) mode. +## Build Instructions (Linux) + +The hardware and software requirements are similar as on Windows. + +To build **Mesh2Splat**, follow the following steps: + +1. Open a terminal in the project root directory. +2. Run one of the provided bash scripts: + - `run_build_debug.sh` + - `run_build_release.sh` +3. Open the `build` folder and run the executable + + ## Limitations - Volumetric Data such as foliage, grass, hair, clouds, etc. has not being targeted and will probably not be converted correctly if using primitives different from triangles.