Documentation ¶
Overview ¶
Package flocking provides a flocking model, mimicking the behaviour of bird flocks or fish schools.
Index ¶
Constants ¶
const MaxNeighbors = 8
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Heading ¶
type Heading struct {
Angle float64
}
// Velocity component.
type Velocity struct { common.Vec2f }
Heading component
type Neighbors ¶
type Neighbors struct { Entities [MaxNeighbors]kd.EntityLocation Count int }
Neighbors holds an entity's neighbours
type SysInitBoids ¶
type SysInitBoids struct {
Count int
}
SysInitBoids system.
func (*SysInitBoids) Initialize ¶
func (s *SysInitBoids) Initialize(w *ecs.World)
Initialize the system
type SysMoveBoids ¶
type SysMoveBoids struct { Speed float64 MaxAcc float64 UpdateInterval int SeparationDist float64 SeparationAngle float64 CohesionAngle float64 AlignmentAngle float64 WallDist float64 WallAngle float64 MouseDist float64 MouseAngle float64 // contains filtered or unexported fields }
UISysDrawBoids is a system that draws ants.
func (*SysMoveBoids) Finalize ¶
func (s *SysMoveBoids) Finalize(world *ecs.World)
FinalizeUI the system
func (*SysMoveBoids) Initialize ¶
func (s *SysMoveBoids) Initialize(world *ecs.World)
InitializeUI the system
type SysNeighbors ¶
type SysNeighbors struct { Neighbors int Radius float64 BuildStep int // contains filtered or unexported fields }
SysNeighbors system.
func (*SysNeighbors) Initialize ¶
func (s *SysNeighbors) Initialize(w *ecs.World)
Initialize the system
type UISysDrawBoid ¶
type UISysDrawBoid struct { Radius float32 // contains filtered or unexported fields }
UISysDrawBoids is a system that draws a single boid and its neighbors.
func (*UISysDrawBoid) FinalizeUI ¶
func (s *UISysDrawBoid) FinalizeUI(world *ecs.World)
FinalizeUI the system
func (*UISysDrawBoid) InitializeUI ¶
func (s *UISysDrawBoid) InitializeUI(world *ecs.World)
InitializeUI the system
func (*UISysDrawBoid) PostUpdateUI ¶
func (s *UISysDrawBoid) PostUpdateUI(world *ecs.World)
PostUpdateUI the system
func (*UISysDrawBoid) UpdateUI ¶
func (s *UISysDrawBoid) UpdateUI(world *ecs.World)
UpdateUI the system
type UISysDrawBoids ¶
type UISysDrawBoids struct {
// contains filtered or unexported fields
}
UISysDrawBoids is a system that draws boids.
func (*UISysDrawBoids) FinalizeUI ¶
func (s *UISysDrawBoids) FinalizeUI(world *ecs.World)
FinalizeUI the system
func (*UISysDrawBoids) InitializeUI ¶
func (s *UISysDrawBoids) InitializeUI(world *ecs.World)
InitializeUI the system
func (*UISysDrawBoids) PostUpdateUI ¶
func (s *UISysDrawBoids) PostUpdateUI(world *ecs.World)
PostUpdateUI the system
func (*UISysDrawBoids) UpdateUI ¶
func (s *UISysDrawBoids) UpdateUI(world *ecs.World)
UpdateUI the system
type UISysDrawBoidsLines ¶
type UISysDrawBoidsLines struct {
// contains filtered or unexported fields
}
UISysDrawBoidsLines is a system that draws boids.
func (*UISysDrawBoidsLines) FinalizeUI ¶
func (s *UISysDrawBoidsLines) FinalizeUI(world *ecs.World)
FinalizeUI the system
func (*UISysDrawBoidsLines) InitializeUI ¶
func (s *UISysDrawBoidsLines) InitializeUI(world *ecs.World)
InitializeUI the system
func (*UISysDrawBoidsLines) PostUpdateUI ¶
func (s *UISysDrawBoidsLines) PostUpdateUI(world *ecs.World)
PostUpdateUI the system
func (*UISysDrawBoidsLines) UpdateUI ¶
func (s *UISysDrawBoidsLines) UpdateUI(world *ecs.World)
UpdateUI the system
type UISysManagePause ¶
type UISysManagePause struct {
// contains filtered or unexported fields
}
UISysManagePause is a simple system that transfers the pause state from the common.PauseMouseListener resource to the model's model.Systems.
func (*UISysManagePause) FinalizeUI ¶
func (s *UISysManagePause) FinalizeUI(world *ecs.World)
FinalizeUI the system
func (*UISysManagePause) InitializeUI ¶
func (s *UISysManagePause) InitializeUI(world *ecs.World)
InitializeUI the system
func (*UISysManagePause) PostUpdateUI ¶
func (s *UISysManagePause) PostUpdateUI(world *ecs.World)
PostUpdateUI the system
func (*UISysManagePause) UpdateUI ¶
func (s *UISysManagePause) UpdateUI(world *ecs.World)
UpdateUI the system