Exemple #1
0
        public void Render()
        {
            IGraphicsService graphicsService = GameService.GetService <IGraphicsService>();
            Node             currentNode     = StartNode;

            while (currentNode != null)
            {
                if (!graphicsService.IsDrawing)
                {
                    graphicsService.SetActiveEffect(currentNode.ActiveEffect);
                    graphicsService.SetDepthState(currentNode.DepthState);
                    graphicsService.StartDrawing();
                }
                Node nextNode = currentNode.PopAndRender();
                if (
                    nextNode != null &&
                    (
                        nextNode.ActiveEffect != currentNode.ActiveEffect ||
                        nextNode.DepthState != currentNode.DepthState ||
                        nextNode.Target != currentNode.Target
                    )
                    )
                {
                    graphicsService.EndDrawing();
                }
                currentNode = nextNode;
            }
            graphicsService.EndDrawing();
        }