Spurious crashes - Switching to enums
Segfaults and stack overflows. I get overflows when running in either debug or release. Segmentation faults when hooked up to GDB. I think it may be related to the copying of uninitialized trait objects, but I don't know. I've decided the trait-based interface just isn't worth this. I'll rearrange the materials into an Enum and a big match block.
This commit is contained in:
@@ -3,11 +3,9 @@ use crate::ray::Ray;
|
||||
use crate::hittable::HitRecord;
|
||||
use crate::Vec3;
|
||||
|
||||
pub struct Material;
|
||||
|
||||
pub Scatter {
|
||||
pub trait Material {
|
||||
fn scatter(
|
||||
ray_in: Ray, rec: HitRecord, attenuation: Vec3, scattered: Ray
|
||||
&self, ray_in: Ray, rec: HitRecord, attenuation: Vec3, scattered: Ray
|
||||
) -> bool;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user