perf: implement L–S performance improvements

- L: pre-project wire endpoints to screen before ApparentIntersection pair loops
- O+S: tight per-segment AABB cull + move a0/a1 Vec3 outside inner snap loop
- P: epoch-cached entity→block reverse map replaces O(E×B) scan
- Q: lazy per-point projection in hit tests eliminates per-wire Vec<Point> alloc
- R: HatchModel.boundary Arc<Vec> so clone is pointer bump not heap alloc
This commit is contained in:
Hakan Seven 2026-05-06 22:42:22 +03:00
commit 45f9f96c93
6 changed files with 267 additions and 235 deletions

View file

@ -1,4 +1,5 @@
// HatchModel — CPU-side hatch fill data; rendered entirely on the GPU.
use std::sync::Arc;
//
// The boundary is a closed polygon in world XY coordinates (max 64 vertices).
// The GPU fragment shader performs point-in-polygon and hatch-line tests so
@ -41,7 +42,8 @@ pub enum HatchPattern {
#[derive(Clone, Debug)]
pub struct HatchModel {
/// World XY coordinates of the boundary polygon vertices (max 64).
pub boundary: Vec<[f32; 2]>,
/// Arc so HatchModel::clone() is a pointer bump rather than a full Vec copy.
pub boundary: Arc<Vec<[f32; 2]>>,
/// Fill pattern.
pub pattern: HatchPattern,
/// Catalog name for this pattern (e.g. "ANSI31", "SOLID", "LINEAR").