feat: hit on primitives

This commit is contained in:
IliaDenisov
2026-03-07 19:28:22 +02:00
parent e4b956232f
commit c076347d70
21 changed files with 1167 additions and 165 deletions
+2 -18
View File
@@ -2,8 +2,6 @@ package world
import (
"sort"
"github.com/google/uuid"
)
// drawKind is used only for stable tie-breaking when priorities are equal.
@@ -18,7 +16,7 @@ const (
type drawItem struct {
kind drawKind
priority int
id uuid.UUID
id PrimitiveID
styleID StyleID
// Exactly one of these is set.
@@ -122,7 +120,7 @@ func (w *World) drawPlanSinglePass(drawer PrimitiveDrawer, plan RenderPlan, allo
if a.kind != b.kind {
return a.kind < b.kind
}
return uuidLess(a.id, b.id)
return a.id < b.id
})
drawer.Save()
@@ -149,17 +147,3 @@ func (w *World) drawPlanSinglePass(drawer PrimitiveDrawer, plan RenderPlan, allo
drawer.Restore()
}
}
func uuidLess(a, b uuid.UUID) bool {
aa := a[:]
bb := b[:]
for i := 0; i < len(aa); i++ {
if aa[i] < bb[i] {
return true
}
if aa[i] > bb[i] {
return false
}
}
return false
}