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:
@@ -28,7 +28,7 @@ fn main() {
|
||||
(400.0 / aspect_ratio) as i32
|
||||
);
|
||||
let samples_per_pixel = 100;
|
||||
let max_depth = 50;
|
||||
let max_depth = 100;
|
||||
|
||||
// world
|
||||
|
||||
@@ -37,7 +37,7 @@ fn main() {
|
||||
Box::new(
|
||||
Sphere{
|
||||
center: Vec3{ x: 0.0, y: 0.0, z: -1.0},
|
||||
radius: 0.5
|
||||
radius: 0.5,
|
||||
material: None,
|
||||
}
|
||||
)
|
||||
@@ -75,7 +75,7 @@ fn main() {
|
||||
eprintln!("Done!");
|
||||
}
|
||||
|
||||
fn ray_color(r: Ray, world: &HittableList, depth: u32, srng: &mut SmallRng, distrib: Uniform<f32> ) -> Vec3 {
|
||||
fn ray_color(r: Ray, world: &dyn Hittable, depth: u32, srng: &mut SmallRng, distrib: Uniform<f32> ) -> Vec3 {
|
||||
// recursion depth guard
|
||||
if depth == 0 {
|
||||
return Vec3::new(0.0, 0.0, 0.0);
|
||||
|
||||
Reference in New Issue
Block a user