Exemplo n.º 1
0
        public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
        {
            if (Water.visibles.Count == 0)
            {
                return;
            }
            var cmd = CommandBufferPool.Get(COMMAND_BUFFER_TAG);

            try{
                foreach (var w in Water.visibles)
                {
                    //只做Demo,因此只构造一个水平的镜面反射。在实际应用中,假如存在多个不同平面的水体,需要为不同平面分别生成反射贴图。
                    var descriptor = new PlanarDescriptor()
                    {
                        position = w.transform.position,
                        normal   = w.transform.up
                    };
                    _generator.Render(cmd, ref renderingData, ref descriptor);
                    context.ExecuteCommandBuffer(cmd);
                    break;
                }
            }finally{
                CommandBufferPool.Release(cmd);
            }
        }
Exemplo n.º 2
0
            public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
            {
                var cmd = CommandBufferPool.Get(CommandBufferTag);

                try{
                    _ssprTexGenerator.Render(cmd, ref renderingData);
                    cmd.SetRenderTarget(this.colorAttachment, this.depthAttachment);
                    foreach (var planar in ReflectPlanar.activePlanars)
                    {
                        var rd = planar.GetComponent <Renderer>();
                        cmd.DrawRenderer(rd, _material);
                    }
                    _ssprTexGenerator.ReleaseTemporary(cmd);
                    context.ExecuteCommandBuffer(cmd);
                }finally{
                    CommandBufferPool.Release(cmd);
                }
            }
Exemplo n.º 3
0
            public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
            {
                var cmd = CommandBufferPool.Get(CommandBufferTag);

                try{
                    ReflectPlanar.GetVisiblePlanarGroups(_planarRendererGroups);
                    foreach (var group in _planarRendererGroups.rendererGroups)
                    {
                        cmd.Clear();
                        var planarDescriptor = group.descriptor;
                        var renderers        = group.renderers;
                        _ssprTexGenerator.Render(cmd, ref renderingData, ref planarDescriptor);
                        cmd.SetRenderTarget(this.colorAttachment, this.depthAttachment);
                        foreach (var rd in renderers)
                        {
                            cmd.DrawRenderer(rd, _material);
                        }
                        _ssprTexGenerator.ReleaseTemporary(cmd);
                        context.ExecuteCommandBuffer(cmd);
                    }
                }finally{
                    CommandBufferPool.Release(cmd);
                }
            }