Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added read/write support of OFF files to vdb_tool #1971

Merged
merged 20 commits into from
Dec 2, 2024
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
2 changes: 2 additions & 0 deletions .github/workflows/ax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ jobs:
- name: nanobind
#if: contains(matrix.config.image, '2023') == false
run: ./ci/install_nanobind.sh 2.0.0
- name: install_gtest
run: ./ci/install_gtest.sh 1.15.2
- name: timestamp
id: timestamp
run: echo "timestamp=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ jobs:
- name: glfw
if: contains(matrix.config.image, '2023') == true
run: ./ci/install_glfw.sh 3.3.10
- name: install_gtest
run: ./ci/install_gtest.sh 1.15.2
- name: timestamp
id: timestamp
run: echo "timestamp=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ jobs:
container:
# @note We can't update this as epydoc doesn't support python3. We'll
# need to re-write the python docs to use sphinx
image: aswf/ci-openvdb:2022
image: aswf/ci-openvdb:2024
steps:
- name: Enable Node 16
run: |
echo "ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true" >> $GITHUB_ENV
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: install_doxygen
run: ./ci/install_doxygen.sh 1_8_11
- name: nanobind
Expand All @@ -55,10 +52,6 @@ jobs:
# run: pip install epydoc
- name: install_latex
run: |
# Fix error: Cannot prepare internal mirrorlist: No URLs in mirrorlist. CentOS 8 reached EOL means need to replace the official mirror to vault.centos.org
# Comment out mirrorlist and replace #baseurl=...mirror.centos.org with baseurl=...vault.centos.org in files starting with CentOS- in /etc/yum.repos.d folder
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
yum -y install texlive-latex-bin texlive-dvips texlive-collection-fontsrecommended texlive-collection-latexrecommended
- name: build
run: >
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/houdini.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ jobs:
run: ./ci/install_glfw.sh 3.3.10
- name: cppunit
run: ./ci/install_cppunit.sh 1.15.1
- name: install_gtest
run: ./ci/install_gtest.sh 1.15.2
- name: timestamp
id: timestamp
run: echo "timestamp=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/nanovdb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ jobs:
github.event.inputs.type == 'all' ||
github.event.inputs.type == 'linux'
runs-on: ${{ (github.repository_owner == 'AcademySoftwareFoundation' && 'ubuntu-20.04-8c-32g-300h') || 'ubuntu-latest' }}
container:
image: aswf/ci-openvdb:2024
steps:
- uses: actions/checkout@v3
- name: install_gtest
run: |
sudo apt-get update
sudo apt-get -q install -y libgtest-dev
run: ./ci/install_gtest.sh 1.15.2
- name: build_and_test
run: |
cd nanovdb/nanovdb
Expand Down
1 change: 1 addition & 0 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ cmake \
-DOPENVDB_BUILD_VDB_PRINT=ON \
-DOPENVDB_BUILD_VDB_LOD=ON \
-DOPENVDB_BUILD_VDB_TOOL=ON \
-DOPENVDB_BUILD_VDB_TOOL_UNITTESTS=ON \
-DOPENVDB_TOOL_USE_NANO=OFF \
-DOPENVDB_BUILD_PYTHON_UNITTESTS=ON \
-DMSVC_MP_THREAD_COUNT=${PARMS[-j]} \
Expand Down
16 changes: 16 additions & 0 deletions ci/install_gtest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

set -ex

GTEST_VERSION="$1"


git clone https://github.com/google/googletest.git -b v${GTEST_VERSION}
cd googletest
mkdir build
cd build
cmake ..

make -j$(nproc)

sudo make install
1 change: 1 addition & 0 deletions nanovdb/nanovdb/unittest/TestNanoVDB.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Uncomment to temporarily disable testing of PNanoVDB
//#define DISABLE_PNANOVDB

#include <iomanip>
#include <iostream>
#include <cstdlib>
#include <sstream> // for std::stringstream
Expand Down
5 changes: 3 additions & 2 deletions openvdb_cmd/vdb_tool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ list(APPEND CMAKE_MODULE_PATH ${OPENVDB_CMAKE_PATH})
add_library(vdb_tool_common INTERFACE)

# Optional components
option(BUILD_TEST "Build unit tests" OFF)
option(OPENVDB_BUILD_VDB_TOOL_UNITTESTS "Build unit tests" OFF)

option(OPENVDB_TOOL_USE_NANO "Compile with NanoVDB support" OFF)
option(OPENVDB_TOOL_NANO_USE_ZIP "Compile NanoVDB with zip compression support. Requires OPENVDB_TOOL_USE_NANO=ON to have effect" ON)
Expand Down Expand Up @@ -185,10 +185,11 @@ install(TARGETS vdb_tool RUNTIME DESTINATION ${OPENVDB_INSTALL_BINDIR})


# unit test
if(BUILD_TEST)
if(OPENVDB_BUILD_VDB_TOOL_UNITTESTS)
find_package(GTest ${MINIMUM_GOOGLETEST_VERSION} CONFIG REQUIRED)

