QuakeServer.World.Area (quake_server v0.1.0)

Copy Markdown View Source

The grid linked entities are filed in: 128 by 128 cells across the world model's ground, each at least 128 units wide, and one list for entities too large for it.

An entity whose box spans more than 16 cells, or reaches the grid's last row or column, goes in the large list; any other is filed in every cell its box covers. Each cell keeps its entities in the order they were filed. entities/3 lists those whose cells a box covers: the large list first, then the cells column by column, each entity once.

grid = QuakeServer.World.Area.grid(world_mins, world_maxs)
cells = QuakeServer.World.Area.cells(grid, absmin, absmax)
area = QuakeServer.World.Area.file(area, entity, cells)
QuakeServer.World.Area.entities(area, grid, {mins, maxs})

Summary

Functions

The cells an entity with box absmin..absmax is filed in.

The entities filed in the large list and in the cells box {mins, maxs} covers, in order, each once.

entity added to the end of each of cells.

The grid over a world model whose bounds are mins..maxs.

entity taken out of each of cells.

Types

cell()

@type cell() :: non_neg_integer() | :large

grid()

@type grid() :: %{scale: {float(), float()}, bias: {float(), float()}}

Functions

cells(grid, absmin, absmax)

@spec cells(grid(), Cauldron3D.Vec.t(), Cauldron3D.Vec.t()) :: [cell()]

The cells an entity with box absmin..absmax is filed in.

entities(area, grid, arg)

@spec entities(map(), grid(), {Cauldron3D.Vec.t(), Cauldron3D.Vec.t()}) :: [
  non_neg_integer()
]

The entities filed in the large list and in the cells box {mins, maxs} covers, in order, each once.

file(area, entity, cells)

@spec file(map(), non_neg_integer(), [cell()]) :: map()

entity added to the end of each of cells.

grid(arg1, arg2)

@spec grid(Cauldron3D.Vec.t(), Cauldron3D.Vec.t()) :: grid()

The grid over a world model whose bounds are mins..maxs.

unfile(area, entity, cells)

@spec unfile(map(), non_neg_integer(), [cell()]) :: map()

entity taken out of each of cells.