示例#1
0
    // Token: 0x06000976 RID: 2422 RVA: 0x0004A528 File Offset: 0x00048728
    private void OnPostRender()
    {
        bool qualityChanged = this.QualityLevel != this.m_qualityLevel;

        this.m_qualityLevel = this.QualityLevel;
        this.UpdateRenderTextures(qualityChanged);
        this.ResetObjectId();
        bool  flag       = this.CameraMotionMult > float.Epsilon;
        bool  clearColor = !flag || this.m_starting;
        float num        = (this.DepthThreshold > float.Epsilon) ? (1f / this.DepthThreshold) : float.MaxValue;

        this.m_motionScaleNorm      = ((this.m_deltaTime >= float.Epsilon) ? (this.MotionScale * (1f / this.m_deltaTime)) : 0f);
        this.m_fixedMotionScaleNorm = ((this.m_fixedDeltaTime >= float.Epsilon) ? (this.MotionScale * (1f / this.m_fixedDeltaTime)) : 0f);
        float scale      = (!this.m_starting) ? this.m_motionScaleNorm : 0f;
        float fixedScale = (!this.m_starting) ? this.m_fixedMotionScaleNorm : 0f;

        Shader.SetGlobalFloat("_AM_MIN_VELOCITY", this.MinVelocity);
        Shader.SetGlobalFloat("_AM_MAX_VELOCITY", this.MaxVelocity);
        Shader.SetGlobalFloat("_AM_RCP_TOTAL_VELOCITY", 1f / (this.MaxVelocity - this.MinVelocity));
        Shader.SetGlobalVector("_AM_DEPTH_THRESHOLD", new Vector2(this.DepthThreshold, num));
        this.m_motionRT.DiscardContents();
        this.m_baseCamera.PreRenderVectors(this.m_motionRT, clearColor, num);
        for (int i = 0; i < this.m_linkedCameraValues.Length; i++)
        {
            AmplifyMotionCamera amplifyMotionCamera = this.m_linkedCameraValues[i];
            if (amplifyMotionCamera != null && amplifyMotionCamera.Overlay && amplifyMotionCamera.isActiveAndEnabled)
            {
                amplifyMotionCamera.PreRenderVectors(this.m_motionRT, clearColor, num);
                amplifyMotionCamera.RenderVectors(scale, fixedScale, this.QualityLevel);
            }
        }
        if (flag)
        {
            float num2   = (this.m_deltaTime >= float.Epsilon) ? (this.MotionScale * this.CameraMotionMult * (1f / this.m_deltaTime)) : 0f;
            float scale2 = (!this.m_starting) ? num2 : 0f;
            this.m_motionRT.DiscardContents();
            this.m_baseCamera.RenderReprojectionVectors(this.m_motionRT, scale2);
        }
        this.m_baseCamera.RenderVectors(scale, fixedScale, this.QualityLevel);
        for (int j = 0; j < this.m_linkedCameraValues.Length; j++)
        {
            AmplifyMotionCamera amplifyMotionCamera2 = this.m_linkedCameraValues[j];
            if (amplifyMotionCamera2 != null && amplifyMotionCamera2.Overlay && amplifyMotionCamera2.isActiveAndEnabled)
            {
                amplifyMotionCamera2.RenderVectors(scale, fixedScale, this.QualityLevel);
            }
        }
        this.m_starting = false;
    }
示例#2
0
    void OnPostRender()
    {
        bool qualityChanged = (QualityLevel != m_qualityLevel);

        m_qualityLevel = QualityLevel;

        UpdateRenderTextures(qualityChanged);

        ResetObjectId();

        bool cameraMotion = (CameraMotionMult > float.Epsilon);
        bool clearColor   = !cameraMotion || m_starting;

        float rcpDepthThreshold = (DepthThreshold > float.Epsilon) ? 1.0f / DepthThreshold : float.MaxValue;

        m_motionScaleNorm      = (m_deltaTime >= float.Epsilon) ? MotionScale * (1.0f / m_deltaTime) : 0;
        m_fixedMotionScaleNorm = (m_fixedDeltaTime >= float.Epsilon) ? MotionScale * (1.0f / m_fixedDeltaTime) : 0;

        float objectScale      = !m_starting ? m_motionScaleNorm : 0;
        float objectFixedScale = !m_starting ? m_fixedMotionScaleNorm : 0;

        Shader.SetGlobalFloat("_AM_MIN_VELOCITY", MinVelocity);
        Shader.SetGlobalFloat("_AM_MAX_VELOCITY", MaxVelocity);
        Shader.SetGlobalFloat("_AM_RCP_TOTAL_VELOCITY", 1.0f / (MaxVelocity - MinVelocity));
        Shader.SetGlobalVector("_AM_DEPTH_THRESHOLD", new Vector2(DepthThreshold, rcpDepthThreshold));

        // pre-render base camera
        m_motionRT.DiscardContents();
        m_baseCamera.PreRenderVectors(m_motionRT, clearColor, rcpDepthThreshold);

        // pre-render overlay cameras
        for (int i = 0; i < m_linkedCameraValues.Length; i++)
        {
            AmplifyMotionCamera cam = m_linkedCameraValues[i];
            if (cam != null && cam.Overlay && cam.isActiveAndEnabled)
            {
                cam.PreRenderVectors(m_motionRT, clearColor, rcpDepthThreshold);
                cam.RenderVectors(objectScale, objectFixedScale, QualityLevel);
            }
        }

        if (cameraMotion)
        {
            float cameraMotionScaleNorm = (m_deltaTime >= float.Epsilon) ? MotionScale * CameraMotionMult * (1.0f / m_deltaTime) : 0;
            float cameraScale           = !m_starting ? cameraMotionScaleNorm : 0;

            m_motionRT.DiscardContents();
            m_baseCamera.RenderReprojectionVectors(m_motionRT, cameraScale);
        }

        // render base camera
        m_baseCamera.RenderVectors(objectScale, objectFixedScale, QualityLevel);

        // render overlay cameras
        for (int i = 0; i < m_linkedCameraValues.Length; i++)
        {
            AmplifyMotionCamera cam = m_linkedCameraValues[i];
            if (cam != null && cam.Overlay && cam.isActiveAndEnabled)
            {
                cam.RenderVectors(objectScale, objectFixedScale, QualityLevel);
            }
        }

        m_starting = false;
    }