diff --git a/lib/bsp_loader/src/brush.rs b/lib/bsp_loader/src/brush.rs index 8d9e65b..e356c82 100644 --- a/lib/bsp_loader/src/brush.rs +++ b/lib/bsp_loader/src/brush.rs @@ -1,3 +1,4 @@ +use strafesnet_common::integer::Planar64; use strafesnet_common::{model,integer}; use strafesnet_common::integer::{vec3::Vector3,Fixed,Ratio}; @@ -81,12 +82,12 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan // test if any *other* faces occlude the intersection for &new_face in &remaining_face_refs{ // new face occludes intersection point - if new_face.dot*intersection.den<new_face.normal.dot(intersection.num){ + if (new_face.dot.fix_2()/Planar64::ONE).lt_ratio(new_face.normal.dot(intersection.num)/intersection.den){ // replace one of the faces with the new face // dont' try to replace face0 because we are exploring that face in particular if let Some(new_intersection)=solve3(face0,new_face,face2){ // face1 does not occlude (or intersect) the new intersection - if face1.dot*new_intersection.den>face1.normal.dot(new_intersection.num){ + if (face1.dot.fix_2()/Planar64::ONE).gt_ratio(face1.normal.dot(intersection.num)/intersection.den){ remaining_face_refs.remove(new_face); face1=new_face; intersection=new_intersection; @@ -95,7 +96,7 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan } if let Some(new_intersection)=solve3(face0,face1,new_face){ // face2 does not occlude (or intersect) the new intersection - if face2.dot*new_intersection.den>face2.normal.dot(new_intersection.num){ + if (face2.dot.fix_2()/Planar64::ONE).gt_ratio(face2.normal.dot(intersection.num)/intersection.den){ remaining_face_refs.remove(new_face); face2=new_face; intersection=new_intersection; @@ -122,7 +123,7 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan } if let Some(new_intersection)=solve3(new_face,face1,face2){ // face0 does not occlude (or intersect) the new intersection - if face0.dot*new_intersection.den>face0.normal.dot(new_intersection.num){ + if (face0.dot.fix_2()/Planar64::ONE).lt_ratio(face0.normal.dot(intersection.num)/intersection.den){ // abort! reject face0 entirely continue 'face; }