From 80f28e8bf7cf009fe9a1a3fbf8ffda046f9fb40c Mon Sep 17 00:00:00 2001
From: Quaternions <krakow20@gmail.com>
Date: Tue, 4 Feb 2025 16:04:55 -0800
Subject: [PATCH] more how

---
 lib/bsp_loader/src/bsp.rs | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lib/bsp_loader/src/bsp.rs b/lib/bsp_loader/src/bsp.rs
index 373bcec..8c9e217 100644
--- a/lib/bsp_loader/src/bsp.rs
+++ b/lib/bsp_loader/src/bsp.rs
@@ -126,12 +126,27 @@ pub fn convert<'a>(
 		if let Some(sides)=bsp.brush_sides.get(brush_start_idx..brush_start_idx+brush.num_brush_sides as usize){
 			let maybe_plane_list:Option<Vec<_>>=sides.iter().map(|side|bsp.plane(side.plane as usize)).collect();
 			if let Some(plane_list)=maybe_plane_list{
+				if plane_list.len()<4{
+					println!("sussy planes!");
+					continue;
+				}
 				let mut polygon_list=Vec::new();
 				let mut mb=model::MeshBuilder::new();
 				let color=mb.acquire_color_id(glam::Vec4::ONE);
 				let tex=mb.acquire_tex_id(glam::Vec2::ZERO);
 
 				// for each face, determine one edge at a time until you complete the face
+				for (face_id,face) in plane_list.iter().enumerate(){
+					// 1. find first edge
+					// 2. follow edges around face
+
+					// === finding first edge ===
+					// 1. pick any two additional planes to make a set of three
+					// 2. check if any planes occlude the intersection
+					// 3. use this test to replace left and right alternating until they are not occluded
+					let mut plane1=&plane_list[(face_id+1).rem_euclid(plane_list.len())];
+					let mut plane2=&plane_list[(face_id+2).rem_euclid(plane_list.len())];
+				}
 
 				let polygon_groups=model::PolygonGroup::PolygonList(model::PolygonList::new(polygon_list));
 				let physics_groups=vec![model::IndexedPhysicsGroup{