Skip to content

Commit

Permalink
raytracer: Use Vol<&[TracingCubeData]> in SurfaceIter.
Browse files Browse the repository at this point in the history
This should be more efficient by avoiding one indirection.
  • Loading branch information
kpreid committed Nov 9, 2023
1 parent e323d8f commit 1b812ef
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions all-is-cubes/src/raytracer/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ use euclid::Vector3D;

use crate::block::{recursive_ray, Evoxel, Evoxels};
use crate::camera::LightingOption;
use crate::math::{
Cube, Face7, FaceMap, FreeCoordinate, FreePoint, GridArray, Rgb, Rgba, VectorOps, Vol,
};
use crate::math::{Cube, Face7, FaceMap, FreeCoordinate, FreePoint, Rgb, Rgba, VectorOps, Vol};
use crate::raycast::{Ray, Raycaster};
use crate::raytracer::{RtBlockData, SpaceRaytracer, TracingBlock, TracingCubeData};

Expand Down Expand Up @@ -125,7 +123,7 @@ pub(crate) struct SurfaceIter<'a, D> {
// TODO: Should `current_block` become part of the state?
current_block: Option<VoxelSurfaceIter<'a, D>>,
blocks: &'a [TracingBlock<D>],
array: &'a GridArray<TracingCubeData>,
array: Vol<&'a [TracingCubeData]>,
}

#[derive(Clone, Copy, Debug)]
Expand All @@ -147,7 +145,7 @@ impl<'a, D: RtBlockData> SurfaceIter<'a, D> {
state: SurfaceIterState::Initial,
current_block: None,
blocks: &rt.blocks,
array: &rt.cubes,
array: rt.cubes.as_ref(),
}
}
}
Expand Down

0 comments on commit 1b812ef

Please sign in to comment.