mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix ray issue after max_iteration
Former-commit-id: 55afdeeb0358934e3874ab3ca573e8cc71904ea1
This commit is contained in:
parent
c37db43580
commit
927f3a12ba
@ -37,7 +37,7 @@ impl<'a, V: ReadVol, F: RayUntil<V::Vox>> Ray<'a, V, F> {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn cast(mut self) -> (f32, Result<&'a V::Vox, V::Err>) {
|
||||
pub fn cast(mut self) -> (f32, Result<Option<&'a V::Vox>, V::Err>) {
|
||||
// TODO: Fully test this!
|
||||
|
||||
const PLANCK: f32 = 0.001;
|
||||
@ -56,7 +56,7 @@ impl<'a, V: ReadVol, F: RayUntil<V::Vox>> Ray<'a, V, F> {
|
||||
.get(ipos)
|
||||
.map(|vox| (vox, (self.until)(vox)))
|
||||
{
|
||||
Ok((vox, true)) => return (dist, Ok(vox)),
|
||||
Ok((vox, true)) => return (dist, Ok(Some(vox))),
|
||||
Ok((_, false)) => {},
|
||||
Err(err) => return (dist, Err(err)),
|
||||
}
|
||||
@ -69,6 +69,6 @@ impl<'a, V: ReadVol, F: RayUntil<V::Vox>> Ray<'a, V, F> {
|
||||
dist += deltas.reduce(f32::min).max(PLANCK);
|
||||
}
|
||||
|
||||
(dist, self.vol.get(ipos))
|
||||
(dist, Ok(None))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user