24 vtkSmartPointer<vtkAppendPolyData> appendData =
25 vtkSmartPointer<vtkAppendPolyData>::New();
27 for (
int i = 0; i < 5; i++)
29 vtkSmartPointer<vtkSphereSource> sphereSource =
30 vtkSmartPointer<vtkSphereSource>::New();
31 sphereSource->SetThetaResolution(theta);
32 sphereSource->SetPhiResolution(phi);
33 sphereSource->SetRadius(0.5);
38 sphereSource->SetRadius(1);
39 sphereSource->SetCenter(0, 0, 0);
break;
41 sphereSource->SetCenter(1, 0, 0);
break;
43 sphereSource->SetCenter(-1, 0, 0);
break;
45 sphereSource->SetCenter(0, 1, 0);
break;
47 sphereSource->SetCenter(0, -1, 0);
break;
49 sphereSource->Update();
50 appendData->AddInputConnection(sphereSource->GetOutputPort());
68 vtkSmartPointer<vtkRenderWindow> renderWindow,
69 vtkSmartPointer<vtkRenderer> renderer,
int maxNoOfPeels,
70 double occlusionRatio)
72 if (!renderWindow || !renderer)
79 renderWindow->SetAlphaBitPlanes(
true);
83 renderWindow->SetMultiSamples(0);
86 renderer->SetUseDepthPeeling(
true);
90 renderer->SetMaximumNumberOfPeels(maxNoOfPeels);
92 renderer->SetOcclusionRatio(occlusionRatio);
95 renderWindow->Render();
97 bool success = renderer->GetLastRenderingUsedDepthPeeling();
103 vtkSmartPointer<vtkRenderWindow> renderWindow,
104 vtkSmartPointer<vtkRenderer> renderer)
106 if (!renderWindow || !renderer)
114 renderWindow->SetAlphaBitPlanes(
false);
115 renderWindow->SetMultiSamples(8);
116 renderer->SetUseDepthPeeling(
false);
117 renderer->SetMaximumNumberOfPeels(4);
118 renderer->SetOcclusionRatio(0.0);
135 vtkSmartPointer<vtkRenderer> renderer,
bool doItOffScreen)
137 if (!renderWindow || !renderer)
146 bool origOffScreenRendering = renderWindow->GetOffScreenRendering() == 1;
147 bool origAlphaBitPlanes = renderWindow->GetAlphaBitPlanes() == 1;
148 int origMultiSamples = renderWindow->GetMultiSamples();
149 bool origUseDepthPeeling = renderer->GetUseDepthPeeling() == 1;
150 int origMaxPeels = renderer->GetMaximumNumberOfPeels();
151 double origOcclusionRatio = renderer->GetOcclusionRatio();
154 renderWindow->SetOffScreenRendering(doItOffScreen);
161 renderWindow->Render();
164 success = success && renderer->GetLastRenderingUsedDepthPeeling();
167 renderWindow->SetOffScreenRendering(origOffScreenRendering);
168 renderWindow->SetAlphaBitPlanes(origAlphaBitPlanes);
169 renderWindow->SetMultiSamples(origMultiSamples);
170 renderer->SetUseDepthPeeling(origUseDepthPeeling);
171 renderer->SetMaximumNumberOfPeels(origMaxPeels);
172 renderer->SetOcclusionRatio(origOcclusionRatio);