Lagrange
lagrange::io Namespace Reference

Mesh input/output. More...

Classes

struct  LoadOptions
 Options used when loading a mesh or a scene. More...
 
struct  SaveOptions
 Options used when saving a mesh or a scene. More...
 

Enumerations

enum class  FileEncoding { Binary , Ascii }
 
enum class  FileFormat {
  Obj , Ply , Gltf , Msh ,
  Fbx , Unknown
}
 

Functions

template<typename MeshType , std::enable_if_t<!lagrange::MeshTraitHelper::is_mesh< MeshType >::value > * = nullptr>
MeshType load_mesh (std::istream &input_stream, const LoadOptions &options={})
 Load a mesh from a stream. More...
 
template<typename MeshType , std::enable_if_t<!lagrange::MeshTraitHelper::is_mesh< MeshType >::value > * = nullptr>
MeshType load_mesh (const fs::path &filename, const LoadOptions &={})
 Load a mesh from a file. More...
 
template<typename MeshType >
MeshType load_mesh_fbx (std::istream &input_stream, const LoadOptions &options={})
 Loads a mesh from an input stream in fbx format. More...
 
template<typename MeshType >
MeshType load_mesh_fbx (const fs::path &filename, const LoadOptions &options={})
 Loads a mesh from a file in fbx format. More...
 
template<typename MeshType >
MeshType load_mesh_gltf (std::istream &input_stream, const LoadOptions &options={})
 Loads a mesh from an input stream in glTF or GLB format. More...
 
template<typename MeshType >
MeshType load_mesh_gltf (const fs::path &filename, const LoadOptions &options={})
 Loads a mesh from a file in glTF or GLB format. More...
 
template<typename MeshType >
MeshType load_mesh_msh (std::istream &input_stream, const LoadOptions &options={})
 Loads a mesh from a stream in MSH format. More...
 
template<typename MeshType >
MeshType load_mesh_msh (const fs::path &filename, const LoadOptions &options={})
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Loads a mesh from a file in MSH format. More...
 
template<typename MeshType >
MeshType load_mesh_obj (std::istream &input_stream_obj, const LoadOptions &options={})
 Loads a mesh from a file in MSH format. More...
 
template<typename MeshType >
MeshType load_mesh_obj (const fs::path &filename, const LoadOptions &options={})
 Loads a mesh from a file in MSH format. More...
 
template<typename MeshType >
MeshType load_mesh_ply (std::istream &input_stream, const LoadOptions &options={})
 Loads a mesh from a stream in PLY format. More...
 
template<typename MeshType >
MeshType load_mesh_ply (const fs::path &filename, const LoadOptions &options={})
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Loads a mesh from a file in PLY format. More...
 
template<typename SceneType >
SceneType load_scene (const fs::path &filename, const LoadOptions &options={})
 Load a scene. More...
 
template<typename SceneType >
SceneType load_scene (std::istream &input_stream, const LoadOptions &options={})
 Load a scene from a stream. More...
 
template<typename SceneType >
SceneType load_scene_fbx (const fs::path &filename, const LoadOptions &options={})
 Load an fbx scene. More...
 
template<typename SceneType >
SceneType load_scene_fbx (std::istream &input_stream, const LoadOptions &options={})
 Load an fbx scene. More...
 
template<typename SceneType >
SceneType load_scene_gltf (const fs::path &filename, const LoadOptions &options={})
 Load a scene using gltf. More...
 
template<typename SceneType >
SceneType load_scene_gltf (std::istream &input_stream, const LoadOptions &options={})
 Load a scene using gltf. More...
 
template<typename SceneType >
SceneType load_scene_obj (const fs::path &filename, const LoadOptions &options={})
 Load an obj into a scene. More...
 
template<typename SceneType >
SceneType load_scene_obj (std::istream &input_stream_obj, std::istream &input_stream_mtl, const LoadOptions &options={})
 Loadn obj into a scene. More...
 
template<typename SceneType >
SceneType load_simple_scene (const fs::path &filename, const LoadOptions &options={})
 Load a simple scene. More...
 
template<typename SceneType >
SceneType load_simple_scene_fbx (std::istream &input_stream, const LoadOptions &options={})
 Load a simple scene from fbx. More...
 
template<typename SceneType >
SceneType load_simple_scene_fbx (const fs::path &filename, const LoadOptions &options={})
 Load a simple scene from fbx. More...
 
template<typename SceneType >
SceneType load_simple_scene_gltf (std::istream &input_stream, const LoadOptions &options={})
 Load a simple scene with gltf. More...
 
