Import/Export

This tutorial covers import and export of RPR data. All items in an RPR scene can be dumped after loading with the call rprsExport(). This saves the data to an rpr file (use the RPR file extension). Once exported, that data can be re-imported with rprsImport() or rendered from the command line with RPRSRender64.exe.

This is a good method for setting up batched renders or transferring data to a remote rendering service.

The tutorial also uses the RPR GLTF library: we can import/export RPR scenes to GLTF exactly the same way we do with RPR format.

status = rprsExport(rprsFileName,context, scene,
        0,0,0,
        0,0,0, 
        0);

Mesh Export

// Mesh Export to RPRS (native RPR file format)
	CHECK(rprsxExport("cube_floor.rprs", context, nullptr, scene, 0, 0, 0, 0, 0, 0, 0, nullptr));

// Mesh Export to GLTF
	CHECK(rprExportToGLTF("cube_floor.gltf", context, nullptr, &scene, 1, 0, nullptr));

See full code

Mesh Import

// RPRS file Import (native RPR file format)
	// Create a scene for the RPRS import
	rpr_scene scene_rprs = nullptr;
	CHECK(rprContextCreateScene(context, &scene_rprs));
	CHECK(rprContextSetScene(context, scene_rprs));
	// Make sure to execute the demo "60_mesh_export" in order to create the cube_floor.rprs file first
	CHECK(rprsImport("cube_floor.rprs", context, matsys, &scene_rprs, true, nullptr));

// GLTF Import
	// Create a scene for the GLTF import
	rpr_scene scene_gltf = nullptr;
	CHECK(rprContextCreateScene(context, &scene_gltf));
	CHECK(rprContextSetScene(context, scene_gltf));
	// Make sure to execute the demo "60_mesh_export" in order to create the cube_floor.gltf file first
	CHECK(rprImportFromGLTF("cube_floor.gltf", context, matsys, &scene_gltf, nullptr, 0, nullptr));

See full code