Builtin Library
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_GEOMETRYorSRC_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)andZERO_AABBare 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_PIXELSorTSRC_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