template<typename SceneType >
SceneType load_simple_scene_gltf (const fs::path &filename, const LoadOptions &options={})
 Load a simple scene with gltf. More...
 
template<typename Scalar , typename Index >
void save_mesh (std::ostream &output_stream, const SurfaceMesh< Scalar, Index > &mesh, FileFormat format, const SaveOptions &options={})
 Save a mesh to a stream. More...
 
template<typename Scalar , typename Index >
void save_mesh (const fs::path &filename, const SurfaceMesh< Scalar, Index > &mesh, const SaveOptions &options={})
 Save a mesh to a file. More...
 
template<typename Scalar , typename Index >
void save_mesh_gltf (std::ostream &output_stream, const SurfaceMesh< Scalar, Index > &mesh, const SaveOptions &options={})
 Saves a mesh to an output stream in glTF or GLB format. More...
 
template<typename Scalar , typename Index >
void save_mesh_gltf (const fs::path &filename, const SurfaceMesh< Scalar, Index > &mesh, const SaveOptions &options={})
 Saves a mesh to a file in glTF or GLB format. More...
 
template<typename Scalar , typename Index >
void save_mesh_msh (std::ostream &output_stream, const SurfaceMesh< Scalar, Index > &mesh, const SaveOptions &options={})
 Saves a mesh to a stream in MSH format. More...
 
template<typename Scalar , typename Index >
void save_mesh_msh (const fs::path &filename, const SurfaceMesh< Scalar, Index > &mesh, const SaveOptions &options={})
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Saves a mesh to a stream in MSH format. More...
 
template<typename Scalar , typename Index >
void save_mesh_obj (std::ostream &output_stream, const SurfaceMesh< Scalar, Index > &mesh, const SaveOptions &options={})
 Saves a mesh to a stream in OBJ format. More...
 
template<typename Scalar , typename Index >
void save_mesh_obj (const fs::path &filename, const SurfaceMesh< Scalar, Index > &mesh, const SaveOptions &options={})
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Saves a mesh to a file in OBJ format. More...
 
template<typename Scalar , typename Index >
void save_mesh_ply (std::ostream &output_stream, const SurfaceMesh< Scalar, Index > &mesh, const SaveOptions &options={})
 Saves a mesh to a stream in PLY format. More...
 
template<typename Scalar , typename Index >
void save_mesh_ply (const fs::path &filename, const SurfaceMesh< Scalar, Index > &mesh, const SaveOptions &options={})
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Saves a mesh to a file in PLY format. More...
 
template<typename Scalar , typename Index >
void save_scene (const fs::path &filename, const scene::Scene< Scalar, Index > &scene, const SaveOptions &options={})
 Save a scene to a file. More...
 
template<typename Scalar , typename Index >
void save_scene (std::ostream &output_stream, const scene::Scene< Scalar, Index > &scene, FileFormat format, const SaveOptions &options={})
 Save a scene to a stream. More...
 
template<typename Scalar , typename Index >
void save_scene_gltf (std::ostream &output_stream, const scene::Scene< Scalar, Index > &scene, const SaveOptions &options={})
 Save a scene to a gltf or glb file. More...
 
template<typename Scalar , typename Index >
void save_scene_gltf (const fs::path &filename, const scene::Scene< Scalar, Index > &scene, const SaveOptions &options={})
 Save a scene to a gltf or glb file. More...
 
template<typename Scalar , typename Index , size_t Dimension = 3>
void save_simple_scene (const fs::path &filename, const scene::SimpleScene< Scalar, Index, Dimension > &scene, const SaveOptions &options={})
 Save a mesh to a file. More...
 
template<typename Scalar , typename Index , size_t Dimension = 3>
void save_simple_scene_gltf (std::ostream &output_stream, const scene::SimpleScene< Scalar, Index, Dimension > &scene, const SaveOptions &options={})
 Save a simple scene to a gltf or glb file. More...
 
template<typename Scalar , typename Index , size_t Dimension = 3>
void save_simple_scene_gltf (const fs::path &filename, const scene::SimpleScene< Scalar, Index, Dimension > &scene, const SaveOptions &options={})
 Save a simple scene to a gltf or glb file. More...
 
template<typename Scalar , typename Index >
bool involve_indexed_attribute (const SurfaceMesh< Scalar, Index > &mesh, span< const AttributeId > attr_ids)
 
