You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
940 B
39 lines
940 B
2 years ago
|
package require -exact vtkrendering 5.0
|
||
|
|
||
|
namespace eval ::vtk {
|
||
|
|
||
|
proc grab_screenshot {renderer basename} {
|
||
|
|
||
|
$renderer Render
|
||
|
|
||
|
set rs \
|
||
|
[::vtk::new_widget_object "_${renderer}" vtkRendererSource rs]
|
||
|
$rs SetInput $renderer
|
||
|
$rs DepthValuesOff
|
||
|
$rs DepthValuesInScalarsOn
|
||
|
|
||
|
set pw \
|
||
|
[::vtk::new_widget_object "_${renderer}" vtkPNGWriter pw]
|
||
|
$pw SetInput [$rs GetOutput]
|
||
|
$pw SetFileName "$basename-rgbz.png"
|
||
|
$pw Write
|
||
|
|
||
|
set iec \
|
||
|
[::vtk::new_widget_object "_${renderer}" vtkImageExtractComponents iec]
|
||
|
$iec SetInput [$rs GetOutput]
|
||
|
$iec SetComponents 3
|
||
|
|
||
|
$pw SetInput [$iec GetOutput]
|
||
|
$pw SetFileName "$basename-z.png"
|
||
|
$pw Write
|
||
|
|
||
|
$iec SetComponents 0 1 2
|
||
|
$pw SetFileName "$basename-rgb.png"
|
||
|
$pw Write
|
||
|
|
||
|
$rs Delete
|
||
|
$pw Delete
|
||
|
$iec Delete
|
||
|
}
|
||
|
}
|