nsi-ffi-wrap
FFI wrapper layer for the Nodal Scene Interface
(ɴsɪ) — turns the C API exposed by nsi-sys
into idiomatic Rust.
This crate provides:
Context— a safe wrapper around an ɴsɪ rendering context with the full set of methods (create,delete,connect,disconnect,set_attribute,set_attribute_at_time,evaluate,render_control).- A loader that opens the renderer's shared library at runtime via
dlopen2. With thelink_lib3delightfeature the loader is replaced by a static link againstlib3delight. - Typed parameter macros for every ɴsɪ data type —
f32!,f32_slice!,f64!,f64_slice!,i32!,i32_slice!,i64!,i64_slice!,string!,string_slice!,color!,color_slice!,point!,point_slice!,point4_f32_slice!(forPw),vector!,vector_slice!,normal!,normal_slice!,matrix_f32!,matrix_f32_slice!,matrix_f64!,matrix_f64_slice!,reference!,reference_slice!,callback!. FfiApiAdapter— exposes any pure-RustNsitrait impl (from thensi-traitcrate) through the C API via a factory closure.- An optional
outputmodule (featureoutput) that streams pixel buckets out of the renderer through user-supplied callbacks, with typed pixel formats (FERRIS_F32,FERRIS_U8, …).
If you just want to render a scene, use the umbrella
nsi crate, which re-exports this
crate together with the toolbelt, 3Delight helpers, and Jupyter
support.
Features
link_lib3delight— link againstlib3delightat build time instead of resolving it at runtime throughdlopen2. Requires theDELIGHTenvironment variable to be set.download_lib3delight— fetch a dynamic library version of 3Delight during the build (CI / fallback use).output— pixel-streaming support (callbacks from the renderer to Rust closures).nightly— enables nightly-only documentation features.ustr_handles— useustrfor node handles (interned, cheap to clone). Default isCString.
License
Licensed under any of
- Apache License, Version 2.0
- MIT License
- zlib License
at your option.