Skip to content
Snippets Groups Projects
Commit b47e3eab authored by Flavien BRIDAULT's avatar Flavien BRIDAULT
Browse files

refactor(viz): modernize material management

`sight::viz::scene3d::material` is refactored and replaced by three new classes:
- `sight::viz::scene3d::material::generic`: generic class to handle any material. It provides functions that allow to set uniforms and a function to set textures, in all techniques where they exist. This solves the initial problem of the intrusive tests for OIT and thus avoids a priori knowledge (declaration, etc...) about the generated pass. If the uniform or the texture exists, set it, otherwise, it silently does nothing. However, if nothing is set amongst all techniques, an error is logged, since it should not happen, normally you would expect to reach at least one technique.
- `sight::viz::scene3d::material::standard`: allows using our "Default" material, and manages the permutations to handle different shading modes, normals display, etc...
- derive this into `sight::viz::scene3d::material::r2vb`: specific version to handle per-primitive colours and triangles generation for quads

Also, most adaptors no longer use `sight::module::viz::scene3d::material_adaptor`. It should only be required when wrapping a real `sight::data::material`. Otherwise, `sight::viz::scene3d::material::generic` or one of its inherited classes must be used.

We also used the opportunity to sort out parts of the OIT logic. We grouped the generation of OIT material techniques from `material_mgr_listener` and the dynamic compositor passes generation into a new class `sight::viz::scene3d::compositor::manager::oit`. This allowed notably to share many hard-coded strings.

Last we harmonized the identifiers for Ogre objects, using the `core::id::join()` function or a new function `viz::scene3d::adaptor::gen_id()` instead of concatenating strings manually.
parent 81e0b884
Branches
Tags
1 merge request!1196Resolve "fix(viz): secure parameters settings in OIT techniques"
Pipeline #316553 passed
Showing
with 1173 additions and 633 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment