MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / createMesh

Function createMesh

src/models/index.ts:648–658  ·  view source on GitHub ↗
(vertices: number[], indices: number[])

Source from the content-addressed store, hash-verified

646}
647
648export function createMesh(vertices: number[], indices: number[]): Model {
649 // vertices: flat array of [x,y,z, nx,ny,nz, r,g,b,a, u,v] per vertex (12 floats each)
650 // NOTE: `vertices.length` and `indices.length` here only return the
651 // correct value for arrays built via literals or `new Array(N)` +
652 // index assignment. Arrays built via `.push()` reflect the LITERAL
653 // initialization size as `.length`, not the post-push size (a
654 // Perry codegen bug). For `.push`-built data, use createMeshExplicit
655 // and pass the counts manually.
656 const handle = bloom_create_mesh(vertices as any, vertices.length / 12, indices as any, indices.length);
657 return makeModel(handle, 1, 1);
658}
659
660/// Explicit-count variant of createMesh — pass `vertexCount` (number
661/// of complete 12-float vertex records) and `indexCount` directly.

Callers 1

initSharedMeshesFunction · 0.90

Calls 2

makeModelFunction · 0.85
bloom_create_meshFunction · 0.50

Tested by

no test coverage detected