static public void RenderLightVolumes(Camera camera, CommandBuffer cmdBuffer, int layerToRender, RenderTargetIdentifier renderTarget, RenderTargetIdentifier depthTarget, uint blendStylesUsed)
        {
            for (int i = 0; i < s_BlendStyles.Length; ++i)
            {
                if ((blendStylesUsed & (uint)(1 << i)) == 0)
                {
                    continue;
                }

                string sampleName = s_BlendStyles[i].name;
                cmdBuffer.BeginSample(sampleName);

                RenderLightVolumeSet(
                    camera,
                    i,
                    cmdBuffer,
                    layerToRender,
                    renderTarget,
                    depthTarget,
                    Light2D.GetLightsByBlendStyle(i)
                    );

                cmdBuffer.EndSample(sampleName);
            }
        }
示例#2
0
        static public void RenderLights(Camera camera, CommandBuffer cmdBuffer, int layerToRender, uint blendStylesUsed)
        {
            for (int i = 0; i < s_BlendStyles.Length; ++i)
            {
                if ((blendStylesUsed & (uint)(1 << i)) == 0)
                {
                    continue;
                }

                string sampleName = s_BlendStyles[i].name;
                cmdBuffer.BeginSample(sampleName);

                cmdBuffer.SetRenderTarget(s_LightRenderTargets[i].Identifier());

                bool  rtDirty = false;
                Color clearColor;
                if (!Light2DManager.GetGlobalColor(layerToRender, i, out clearColor))
                {
                    clearColor = Color.black;
                }
                else
                {
                    rtDirty = true;
                }

                if (s_LightRenderTargetsDirty[i] || rtDirty)
                {
                    cmdBuffer.ClearRenderTarget(false, true, clearColor);
                }

                rtDirty |= RenderLightSet(
                    camera,
                    i,
                    cmdBuffer,
                    layerToRender,
                    s_LightRenderTargets[i].Identifier(),
                    Light2D.GetLightsByBlendStyle(i)
                    );

                s_LightRenderTargetsDirty[i] = rtDirty;

                cmdBuffer.EndSample(sampleName);
            }
        }
        static public void RenderLightVolumes(Camera camera, CommandBuffer cmdBuffer, int layerToRender)
        {
            for (int i = 0; i < s_BlendStyles.Length; ++i)
            {
                if (!s_BlendStyles[i].enabled)
                {
                    continue;
                }

                string sampleName = s_BlendStyles[i].name;
                cmdBuffer.BeginSample(sampleName);

                RenderLightVolumeSet(
                    camera,
                    i,
                    cmdBuffer,
                    layerToRender,
                    s_RenderTargets[i].Identifier(),
                    Light2D.GetLightsByBlendStyle(i)
                    );

                cmdBuffer.EndSample(sampleName);
            }
        }