CauldronGPU.Sectors.Surfaces (CauldronGPU v0.3.3)

Copy Markdown View Source

Convex polygons gathered into one CauldronGPU.Mesh, one part per material key.

A surface is {key, corners}: key names its material (any term), corners are at least three {position, normal, uv, light} in counter-clockwise order seen from the side they face, positions and normals in map coordinates (+Z up) and light a sector light level 0..255, read through CauldronGPU.Sectors.Light.uv/1.

{mesh, keys} = CauldronGPU.Sectors.Surfaces.mesh(surfaces)

keys lists the material key of each part, in part order.

Summary

Functions

The mesh holding surfaces and the material key of each of its parts.

Types

corner()

@type corner() :: {vec3(), vec3(), {number(), number()}, integer()}

surface()

@type surface() :: {term(), [corner()]}

vec3()

@type vec3() :: {number(), number(), number()}

Functions

mesh(surfaces)

@spec mesh([surface()]) :: {CauldronGPU.Mesh.t(), [term()]}

The mesh holding surfaces and the material key of each of its parts.