import Qt3D.Core 2.14
import Qt3D.Render 2.14

RenderSettings {
    id: doubleViewportFrameGraph

    property alias leftCamera: cameraSelectorLeftViewport.camera;
    property alias rightCamera: cameraSelectorRightViewport.camera;
    property alias window: surfaceSelector.surface
    property alias leftViewportNormalizedRect: leftViewport.normalizedRect;
    property alias rightViewportNormalizedRect: rightViewport.normalizedRect;

    activeFrameGraph: RenderSurfaceSelector {
        id: surfaceSelector
        
        Viewport {
            id: mainViewport
            normalizedRect: Qt.rect(0, 0, 1, 1)

            ClearBuffers {
                buffers: ClearBuffers.ColorDepthBuffer
                clearColor: "#010101"
                LayerFilter {
                    filterMode: LayerFilter.AcceptAnyMatchingLayers
                    layers: []
                }
            }

            Viewport {
                id: leftViewport
                normalizedRect: Qt.rect(0, 0, 0.5, 1)
                CameraSelector { 
                    id: cameraSelectorLeftViewport 
                    LayerFilter {
                        filterMode: LayerFilter.DiscardAnyMatchingLayers
                        layers: layer1
                    }
                }
            }

            Viewport {
                id: rightViewport
                normalizedRect: Qt.rect(0.5, 0, 0.5, 1)
                CameraSelector { 
                    id: cameraSelectorRightViewport 
                    LayerFilter {
                        filterMode: LayerFilter.DiscardAnyMatchingLayers
                        layers: layer2
                    }
                }
            }
        }

    }
}