jalberse / shimmer

Physically based rendering in Rust
Apache License 2.0
33 stars 0 forks source link

Add vecmath module - points, vectors, etc #2

Closed jalberse closed 1 year ago

jalberse commented 1 year ago

Chapter 3 of PBRT v4.

We may not use the tuple class, as we won't be inheriting from it for points and vectors. We may want to find a Rusty approach to avoid duplicate code.

jalberse commented 1 year ago

We will want operator overloading - https://crates.io/crates/auto_ops

jalberse commented 1 year ago

https://github.com/rust-bio/rust-bio/issues/69

I think I'm settling on an approach using the newtype pattern around glam's vec structs. But, there's a lot of boilerplate there. For a lot of functions, the approach in the above discussion is likely helpful. That would be for just exposing methods of the wrapped type.

We further probably want derive_more for basic operations' trait implementations. I'm having some trouble with rust-analyzer on that, though.

jalberse commented 1 year ago

proc macros apparently don't play very well with rust-analyzer. I think I will just write a few limited macros to fit our use case here, or else just implement these things explicitly. Either approach would be acceptable to me; I don't love macros, I think typing things out explicitly can be fine.