Exemplo n.º 1
0
        public void Render(ScriptableRenderContext renderContext, Camera camera, bool allowHDR, bool useDynamicBatching, bool useGPUInstancing, bool useLightsPerObject, ShadowSettings shadowSettings,
                           PostProcessingAsset postProcessingAsset, GrassSeaConfig grassSeaConfig)
        {
            this.renderContext = renderContext;
            this.camera        = camera;

            #if UNITY_EDITOR
            SetCommandBufferName();
            DrawSceneView(); // draw it before culling or it may be culled
            #endif

            if (Cull(shadowSettings.MaxDistance) == false)
            {
                return;
            }

            useHDR = allowHDR && camera.allowHDR;
            commandBuffer.BeginSample(commandBufferName);
            ExecuteCommandBuffer(); // ?? why do this ? maybe begin sample must be execute before next sample
            lighting.Setup(renderContext, cullingResults, shadowSettings, useLightsPerObject);
            postProcessingStack.Setup(renderContext, camera, postProcessingAsset, useHDR);
            commandBuffer.EndSample(commandBufferName);

            // grass sea
            if (grassSeaConfig)
            {
                grassSeaRenderer.Render(renderContext, grassSeaConfig);
            }

            Setup(shadowSettings);
            DrawVisibleObjects(useDynamicBatching, useGPUInstancing, useLightsPerObject);

            #if UNITY_EDITOR
            DrawUnsupportedShaderObjects();
            DrawGizmos(true);
            // DrawGizmos(false);
            #endif

            if (postProcessingStack.IsActive)
            {
                postProcessingStack.Render(cameraFrameBufferPropertyID);
            }

            #if UNITY_EDITOR
            DrawGizmos(false);
            #endif

            Cleanup();
            Submit();
        }
Exemplo n.º 2
0
        public WindsmoonRenderPipeline(bool allowHDR, bool useDynamicBatching, bool useGPUInstancing, bool useSRPBatcher, bool useLightsPerObject, ShadowSettings shadowSettings,
                                       PostProcessingAsset postProcessingAsset, GrassSeaConfig grassSeaConfig)
        {
            this.allowHDR           = allowHDR;
            this.useDynamicBatching = useDynamicBatching;
            this.useGPUInstancing   = useGPUInstancing;
            this.useLightsPerObject = useLightsPerObject;
            this.shadowSettings     = shadowSettings;
            GraphicsSettings.useScriptableRenderPipelineBatching = useSRPBatcher;
            GraphicsSettings.lightsUseLinearIntensity            = true;
            this.shadowSettings      = shadowSettings;
            this.postProcessingAsset = postProcessingAsset;
            this.grassSeaConfig      = grassSeaConfig;

#if UNITY_EDITOR
            Lightmapping.SetDelegate(requestLightDelegate);
#endif
        }