template<typename Scalar , typename Index >
std::tuple< SurfaceMesh< Scalar, Index >, std::vector< AttributeId > > remap_indexed_attributes (const SurfaceMesh< Scalar, Index > &in_mesh, span< const AttributeId > in_attr_ids)
 
 LA_SURFACE_MESH_X (load_mesh_fbx, 0)
 
 LA_SIMPLE_SCENE_X (load_simple_scene_fbx, 0)
 
 LA_SCENE_X (load_scene_fbx, 0)
 
 LA_SURFACE_MESH_X (load_mesh_gltf, 0)
 
 LA_SIMPLE_SCENE_X (load_simple_scene_gltf, 0)
 
 LA_SCENE_X (load_scene_gltf, 0)
 
 LA_SURFACE_MESH_X (load_mesh, 0)
 
std::string_view get_suffix (std::string_view name)
 
template<typename Scalar , typename Index , typename ValueType , AttributeElement element>
void extract_normal (happly::Element &ply_element, const std::string_view name, SurfaceMesh< Scalar, Index > &mesh)
 
template<typename Scalar , typename Index , typename ValueType >
void extract_vertex_uv (happly::Element &vertex_element, const std::string_view name, SurfaceMesh< Scalar, Index > &mesh)
 
template<typename Scalar , typename Index , typename ValueType , AttributeElement element>
void extract_color (happly::Element &ply_element, const std::string_view name, SurfaceMesh< Scalar, Index > &mesh)
 
template<AttributeElement element, typename Scalar , typename Index >
void extract_property (happly::Element &ply_element, const std::string &name, SurfaceMesh< Scalar, Index > &mesh)
 
template<typename Scalar , typename Index >
void extract_vertex_properties (happly::Element &vertex_element, SurfaceMesh< Scalar, Index > &mesh, const LoadOptions &options)
 
template<typename Scalar , typename Index >
void extract_facet_properties (happly::Element &facet_element, SurfaceMesh< Scalar, Index > &mesh, const LoadOptions &options)
 
 LA_SCENE_X (load_scene_obj, 0)
 
 LA_SCENE_X (load_scene, 0)
 
 LA_SIMPLE_SCENE_X (load_simple_scene, 0)
 
template<typename Scalar , typename Index , size_t Dimension>
tinygltf::Model scene2model (const scene::SimpleScene< Scalar, Index, Dimension > &lscene, const SaveOptions &options)
 
 LA_SIMPLE_SCENE_X (save_simple_scene_gltf, 0)
 
template<typename Scalar , typename Index >
tinygltf::Model lagrange_scene_to_gltf_model (const scene::Scene< Scalar, Index > &lscene, const SaveOptions &options)
 
 LA_SCENE_X (save_scene_gltf, 0)
 
 LA_SURFACE_MESH_X (save_mesh, 0)
 
 LA_SCENE_X (save_scene, 0)
 
 LA_SIMPLE_SCENE_X (save_simple_scene, 0)
 
template<typename Scalar , typename Index >
void stitch_mesh (SurfaceMesh< Scalar, Index > &mesh)
 

Detailed Description

Mesh input/output.

Function Documentation

◆ load_mesh() [1/2]

MeshType load_mesh ( std::istream &  input_stream,
const LoadOptions options = {} 
)

Load a mesh from a stream.

A mesh loader will automatically be selected based on the contents of the stream.

Template Parameters
MeshTypeThe mesh type to load.
Parameters
[in]input_streamThe input stream.
[in]optionsExtra options related to loading.
Returns
A SurfaceMesh object loaded from the input stream.

◆ load_mesh() [2/2]

MeshType load_mesh ( const fs::path &  filename,
const LoadOptions options = {} 
)

Load a mesh from a file.

The loader will be chosen depending on the file extension.

Parameters
[in]filenameInput file name.
[in]optionsExtra options related to loading.
Returns
A SurfaceMesh object loaded from the input file.

◆ load_mesh_fbx() [1/2]

MeshType load_mesh_fbx ( std::istream &  input_stream,
const LoadOptions options = {} 
)

Loads a mesh from an input stream in fbx format.

If the scene contains multiple meshes, they will be merged into one.

Parameters
input_streamInput data stream.
optionsLoad options.
Template Parameters
MeshTypeMesh type to load.
Returns
Loaded mesh.

◆ load_mesh_fbx() [2/2]

MeshType load_mesh_fbx ( const fs::path &  filename,
const LoadOptions options = {} 
)

Loads a mesh from a file in fbx format.

If the scene contains multiple meshes, they will be merged into one.

