コード例 #1
0
        // Token: 0x06001B91 RID: 7057 RVA: 0x00090340 File Offset: 0x0008E540
        private void UpdateRenderScale()
        {
            if (this.allRenderScales.Count == 0)
            {
                return;
            }
            if (!this.scaleRenderViewport)
            {
                this.renderViewportScaleSetting.currentValue = this.defaultRenderViewportScaleLevel;
                this.renderScaleSetting.currentValue         = this.defaultRenderViewportScaleLevel;
                VRTK_AdaptiveQuality.SetRenderScale(1f, 1f);
                return;
            }
            float num = VRTK_SDK_Bridge.ShouldAppRenderWithLowResources() ? (this.singleFrameDurationInMilliseconds * 0.75f) : this.singleFrameDurationInMilliseconds;
            float thresholdInMilliseconds = 0.7f * num;
            float extrapolationThresholdInMilliseconds = 0.85f * num;
            float thresholdInMilliseconds2             = 0.9f * num;
            int   num2 = this.renderViewportScaleSetting.currentValue;

            if (this.timing.WasFrameTimingBad(1, thresholdInMilliseconds2, this.renderViewportScaleSetting.lastChangeFrameCount, this.renderViewportScaleSetting.decreaseFrameCost) || this.timing.WasFrameTimingBad(3, thresholdInMilliseconds2, this.renderViewportScaleSetting.lastChangeFrameCount, this.renderViewportScaleSetting.decreaseFrameCost) || this.timing.WillFrameTimingBeBad(extrapolationThresholdInMilliseconds, thresholdInMilliseconds2, this.renderViewportScaleSetting.lastChangeFrameCount, this.renderViewportScaleSetting.decreaseFrameCost))
            {
                num2 = this.ClampRenderScaleLevel((this.renderViewportScaleSetting.currentValue == 2) ? 1 : (this.renderViewportScaleSetting.currentValue - 2));
            }
            else if (this.timing.WasFrameTimingGood(12, thresholdInMilliseconds, this.renderViewportScaleSetting.lastChangeFrameCount - this.renderViewportScaleSetting.increaseFrameCost, this.renderViewportScaleSetting.increaseFrameCost))
            {
                num2 = this.ClampRenderScaleLevel(this.renderViewportScaleSetting.currentValue + 2);
            }
            else if (this.timing.WasFrameTimingGood(6, thresholdInMilliseconds, this.renderViewportScaleSetting.lastChangeFrameCount, this.renderViewportScaleSetting.increaseFrameCost))
            {
                num2 = this.ClampRenderScaleLevel(this.renderViewportScaleSetting.currentValue + 1);
            }
            if (num2 != this.renderViewportScaleSetting.currentValue)
            {
                if (this.renderViewportScaleSetting.currentValue >= this.renderScaleSetting.currentValue && num2 < this.renderScaleSetting.currentValue)
                {
                    this.lastRenderViewportScaleLevelBelowRenderScaleLevelFrameCount = Time.frameCount;
                }
                this.renderViewportScaleSetting.currentValue = num2;
            }
            if (this.overrideRenderViewportScale)
            {
                this.renderViewportScaleSetting.currentValue = this.overrideRenderViewportScaleLevel;
            }
            float num3 = 1f;

            if (!this.hmdDisplayIsOnDesktop)
            {
                if (this.renderViewportScaleSetting.currentValue == 0)
                {
                    if (this.interleavedReprojectionEnabled && this.timing.GetFrameTiming(0) < this.singleFrameDurationInMilliseconds * 0.85f)
                    {
                        this.interleavedReprojectionEnabled = false;
                    }
                    else if (this.timing.GetFrameTiming(0) > this.singleFrameDurationInMilliseconds * 0.925f)
                    {
                        this.interleavedReprojectionEnabled = true;
                    }
                }
                else
                {
                    this.interleavedReprojectionEnabled = false;
                }
                VRTK_SDK_Bridge.ForceInterleavedReprojectionOn(this.interleavedReprojectionEnabled);
            }
            else if (this.renderViewportScaleSetting.currentValue == 0)
            {
                num3 = 0.8f;
            }
            int currentValue = this.renderScaleSetting.currentValue;
            int b            = (this.renderViewportScaleSetting.currentValue - this.renderScaleSetting.currentValue) / 2;

            if (this.renderScaleSetting.currentValue < this.renderViewportScaleSetting.currentValue && Time.frameCount >= this.renderScaleSetting.lastChangeFrameCount + this.renderScaleSetting.increaseFrameCost)
            {
                currentValue = this.ClampRenderScaleLevel(this.renderScaleSetting.currentValue + Mathf.Max(1, b));
            }
            else if (this.renderScaleSetting.currentValue > this.renderViewportScaleSetting.currentValue && Time.frameCount >= this.renderScaleSetting.lastChangeFrameCount + this.renderScaleSetting.decreaseFrameCost && Time.frameCount >= this.lastRenderViewportScaleLevelBelowRenderScaleLevelFrameCount + this.renderViewportScaleSetting.increaseFrameCost)
            {
                currentValue = (this.timing.WasFrameTimingGood(6, thresholdInMilliseconds, 0, 0) ? this.ClampRenderScaleLevel(this.renderScaleSetting.currentValue + Mathf.Min(-1, b)) : this.renderViewportScaleSetting.currentValue);
            }
            this.renderScaleSetting.currentValue = currentValue;
            if (!this.scaleRenderTargetResolution)
            {
                this.renderScaleSetting.currentValue = this.allRenderScales.Count - 1;
            }
            float num4 = this.allRenderScales[this.renderScaleSetting.currentValue];
            float renderViewportScale = this.allRenderScales[Mathf.Min(this.renderViewportScaleSetting.currentValue, this.renderScaleSetting.currentValue)] / num4 * num3;

            VRTK_AdaptiveQuality.SetRenderScale(num4, renderViewportScale);
        }
コード例 #2
0
 // Token: 0x06001B87 RID: 7047 RVA: 0x0008FE63 File Offset: 0x0008E063
 private void OnDisable()
 {
     Camera.onPreCull = (Camera.CameraCallback)Delegate.Remove(Camera.onPreCull, new Camera.CameraCallback(this.OnCameraPreCull));
     VRTK_AdaptiveQuality.SetRenderScale(1f, 1f);
 }