MCPcopy Create free account
hub / github.com/Kitware/VTK / ValidateRender

Method ValidateRender

Rendering/Volume/vtkGPUVolumeRayCastMapper.cxx:207–253  ·  view source on GitHub ↗

------------------------------------------------------------------------------ This method us used by the render method to validate everything before attempting to render. This method returns 0 if something is not right - such as missing input, a null renderer or a null volume, no scalars, etc. In some cases it will produce a vtkErrorMacro message, and in others (for example, in the case of croppi

Source from the content-addressed store, hash-verified

205// return with a value of 1.
206//------------------------------------------------------------------------------
207int vtkGPUVolumeRayCastMapper::ValidateRender(vtkRenderer* ren, vtkVolume* vol)
208{
209 // Check that we have everything we need to render.
210 int goodSoFar = 1;
211
212 // Check for a renderer - we MUST have one
213 if (!ren)
214 {
215 goodSoFar = 0;
216 vtkErrorMacro("Renderer cannot be null.");
217 }
218
219 // Check for the volume - we MUST have one
220 if (goodSoFar && !vol)
221 {
222 goodSoFar = 0;
223 vtkErrorMacro("Volume cannot be null.");
224 }
225
226 // Check the cropping planes. If they are invalid, just silently
227 // fail. This will happen when an interactive widget is dragged
228 // such that it defines 0 or negative volume - this can happen
229 // and should just not render the volume.
230 // Check the cropping planes
231 if (goodSoFar && this->Cropping &&
232 (this->CroppingRegionPlanes[0] >= this->CroppingRegionPlanes[1] ||
233 this->CroppingRegionPlanes[2] >= this->CroppingRegionPlanes[3] ||
234 this->CroppingRegionPlanes[4] >= this->CroppingRegionPlanes[5]))
235 {
236 // No error message here - we want to be silent
237 goodSoFar = 0;
238 }
239
240 if (!goodSoFar)
241 {
242 return 0;
243 }
244
245 auto multiVol = vtkMultiVolume::SafeDownCast(vol);
246 bool success = true;
247 for (const auto& port : this->Ports)
248 {
249 auto currentVol = multiVol ? multiVol->GetVolume(port) : vol;
250 success &= this->ValidateInput(currentVol->GetProperty(), port) == 1;
251 }
252 return (success ? 1 : 0);
253}
254
255vtkDataSet* vtkGPUVolumeRayCastMapper::FindData(int port, DataMap& container)
256{

Callers 3

RenderMethod · 0.95
CanonicalViewRenderMethod · 0.95
PreLoadDataMethod · 0.80

Calls 3

ValidateInputMethod · 0.95
GetVolumeMethod · 0.45
GetPropertyMethod · 0.45

Tested by

no test coverage detected