Skip to content

Commit

Permalink
Migrate to use go-database libs
Browse files Browse the repository at this point in the history
  • Loading branch information
minkezhang committed Jan 6, 2023
1 parent d546378 commit 8134f3d
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 413 deletions.
10 changes: 7 additions & 3 deletions collider/collider.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"sync"
"time"

"github.com/downflux/go-collider/internal/collider"
"github.com/downflux/go-collider/internal/kinematics"
"github.com/downflux/go-database/agent"
"github.com/downflux/go-database/database"
"github.com/downflux/go-database/feature"
"github.com/downflux/go-database/filters"
"github.com/downflux/go-database/projectile"
"github.com/downflux/go-geometry/2d/vector"
"github.com/downflux/go-geometry/2d/vector/polar"
Expand Down Expand Up @@ -83,8 +83,12 @@ func (c *C) generate(d time.Duration) ([]am, []pm) {
v.Copy(a.TargetVelocity())

aabb := a.AABB()
ns := c.db.QueryAgents(aabb, func(b agent.RO) bool { return collider.IsSquishableColliding(a, b) })
fs := c.db.QueryFeatures(aabb, func(f feature.RO) bool { return collider.IsCollidingFeature(a, f) })
ns := c.db.QueryAgents(aabb, func(b agent.RO) bool {
return filters.AgentIsCollidingNotSquishable(a, b)
})
fs := c.db.QueryFeatures(aabb, func(f feature.RO) bool {
return filters.AgentIsCollidingWithFeature(a, f)
})

for _, f := range fs {
kinematics.SetFeatureCollisionVelocity(a, f, v)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
github.com/downflux/go-bvh v1.0.0
github.com/downflux/go-database v0.3.3
github.com/downflux/go-database v0.3.5
github.com/downflux/go-geometry v0.15.4
github.com/google/go-cmp v0.5.9
)
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ github.com/downflux/go-database v0.3.2 h1:LnXY4hRmdeH9oIjTschW9Z+MxGUFGOu5Sz+lX+
github.com/downflux/go-database v0.3.2/go.mod h1:GgparhC7kkqx5VPbyFjE8/zA7o2F/E8P8SR/GwXNs+s=
github.com/downflux/go-database v0.3.3 h1:VJis0vWeEbJ0MN/f/kowD0+RSyDajqVh3T2JbZjR0RU=
github.com/downflux/go-database v0.3.3/go.mod h1:GgparhC7kkqx5VPbyFjE8/zA7o2F/E8P8SR/GwXNs+s=
github.com/downflux/go-database v0.3.4 h1:MU0JwgdkK7lCTG7GGohBLOcCmErU6vh/Gyf+pZyTPY8=
github.com/downflux/go-database v0.3.4/go.mod h1:GgparhC7kkqx5VPbyFjE8/zA7o2F/E8P8SR/GwXNs+s=
github.com/downflux/go-database v0.3.5 h1:36TZFOI2vbHhGJGRe9MFtpmOco+OEA45glTyArVpzLc=
github.com/downflux/go-database v0.3.5/go.mod h1:GgparhC7kkqx5VPbyFjE8/zA7o2F/E8P8SR/GwXNs+s=
github.com/downflux/go-geometry v0.15.2 h1:opm0LgH8p6xIt9od3ZcDxf5HSHP/GOj937s5fUwI1cs=
github.com/downflux/go-geometry v0.15.2/go.mod h1:ZJcto0QwYRdoIbi5G4mh5y6v2xUS+d++/cANaO1F9+8=
github.com/downflux/go-geometry v0.15.3 h1:Kwr2tiozUQF/Q47pCZDRaPS+MPrV6KsC87Gm0J7p15w=
Expand Down
60 changes: 0 additions & 60 deletions internal/collider/collider.go

This file was deleted.

89 changes: 0 additions & 89 deletions internal/collider/collider_test.go

This file was deleted.

137 changes: 0 additions & 137 deletions internal/geometry/hyperrectangle/hyperrectangle.go

This file was deleted.

Loading

0 comments on commit 8134f3d

Please sign in to comment.