コード例 #1
0
ファイル: ShadowRenderPass.cs プロジェクト: sjb8100/SRP
        //---------------------------------------------------------------------------------------------------------------------------------------------------
        private void RenderShadowSplit(ref ShadowSliceData slice, Vector3 lightDirection, Matrix4x4 proj, Matrix4x4 view, ref ScriptableRenderContext loop, DrawShadowsSettings settings)
        {
            var commandBuffer = new CommandBuffer {
                name = "ShadowSetup"
            };

            // Set viewport / matrices etc
            commandBuffer.SetViewport(new Rect(slice.atlasX, slice.atlasY, slice.shadowResolution, slice.shadowResolution));
            //commandBuffer.ClearRenderTarget (true, true, Color.green);
            commandBuffer.SetGlobalVector("g_vLightDirWs", new Vector4(lightDirection.x, lightDirection.y, lightDirection.z));
            commandBuffer.SetViewProjectionMatrices(view, proj);
            //  commandBuffer.SetGlobalDepthBias (1.0F, 1.0F);
            loop.ExecuteCommandBuffer(commandBuffer);
            commandBuffer.Dispose();

            // Render
            loop.DrawShadows(ref settings);
        }