CauldronGPU.Sectors.Textures (CauldronGPU v0.3.3)

Copy Markdown View Source

Pictures of a Cauldron2D.Sectors.Pictures set uploaded as RGBA textures through a 768-byte palette. Masked pixels (mask byte 0) are see-through.

The set must keep its pictures in Elixir (Pictures.new(named, tables, native: false)).

textures = CauldronGPU.Sectors.Textures.upload(gpu, pictures, palette, [3, 7], :nearest)
%{handle: handle, masked: false} = textures[3]

Summary

Functions

The RGBA texture of one column-by-column picture in colours, a tuple of 256 RGBA binaries.

Uploads pictures ids of pictures, filtered with filter. Raises ArgumentError when the set keeps its pictures in the native library.

Types

entry()

@type entry() :: %{handle: CauldronGPU.Handle.t(), masked: boolean()}

Functions

texture(picture, colours)

The RGBA texture of one column-by-column picture in colours, a tuple of 256 RGBA binaries.

upload(gpu, pictures, palette, ids, filter)

@spec upload(
  CauldronGPU.Target.t(),
  Cauldron2D.Sectors.Pictures.t(),
  binary(),
  [non_neg_integer()],
  :linear | :nearest
) :: %{required(non_neg_integer()) => entry()}

Uploads pictures ids of pictures, filtered with filter. Raises ArgumentError when the set keeps its pictures in the native library.