ElixirDoom.Gpu.Sprites (elixir_doom v0.2.0)

Copy Markdown View Source

The things of a level view as upright pictures for the graphics card, one instance a thing, kept under the thing's id so the renderer moves it smoothly between ticks.

{changes, live, sprites} = ElixirDoom.Gpu.Sprites.changes(view, live, target, sprites, camera, look)

Each thing stands on its feet with its picture's offsets, mirrored where the view says, turned to face the view as Doom's sprites do, its see-through texels cut out. It stands in its sector (CauldronGPU.Instance's standing): its sector's own floor and ceiling heights do not hide it, so it shows whole where it sinks into them, while walls and the raised floors and lowered ceilings of other sectors in front of it do; things are drawn farthest first. It is lit as the software view lights it: by its sector's light (plus the view's extra light) at its distance from the eye, fully when bright, through the fixed light table when one is in force. A shimmering thing is drawn as ElixirDoom.Gpu.Shimmer draws it.

sprites is what the last call returned (nil the first time): each picture's quad mesh and the ids placed. look is %{first_id:, stretch:, fixed:, extra_light:}: the instance id of a thing with id 0 (a thing's instance is that plus its id), how many times taller than wide a unit is drawn, the fixed light table or nil, and the light added.

Summary

Functions

The changes that draw view's things, with the live map and the sprites to keep.

Types

look()

@type look() :: %{
  first_id: pos_integer(),
  stretch: number(),
  fixed: non_neg_integer() | nil,
  extra_light: integer()
}

t()

@type t() :: %{
  meshes: %{required({non_neg_integer(), boolean()}) => CauldronGPU.Handle.t()},
  placed: MapSet.t()
}

Functions

changes(view, live, target, sprites, camera, look)

The changes that draw view's things, with the live map and the sprites to keep.