composite Material #4

Open
opened 2019-07-07 10:31:44 +02:00 by neoq · 0 comments
neoq commented 2019-07-07 10:31:44 +02:00 (Migrated from github.com)

it should own multiple materials and take their respective probabilities in the constructor.
The selection can be implemented with std::discrete_distribution
Something like this:

template <typename ... Materials>
struct Composite : Material {
    Composite(Materials
    auto do_scatter(..) {
        //does not work of course
        return std::get<rng()>(materials).do_scatter(..);
    }
private:
   std::tuple<Materials...> materials;
};
it should own multiple materials and take their respective probabilities in the constructor. The selection can be implemented with std::discrete_distribution Something like this: ```c++ template <typename ... Materials> struct Composite : Material { Composite(Materials auto do_scatter(..) { //does not work of course return std::get<rng()>(materials).do_scatter(..); } private: std::tuple<Materials...> materials; }; ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
neop/raytracer#4
No description provided.