void OnGUI() { if (Camera.current != null) { NVIDIA.VRWorks.FeatureData data = m_VRWorks.GetActiveFeatureData(); float ratio = 100.0f; string mode = "Off"; if (m_VRWorks.GetActiveFeature() != NVIDIA.VRWorks.Feature.None) { mode = "On"; ratio = 100.0f * ((data.boundingRect[2] - data.boundingRect[0]) * (data.boundingRect[3] - data.boundingRect[1]) / (Camera.current.pixelWidth * Camera.current.pixelHeight)); } mode += " (" + ratio.ToString("F2") + "% pixels rendered)"; GUI.Label(new Rect(10, 10, 300, 30), "MRS: " + mode, style); } }
void CustomGraphicsBlit(RenderTexture source, RenderTexture dest, Material fxMaterial, int passNr) { RenderTexture.active = dest; fxMaterial.SetTexture("_MainTex", source); if (m_VRWorks.GetActiveFeature() != NVIDIA.VRWorks.Feature.None) { NVIDIA.VRWorks.FeatureData data = m_VRWorks.GetActiveFeatureData(); GL.Viewport(new Rect(0, 0, data.boundingRect[2] - data.boundingRect[0], data.boundingRect[3] - data.boundingRect[1])); } GL.PushMatrix(); GL.LoadOrtho(); fxMaterial.SetPass(passNr); GL.Begin(GL.QUADS); GL.MultiTexCoord2(0, 0.0f, 0.0f); GL.Vertex3(0.0f, 0.0f, 3.0f); // BL GL.MultiTexCoord2(0, 1.0f, 0.0f); GL.Vertex3(1.0f, 0.0f, 2.0f); // BR GL.MultiTexCoord2(0, 1.0f, 1.0f); GL.Vertex3(1.0f, 1.0f, 1.0f); // TR GL.MultiTexCoord2(0, 0.0f, 1.0f); GL.Vertex3(0.0f, 1.0f, 0.0f); // TL GL.End(); GL.PopMatrix(); if (m_VRWorks.GetActiveFeature() != NVIDIA.VRWorks.Feature.None) { GL.Viewport(new Rect(0, 0, dest.width, dest.height)); } }