Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

renderer.sources

The src shapes renderer.mesh.create / update and renderer.texture.create / update take.

  • classifyMesh(src) answers which mesh src it is (SRC_GPU, SRC_CPU, SRC_GEOMETRY or SRC_BUFFERS), and raises for a src that is none of them or a geometry src whose indices address a vertex its positions do not carry.
  • vertexRecordsToArrays(src) turns geometry written as per-vertex records (vertices = { { pos, normal?, uv?, uv1? }, ... }) into the parallel flat arrays the upload takes.
  • boundsFromPositions(positions), vecToAabb(min, max) and ZERO_AABB are the bounds a mesh is created with; geometryCounts(src) answers the vertex and index counts raw geometry implies.
  • classifyTex(src) answers which texture src it is (TSRC_GPU, TSRC_CPU, TSRC_PIXELS or TSRC_TARGET).
local Sources = require("modules.api.engine.renderer.sources")
local src = { positions = { 0, 0, 0, 1, 0, 0, 0, 1, 0 }, indices = { 0, 1, 2 } }
assert(Sources.classifyMesh(src) == Sources.SRC_GEOMETRY)
print(Sources.boundsFromPositions(src.positions).max.x) -- 1