comments
This commit is contained in:
parent
99301bb990
commit
204dce366f
@ -204,6 +204,8 @@ impl<L> BvhNode<L>{
|
|||||||
match &node.content{
|
match &node.content{
|
||||||
RecursiveContent::Leaf(leaf)=>if let Some(time)=f(leaf,ray){
|
RecursiveContent::Leaf(leaf)=>if let Some(time)=f(leaf,ray){
|
||||||
let ins=TimedInstruction{time:time.into(),instruction:leaf};
|
let ins=TimedInstruction{time:time.into(),instruction:leaf};
|
||||||
|
// this lower bound can also be omitted
|
||||||
|
// but it causes type inference errors lol
|
||||||
if start_time.lt_ratio(ins.time)&&ins.time.lt_ratio(collector.time()){
|
if start_time.lt_ratio(ins.time)&&ins.time.lt_ratio(collector.time()){
|
||||||
collector.collect(Some(ins));
|
collector.collect(Some(ins));
|
||||||
}
|
}
|
||||||
@ -212,6 +214,8 @@ impl<L> BvhNode<L>{
|
|||||||
RecursiveContent::Branch(children)=>for child in children{
|
RecursiveContent::Branch(children)=>for child in children{
|
||||||
// Am I an upcoming superstar?
|
// Am I an upcoming superstar?
|
||||||
if let Some(t)=intersect_aabb(ray,&child.aabb){
|
if let Some(t)=intersect_aabb(ray,&child.aabb){
|
||||||
|
// we don't need to check the lower bound
|
||||||
|
// because child aabbs are guaranteed to be within the parent bounds.
|
||||||
if t<collector.time(){
|
if t<collector.time(){
|
||||||
nodes.insert(t,child);
|
nodes.insert(t,child);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user