MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ save_mesh() [1/5]

bool MayaFlux::IO::save_mesh ( const std::shared_ptr< Buffers::ComputeMeshBuffer > &  buffer,
const std::string &  filepath,
const ModelWriteOptions options = {} 
)

Save a ComputeMeshBuffer's current live geometry to disk.

Wraps download_compute_mesh() and write_via_registry() in one call. See download_compute_mesh's own doc for the one-shot readback this performs.

Definition at line 349 of file ModelExport.cpp.

353{
354 auto mesh_data = download_compute_mesh(buffer);
355 if (!mesh_data) {
356 return false;
357 }
358
359 if (buffer->has_diffuse_texture()) {
360 const auto image_path = pack_diffuse_texture(buffer->get_diffuse_texture(), filepath, "");
361 if (!image_path.empty()) {
362 ensure_submesh_region(*mesh_data, "mesh");
363 mesh_data->submeshes->regions.front().set_attribute("diffuse_path", image_path);
364 }
365 }
366
367 return write_via_registry(filepath, { *mesh_data }, options);
368}
std::shared_ptr< NetworkGeometryBuffer > buffer
std::optional< Kakshya::MeshData > download_compute_mesh(const std::shared_ptr< Buffers::ComputeMeshBuffer > &buffer)
Download a ComputeMeshBuffer's current live geometry to CPU.

References buffer, and download_compute_mesh().

+ Here is the call graph for this function: