Commit graph

10 commits

Author SHA1 Message Date
Antoine Martin 614217d33e library: document material module 2020-03-23 12:42:36 +01:00
Bruno BELANYI 552c0cb966 library: implement refraction
This necessitated to rework how light properties for a material were
given. A material can have either reflectivity or transparency. This
changes the parsing of materials, using a `LightProperty` structure at
its core.

This is does not implement the true Fresnel equations to take into
account the amount of reflection that an incident goes through when
encountering a transparent object.
2020-03-19 18:23:20 +01:00
Bruno BELANYI 4235d3d62f library: material: uniform: optional deserialization 2020-03-19 13:08:49 +01:00
Bruno BELANYI 563a793273 library: refactorize light properties handling
Instead of having a method per property, compute them all at once and
use them throughout the rendering pipeline.
2020-03-18 22:46:33 +01:00
Bruno BELANYI 05fb6601b2 library: use enum_dispatch on Object related trait
This allows for easier testing (notable allowing for comparisons),
better performance (thanks to inlining instead of vtable indirection),
and should ease the deserialization of `Material`, `Shape`, and
`Texture` traits. This should allow `Object` to be deserialized easily.
2020-03-18 15:24:09 +01:00
Bruno BELANYI 803b34641d library: material: uniform: add deserialization 2020-03-18 14:38:17 +01:00
Bruno BELANYI 9dcce9218f library: material: uniform: fix float comparison 2020-03-18 14:34:37 +01:00
Bruno BELANYI d8f5f880ec library: material: add reflectivity
This necessitates adding it to the trait, and its implementations.
2020-03-18 00:08:23 +01:00
Bruno BELANYI 7112873715 library: replace super::super by crate import
Done with the following shell command:
`sed -e 's/super::super/crate/' -i $(git grep -l super::super)`.

Followed by a `cargo fmt --all`.
2020-03-17 20:49:30 +01:00
Bruno BELANYI d785800bfe library: material: split Material into trait
The former `Material` type is now `UniformMaterial` and implements the
`Material` trait.
2020-03-17 19:29:05 +01:00