Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ jobs:
repository: STORM-IRIT/Radium-Releases
event-type: code-update-event
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'

97 changes: 60 additions & 37 deletions .github/workflows/pull-request-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ on:
pull_request:
branches:
- master
- release-candidate
push:
branches:
- release-candidate

env:
ext-dir: ${GITHUB_WORKSPACE//\\//}/external/install/
install_prefix: install
build_prefix: build
src_prefix: src

jobs:
build:
Expand All @@ -18,12 +25,23 @@ jobs:
fail-fast: false
matrix:
config:
- { name: "Windows MSVC", suffix: "Windows", os: windows-latest, cc: "cl.exe", cxx: "cl.exe", assimp: "OFF" }
- { name: "Windows MSVC", suffix: "Windows", os: windows-latest, cc: "cl.exe", cxx: "cl.exe", assimp: "OFF"}
- { name: "Ubuntu gcc", suffix: "Ubuntu-gcc", os: ubuntu-24.04, cc: "gcc", cxx: "g++", assimp: "ON" }
- { name: "MacOS clang", suffix: "macOS", os: macos-latest, cc: "clang", cxx: "clang++", assimp: "ON" }

build-type:
- "Release"
steps:
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Compute paths
id: paths
run: |
radium_build_dir="${{ env.build_prefix }}/${{ matrix.build-type }}/Radium-Engine"
radium_install_dir="${{ env.install_prefix }}/${{ matrix.build-type }}/Radium-Engine"
external_build_dir="${{ env.build_prefix }}/${{ matrix.build-type }}/external"
external_install_dir="${{ env.install_prefix }}/${{ matrix.build-type }}/external"
echo "radium_build_dir=$radium_build_dir" >> $GITHUB_OUTPUT
echo "radium_install_dir=$radium_install_dir" >> $GITHUB_OUTPUT
echo "external_build_dir=$external_build_dir" >> $GITHUB_OUTPUT
echo "external_install_dir=$external_install_dir" >> $GITHUB_OUTPUT

- name: Add msbuild to PATH
uses: seanmiddleditch/gha-setup-vsdevenv@master
Expand All @@ -33,46 +51,49 @@ jobs:
uses: jurplel/install-qt-action@v4
with:
cache: true
cache-key-prefix: install-qt-action-${{ matrix.config.name }}-6.2.9
cache-key-prefix: install-qt-action-${{ matrix.config.name }}-6.2.0
version: 6.2.0

- name: Prepare directories
run: |
mkdir -p install/
mkdir -p src/
mkdir -p src/Radium-Apps
mkdir -p build/Radium-Engine
mkdir -p build/Radium-Apps
mkdir -p external/install/
mkdir -p external/build/
mkdir -p "${{ env.src_prefix }}"
mkdir -p "${{ steps.paths.outputs.radium_build_dir }}"
mkdir -p "${{ steps.paths.outputs.external_build_dir }}"
mkdir -p "${{ steps.paths.outputs.radium_install_dir }}"
mkdir -p "${{ steps.paths.outputs.external_install_dir }}"

- name: Clone Radium
id: sha
run: |
cd src && git clone --recurse-submodules https://github.com/STORM-IRIT/Radium-Engine.git --single-branch && cd ..
git clone --recurse-submodules https://github.com/STORM-IRIT/Radium-Engine.git --single-branch ${{ env.src_prefix }}/Radium-Engine
radium_sha=`git -C ${{ env.src_prefix }}/Radium-Engine rev-parse --short HEAD`
echo "radium_sha=$radium_sha" >> $GITHUB_OUTPUT

- name: Cache externals
id: cache-external
- name: Cache radium install
id: cache-radium-install
uses: actions/cache@v4
with:
path: external
key: ${{ runner.os }}-${{ matrix.config.cc }}-external-${{ hashFiles('src/Radium-Engine/external/**/CMakeLists.txt') }}

- name: Configure and build external
if: steps.cache-external.outputs.cache-hit != 'true'
run: |
cd external/build/
cmake ../../src/Radium-Engine/external -GNinja -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_BUILD_TYPE=Release -DRADIUM_IO_ASSIMP=${{ matrix.config.assimp }} -DCMAKE_EXECUTE_PROCESS_COMMAND_ECHO=STDOUT -DRADIUM_UPDATE_VERSION=OFF -DRADIUM_EXTERNAL_CMAKE_INSTALL_MESSAGE=LAZY -DCMAKE_INSTALL_PREFIX=../install/
cmake --build . --parallel --config Release

- name: Configure Radium
run: |
cd build/Radium-Engine
cmake ../../src/Radium-Engine -GNinja -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../../install/ -DRADIUM_IO_ASSIMP=${{ matrix.config.assimp }} -DCMAKE_EXECUTE_PROCESS_COMMAND_ECHO=STDOUT -DRADIUM_UPDATE_VERSION=OFF -DRADIUM_EXTERNAL_CMAKE_INSTALL_MESSAGE=LAZY -DRADIUM_INSTALL_DOC=OFF -DRADIUM_ENABLE_TESTING=OFF -C ${{env.ext-dir}}/radium-options.cmake

- name: Build Radium
path: |
${{ steps.paths.outputs.external_install_dir }}
${{ steps.paths.outputs.radium_install_dir }}
key: ${{ matrix.config.name }}-radium-v1-${{ steps.sha.outputs.radium_sha }}
- name: Cache radium build
id: cache-radium-build
uses: actions/cache@v4
with:
path: |
${{ steps.paths.outputs.external_build_dir }}
${{ steps.paths.outputs.radium_build_dir }}
key: ${{ matrix.config.name }}-radium-build-v1
- name: Configure and build radium
if: steps.cache-radium-install.outputs.cache-hit != 'true'
run: |
cd build/Radium-Engine
cmake --build . --parallel --config Release --target install
"${{ env.src_prefix }}/Radium-Engine/scripts/build.sh" \
-B ${{ env.build_prefix }} \
-G Ninja --cxx ${{ matrix.config.cxx }} --cc ${{ matrix.config.cc }} \
-c ${{ matrix.build-type }} --enable-testing OFF \
--install-external "${{ steps.paths.outputs.external_install_dir }}" \
--install-radium "${{ steps.paths.outputs.radium_install_dir }}"

- name: Clone Radium Apps
uses: actions/checkout@master
Expand All @@ -81,10 +102,12 @@ jobs:

- name: Configure Radium Apps
run: |
cd build/Radium-Apps
cmake ../../src/Radium-Apps -GNinja -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../../install/ -DRadium_DIR=../../install/lib/cmake/Radium
cmake -S "${{ env.src_prefix }}/Radium-Apps" -B "${{ env.build_prefix }}/Radium-Apps" -GNinja \
-DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} -DCMAKE_C_COMPILER=${{ matrix.config.cc }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
-DCMAKE_INSTALL_PREFIX=${{ env.install_prefix }}/Radium-Apps \
-DRadium_DIR="${{ github.workspace }}/${{ steps.paths.outputs.radium_install_dir }}/lib/cmake/Radium"

- name: Build Radium Apps
run: |
cd build/Radium-Apps
cmake --build . --parallel --config Release --target install
cmake --build "${{ env.build_prefix }}/Radium-Apps" --parallel --config ${{ matrix.build-type }} --target install
90 changes: 0 additions & 90 deletions .github/workflows/release-candidate-push-ci.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
default: true
MD002: false
MD033: false

MD013:
line_length: 520
code_block_line_length: 200
MD034: true
MD041: false
# link fragments from php markdown are not recognized
MD051: false
30 changes: 30 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

ci:
autoupdate_branch: release-candidate

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: ^tests/.*/data/.*$
- id: end-of-file-fixer
exclude: ^tests/.*/data/.*$
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.13
hooks:
- id: cmake-format
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.45.0
hooks:
- id: markdownlint
args: [-f]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v20.1.8
hooks:
- id: clang-format
types_or: [c++, c, cuda]
13 changes: 5 additions & 8 deletions CLISubdivider/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
cmake_minimum_required(VERSION 3.18)

#-------------------------------------------------------------------------------
# -------------------------------------------------------------------------------
# exampleApp executables setup
project(Radium-CLI-Subdivider)

find_package( Radium REQUIRED Core IO)
find_package(Radium REQUIRED Core IO)

#------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# Application specific


add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries (${PROJECT_NAME} PUBLIC Radium::Core Radium::IO)
target_link_libraries(${PROJECT_NAME} PUBLIC Radium::Core Radium::IO)

# call the installation configuration (defined in RadiumConfig.cmake)
configure_radium_app(
NAME ${PROJECT_NAME}
)
configure_radium_app(NAME ${PROJECT_NAME})
69 changes: 37 additions & 32 deletions CLISubdivider/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Radium Subdivider Command-Line Interface

Load a triangle mesh and subdivide it using OpenMesh.
Load a triangle mesh and subdivide it using OpenMesh.

## CLI parameters

```cpp
std::cout << "Usage :\n"
<< argv[0] << " -i input.obj -o output -s type -n iteration \n\n"
Expand All @@ -14,43 +15,47 @@ std::cout << "Usage :\n"
"iteration of subdivision\n\n";
```


## Code breakdown

Excluding command parsing, only very few steps are required to load, simplify and save the object:

1. Load triangular mesh or generate
```cpp
Ra::Core::Geometry::TriangleMesh mesh;
Ra::IO::OBJFileManager obj;
1. Load triangular mesh or generate

// Load geometry as triangle
if ( inputFilename.empty() ) { mesh = Ra::Core::Geometry::makeBox(); }
else { obj.load( inputFilename, mesh ); }
```
```cpp
Ra::Core::Geometry::TriangleMesh mesh;
Ra::IO::OBJFileManager obj;

2. Create topological structure from the loaded geometry, and OpenMesh datastructures.
```cpp
// Create topological structure
Ra::Core::Geometry::TopologicalMesh topologicalMesh( mesh );
// Load geometry as triangle
if ( inputFilename.empty() ) { mesh = Ra::Core::Geometry::makeBox(); }
else { obj.load( inputFilename, mesh ); }
```

// Create CatmullClarkSubdivider
using Subdivider =
OpenMesh::Subdivider::Uniform::SubdividerT<Ra::Core::Geometry::TopologicalMesh, Scalar>;
Subdiviser subdiviser(Ra::Core::Geometry::CatmullClarkSubdivider);
```
2. Create topological structure from the loaded geometry, and OpenMesh datastructures.

3. Create OpenMesh subdivider and process geometry
```cpp
subdivider.attach( topologicalMesh );
subdivider( nIter );
subdivider.detach();
```
```cpp
// Create topological structure
Ra::Core::Geometry::TopologicalMesh topologicalMesh( mesh );

4. Convert and save simplified geometry
```cpp
// Convert processed topological structure to triangle mesh
mesh = topologicalMesh.toTriangleMesh();
// Create CatmullClarkSubdivider
using Subdivider =
OpenMesh::Subdivider::Uniform::SubdividerT<Ra::Core::Geometry::TopologicalMesh, Scalar>;
Subdiviser subdiviser(Ra::Core::Geometry::CatmullClarkSubdivider);
```

3. Create OpenMesh subdivider and process geometry

```cpp
subdivider.attach( topologicalMesh );
subdivider( nIter );
subdivider.detach();
```

4. Convert and save simplified geometry

```cpp
// Convert processed topological structure to triangle mesh
mesh = topologicalMesh.toTriangleMesh();

// Save triangle mesh to obj file
obj.save( outputFilename, mesh );
```
// Save triangle mesh to obj file
obj.save( outputFilename, mesh );
```
Loading
Loading