Parameters
[in]filenameInput filename.
[in]optionsLoad options.
Template Parameters
MeshTypeMesh type to load.
Returns
Loaded mesh.

◆ load_mesh_gltf() [1/2]

MeshType load_mesh_gltf ( std::istream &  input_stream,
const LoadOptions options = {} 
)

Loads a mesh from an input stream in glTF or GLB format.

If the scene contains multiple meshes, they will be merged into one.

Parameters
input_streamInput data stream.
optionsLoad options.
Template Parameters
MeshTypeMesh type to load.
Returns
Loaded mesh.

◆ load_mesh_gltf() [2/2]

MeshType load_mesh_gltf ( const fs::path &  filename,
const LoadOptions options = {} 
)

Loads a mesh from a file in glTF or GLB format.

If the scene contains multiple meshes, they will be merged into one.

Parameters
[in]filenameInput filename.
[in]optionsLoad options.
Template Parameters
MeshTypeMesh type to load.
Returns
Loaded mesh.

◆ load_mesh_msh() [1/2]

MeshType load_mesh_msh ( std::istream &  input_stream,
const LoadOptions options = {} 
)

Loads a mesh from a stream in MSH format.

Parameters
[in]input_streamInput stream.
[in]optionsLoad options.
Template Parameters
MeshTypeMesh type to load.
Returns
Loaded mesh.

◆ load_mesh_msh() [2/2]

