public HvrViewportSwapChain(int maximumViewports) { m_maximumViewports = maximumViewports; m_viewports = new ViewportInterface[m_maximumViewports]; for (int i = 0; i < m_maximumViewports; ++i) { m_viewports[i] = new ViewportInterface(); } m_viewportIndex = 0; }
private ViewportInterface _GetViewportAndFlip() { if (m_viewports == null) { return(null); } ViewportInterface viewport = m_viewports[m_viewportIndex]; m_viewportIndex = (m_viewportIndex + 1) % m_maximumViewports; // flip the index viewport.SetSamples(QualitySettings.antiAliasing); return(viewport); }
public ViewportInterface NextViewport(Matrix4x4 view, Matrix4x4 proj, int viewportLeft, int viewportTop, int viewportWidth, int viewportHeight) { if (m_viewports == null) { return(null); } ViewportInterface viewport = _GetViewportAndFlip(); viewport.SetViewMatrix(view); #if UNITY_5_5_OR_NEWER if (SystemInfo.graphicsDeviceType == GraphicsDeviceType.Direct3D11) { viewport.SetReverseDepthEnabled(true); } #endif viewport.SetProjMatrix(proj); viewport.SetDimensions(viewportLeft, viewportTop, viewportWidth, viewportHeight); return(viewport); }