Ejemplo n.º 1
0
    public void Render(ScriptableRenderContext renderContext, Camera camera, VXGIRenderer renderer)
    {
        UpdateResolution();

        float realtime         = Time.realtimeSinceStartup;
        bool  tracingThrottled = throttleTracing;

#if UNITY_EDITOR
        tracingThrottled &= UnityEditor.EditorApplication.isPlaying;
#endif

        if (tracingThrottled)
        {
            if (_previousTrace + 1f / tracingRate < realtime)
            {
                _previousTrace = realtime;

                PrePass(renderContext, renderer);
            }
        }
        else
        {
            PrePass(renderContext, renderer);
        }

        renderContext.SetupCameraProperties(camera, camera.stereoEnabled);
        if (camera.stereoEnabled)
        {
            renderContext.StartMultiEye(camera);
        }

        _command.ClearRenderTarget(
            (camera.clearFlags & CameraClearFlags.Depth) != 0,
            camera.clearFlags == CameraClearFlags.Color,
            camera.backgroundColor
            );
        renderContext.ExecuteCommandBuffer(_command);
        _command.Clear();

        if (camera.clearFlags == CameraClearFlags.Skybox)
        {
            renderContext.DrawSkybox(camera);
        }

        if (visualizeMipmap)
        {
            renderer.RenderMipmap(renderContext, camera, this);
        }
        else
        {
            SetupShader(renderContext);
            renderer.RenderDeferred(renderContext, camera, this);
        }

        if (camera.stereoEnabled)
        {
            renderContext.StopMultiEye(camera);
            renderContext.StereoEndRender(camera);
        }
    }
Ejemplo n.º 2
0
    public void Render(ScriptableRenderContext renderContext, Camera camera, VXGIRenderer renderer)
    {
        VXGIRenderPipeline.TriggerCameraCallback(camera, "OnPreRender", Camera.onPreRender);

        _command.BeginSample(_command.name);
        renderContext.ExecuteCommandBuffer(_command);
        _command.Clear();

        UpdateResolution();

        float realtime         = Time.realtimeSinceStartup;
        bool  tracingThrottled = throttleTracing;

        if (tracingThrottled)
        {
            if (_previousTrace + 1f / tracingRate < realtime)
            {
                _previousTrace = realtime;

                PrePass(renderContext, renderer);
            }
        }
        else
        {
            PrePass(renderContext, renderer);
        }

        renderContext.SetupCameraProperties(camera);

        _command.ClearRenderTarget(
            (camera.clearFlags & CameraClearFlags.Depth) != 0,
            camera.clearFlags == CameraClearFlags.Color,
            camera.backgroundColor
            );
        renderContext.ExecuteCommandBuffer(_command);
        _command.Clear();

        SetupShader(renderContext);

        VXGIRenderPipeline.TriggerCameraCallback(camera, "OnPreCull", Camera.onPreCull);

        renderer.RenderDeferred(renderContext, camera, this);

        _command.EndSample(_command.name);
        renderContext.ExecuteCommandBuffer(_command);
        _command.Clear();

        VXGIRenderPipeline.TriggerCameraCallback(camera, "OnPostRender", Camera.onPostRender);
    }
Ejemplo n.º 3
0
    public void Render(ScriptableRenderContext renderContext, Camera camera, VXGIRenderer renderer)
    {
        UpdateResolution();

        float realtime         = Time.realtimeSinceStartup;
        bool  tracingThrottled = throttleTracing;

#if UNITY_EDITOR
        tracingThrottled &= UnityEditor.EditorApplication.isPlaying;
#endif

        if (tracingThrottled)
        {
            if (_previousTrace + 1f / tracingRate < realtime)
            {
                _previousTrace = realtime;

                PrePass(renderContext, renderer);
            }
        }
        else
        {
            PrePass(renderContext, renderer);
        }

        renderContext.SetupCameraProperties(camera);

        _command.ClearRenderTarget(true, true, Color.clear);
        renderContext.ExecuteCommandBuffer(_command);
        _command.Clear();

        if (pass == VXGIRenderer.Pass.Mipmap)
        {
            renderer.RenderMipmap(renderContext, camera, this);
        }
        else
        {
            SetupShader(renderContext);
            renderer.RenderDeferred(renderContext, camera, this);
        }

        renderContext.Submit();
    }
    public void Render(ScriptableRenderContext renderContext, Camera camera, VXGIRenderer renderer)
    {
        VXGIRenderPipeline.TriggerCameraCallback(Camera, "OnPreRender", Camera.onPreRender);

        _command.BeginSample(_command.name);
        renderContext.ExecuteCommandBuffer(_command);
        _command.Clear();

        UpdateResolution();

        var time = Time.realtimeSinceStartup;

        if (!limitRefreshRate || (_previousRefresh + 1f / refreshRate < time))
        {
            _previousRefresh = time;

            PrePass(renderContext, renderer);
        }

        renderContext.SetupCameraProperties(camera);

        _command.ClearRenderTarget(
            (camera.clearFlags & CameraClearFlags.Depth) != 0,
            camera.clearFlags == CameraClearFlags.Color,
            camera.backgroundColor
            );
        renderContext.ExecuteCommandBuffer(_command);
        _command.Clear();

        SetupShader(renderContext);

        VXGIRenderPipeline.TriggerCameraCallback(Camera, "OnPreCull", Camera.onPreCull);

        renderer.RenderDeferred(renderContext, camera, this);

        _command.EndSample(_command.name);
        renderContext.ExecuteCommandBuffer(_command);
        _command.Clear();

        VXGIRenderPipeline.TriggerCameraCallback(Camera, "OnPostRender", Camera.onPostRender);
    }