Draws a sector map from a point inside it: walls, floors, ceilings and sky, and the
things standing in it, nearest in front, into a Cauldron2D.Sectors.Frame.
%{frame: frame, seen: lines} =
Cauldron2D.Sectors.View.render(frame, pictures, map, %{
x: 1056.0, y: -3616.0, z: 41.0, angle: :math.pi() / 2,
sectors: sectors, sides: sides, things: things
}, sky: %{picture: sky, flat: sky_flat, columns: 1024 / (2 * :math.pi()), mid: 100.0, step: 1.0})map is a Cauldron2D.Sectors.Map with its BSP. The view gives the eye's x, y and
height z, its heading angle in radians (0 along +x), and the sectors and
sides as they are now — a door's ceiling moves and a switch's picture changes, so the
game passes its own copies rather than the map's. pitch moves the horizon up (> 0)
or down by that many pixels. things are what stand in the sectors:
%{x:, y:, z:, sector:, picture:, offset: {left, top}, flip: false, bright: false, shimmer: false}where z is the height of the thing's feet, offset where the picture's origin is —
left texels from its left edge, top texels above its bottom row at the feet — and
bright draws it unlit. A shimmer thing is drawn as a blur of what is behind it.
The result's seen is the set of line indexes some of which was drawn, for an automap.
Options
:sky—%{picture:, flat:, columns:, mid:, step:}: a ceiling whose picture isflatshows picturepicturewrapped around the view,columnspicture columns per radian, its rowmidat the horizon andsteprows a pixel; default none:stretch— how many times taller than wide a world unit is drawn. Default1.0:contrast— light added to walls running alongyand taken from walls running alongx, so corners read. Default0:extra_light— light added everywhere. Default0:fixed— a light table to draw everything through instead of lighting it. Defaultnil:light— options forCauldron2D.Sectors.Light:fov— the horizontal field of view in radians. Defaultπ/2
Summary
Functions
Draw map as seen by eye onto frame. See the moduledoc.
Types
@type thing() :: %{ :x => number(), :y => number(), :z => number(), :sector => non_neg_integer(), :picture => non_neg_integer(), optional(:offset) => {number(), number()}, optional(:flip) => boolean(), optional(:bright) => boolean(), optional(:shimmer) => boolean() }
Functions
@spec render( Cauldron2D.Sectors.Frame.t(), Cauldron2D.Sectors.Pictures.t(), Cauldron2D.Sectors.Map.t(), eye(), keyword() ) :: %{frame: Cauldron2D.Sectors.Frame.t(), seen: MapSet.t(non_neg_integer())}
Draw map as seen by eye onto frame. See the moduledoc.