Open jalberse opened 1 year ago
Actually, I think we want to use a NewType pattern. Using Palette would lose optimizations that glam implements for DVec3 operations.
I am convinced we will want to use a new type pattern around the DVec3.
This will introduce boilerplate - we will need pass-through functions and trait implementations to avoid constantly needing to get the color as a DVec3 to perform operations. But, I think it's worth it to make the interfaces more clear and to enforce type expectations (such as ensuring we are actually providing a Color where we expect and not the various other vectors we are using during calculations)
Color calculations for ray tracing must be done in linear color space, and so far I have just been using DVec3 for that. But, I think it would be nice to specify that the type is a color, so that we have more of the business logic encoded in the type system, avoiding future potential errors.
Using Palette::Rgb with T: f64 might be nice. It would play well with later conversion to Srgb for saving the image off. Or, maybe a simple NewType pattern would suffice.