Writes the output of render_mesh() or render_scene()
to a PNG file using the built-in C++ PNG writer (stb_image_write).
No additional R packages are required.
Arguments
- image
An image list returned by
render_mesh()orrender_scene().- filename
Output PNG file path.
Examples
mesh <- generate_cuboid(c(0, 0, 0), c(1, 1, 1))
img <- render_mesh(mesh$vertices, mesh$triangles)
tmp_file <- tempfile(fileext = ".png")
write_png(img, tmp_file)