| 318 | } |
| 319 | |
| 320 | int vtkGPUVolumeRayCastMapper::ValidateInput(vtkVolumeProperty* property, int port) |
| 321 | { |
| 322 | vtkDataSet* input = this->GetInput(port); |
| 323 | |
| 324 | vtkTypeBool goodSoFar = 1; |
| 325 | if (input == nullptr) |
| 326 | { |
| 327 | vtkErrorMacro("Input is nullptr but is required"); |
| 328 | goodSoFar = 0; |
| 329 | } |
| 330 | |
| 331 | if (goodSoFar) |
| 332 | { |
| 333 | this->GetInputAlgorithm(port, 0)->Update(); |
| 334 | } |
| 335 | |
| 336 | if (goodSoFar) |
| 337 | { |
| 338 | this->CloneInput(input, port); |
| 339 | } |
| 340 | |
| 341 | // Update the date then make sure we have scalars. Note |
| 342 | // that we must have point or cell scalars because field |
| 343 | // scalars are not supported. |
| 344 | vtkDataArray* scalars = nullptr; |
| 345 | if (goodSoFar) |
| 346 | { |
| 347 | // Now make sure we can find scalars |
| 348 | scalars = vtkGPUVolumeRayCastMapper::GetScalars(this->TransformedInputs[port], this->ScalarMode, |
| 349 | this->ArrayAccessMode, this->ArrayId, this->ArrayName, this->CellFlag); |
| 350 | |
| 351 | // We couldn't find scalars |
| 352 | if (!scalars) |
| 353 | { |
| 354 | vtkErrorMacro("No scalars named \"" << this->ArrayName << "\" or with id " << this->ArrayId |
| 355 | << " found on input."); |
| 356 | goodSoFar = 0; |
| 357 | } |
| 358 | // Even if we found scalars, if they are field data scalars that isn't good |
| 359 | else if (this->CellFlag == 2) |
| 360 | { |
| 361 | vtkErrorMacro("Only point or cell scalar support - found field scalars instead."); |
| 362 | goodSoFar = 0; |
| 363 | } |
| 364 | } |
| 365 | |
| 366 | // Make sure the scalar type is actually supported. This mappers supports |
| 367 | // almost all standard scalar types. |
| 368 | if (goodSoFar) |
| 369 | { |
| 370 | switch (scalars->GetDataType()) |
| 371 | { |
| 372 | case VTK_CHAR: |
| 373 | vtkErrorMacro(<< "scalar of type VTK_CHAR is not supported " |
| 374 | << "because this type is platform dependent. " |
| 375 | << "Use VTK_SIGNED_CHAR or VTK_UNSIGNED_CHAR instead."); |
| 376 | goodSoFar = 0; |
| 377 | break; |
no test coverage detected