MeshType load_mesh_msh ( const fs::path &  filename,
const LoadOptions options = {} 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Loads a mesh from a file in MSH format.

Parameters
[in]filenameInput filename.
[in]optionsLoad options.
See also
load_mesh_msh(std::istream&) for more info.
Template Parameters
MeshTypeMesh type to load.
Returns
Loaded mesh.

◆ load_mesh_obj() [1/2]

MeshType load_mesh_obj ( std::istream &  input_stream_obj,
const LoadOptions options = {} 
)

Loads a mesh from a file in MSH format.

Parameters
[in]input_stream_objInput stream.
[in]optionsLoad options.
Template Parameters
MeshTypeMesh type to load.
Returns
Loaded mesh.

◆ load_mesh_obj() [2/2]

MeshType load_mesh_obj ( const fs::path &  filename,
const LoadOptions options = {} 
)

Loads a mesh from a file in MSH format.

Parameters
[in]filenameInput filename.
[in]optionsLoad options.
Template Parameters
MeshTypeMesh type to load.
Returns
Loaded mesh.

◆ load_mesh_ply() [1/2]

MeshType load_mesh_ply ( std::istream &  input_stream,
const LoadOptions options = {} 
)

Loads a mesh from a stream in PLY format.

Parameters
[in,out]input_streamInput stream.
[in]optionsLoad options.
Template Parameters
MeshTypeMesh type to load.
Returns
Loaded mesh.

◆ load_mesh_ply() [2/2]

MeshType load_mesh_ply ( const fs::path &  filename,
const LoadOptions options = {} 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Loads a mesh from a file in PLY format.

Parameters
[in]filenameInput filename.
[in]optionsLoad options.
Template Parameters
MeshTypeMesh type to load.
Returns
Loaded mesh.

◆ load_scene() [1/2]

SceneType load_scene ( const fs::path &  filename,
const LoadOptions options = {} 
)

Load a scene.

Parameters
[in]filenameInput scene file.
[in]optionsExtra options related to loading.
Returns
A Scene object created from the input scene file.

◆ load_scene() [2/2]

SceneType load_scene ( std::istream &  input_stream,
const LoadOptions options = {} 
)

Load a scene from a stream.

Parameters
[in]input_streamThe input stream.
[in]optionsExtra options related to loading.
Returns
A Scene object loaded from the input stream.

◆ load_scene_fbx() [1/2]

SceneType load_scene_fbx ( const fs::path &  filename,
const LoadOptions options = {} 
)

Load an fbx scene.

Parameters
[in]filenameinput file name
[in]options
Returns
loaded scene

◆ load_scene_fbx() [2/2]

SceneType load_scene_fbx ( std::istream &  input_stream,
const LoadOptions options = {} 
)

Load an fbx scene.

Parameters
[in]input_streamInput stream containing the scene data
[in]options
Returns
loaded scene

◆ load_scene_gltf() [1/2]

SceneType load_scene_gltf ( const fs::path &  filename,
const LoadOptions options = {} 
)

Load a scene using gltf.

Parameters
[in]filenameinput file name
[in]options
Returns
loaded scene

◆ load_scene_gltf() [2/2]

SceneType load_scene_gltf ( std::istream &  input_stream,
const LoadOptions options = {} 
)

Load a scene using gltf.

Parameters
[in]input_streamInput stream containing the scene data
[in]options
Returns
loaded scene

◆ load_scene_obj() [1/2]

SceneType load_scene_obj ( const fs::path &  filename,
const LoadOptions options = {} 
)

Load an obj into a scene.

Parameters
[in]filenameinput file name
[in]options
Returns
loaded scene

◆ load_scene_obj() [2/2]

SceneType load_scene_obj ( std::istream &  input_stream_obj,
std::istream &  input_stream_mtl,
const LoadOptions options = {} 
)

Loadn obj into a scene.

Parameters
[in]input_stream_objInput stream containing the obj file data
[in]input_stream_mtlInput stream containing the mtl file data
[in]options
Returns
loaded scene

◆ load_simple_scene()

SceneType load_simple_scene ( const fs::path &  filename,
const LoadOptions options = {} 
)

Load a simple scene.

Parameters
[in]filenameInput scene file.
[in]optionsExtra options related to loading.
Returns
A SimpleScene object created from the input scene file.

◆ load_simple_scene_fbx() [1/2]

SceneType load_simple_scene_fbx ( std::istream &  input_stream,
const LoadOptions options = {} 
)

Load a simple scene from fbx.

Parameters
[in]filenameinput file
[in]options
Returns
scene

◆ load_simple_scene_fbx() [2/2]

SceneType load_simple_scene_fbx ( const fs::path &  filename,
const LoadOptions options = {} 
)

Load a simple scene from fbx.

Parameters
[in]filenameinput file
[in]options
Returns
scene

◆ load_simple_scene_gltf() [1/2]

SceneType load_simple_scene_gltf ( std::istream &  input_stream,
const LoadOptions options = {} 
)

Load a simple scene with gltf.

Parameters
[in]input_streaminput stream data
[in]options
Returns
scene

◆ load_simple_scene_gltf() [2/2]

SceneType load_simple_scene_gltf ( const fs::path &  filename,
const LoadOptions options = {} 
)

Load a simple scene with gltf.

Parameters
[in]filenameinput file
[in]options
Returns
scene

◆ save_mesh() [1/2]

void save_mesh ( std::ostream &  output_stream,
const SurfaceMesh< Scalar, Index > &  mesh,
FileFormat  format,
const SaveOptions options = {} 
)

Save a mesh to a stream.

Parameters
[in]output_streamStream to output
[in]meshMesh to save
[in]formatMesh format to use.
[in]optionsExtra options related to saving.

◆ save_mesh() [2/2]

void save_mesh ( const fs::path &  filename,
const SurfaceMesh< Scalar, Index > &  mesh,
const SaveOptions options = {} 
)

Save a mesh to a file.

Parameters
[in]filenamepath to output
[in]meshmesh to save
[in]optionsExtra options related to saving.

◆ save_mesh_gltf() [1/2]

void save_mesh_gltf ( std::ostream &  output_stream,
const SurfaceMesh< Scalar, Index > &  mesh,
const SaveOptions options = {} 
)

Saves a mesh to an output stream in glTF or GLB format.

Parameters
[in]output_streamOutput data stream.
[in]meshMesh to write.
[in]optionsSave options.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

◆ save_mesh_gltf() [2/2]

void save_mesh_gltf ( const fs::path &  filename,
const SurfaceMesh< Scalar, Index > &  mesh,
const SaveOptions options = {} 
)

Saves a mesh to a file in glTF or GLB format.

Parameters
[in]filenameOutput filename.
[in]meshMesh to write.
[in]optionsSave options.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

◆ save_mesh_msh() [1/2]

void save_mesh_msh ( std::ostream &  output_stream,
const SurfaceMesh< Scalar, Index > &  mesh,
const SaveOptions options = {} 
)

Saves a mesh to a stream in MSH format.

If the mesh cannot be saved, an exception is raised (e.g., invalid output stream, incorrect mesh dimension, or facet size < 3).

Parameters
[in,out]output_streamOutput stream.
[in]meshInput mesh.
[in]optionsOption settings.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

◆ save_mesh_msh() [2/2]

void save_mesh_msh ( const fs::path &  filename,
const SurfaceMesh< Scalar, Index > &  mesh,
const SaveOptions options = {} 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Saves a mesh to a stream in MSH format.

If the mesh cannot be saved, an exception is raised (e.g., incorrect mesh dimension, or facet size < 3).

Parameters
[in]filenameOutput filename.
[in]meshMesh to write.
[in]optionsSave options.
See also
save_mesh_msh(std::ostream&, const SurfaceMesh<S, I>&, const MshOptions&) for more info.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

◆ save_mesh_obj() [1/2]

void save_mesh_obj ( std::ostream &  output_stream,
const SurfaceMesh< Scalar, Index > &  mesh,
const SaveOptions options = {} 
)

Saves a mesh to a stream in OBJ format.

If the mesh cannot be saved, an exception is raised (e.g., invalid output stream, incorrect mesh dimension, or facet size < 3).

Parameters
[in,out]output_streamOutput stream.
[in]meshMesh to write.
[in]optionsSave options.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

◆ save_mesh_obj() [2/2]

void save_mesh_obj ( const fs::path &  filename,
const SurfaceMesh< Scalar, Index > &  mesh,
const SaveOptions options = {} 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Saves a mesh to a file in OBJ format.

If the mesh cannot be saved, an exception is raised (e.g., incorrect mesh dimension, or facet size < 3).

Parameters
[in]filenameOutput filename.
[in]meshMesh to write.
[in]optionsSave options.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

◆ save_mesh_ply() [1/2]

void save_mesh_ply ( std::ostream &  output_stream,
const SurfaceMesh< Scalar, Index > &  mesh,
const SaveOptions options = {} 
)

Saves a mesh to a stream in PLY format.

Parameters
[in,out]output_streamOutput stream.
[in]meshMesh to write.
[in]optionsSave options.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

◆ save_mesh_ply() [2/2]

void save_mesh_ply ( const fs::path &  filename,
const SurfaceMesh< Scalar, Index > &  mesh,
const SaveOptions options = {} 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Saves a mesh to a file in PLY format.

Parameters
[in]filenameOutput filename.
[in]meshMesh to write.
[in]optionsSave options.
Template Parameters
ScalarMesh scalar type.
IndexMesh index type.

◆ save_scene() [1/2]

void save_scene ( const fs::path &  filename,
const scene::Scene< Scalar, Index > &  scene,
const SaveOptions options = {} 
)

Save a scene to a file.

Parameters
[in]filenamepath to output
[in]scenescene to save
[in]optionsSaveOptions, check the struct for more details.

◆ save_scene() [2/2]

void save_scene ( std::ostream &  output_stream,
const scene::Scene< Scalar, Index > &  scene,
FileFormat  format,
const SaveOptions options = {} 
)

Save a scene to a stream.

Parameters
[in]output_streamStream to output
[in]sceneScene to save
[in]formatFileFormat to use.
[in]optionsSaveOptions, check the struct for more details.

◆ save_scene_gltf() [1/2]

void save_scene_gltf ( std::ostream &  output_stream,
const scene::Scene< Scalar, Index > &  scene,
const SaveOptions options = {} 
)

Save a scene to a gltf or glb file.

Parameters
output_streamStream to output data
sceneScene to save
optionsSaveOptions, check the struct for more details.

◆ save_scene_gltf() [2/2]

void save_scene_gltf ( const fs::path &  filename,
const scene::Scene< Scalar, Index > &  scene,
const SaveOptions options = {} 
)

Save a scene to a gltf or glb file.

Parameters
filenamepath to output file
sceneScene to save
optionsSaveOptions, check the struct for more details.

◆ save_simple_scene()

void save_simple_scene ( const fs::path &  filename,
const scene::SimpleScene< Scalar, Index, Dimension > &  scene,
const SaveOptions options = {} 
)

Save a mesh to a file.

Parameters
[in]filenamepath to output
[in]scenemesh to save
[in]optionsSaveOptions, check the struct for more details.

◆ save_simple_scene_gltf() [1/2]

void save_simple_scene_gltf ( std::ostream &  output_stream,
const scene::SimpleScene< Scalar, Index, Dimension > &  scene,
const SaveOptions options = {} 
)

Save a simple scene to a gltf or glb file.

Parameters
output_streamStream to output data
sceneScene to save
optionsSaveOptions, check the struct for more details.

◆ save_simple_scene_gltf() [2/2]

void save_simple_scene_gltf ( const fs::path &  filename,
const scene::SimpleScene< Scalar, Index, Dimension > &  scene,
const SaveOptions options = {} 
)

Save a simple scene to a gltf or glb file.

Parameters
filenamepath to output file
sceneScene to save
optionsSaveOptions, check the struct for more details.