Skip to content

vertexnova/vneio

Repository files navigation

VertexNova I/O (vneio)

CI Coverage C++ Standard License

Mesh and Image library extracted from VertexNova core, structured like vneevents / vnelogging / vnemath. It provides:

  • Mesh – Load 3D meshes (Assimp), with vertex attributes, materials, submeshes, optional normalization and barycentrics.
  • Image – Load/save images (stb_image), resize, flip, raw pixel access.
  • Volume – Load 3D volumes (NRRD, MHD), with spacing, origin, direction matrix. NRRD loading uses Teem nrrdio (required; supports compressed and advanced formats).

Namespaces: vne::Mesh, vne::Image. Includes live under vertexnova/io/.

Requirements

  • C++20
  • CMake 3.16+
  • Mesh: Assimp (optional; add under 3rd_party/assimp or use find_package(assimp))
  • Image: stb (fetched automatically if 3rd_party/stb_image is not present)
  • Volume (NRRD): Teem nrrdio (required for image component; add under deps/external/nrrdio/ or 3rd_party/nrrdio/ or use find_package(nrrdio)).
  • Logging (optional): vnelogging and vnecommon under deps/internal/ for mesh load logging

Build

Clone with submodules (for vnecmake, deps/internal, deps/external/assimp, deps/external/googletest):

git clone --recursive https://github.com/vertexnova/vneio.git
cd vneio
# Or, if already cloned: git submodule update --init --recursive

Test data (for VNEIO_BUILD_TESTS=ON): Minimal assets live in testdata/ (e.g. meshes/minimal.stl, textures/sample.png). No LFS or extra submodules required. If you had the old testdata/vneresources submodule, run git submodule deinit testdata/vneresources and remove the folder if desired.

Then build:

mkdir build && cd build
cmake .. -DVNEIO_BUILD_MESH=ON -DVNEIO_BUILD_IMAGE=ON
cmake --build .

# With tests (requires deps/external/googletest; testdata/ is in repo):
# cmake .. -DVNEIO_BUILD_MESH=ON -DVNEIO_BUILD_IMAGE=ON -DVNEIO_BUILD_TESTS=ON
# cmake --build . && ctest --output-on-failure
  • VNEIO_BUILD_MESH – build mesh component (default ON; needs Assimp).
  • VNEIO_BUILD_IMAGE – build image component (default ON; stb fetched if needed).
  • VNEIO_BUILD_TESTS – build tests (default OFF). Enable with -DVNEIO_BUILD_TESTS=ON.
  • VNEIO_BUILD_EXAMPLES – build examples (default OFF). Enable with -DVNEIO_BUILD_EXAMPLES=ON.
  • ENABLE_COVERAGE – enable code coverage (default OFF). Use with Debug + GCC/Clang and lcov for reports.

To use a local Assimp or stb_image, place them under 3rd_party/assimp and 3rd_party/stb_image with their own CMakeLists.txt so that add_subdirectory(3rd_party/...) works.

Usage

Link against vne::io (or vne::io::mesh / vne::io::image). Include:

#include <vertexnova/io/vneio.h>
// or
#include <vertexnova/io/mesh/mesh.h>
#include <vertexnova/io/mesh/assimp_loader.h>
#include <vertexnova/io/image/image.h>

Mesh

#include <vertexnova/io/mesh/assimp_loader.h>

vne::Mesh::AssimpLoader loader;
vne::Mesh::Mesh mesh;
if (loader.loadFile("model.obj", mesh)) {
    // mesh.vertices, mesh.indices, mesh.parts, mesh.materials
}

Image

#include <vertexnova/io/image/image.h>

vne::Image::Image img("texture.png");
if (!img.isEmpty()) {
    int w = img.getWidth(), h = img.getHeight();
    const uint8_t* data = img.getData();
}

Layout (like vneevents/vnelogging)

  • include/vertexnova/io/ – public headers (mesh/, image/, vneio.h)
  • src/vertexnova/io/ – implementation (mesh/, image/)
  • cmake/vnecmake/ – shared CMake modules (submodule)
  • deps/internal/vnecommon/, deps/internal/vnelogging/ – submodules used for logging (when present)
  • deps/external/assimp, deps/external/stb_image – mesh/image dependencies (assimp is submodule, stb_image is a copy)
  • tests/, examples/ – optional

License

Apache-2.0. Same as the original VertexNova core code.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published