CauldronGPU.Target protocol (CauldronGPU v0.3.3)

Copy Markdown View Source

Anything a scene can be sent to: a CauldronGPU renderer in the VM, a CauldronGPU.Host in its own process, or a browser scene (Cauldron3D.Net.Scene). The converters (CauldronGPU.Bsp, CauldronGPU.AliasModel, CauldronGPU.StudioModel, CauldronGPU.Sectors) upload through it, so they work with every one.

Summary

Types

t()

All the types that implement this protocol.

Functions

Makes a canvas, a texture drawn into by 2D layers, and returns its handle.

Defines a material and returns its handle.

Uploads a mesh and returns its handle.

Lets the target free a mesh, texture or material once no scene entry uses it. A CauldronGPU renderer frees a handle's object when the handle is no longer referenced, and answers :ok here.

Sends one tick of changes (CauldronGPU.Stream).

Uploads a texture and returns its handle.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

canvas(target, canvas)

@spec canvas(t(), CauldronGPU.Canvas.t()) :: CauldronGPU.Handle.t()

Makes a canvas, a texture drawn into by 2D layers, and returns its handle.

material(target, material)

@spec material(t(), CauldronGPU.Material.t()) :: CauldronGPU.Handle.t()

Defines a material and returns its handle.

mesh(target, mesh)

@spec mesh(t(), CauldronGPU.Mesh.t()) :: CauldronGPU.Handle.t()

Uploads a mesh and returns its handle.

release(target, handle)

@spec release(t(), CauldronGPU.Handle.t()) :: :ok

Lets the target free a mesh, texture or material once no scene entry uses it. A CauldronGPU renderer frees a handle's object when the handle is no longer referenced, and answers :ok here.

submit(target, changes)

@spec submit(t(), [CauldronGPU.Stream.change()]) :: :ok | {:error, term()}

Sends one tick of changes (CauldronGPU.Stream).

texture(target, texture)

@spec texture(t(), CauldronGPU.Texture.t()) :: CauldronGPU.Handle.t()

Uploads a texture and returns its handle.