コード例 #1
0
    void Cleanup()
    {
        //cleanup light(null) and shadows(render target)
        lighting.CleanUp();

        if (useIntermediateBuffer)
        {
            buffer.ReleaseTemporaryRT(colorAttachmentId);
            buffer.ReleaseTemporaryRT(depthAttachmentId);
            if (useColorTexture)
            {
                buffer.ReleaseTemporaryRT(colorTextureId);
            }
            if (useDepthTexture)
            {
                buffer.ReleaseTemporaryRT(depthTextureId);
            }
        }
    }
コード例 #2
0
    CullingResults cullingResults; // We want to figure out what can be rendered

    public void Render(
        ScriptableRenderContext ctx,
        Camera camera,
        bool useDynamicBatching,
        bool useGPUInstancing,
        ShadowSettings shadowSettings)
    {
        this.ctx    = ctx;
        this.camera = camera;

        // Allow secondary cameras
        PrepareBuffer();
        // Allow UI Drawing in the scene view
        PrepareForSceneWindow();

        if (!Cull(shadowSettings.MaxDistance))
        {
            return;
        }

        buffer.BeginSample(SampleName);
        ExecuteBuffer();

        // Do the lighting setup first to not affect the usual rendering.
        lighting.SetUp(ctx, cullingResults, shadowSettings);

        buffer.EndSample(SampleName);

        SetUp();

        DrawVisibleGeometry(useDynamicBatching, useGPUInstancing);
        DrawUnsupportedShaders();
        DrawGizmos();

        // Clean up the lighting, which cleans up the shadows also.
        lighting.CleanUp();

        // Submit the previous cmd to the render queue
        Submit();
    }
コード例 #3
0
 public void Render(ScriptableRenderContext context, Camera camera, bool useDynamicBatching, bool useGPUInstancing, ShadowSettings shadowSettings)
 {
     this._context = context;
     this._camera  = camera;
     PrepareBuffer();
     PrepareForSceneWindow();
     if (!Cull(shadowSettings.maxDistance))
     {
         return;
     }
     _buffer.BeginSample(SampleName);
     ExecuteBuffer();
     _lighting.Setup(context, _cullingResults, shadowSettings);
     _buffer.EndSample(SampleName);
     Setup();
     // DrawVisibleGeometry方法的工作是绘制相机所能看到的所有几何图形
     DrawVisibleGeometry(useDynamicBatching, useGPUInstancing);
     DrawUnsupportedShaders();
     DrawGizmos();
     _lighting.CleanUp();
     Submit();
 }