CauldronGPU.Sectors.Live.Geometry (CauldronGPU v0.3.3)

Copy Markdown View Source

The surfaces of a sector map sector by sector, from its sectors and sides as they are now: each sector's floors and ceilings over its subsectors' polygons (CauldronGPU.Sectors.Flats.polygons/1), and the walls facing into it (CauldronGPU.Sectors.Walls, with its pegging and sky rules). Floors and ceilings whose picture marks a sky, and the upper walls left out between two sky ceilings (from the lower ceiling up to the higher, facing into the higher sector), are sky surfaces keyed :sky.

A surface is {{:picture, id} | :sky, corners}, each corner {position, normal, uv, {sector, contrast}} in map coordinates (+Z up): sector the sector it is lit by and contrast the light -16, 0 or 16 added for the wall's direction.

geometry = CauldronGPU.Sectors.Live.Geometry.new(map)
CauldronGPU.Sectors.Live.Geometry.surfaces(geometry, [3, 7], sectors, sides, pictures, sky)
CauldronGPU.Sectors.Live.Geometry.neighbours(geometry, 3)

Summary

Functions

The sectors sharing a two-sided line with sector.

The geometry of map, which must carry a BSP.

The surfaces of each of wanted, as %{sector => surfaces}, given the map's sectors and sides as they are now; sky is the set of picture ids that mark a sky.

Types

corner()

@type corner() ::
  {{number(), number(), number()}, {number(), number(), number()},
   {number(), number()}, {non_neg_integer(), integer()}}

surface()

@type surface() :: {{:picture, non_neg_integer()} | :sky, [corner()]}

t()

@type t() :: %CauldronGPU.Sectors.Live.Geometry{
  lines: %{required(non_neg_integer()) => [non_neg_integer()]},
  map: Cauldron2D.Sectors.Map.t(),
  neighbours: %{required(non_neg_integer()) => MapSet.t(non_neg_integer())},
  polygons: %{
    required(non_neg_integer()) => [CauldronGPU.Sectors.Flats.polygon()]
  }
}

Functions

neighbours(geometry, sector)

@spec neighbours(t(), non_neg_integer()) :: MapSet.t(non_neg_integer())

The sectors sharing a two-sided line with sector.

new(map)

@spec new(Cauldron2D.Sectors.Map.t()) :: t()

The geometry of map, which must carry a BSP.

surfaces(geometry, wanted, sectors, sides, pictures, sky)

@spec surfaces(
  t(),
  [non_neg_integer()],
  tuple(),
  tuple(),
  Cauldron2D.Sectors.Pictures.t(),
  MapSet.t()
) ::
  %{required(non_neg_integer()) => [surface()]}

The surfaces of each of wanted, as %{sector => surfaces}, given the map's sectors and sides as they are now; sky is the set of picture ids that mark a sky.