コード例 #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;
        }
コード例 #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;
        }
コード例 #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;
        }
コード例 #4
0
ファイル: CCRenderer.cs プロジェクト: KevinHeyer/CocosSharp
        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;
        }
コード例 #5
0
ファイル: CCRenderer.cs プロジェクト: KevinHeyer/CocosSharp
        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;
        }
コード例 #6
0
ファイル: CCRenderer.cs プロジェクト: KevinHeyer/CocosSharp
        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;
        }