Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7018ae1
Exposed step and decimal size on numerical property widgets
RealDanTheMan Jun 4, 2025
9f2a878
Exposed additional collision generation properties to UI
RealDanTheMan Jun 4, 2025
47ba41b
Removed single hull and exact decomposition collision generation
RealDanTheMan Jun 4, 2025
cd778ad
Added tooltips too all property widgets
RealDanTheMan Jun 5, 2025
1c92119
Adjusted collision opacity
RealDanTheMan Jun 7, 2025
b629dba
Fixed z fighting when drawing transparent collision
RealDanTheMan Jun 7, 2025
b0993e3
Removed opengl header to fall back on QT OpenGL implementation
RealDanTheMan Jun 7, 2025
8523296
Scene grid will now fade out in the distance
RealDanTheMan Jun 7, 2025
6b19232
Scene grid now fades after distance derived from scene bouding sphere
RealDanTheMan Jun 7, 2025
0ed0e9e
Improved scene grid fading effect
RealDanTheMan Jun 7, 2025
1896416
Scene grid now uses meter size cells
RealDanTheMan Jun 7, 2025
8145974
Further adjusted scene grid fade effect
RealDanTheMan Jun 7, 2025
e4f6ffd
Updated demo images
RealDanTheMan Jun 7, 2025
7e2e367
Added product directory to gitignore
RealDanTheMan Jun 8, 2025
f3e5a98
Project cmake now supports MacOS package builds via PRODUCT_PACKAGE flag
RealDanTheMan Jun 8, 2025
0309bea
Added script for building native macosx package
RealDanTheMan Jun 8, 2025
28daac8
Updated cmake and build scripts to support package builds on linux os
RealDanTheMan Jul 24, 2025
627b353
Added package resources for linux app image
RealDanTheMan Jul 24, 2025
181d35b
Updated windows build script to fix dependency resolution across plugins
RealDanTheMan Jul 27, 2025
d9a066e
Renamed windows build script to be more representative
RealDanTheMan Jul 27, 2025
17c6292
Updated usd plugins location for MacOS package builds
RealDanTheMan Jul 30, 2025
e68bbbf
Fixed windows build test workflow
RealDanTheMan Jul 30, 2025
04f183f
Updated readme file
RealDanTheMan Jul 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@v4

- name: Run Build Script
run: shell\build.bat
run: shell\build-product.bat
shell: cmd

- name: List Output
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# Build and caches
.cache
build
product

# MacOS directory files
.DS_Store
70 changes: 55 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.25)
project(CollisionCraft VERSION 0.1 LANGUAGES CXX)

option(PACKAGE_PRODUCT "Build product package" OFF)

# C++ Standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -18,10 +20,10 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
endif()

# Build paths
set(CMAKE_BINARY_DIR ./bin/)
set(CMAKE_BINARY_DIR "./bin/")
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(PROJECT_SOURCE_DIR source/)
set(PROJECT_SOURCE_DIR "${CMAKE_SOURCE_DIR}/source/")
set(CMAKE_AUTOMOC ON)

