loadMesh
import { loadMesh } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
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:
- Wavefront obj file *.obj (ONLY TRIANGULATED FACES)
- Polygon File Format *.ply
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;filenameName of the file
verticesOutput destination, filled by the native operation. vertex coordinates, each value contains 3 floats
indicesOutput destination, filled by the native operation. per-face list of vertices, each value is a vector of ints
normalsOutput destination, filled by the native operation. per-vertex normals, each value contains 3 floats
colorsOutput destination, filled by the native operation. per-vertex colors, each value contains 3 floats
texCoordsOutput 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.