| 447 | } |
| 448 | |
| 449 | osg::FrameBufferAttachment createMultiviewCompatibleAttachment(osg::Texture* tex) |
| 450 | { |
| 451 | switch (tex->getTextureTarget()) |
| 452 | { |
| 453 | case GL_TEXTURE_2D: |
| 454 | { |
| 455 | auto* tex2d = static_cast<osg::Texture2D*>(tex); |
| 456 | return osg::FrameBufferAttachment(tex2d); |
| 457 | } |
| 458 | case GL_TEXTURE_2D_MULTISAMPLE: |
| 459 | { |
| 460 | auto* tex2dMsaa = static_cast<osg::Texture2DMultisample*>(tex); |
| 461 | return osg::FrameBufferAttachment(tex2dMsaa); |
| 462 | } |
| 463 | #ifdef OSG_HAS_MULTIVIEW |
| 464 | case GL_TEXTURE_2D_ARRAY: |
| 465 | { |
| 466 | auto* tex2dArray = static_cast<osg::Texture2DArray*>(tex); |
| 467 | return osg::FrameBufferAttachment(tex2dArray, osg::Camera::FACE_CONTROLLED_BY_MULTIVIEW_SHADER, 0); |
| 468 | } |
| 469 | case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: |
| 470 | { |
| 471 | auto* tex2dMsaaArray = static_cast<osg::Texture2DMultisampleArray*>(tex); |
| 472 | return osg::FrameBufferAttachment(tex2dMsaaArray, osg::Camera::FACE_CONTROLLED_BY_MULTIVIEW_SHADER, 0); |
| 473 | } |
| 474 | #endif |
| 475 | default: |
| 476 | throw std::logic_error("Invalid texture type received"); |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | unsigned int osgFaceControlledByMultiviewShader() |
| 481 | { |
no outgoing calls
no test coverage detected