# External dependencies
Expand All @@ -39,19 +41,17 @@ find_package(Qt6 REQUIRED COMPONENTS

if(APPLE)
message(STATUS "Targeting MacOS dependencies")
set(USD_PATH lib/openusd/macos)
set(VHACD_PATH lib/vhacd/macos)
# TMP flag to avoid compile issues with OpenUSD with older versions of TBB
add_compile_options(-Wno-error=changes-meaning)
set(USD_PATH "${CMAKE_SOURCE_DIR}/lib/openusd/macos")
set(VHACD_PATH "${CMAKE_SOURCE_DIR}/lib/vhacd/macos")
elseif(UNIX)
message(STATUS "Targeting Unix dependencies")
set(USD_PATH lib/openusd/linux)
set(VHACD_PATH lib/vhacd/linux)
set(USD_PATH "${CMAKE_SOURCE_DIR}/lib/openusd/linux")
set(VHACD_PATH "${CMAKE_SOURCE_DIR}/lib/vhacd/linux")
# TMP flag to avoid compile issues with OpenUSD with older versions of TBB
add_compile_options(-Wno-error=changes-meaning)
elseif(WIN32)
message(STATUS "Targeting Windows dependencies")
set(VHACD_PATH ${CMAKE_SOURCE_DIR}/lib/vhacd/windows)
set(VHACD_PATH "${CMAKE_SOURCE_DIR}/lib/vhacd/windows")
else()
message(FATAL_ERROR "Unsupported target architecture")
endif()
Expand Down Expand Up @@ -79,8 +79,8 @@ set(SOURCES
# Define resources
qt_add_resources(PROCESSED_RESOURCES resources/resources.qrc)

set(VHACD_INCLUDES ${VHACD_PATH}/include)
set(VHACD_LIB ${VHACD_PATH}/lib)
set(VHACD_INCLUDES "${VHACD_PATH}/include")
set(VHACD_LIB "${VHACD_PATH}/lib")

# Create executable target and link modules
add_executable(CollisionCraft ${SOURCES} ${PROCESSED_RESOURCES})
Expand All @@ -98,8 +98,8 @@ else()
endif()

if(APPLE OR UNIX)
set(USD_INCLUDES ${USD_PATH}/include)
set(USD_LIB ${USD_PATH}/lib)
set(USD_INCLUDES "${USD_PATH}/include")
set(USD_LIB "${USD_PATH}/lib")
target_include_directories(CollisionCraft PRIVATE
${PROJECT_SOURCE_DIR}
${Python3_INCLUDE_DIRS}
Expand All @@ -118,6 +118,7 @@ if(APPLE OR UNIX)
Qt6::Widgets
Qt6::OpenGL
Qt6::OpenGLWidgets
Qt6::DBus

# OpenUSD Modules
usd_usd
Expand All @@ -136,6 +137,45 @@ if(APPLE OR UNIX)
# VHACD dependency
libvhacd
)

if (PACKAGE_PRODUCT)
if (APPLE)
set(APP_RPATHS
"/opt/homebrew/opt/qt@6/lib"
"${USD_LIB}"
"${VHACD_LIB}"
)
set_target_properties(CollisionCraft PROPERTIES
BUNDLE TRUE
MACOSX_BUNDLE TRUE
INSTALL_RPATH "${APP_RPATHS}"
BUILD_WITH_INSTALL_RPATH TRUE
)
elseif (UNIX)
install(TARGETS CollisionCraft DESTINATION "./usr/bin")
install(FILES "${CMAKE_SOURCE_DIR}/resources/packaging/linux/CollisionCraft.desktop"
DESTINATION "./usr/share/applications")

install(FILES "${CMAKE_SOURCE_DIR}/resources/packaging/linux/icon.png"
DESTINATION "./usr/share/icons")

set(APP_RPATHS
"${USD_LIB}"
"${VHACD_LIB}"
"$ORIGIN/../lib"
"/usr/lib"
"/usr/lib/qt6"
"/usr/lib/qt6/plugins/platforms"
)

set_target_properties(CollisionCraft PROPERTIES
INSTALL_RPATH "${APP_RPATHS}"
BUILD_WITH_INSTALL_RPATH TRUE
CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE
)
endif()
endif()

elseif(WIN32)
target_include_directories(CollisionCraft PRIVATE
${PROJECT_SOURCE_DIR}
Expand Down Expand Up @@ -177,4 +217,4 @@ elseif(WIN32)
${VHACD_LIB}/vhacd.lib
opengl32
)
endif()
endif()
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Small front end application for generating collision meshes from 3D models.
<img src="demo/img_01.png" alt="App Preview Image" width="320">
<img src="demo/img_02.png" alt="App Preview Image" width="320">
<img src="demo/img_03.png" alt="App Preview Image" width="320">
<img src="demo/img_04.png" alt="App Preview Image" width="320">
</p>


Expand Down Expand Up @@ -81,7 +82,7 @@ cd CollisionCraft
```bash
git clone https://github.com/RealDanTheMan/CollisionCraft
cd CollisionCraft
./shell/build.bat
./shell/build-product.bat
./shell/run.bat
```

Expand Down
Binary file modified demo/img_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/img_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified demo/img_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added demo/img_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions resources/packaging/linux/CollisionCraft.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Desktop Entry]
Name=Collision Craft
Exec=CollisionCraft
Type=Application
Categories=Graphics
Icon=icon
Binary file added resources/packaging/linux/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/shaders/collision.ps
Binary file not shown.
Binary file modified resources/shaders/grid.ps
Binary file not shown.
4 changes: 3 additions & 1 deletion resources/shaders/grid.vs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ layout (location = 0) in vec3 position;
uniform mat4 SV_VIEW_MAT;
uniform mat4 SV_PROJ_MAT;

out vec3 local_position;


void main()
{
mat4 mvp = SV_PROJ_MAT * SV_VIEW_MAT;
vec4 pos = mvp * vec4(position.xyz, 1.0);

local_position = position.xyz;
gl_Position = pos;
}
47 changes: 47 additions & 0 deletions shell/build-product.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
echo off
setlocal

set CWD=%CD%
set BUILD_PATH="%CWD%/build"
echo "Build Path: %BUILD_PATH%"

rmdir /s /q %BUILD_PATH%
mkdir %BUILD_PATH%
mkdir %BUILD_PATH%\bin\Release

for /f "usebackq tokens=*" %%i in (`where vcpkg`) do (
set "VCPKG_EXE=%%i"
set "VCPKG_PATH=%%~dpi"
)

if "%VCPKG_PATH%" == "" (
echo "Error: VCPKG is not present in PATH"
exit /b 1
)

REM Run CMake build using VS2017 flavour
set VCPKG_TOOLCHAIN="%VCPKG_PATH%\scripts\buildsystems\vcpkg.cmake"
cmake -B%BUILD_PATH% -S . -DCMAKE_TOOLCHAIN_FILE=%VCPKG_TOOLCHAIN% -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release
cmake --build %BUILD_PATH% --config Release

set QT_PLUG_SRC="%VCPKG_PATH%\installed\x64-windows\Qt6\plugins"
set QT_PLUG_DST="%BUILD_PATH%\bin\Release\qt\plugins"
echo "Deploying QT plug-ins -> %QT_PLUG_DST%"



xcopy /E /I /Y "%QT_PLUG_SRC%\imageformats" "%QT_PLUG_DST%\imageformats"
xcopy /E /I /Y "%QT_PLUG_SRC%\platforms" "%QT_PLUG_DST%\platforms"
xcopy /E /I /Y "%QT_PLUG_SRC%\styles" "%QT_PLUG_DST%\styles"

set USD_PLUG_SRC="%VCPKG_PATH%\installed\x64-windows\bin\usd"
set USD_PLUG_DST="%BUILD_PATH%\bin\Release\usd"
echo "Deploying USD plug-ins -> %USD_PLUG_DST%"
xcopy /E /I /Y "%USD_PLUG_SRC%" "%USD_PLUG_DST%"
xcopy /Y "%VCPKG_PATH%\installed\x64-windows\lib\usd\plugInfo.json" "%USD_PLUG_DST%"

cmake -B%BUILD_PATH% -S . -DCMAKE_TOOLCHAIN_FILE=%VCPKG_TOOLCHAIN% -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release
cmake --build %BUILD_PATH% --config Release

cd %CWD%
endlocal
101 changes: 101 additions & 0 deletions shell/build-product.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
CWD=$PWD
OS_NAME=$(uname -s)
BUILD_PATH="$CWD/product"

rm -rf $BUILD_PATH
mkdir $BUILD_PATH

if [[ "$OS_NAME" == "Darwin" ]]; then
echo "Running product build on MacOS"

# Build release flavour
cmake -B$BUILD_PATH -DCMAKE_MACOSX_BUNDLE=ON -DCMAKE_BUILD_TYPE=Release -DPACKAGE_PRODUCT=ON
cmake --build $BUILD_PATH -- -j$(sysctl -n hw.ncpu)

# Deploy QT plugins
QT_PLUG_SRC="/opt/homebrew/share/qt/plugins"
QT_PLUG_DST="$BUILD_PATH/bin/CollisionCraft.app/Contents/PlugIns"
echo "Deploying QT plugins -> $QT_PLUG_DST"

mkdir -p "$QT_PLUG_DST"
mkdir -p "$QT_PLUG_DST/iconengines"
mkdir -p "$QT_PLUG_DST/imageformats"
mkdir -p "$QT_PLUG_DST/platforminputcontexts"
mkdir -p "$QT_PLUG_DST/platform"
mkdir -p "$QT_PLUG_DST/styles"

cp -r "$QT_PLUG_SRC/iconengines"* "$QT_PLUG_DST/iconengines"
cp -r "$QT_PLUG_SRC/imageformats"* "$QT_PLUG_DST/imageformats"
cp -r "$QT_PLUG_SRC/platforminputcontexts"* "$QT_PLUG_DST/platforminputcontexts"
cp -r "$QT_PLUG_SRC/platform"* "$QT_PLUG_DST/platform"
cp -r "$QT_PLUG_SRC/styles"* "$QT_PLUG_DST/styles"

find $BUILD_PATH/bin/CollisionCraft.app/Contents/PlugIns -name "*.dylib" | while read dylib; do
install_name_tool -add_rpath /opt/homebrew/opt/qt@6/lib "$dylib"
done

# Deploy OpenUSD plugins
USD_PLUG_SRC="$CWD/lib/openusd/macos/lib/usd"
USD_PLUG_DST="$BUILD_PATH/bin/CollisionCraft.app/Contents/Frameworks/usd"
echo "Deploying USD plugins -> $USD_PLUG_DST"
mkdir -p "$USD_PLUG_DST"
cp -r "$USD_PLUG_SRC/"* "$USD_PLUG_DST"

# Package dependencies & code sign.
echo "Deploying package dependencies..."
/opt/homebrew/opt/qt@6/bin/macdeployqt $BUILD_PATH/bin/CollisionCraft.app -dmg -verbose=1

echo "Signing package..."
codesign --deep --force --verify --verbose --sign "-" "$BUILD_PATH/bin/CollisionCraft.app"


elif [[ "$OS_NAME" == "Linux" ]]; then
echo "Running product build on Linux"

# Create application package structure.
APP_DIR="$BUILD_PATH/package/linux/AppDir"
mkdir -p "$APP_DIR/usr/bin"
mkdir -p "$APP_DIR/usr/lib"
mkdir -p "$APP_DIR/usr/plugins"
mkdir -p "$APP_DIR/usr/share/applications"

# Run release build.
cmake \
-B$BUILD_PATH \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$APP_DIR \
-DPACKAGE_PRODUCT=ON

cmake --build $BUILD_PATH -- -j$(nproc)
cmake --install $BUILD_PATH

# Deploy QT dependencies.
QT_PLUG_SRC="/usr/lib/qt6/plugins"
QT_PLUG_DST="$APP_DIR/usr/lib/qt6/plugins"
mkdir -p "$APP_DIR/usr/lib/qt6/plugins/platforms"
mkdir -p "$APP_DIR/usr/lib/qt6/plugins/xcbglintegrations"

cp -r "$QT_PLUG_SRC/platforms/libqwayland-egl.so" "$QT_PLUG_DST/platforms"
cp -r "$QT_PLUG_SRC/platforms/libqxcb.so" "$QT_PLUG_DST/platforms"
cp -r "$QT_PLUG_SRC/xcbglintegrations/libqxcb-glx-integration.so" "$QT_PLUG_DST/xcbglintegrations"

# Deploy USD plugins
USD_PLUG_SRC="$CWD/lib/openusd/linux/lib/usd"
USD_PLUG_DST="$APP_DIR/usr/lib/usd"
echo "Deploying USD plugins -> $USD_PLUG_DST"
mkdir -p "$USD_PLUG_DST"
cp -r "$USD_PLUG_SRC/"* "$USD_PLUG_DST"

# Invoke linuxdeploy to create package app image.
export NO_STRIP=1

linuxdeploy --appdir "$APP_DIR" \
--executable "$APP_DIR/usr/bin/CollisionCraft" \
--desktop-file "$APP_DIR/usr/share/applications/CollisionCraft.desktop" \
--icon-file "$APP_DIR/usr/share/icons/icon.png" \
--output appimage


else
echo "Unsupported OS: $OS_NAME - aborting"
fi
32 changes: 0 additions & 32 deletions shell/build.bat

This file was deleted.

Loading
Loading