Composes the world as a ground plane seen in perspective from above it, turning freely: the floor recedes to a horizon, movers stand on it as billboards, and everything fades towards the atlas's void colour with distance.
Cauldron2D.Projection.Mode7.render(:my_game,
position: {12.5, 8.5},
heading: :math.pi() / 2,
cell: &MyGame.cell/1,
size: {320, 200},
movers: [{:hero, {14.5, 8.5}, 0.0}]
)The plane is drawn from each cell's :top face, so a cell with storeys lies flat like
any other: this projection has no verticality. Use Cauldron2D.Projection.Iso,
Cauldron2D.Projection.Oblique or Cauldron2D.Projection.FirstPerson for a world
whose walls must stand up.
Unlike the isometric view the heading is continuous, so a game may turn by any angle.
Options
:position—{x, y}in tiles, where the camera is, required:heading— radians,0along+x, required:cell—fn {x, y} -> cell end, asCauldron2D.Surfacetakes cells;:voidis drawn as the void colour, required:size—{width, height}of the picture in pixels, required:eye— how far above the plane the camera sits, in tiles. Default1.6:pitch—-0.8..0.8, 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 the plane fades 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 camera,:backaway,:sideacross (mirrored one way); with no heading it faces the camera. Default[]:volumes— coloured regions of space, asCauldron2D.Projection.Volumedescribes them, each tinting the plane and the movers behind it. Default[]:at— the time in milliseconds an animated art's frame is chosen for. Default0
Summary
Functions
Where world point {x, y} lands in the picture, or nil when it is behind the camera.
The picture, as the module documentation describes.
The tile under picture pixel {px, py}, or nil at or above the horizon.
The world point under picture pixel {px, py}, or nil at or above the horizon.
Types
@type option() :: {:position, {number(), number()}} | {:heading, number()} | {:cell, ({integer(), integer()} -> Cauldron2D.Surface.cell())} | {:size, {pos_integer(), pos_integer()}} | {:eye, number()} | {:pitch, number()} | {:aspect, number()} | {:fov, number()} | {:range, number()} | {:sky, {{byte(), byte(), byte()}, {byte(), byte(), byte()}}} | {:movers, [tuple()]} | {:volumes, [map()]} | {:at, integer()}
Functions
@spec project(Cauldron2D.Atlas.name() | Cauldron2D.Atlas.t(), {number(), number()}, [ option() ]) :: {float(), float()} | nil
Where world point {x, y} lands in the picture, or nil when it is behind the camera.
@spec render(Cauldron2D.Atlas.name() | Cauldron2D.Atlas.t(), [option()]) :: FrenchCurve.Raster.t()
The picture, as the module documentation describes.
@spec tile_at(Cauldron2D.Atlas.name() | Cauldron2D.Atlas.t(), {number(), number()}, [ option() ]) :: {integer(), integer()} | nil
The tile under picture pixel {px, py}, or nil at or above the horizon.
@spec unproject( Cauldron2D.Atlas.name() | Cauldron2D.Atlas.t(), {number(), number()}, [option()] ) :: {float(), float()} | nil
The world point under picture pixel {px, py}, or nil at or above the horizon.