rustgd / cgmath

A linear algebra and mathematics library for computer graphics.
https://docs.rs/cgmath
Apache License 2.0
1.12k stars 155 forks source link

Allow inverted near far for inverted depth fp32 #509

Closed giordi91 closed 4 years ago

giordi91 commented 4 years ago

While trying to make an inverted depth using a floating-point depth buffer. I got a panic from the asserts! macro preventing such behaviour.

I have removed such macros to allow for a higher accuracy inverted depth fp32 buffer. Here below a render doc screenshot of it working: image

Tests still pass accordingly.

I did not find any particular guideline on the contribution or how the PR should be formatted, so I hope this is good enough.

giordi91 commented 4 years ago

Something like this? I did not use the assert_* variant because I did not seem to be able to pass in a message. I find reading the documentation of the macro being confusing for me since I am fairly new to Rust. Let me know if that fits the requirements

giordi91 commented 4 years ago

No worries, it is mostly me being clumsy with a new language and library. Thanks for your patience.