Пример #1
0
        protected override void DrawCore(RenderDrawContext context)
        {
            // Get or create VisibilityGroup for this RenderSystem
            var sceneInstance   = SceneInstance.GetCurrent(context.RenderContext);
            var visibilityGroup = sceneInstance.GetOrCreateVisibilityGroup(RenderSystem);

            using (context.RenderContext.PushTagAndRestore(SceneInstance.CurrentVisibilityGroup, visibilityGroup))
                using (context.RenderContext.PushTagAndRestore(SceneInstance.CurrentRenderSystem, RenderSystem))
                {
                    // Collect
                    visibilityGroup.Reset();

                    try
                    {
                        // Collect in layers. Setup features/stages, enumerate viewes and populates VisibilityGroup
                        Layers.Collect(context.RenderContext);
                        Master.Collect(context.RenderContext);

                        // Collect in render features
                        RenderSystem.Collect(context);

                        // Extract
                        RenderSystem.Extract(context);

                        // Prepare
                        RenderSystem.Prepare(context);

                        // Draw the layers
                        Layers.Draw(context);

                        // Draw the master track
                        Master.Draw(context);

                        // Flush
                        RenderSystem.Flush(context);
                    }
                    finally
                    {
                        // Reset render context data
                        RenderSystem.Reset();
                    }

                    context.RenderContext.Reset();
                }
        }