PreserveColorBuffer
You can see the following effect after preserving color buffer for renderer object.
renderer->SetPreserveColorBuffer(true);
renderer->ResetCamera();
renderWindow->Render();
renderWindowInteractor->Start();
Download 3D Model With WASM From Web Pabge
vSPNew( writer, vtkXMLPolyDataWriter );
writer->SetInputData( newArchPd );
writer->SetFileName( "newArchPd.vtp" );
writer->Write();
char *jsStr = "const shot = Module.FS.readFile( \"newArchPd.vtp\" ); \
const link = document.createElement('a'); \
link.style.display = 'none'; \
document.body.appendChild(link); \
const blob = new Blob([shot]); \
link.href = URL.createObjectURL(blob); \
link.download = 'newArchPd.vtp'; \
link.click(); \
document.body.removeChild(link);";
emscripten_run_script( jsStr );
The browser will download the VTP file automatically when your web page run to the above logic.
[…] The flag PreserveColorBuffer can also be used to track movements of item. Related post: https://www.weiy.city/2022/12/vtk-preservecolorbuffer-save-model-to-local-disk-from-web-page/ […]