3D model file I/O based on Assimp More...
Classes | |
struct | Material |
struct | ExportOptions |
Functions | |
MeshGL | ImportMesh (const std::string &filename, bool forceCleanup=false) |
void | ExportMesh (const std::string &filename, const MeshGL &mesh, const ExportOptions &options) |
3D model file I/O based on Assimp
struct manifold::Material |
PBR material properties for GLB/glTF files.
Class Members | ||
---|---|---|
double | roughness = 0.2 | Roughness value between 0 (shiny) and 1 (matte). |
double | metalness = 1 | Metalness value, generally either 0 (dielectric) or 1 (metal). |
vec4 | color = vec4(1.0) |
Color (RGBA) multiplier to apply to the whole mesh (each value between 0 and 1). |
vector< vec4 > | vertColor |
Optional: If non-empty, must match Mesh.vertPos. Provides an RGBA color for each vertex, linearly interpolated across triangles. Colors are linear, not sRGB. Only used with Mesh export, not MeshGL. |
ivec3 | normalChannels = ivec3(-1) |
For MeshGL export, gives the property indicies where the normal channels can be found. Must be >= 3, since the first three are position. |
ivec4 | colorChannels = ivec4(-1) |
For MeshGL export, gives the property indicies where the color channels can be found. Any index < 0 will output all 1.0 for that channel. |
struct manifold::ExportOptions |
Imports the given file as a Mesh structure, which can be converted to a Manifold if the mesh is a proper oriented 2-manifold. Any supported polygon format will be automatically triangulated.
This is a very simple import function and is intended primarily as a demonstration. Generally users of this library will need to modify this to read all the important properties for their application and set up any custom data structures.
filename | Supports any format the Assimp library supports. |
forceCleanup | This merges identical vertices, which can break manifoldness. However it is always done for STLs, as they cannot possibly be manifold without this step. |
void ExportMesh | ( | const std::string & | filename, |
const MeshGL & | mesh, | ||
const ExportOptions & | options | ||
) |
Saves the Mesh to the desired file type, determined from the extension specified. In the case of .glb/.gltf, this will save in version 2.0.
This is a very simple export function and is intended primarily as a demonstration. Generally users of this library will need to modify this to write all the important properties for their application and read any custom data structures.
filename | The file extension must be one that Assimp supports for export. GLB & 3MF are recommended. |
mesh | The mesh to export, likely from Manifold.GetMeshGL(). |
options | The options currently only affect an exported GLB's material. Pass {} for defaults. |