add_executable(vdb_tool_test src/unittest.cpp)
target_include_directories(vdb_tool_test PRIVATE vdb_tool_common)
target_link_libraries(vdb_tool_test PRIVATE vdb_tool_common GTest::gmock GTest::gtest GTest::gmock_main GTest::gtest_main)
add_test(vdb_tool_unit_test vdb_tool_test)
endif()
15 changes: 8 additions & 7 deletions openvdb_cmd/vdb_tool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ This command-line tool, dubbed vdb_tool, can combine any number of the of high-l
| **eval** | Evaluate an expression written in our Reverse Polish Notation (see below) |
| **config** | Load a configuration file and add the actions for processing |
| **default** | Set default values used by all subsequent actions |
| **read** | Read mesh, points and level sets as obj, ply, abc, stl, pts, vdb or nvdb files |
| **write** | Write a polygon mesh, points or level set as a obj, ply, stl, abc or vdb file |
| **read** | Read mesh, points and level sets as obj, ply, abc, stl, off, pts, vdb or nvdb files |
| **write** | Write a polygon mesh, points or level set as a obj, ply, stl, off, abc or vdb file |
| **vdb2points** | Extracts points from a VDB grid |
| **mesh2ls** | Convert a polygon mesh to a narrow-band level set |
| **points2ls** | Convert points into a narrow-band level set |
Expand Down Expand Up @@ -59,9 +59,10 @@ For support, bug-reports or ideas for improvements please contact ken.museth@gma
| Extension | Actions | Description |
|-------|-------|-------|
| vdb | read and write | OpenVDB sparse volume files with float, Vec3f and points |
| obj | read and write | ASCII OBJ mesh files with triangle, quad or points |
| ply | read and write | Binary and ASCII PLY mesh files with triangle, quad or points |
| obj | read and write | ASCII OBJ mesh files with triangles, quads or points |
| ply | read and write | Binary and ASCII PLY mesh files with triangles, quads or points |
| stl | read and write | Binary STL mesh files with triangles |
| off | read and write | ASCI OFF mesh files with triangles, quads or points |
| pts | read | ASCII PTS points files with one or more point clouds |
| abc | optional read and write | Alembic binary mesh files |
| nvdb| optional read and write | NanoVDB file with voxels or points |
Expand All @@ -73,7 +74,7 @@ For support, bug-reports or ideas for improvements please contact ken.museth@gma

# Terminology

We introduce terms: **actions**, **options**, **expressions**, and **instructions**. Actions are high-level openvdb tools, which each have unique options, e.g. -mesh2ls geo=1 voxel=0.1, where "-mesh2ls" is an action with two options "geo" and "voxel". Expressions are strings of code with one or more low-level instructions in our stack-based programming language (see below). These expressions start with "{" and ends with "}", and ":" is used to separate values and instructions. E.g. {1:2:+} is an expression with two values (1 and 2) and one instruction "+", and it reduces to the string value "3". See section on the "Stack-based string expressions" below for more details.
We introduce the following terms: **actions**, **options**, **expressions**, and **instructions**. Actions are high-level openvdb tools, which each have unique options, e.g. -mesh2ls geo=1 voxel=0.1, where "-mesh2ls" is an action with two options "geo" and "voxel". Expressions are strings of code with one or more low-level instructions in our stack-based programming language (see below). These expressions start with "{" and ends with "}", and ":" is used to separate values and instructions. E.g. {1:2:+} is an expression with two values (1 and 2) and one instruction "+", and it reduces to the string value "3". See section on the "Stack-based string expressions" below for more details.

Note that **actions** always start with one or more "-" and (except for file names) its associated **options** always contain a "=" and an optional number of leading characters used for identification, e.g. "-erode r=2" is identical to "-erode radius=2.0", but "-erode rr=2" will produce an error since "rr" does not match the first two characters of any option associated with the action "erode".

Expand All @@ -88,7 +89,7 @@ This tool supports its own light-weight stack-oriented programming language that
This tool is using CMake for build on Linux and Windows.
The only mandatory dependency of is [OpenVDB](http://www.openvdb.org). Optional dependencies include NanoVDB, libpng, libjpeg, OpenEXR, and Alembic. To enable them use the `-DUSE_<name>=ON` flags. See the CMakeLists.txt for details.

The included unit test are using Gtest. Add `-DBUILD_TEST=ON` to the cmake command line to build it.
The included unit test are using Gtest. Add `-DOPENVDB_BUILD_VDB_TOOL_UNITTESTS=ON` to the cmake command line to build it.

## Building OpenVDB

Expand All @@ -102,7 +103,7 @@ To generate the makefile, navigate to the cloned directory of vdb_tool, then fol
```bash
mkdir build
cd build
cmake -DOPENVDB_CMAKE_PATH=/usr/local/lib/cmake/OpenVDB -DUSE_ALL=ON -DBUILD_TEST=ON ..
cmake -DOPENVDB_CMAKE_PATH=/usr/local/lib/cmake/OpenVDB -DUSE_ALL=ON -DOPENVDB_BUILD_VDB_TOOL_UNITTESTS=ON ..
```
Update the OpenVDB cmake path above as needed.

Expand Down
Loading
Loading