bandwidth reduction, filtering explosions and sending objects as [4]int
This commit is contained in:
+13
@@ -21,6 +21,19 @@ func (o Obstacle) distance_from_point(p v.Point2d) float32 {
|
||||
return float32(dist)
|
||||
}
|
||||
|
||||
func (o Obstacle) minify() [4]int {
|
||||
out := [4]int{int(o.Bounds.A.X), int(o.Bounds.A.Y), int(o.Bounds.B.X), int(o.Bounds.B.Y)}
|
||||
return out
|
||||
}
|
||||
|
||||
func MinifyObstacles(o []Obstacle) [][4]int {
|
||||
out := [][4]int{}
|
||||
for i := range o {
|
||||
out = append(out, o[i].minify())
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func GenerateObstacles(count int, width, height float32) []Obstacle {
|
||||
out := []Obstacle{}
|
||||
for i := 0; i < count; i++ {
|
||||
|
||||
Reference in New Issue
Block a user