Skip to content

loadMesh

ptcloudfunctionOpenCV 5.0.0
import { loadMesh } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSfilename, vertices, indices, normals
FUNCTIONloadMesh
RETURN TYPEvoid
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Loads a mesh from a file.

The function loads mesh from the specified file and returns it. If the mesh cannot be read, throws an error Vertex attributes (i.e. space and texture coodinates, normals and colors) are returned in same-sized arrays with corresponding elements having the same indices. This means that if a face uses a vertex with a normal or a texture coordinate with different indices (which is typical for OBJ files for example), this vertex will be duplicated for each face it uses.

Currently, the following file formats are supported:

loadMesh(filename: EmbindString, vertices: Mat, indices: MatVector, normals: Mat, colors: Mat, texCoords: Mat): void;
4 available overloads
loadMesh(filename: EmbindString, vertices: Mat, indices: MatVector): void;
loadMesh(filename: EmbindString, vertices: Mat, indices: MatVector, normals: Mat): void;
loadMesh(filename: EmbindString, vertices: Mat, indices: MatVector, normals: Mat, colors: Mat): void;
loadMesh(filename: EmbindString, vertices: Mat, indices: MatVector, normals: Mat, colors: Mat, texCoords: Mat): void;
filename

Name of the file

vertices

Output destination, filled by the native operation. vertex coordinates, each value contains 3 floats

indices

Output destination, filled by the native operation. per-face list of vertices, each value is a vector of ints

normals

Output destination, filled by the native operation. per-vertex normals, each value contains 3 floats

colors

Output destination, filled by the native operation. per-vertex colors, each value contains 3 floats

texCoords

Output destination, filled by the native operation. per-vertex texture coordinates, each value contains 2 or 3 floats

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.