diff --git a/crates/nsi-core/Cargo.toml b/crates/nsi-core/Cargo.toml index c3e3b8e..e986ccd 100644 --- a/crates/nsi-core/Cargo.toml +++ b/crates/nsi-core/Cargo.toml @@ -37,7 +37,7 @@ enum_dispatch = "0.3" lazy_static = "1.4" log = "0.4" ndspy-sys = { version = "0.2", optional = true } -nsi-sys = "0.7" +nsi-sys = "0.8" null-terminated-str = "0.1" num_enum = "0.7" rclite = "0.2" diff --git a/crates/nsi-core/build.rs b/crates/nsi-core/build.rs index e593704..019039f 100755 --- a/crates/nsi-core/build.rs +++ b/crates/nsi-core/build.rs @@ -1,8 +1,5 @@ #![cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))] -#[cfg(feature = "download_lib3delight")] -use reqwest; - fn main() -> Result<(), Box> { #[cfg(feature = "download_lib3delight")] #[allow(unused_variables)] @@ -39,9 +36,9 @@ fn main() -> Result<(), Box> { .bytes() .ok()?; File::create(lib_path.clone()) - .expect(&format!("Could not create {}", lib_path.display())) + .unwrap_or_else(|_| panic!("Could not create {}", lib_path.display())) .write_all(&lib_data) - .expect(&format!( + .unwrap_or_else(|_| panic!( "Could not write to {}", lib_path.display() )); diff --git a/crates/nsi-core/src/output/mod.rs b/crates/nsi-core/src/output/mod.rs index 6645e8e..9f1dcef 100644 --- a/crates/nsi-core/src/output/mod.rs +++ b/crates/nsi-core/src/output/mod.rs @@ -464,9 +464,9 @@ pub trait FnQuery<'a> = dyn FnMut(Query) -> Error + 'a; /// [`OutputDriver`](crate::OUTPUT_DRIVER) node. pub struct OpenCallback<'a>(Box>>>); -// Why do we need a triple Box here? No idea and neither had anyone from the -// Rust community. But omitting a single Box wrapper layer leads to an instant -// crash. +// Why do we need a triple Box here? Why does a Box> not suffice? +// No idea and neither had anyone from the Rust community. But omitting a +// single Box wrapper layer leads to an instant segfault. impl<'a> OpenCallback<'a> { pub fn new(fn_open: F) -> Self where diff --git a/crates/nsi-core/src/output/pixel_format.rs b/crates/nsi-core/src/output/pixel_format.rs index faa6a44..20b121a 100644 --- a/crates/nsi-core/src/output/pixel_format.rs +++ b/crates/nsi-core/src/output/pixel_format.rs @@ -117,12 +117,10 @@ impl LayerDepth { /// A typical format for a pixel containing two such layers, an *RGBA* **color** /// & **alpha** output layer and a world space **normal**, will look like this: /// -/// [`name`](Layer::name()) | [`depth`](Layer::depth()) -/// | [`offset`](Layer::offset()) -/// ------------------------|-------------------------------------------------------|---------------------------- -/// `Ci` | -/// [`ColorAndAlpha`](LayerDepth::ColorAndAlpha)(`rgba`) | `0` `N_world` -/// | [`Vector`](LayerDepth::Vector)(`xyz`) | `4` +/// | [`name`](Layer::name()) | [`depth`](Layer::depth()) | [`offset`](Layer::offset()) +/// |-------------------------|-----------------------------------------------------|---------------------------- +/// | `Ci` |[`ColorAndAlpha`](LayerDepth::ColorAndAlpha)(`rgba`) | `0` +/// | `N_world` | [`Vector`](LayerDepth::Vector)(`xyz`) | `4` /// /// ## RAW Layout /// @@ -130,9 +128,9 @@ impl LayerDepth { /// For the above example the actual layout of a single pixel in the /// buffer is: /// -/// Value | `r`ed | `g`reen | `b`lue | `a`lpha | `x` | `y` | `z` -/// -------|---------|---------|---------|---------|-----|-----|---- -/// Offset | `0` | `1` | `2` | `3` | `4` | `5` | `6` +/// | Value | `r`ed | `g`reen | `b`lue | `a`lpha | `x` | `y` | `z` +/// |--------|---------|---------|---------|---------|-----|-----|---- +/// | Offset | `0` | `1` | `2` | `3` | `4` | `5` | `6` /// /// The `offset` is the offset into the pixel buffer to obtain the 1st element. /// For example, the **y** coordinate of the the normal will be stored in diff --git a/crates/nsi-sys/src/lib.rs b/crates/nsi-sys/src/lib.rs index f3e3538..a35b7ec 100755 --- a/crates/nsi-sys/src/lib.rs +++ b/crates/nsi-sys/src/lib.rs @@ -1,15 +1,18 @@ #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] -//! Auto-generated Rust bindings for *Illumination Research*’s *Nodal +//! Auto-generated Rust bindings for *Illumination Research*'s *Nodal //! Scene Interface* – ɴsɪ. //! //! You should not need to use this crate directly except for two //! reasons. You are likely either: +//! //! * a masochist who wants to use the C-API directly from Rust. +//! //! * Not happy with my high level Rust binding (see below) – consider //! opening an issue [here](https://github.com/virtualritz/nsi/issues) //! instead. +//! //! * writing a renderer that exposes an ɴsɪ C-API. //! //! # High Level Bindings @@ -47,25 +50,6 @@ //! //! # Features //! -//! * `download_lib3delight` – Fetches the dynamic library version of *3Delight -//! 2.1.2* for *Linux*, *macOS* or *Windows*. -//! -//! This can be used as a fallback, to build against, if you do not have the -//! renderer installed on your system. But it is an old version of 3Delight -//! and foremost a CI feature. -//! -//! It is instead suggested that you [download a *3Delight* -//! package](https://www.3delight.com/download) for your platform & install -//! it. This will set the `DELIGHT` environment variable that the build -//! script is looking for to find a locally installed library to link -//! against. Free version renders with up to 12 cores. -//! -//! This will also install *3Delight Display* which you can render to, -//! progressively – useful for debugging. -//! -//! * `link_lib3delight` – Links against the dynamic library version of -//! 3Delight. Requires the `DELIGHT` environment variable to be set. -//! //! * `omit_functions` – Omit generating bindings for the API's functions. This //! is for the case where you want to expose your own C-API hooks from your //! renderer.