the asset name
the parsed model: vertices (Float32Array of x, y, z),
uvs (Float32Array of u, v), indices (Uint16Array of triangle vertex
indices), vertexCount, and groups (the usemtl material groups, as
{materialName, start, count} index ranges); or null if none is loaded
under that name
// 1. preload the OBJ model and its texture
await loader.preload([
{ name: "cube", type: "obj", src: "models/cube.obj" },
{ name: "cube", type: "image", src: "models/cube_texture.png" },
]);
// 2. a Mesh takes the model and the texture by name
const mesh = new Mesh(400, 300, {
model: "cube",
texture: "cube",
width: 200,
height: 200,
});
app.world.addChild(mesh);
// 3. or read the parsed data directly
const { vertices, uvs, indices, vertexCount } = loader.getOBJ("cube");
Get a loaded Wavefront OBJ model (an
"obj"asset), parsed. Most code never needs it: aMeshtakes the model's name.