Documentation
¶
Overview ¶
Package view is what one pair of eyes sees of a world.
View ¶
A View is a rectangle of the world and the entities the space finds in it, as an EntitySet. The world keeps one a camera (world.Write.NewView) and the System refreshes each once a tick after movement; a View over the whole world simply sees everything.
Sectors seen ¶
In a world cut into sectors a camera's View (NewSeen) is of the sectors its picture covers within its sight (the world's lod.Ladder.Sight times camera.SightOf), each at the lod.Level the camera sees it at, lod.Omitted off the picture or past the sight: two drawn side by side a level apart at most, none finer than it is ticked at. It holds the entities of the sectors seen; View.Level and View.Fog say how fully one at a point is drawn and how far into the fog.
Index ¶
- type EntitySet
- type Sectors
- type System
- type View
- func (v *View) Contains(id uid.UID64) bool
- func (v *View) CopyInto(dst *View)
- func (v *View) Fog(x, y float32) float32
- func (v *View) Fogging() [4]float32
- func (v *View) Grid() Sectors
- func (v *View) Level(x, y float32) lod.Level
- func (v *View) Sectors(each func(i int, box geom.AABB, level lod.Level))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntitySet ¶
type EntitySet struct {
// contains filtered or unexported fields
}
EntitySet is a set of the world's entities by index, the zero value empty and ready. It knows nothing of generations: fill it only with ids of entities alive at the time.
type Sectors ¶
type Sectors interface {
Len() int
Cols() int
Box(i int) geom.AABB
Of(x, y float32) int
Level(cam camera.Camera, i int) lod.Level
Ladder() lod.Ladder
}
Sectors is a world's grid of sectors as a View sees it: how many and how many in a row (the sector i lies at column i % Cols, row i / Cols), each one's rectangle, the one a point lies in, the level a camera sees one at (the level ticked for a camera that is no observer) and the world's ladder. An observer sees a sector at the level it is ticked at or coarser, never finer.
type System ¶
type System struct {
// contains filtered or unexported fields
}
System refreshes every View listed at views once a tick from the Space.
type View ¶
type View struct {
// Bounds is the rectangle seen, as of the last tick.
Bounds geom.AABB
// Culled says Bounds is less than the whole world and In is the answer; false means everything.
Culled bool
// In is who the Space found in Bounds, when Culled.
In EntitySet
// contains filtered or unexported fields
}
View is a rectangle of the world and the entities the Space finds in it, refreshed each tick after movement. The zero value sees everything.
func NewSeen ¶
NewSeen is a View of what cam shows of a world cut into sectors: the sectors its picture covers within its sight, each at its level, and the entities in them.
func (*View) CopyInto ¶ added in v0.5.0
CopyInto has dst see what v sees now, keeping dst's memory; no tick refreshes dst.
func (*View) Fog ¶
Fog is how far into the fog before the camera's sight the world point (x, y) lies, 0 short of it to 1 at the sight's end.
func (*View) Fogging ¶
Fogging is the fog before the camera's sight ends as a shader takes it: from where (x, y), where it begins and where it ends; all zero without a sight.
func (*View) Level ¶
Level is how fully what stands at the world point (x, y) is drawn: the level the camera sees its sector at, shifted coarser by its LevelShift (camera.Shifted) to lod.L5 at most but never from lod.Standard or finer, lod.Omitted off the picture or past the sight; lod.Standard in a View of no sectors.