Ejemplo n.º 1
0
        internal void ProcessQuadRenderCommand(CCQuadCommand quadCommand)
        {
            var worldTransform = quadCommand.WorldTransform;
            var identity       = worldTransform == CCAffineTransform.Identity;

            quadCommands.Add(quadCommand);

            var quads = quadCommand.Quads;

            for (int i = 0, N = quadCommand.QuadCount; i < N; ++i)
            {
                if (identity)
                {
                    currentBatchedQuads.Add(quads[i]);
                }
                else
                {
                    currentBatchedQuads.Add(worldTransform.Transform(quads[i]));
                }
            }

            // We're changing command types so render any pending sequence of commandss
            // e.g. Batched quad commands
            if ((currentCommandType & CCCommandType.Quad) == CCCommandType.None)
            {
                Flush();
            }

            currentCommandType = CCCommandType.Quad;
        }
Ejemplo n.º 2
0
        internal void VisitRenderQueue()
        {
            currentCommandType       = CCCommandType.None;
            currentViewportGroupId   = 0;
            currentViewportIdIndex   = 0;
            currentLayerGroupId      = 0;
            currentLayerGroupIdIndex = 0;
            currentGroupId           = 0;
            currentGroupIdIndex      = 0;
            currentArrivalIndex      = 0;
            maxViewportGroupId       = 0;
            maxLayerGroupId          = 0;
            maxGroupId = 0;

            Array.Sort <CCRenderCommand>(renderQueue.Elements, 0, renderQueue.Count);

            drawManager.ViewMatrix       = Matrix.Identity;
            drawManager.ProjectionMatrix = Matrix.Identity;

            foreach (CCRenderCommand command in renderQueue)
            {
                byte viewportGroupId = command.ViewportGroup;

                if (viewportGroupId != currentViewportGroupId)
                {
                    // We're about to change viewport
                    // So flush any pending render commands which use previous viewport
                    Flush();

                    currentViewportGroupId = viewportGroupId;
                    drawManager.Viewport   = viewportGroupStack[currentViewportGroupId];
                }

                byte layerGroupId = command.LayerGroup;

                if (layerGroupId != currentLayerGroupId)
                {
                    // We're about to change view/proj matrices
                    // So flush any pending render commands which use previous MVP state
                    Flush();

                    currentLayerGroupId          = layerGroupId;
                    drawManager.ViewMatrix       = layerGroupViewMatrixStack[currentLayerGroupId];
                    drawManager.ProjectionMatrix = layerGroupProjMatrixStack[currentLayerGroupId];
                }

                command.RequestRenderCommand(this);
            }

            // This only resets the count of the queue so is inexpensive
            renderQueue.Clear();

            // Flush any remaining render commands
            Flush();

            currentViewportGroupId = 0;
            currentLayerGroupId    = 0;
        }
Ejemplo n.º 3
0
        internal void ProcessCustomRenderCommand(CCCustomCommand customCommand)
        {
            // We're changing command types so render any pending sequence of commands
            // e.g. Batched quad commands
            if ((currentCommandType & CCCommandType.Custom) == CCCommandType.None)
            {
                Flush();
            }

            customCommand.RenderCustomCommand(drawManager);

            currentCommandType = CCCommandType.Custom;
        }
Ejemplo n.º 4
0
        internal void ProcessCustomRenderCommand(CCCustomCommand customCommand)
        {
            // We're changing command types so render any pending sequence of commands
            // e.g. Batched quad commands
            if((currentCommandType & CCCommandType.Custom) == CCCommandType.None)
                Flush();

            customCommand.RenderCustomCommand(drawManager);

            currentCommandType = CCCommandType.Custom;
        }
Ejemplo n.º 5
0
        internal void ProcessQuadRenderCommand(CCQuadCommand quadCommand)
        {
            var worldTransform = quadCommand.WorldTransform;
            var identity = worldTransform == CCAffineTransform.Identity;

            quadCommands.Add(quadCommand);

            var quads = quadCommand.Quads;
            for (int i = 0, N = quadCommand.QuadCount; i < N; ++i)
            {
                if (identity)
                    currentBatchedQuads.Add(quads[i]);
                else
                    currentBatchedQuads.Add(worldTransform.Transform(quads[i]));
            }

            // We're changing command types so render any pending sequence of commandss
            // e.g. Batched quad commands
            if((currentCommandType & CCCommandType.Quad) == CCCommandType.None)
                Flush();

            currentCommandType = CCCommandType.Quad;
        }
Ejemplo n.º 6
0
        internal void VisitRenderQueue()
        {
            currentCommandType = CCCommandType.None;
            currentViewportGroupId = 0;
            currentViewportIdIndex = 0;
            currentLayerGroupId = 0;
            currentLayerGroupIdIndex = 0;
            currentGroupId = 0;
            currentGroupIdIndex = 0;
            currentArrivalIndex = 0;
            maxViewportGroupId = 0;
            maxLayerGroupId = 0;
            maxGroupId = 0;

            Array.Sort<CCRenderCommand>(renderQueue.Elements, 0, renderQueue.Count);

            drawManager.ViewMatrix = Matrix.Identity;
            drawManager.ProjectionMatrix = Matrix.Identity;

            foreach(CCRenderCommand command in renderQueue)
            {
                byte viewportGroupId = command.ViewportGroup;

                if(viewportGroupId != currentViewportGroupId)
                {
                    // We're about to change viewport
                    // So flush any pending render commands which use previous viewport
                    Flush();

                    currentViewportGroupId = viewportGroupId;
                    drawManager.Viewport = viewportGroupStack[currentViewportGroupId];
                }

                byte layerGroupId = command.LayerGroup;

                if(layerGroupId != currentLayerGroupId) 
                {
                    // We're about to change view/proj matrices
                    // So flush any pending render commands which use previous MVP state
                    Flush();

                    currentLayerGroupId = layerGroupId;
                    drawManager.ViewMatrix = layerGroupViewMatrixStack[currentLayerGroupId];
                    drawManager.ProjectionMatrix = layerGroupProjMatrixStack[currentLayerGroupId];
                }

                command.RequestRenderCommand(this);
            }

            // This only resets the count of the queue so is inexpensive
            renderQueue.Clear();

            // Flush any remaining render commands
            Flush();

            currentViewportGroupId = 0;
            currentLayerGroupId = 0;
        }