Renders the world from a point inside it, looking along a heading: standing arts as textured walls of their height, floors textured to the horizon, movers and the standing arts of no height as billboards, everything fading towards the atlas's void colour with distance.
Cauldron2D.Projection.FirstPerson.render(:my_game,
position: {12.5, 8.5},
heading: :math.pi() / 2,
cell: &MyGame.cell/1,
size: {320, 200},
movers: [{:guard, {14.5, 8.5}, 0.0}]
)Options
:position—{x, y}in tiles, where the eye is, required:heading— radians,0along+x, required:cell—fn {x, y} -> cell end, asCauldron2D.Surfacetakes cells;:voidends a ray, required:size—{width, height}of the picture in pixels, required:eye— how far above the ground the eye is, in tiles, so that a figure of a given height looks out from its own head rather than a fixed point. A cell is one tile across and a storey one tile tall, so an art standing1.5tiles looks from about1.35;Cauldron2D.Atlas.eye_height/2answers for an art. Default0.6:pitch—-1.0..1.0, how far the horizon is moved down or up the picture. Default0.0:aspect— a pixel's width over its height, so a picture drawn into cells that are not square keeps its proportions. Default1.0:fov— the horizontal field of view in degrees. Default70:range— how many tiles away things fade out entirely. Default24:sky—{top, bottom}colours above the horizon. Default a blue gradient:movers—[{art, {x, y}}]or[{art, {x, y}, heading}]; a mover shows its:frontpose when heading towards the eye,:backaway,:sideacross (mirrored one way); with no heading it faces the eye. Default[]:volumes— coloured regions of space, asCauldron2D.Projection.Volumedescribes them, tinting whatever the eye sees through them and nothing in front of them. Default[]:at— the time in milliseconds an animated art's frame is chosen for. Default0
A wall is the cell's standing arts stacked, base first then its overlays in order,
each the storeys of its height with the face towards the eye — :north, :east,
:south or :west, else :side — as its texture, repeated per storey. A floor is
the base's :top face. An
overlay of height 0 stands at its tile's centre facing the eye, drawn as a mover
with no heading is, at its own size against the tile.
Summary
Functions
The picture, as the module documentation describes.
Types
@type option() :: {:position, {number(), number()}} | {:heading, number()} | {:cell, ({integer(), integer()} -> Cauldron2D.Surface.cell())} | {:size, {pos_integer(), pos_integer()}} | {:pitch, number()} | {:aspect, number()} | {:fov, number()} | {:eye, number()} | {:range, number()} | {:sky, {{byte(), byte(), byte()}, {byte(), byte(), byte()}}} | {:movers, [tuple()]} | {:volumes, [map()]} | {:at, integer()}
Functions
@spec render(Cauldron2D.Atlas.name() | Cauldron2D.Atlas.t(), [option()]) :: FrenchCurve.Raster.t()
The picture, as the module documentation describes.