CustusX
20.03-rc1
An IGT application
|
#include <vtkSphereSource.h>
#include <vtkSmartPointer.h>
#include <vtkAppendPolyData.h>
#include <vtkCamera.h>
#include <vtkPolyDataMapper.h>
#include <vtkActor.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkProperty.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkTimerLog.h>
#include <vtkTransform.h>
#include <vtkDepthSortPolyData.h>
Go to the source code of this file.
Functions | |
vtkSmartPointer< vtkAppendPolyData > | GenerateOverlappingBunchOfSpheres (int theta, int phi) |
bool | SetupEnvironmentForDepthPeeling (vtkSmartPointer< vtkRenderWindow > renderWindow, vtkSmartPointer< vtkRenderer > renderer, int maxNoOfPeels, double occlusionRatio) |
bool | IsDepthPeelingSupported (vtkSmartPointer< vtkRenderWindow > renderWindow, vtkSmartPointer< vtkRenderer > renderer, bool doItOffScreen) |
int | main (int argc, char *argv[]) |
vtkSmartPointer<vtkAppendPolyData> GenerateOverlappingBunchOfSpheres | ( | int | theta, |
int | phi | ||
) |
Generate a bunch of overlapping spheres within one poly data set: one big sphere evenly surrounded by four small spheres that intersect the centered sphere.
theta | sphere sampling resolution (THETA) |
phi | sphere sampling resolution (PHI) |
Definition at line 32 of file CorrectlyRenderTranslucentGeometry.cxx.
bool IsDepthPeelingSupported | ( | vtkSmartPointer< vtkRenderWindow > | renderWindow, |
vtkSmartPointer< vtkRenderer > | renderer, | ||
bool | doItOffScreen | ||
) |
Find out whether this box supports depth peeling. Depth peeling requires a variety of openGL extensions and appropriate drivers.
renderWindow | a valid openGL-supporting render window |
renderer | a valid renderer instance |
doItOffScreen | do the test off screen which means that nothing is rendered to screen (this requires the box to support off screen rendering) |
Definition at line 116 of file CorrectlyRenderTranslucentGeometry.cxx.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Example application demonstrating correct rendering of translucent geometry. It will automatically detect whether depth peeling is supported by the hardware and software, and will apply depth peeling if possible. Otherwise a fallback strategy is used: depth sorting on the CPU.
Usage: [ProgramName] Theta Phi MaximumPeels OcclusionRatio ForceDepthSortingFlag DoNotUseAnyDepthRelatedAlgorithmFlag
Theta ... spheres' THETA resolution
Phi ... spheres' PHI resolution
MaximumPeels ... maximum number of depth peels (multi-pass rendering) for depth peeling mode
OcclusionRatio ... occlusion ratio for depth peeling mode (0.0 for a perfect rendered image, >0.0 for a non-perfect image which is expected to be slower)
ForceDepthSortingFlag ... force depth sorting even if depth peeling is supported
DoNotUseAnyDepthRelatedAlgorithmFlag ... neither use depth peeling nor depth sorting - just render as usual
Definition at line 180 of file CorrectlyRenderTranslucentGeometry.cxx.
bool SetupEnvironmentForDepthPeeling | ( | vtkSmartPointer< vtkRenderWindow > | renderWindow, |
vtkSmartPointer< vtkRenderer > | renderer, | ||
int | maxNoOfPeels, | ||
double | occlusionRatio | ||
) |
Setup the rendering environment for depth peeling (general depth peeling support is requested).
renderWindow | a valid openGL-supporting render window |
renderer | a valid renderer instance |
maxNoOfPeels | maximum number of depth peels (multi-pass rendering) |
occlusionRatio | the occlusion ration (0.0 means a perfect image, >0.0 means a non-perfect image which in general results in faster rendering) |
Definition at line 78 of file CorrectlyRenderTranslucentGeometry.cxx.