------------------------------------------------------------------------------
| 1378 | |
| 1379 | //------------------------------------------------------------------------------ |
| 1380 | void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::CheckPropertyKeys(vtkVolume* vol) |
| 1381 | { |
| 1382 | // Check the property keys to see if we should modify the blend/etc state: |
| 1383 | // Otherwise this breaks volume/translucent geo depth peeling. |
| 1384 | vtkInformation* volumeKeys = vol->GetPropertyKeys(); |
| 1385 | this->PreserveGLState = false; |
| 1386 | this->DepthMaskOverride = false; |
| 1387 | if (volumeKeys && volumeKeys->Has(vtkOpenGLActor::GLDepthMaskOverride())) |
| 1388 | { |
| 1389 | // Give a chance to volumes to write to the depth buffer. |
| 1390 | // A value of 0 keeps the depth mask disabled as set by vtkVolumeStateRAII. |
| 1391 | // A value of 1 enables the depth mask and allows writing to the depth buffer. |
| 1392 | // Any other value will prevent vtkVolumeStateRAII from changing the state. |
| 1393 | int override = volumeKeys->Get(vtkOpenGLActor::GLDepthMaskOverride()); |
| 1394 | switch (override) |
| 1395 | { |
| 1396 | case 0: // glDepthMask(GL_TRUE) |
| 1397 | this->DepthMaskOverride = false; |
| 1398 | break; |
| 1399 | case 1: // glDepthMask(GL_FALSE) |
| 1400 | this->DepthMaskOverride = true; |
| 1401 | break; |
| 1402 | default: // no-op |
| 1403 | this->PreserveGLState = true; |
| 1404 | break; |
| 1405 | } |
| 1406 | } |
| 1407 | |
| 1408 | // Some render passes (e.g. DualDepthPeeling) adjust the viewport for |
| 1409 | // intermediate passes so it is necessary to preserve it. This is a |
| 1410 | // temporary fix for vtkDualDepthPeelingPass to work when various viewports |
| 1411 | // are defined. The correct way of fixing this would be to avoid setting the |
| 1412 | // viewport within the mapper. It is enough for now to check for the |
| 1413 | // RenderPasses() vtkInfo given that vtkDualDepthPeelingPass is the only pass |
| 1414 | // currently supported by this mapper, the viewport will have to be adjusted |
| 1415 | // externally before adding support for other passes. |
| 1416 | vtkInformation* info = vol->GetPropertyKeys(); |
| 1417 | this->PreserveViewport = info && info->Has(vtkOpenGLRenderPass::RenderPasses()); |
| 1418 | } |
| 1419 | |
| 1420 | //------------------------------------------------------------------------------ |
| 1421 | void vtkOpenGLGPUVolumeRayCastMapper::vtkInternal::CheckPickingState(vtkRenderer* ren) |