Exemple #1
0
        protected override void Draw()
        {
            /*
             * if(visibleTileRangeDirty)
             *  UpdateVisibleTileRange();*/

            base.Draw();

            CCDrawManager drawManager = Window.DrawManager;

            var alphaTest = drawManager.AlphaTestEffect;

            alphaTest.AlphaFunction  = CompareFunction.Greater;
            alphaTest.ReferenceAlpha = 0;

            drawManager.PushEffect(alphaTest);
            drawManager.BindTexture(tileSetTexture);

            foreach (var buffer in drawBufferManager.Buffers)
            {
                drawManager.DrawBuffer(buffer.QuadsVertexBuffer, buffer.IndexBuffer, 0,
                                       buffer.NumberOfTiles * NumOfPrimitivesPerQuad);
            }

            drawManager.PopEffect();
        }
Exemple #2
0
        protected override void Draw()
        {
            if (visibleTileRangeDirty)
            {
                UpdateVisibleTileRange();
            }

            if (tileAnimationsDirty)
            {
                UpdateTileAnimations();
            }

            base.Draw();

            CCDrawManager drawManager = Window.DrawManager;

            var alphaTest = drawManager.AlphaTestEffect;

            alphaTest.AlphaFunction  = CompareFunction.Greater;
            alphaTest.ReferenceAlpha = 0;

            drawManager.PushEffect(alphaTest);

            foreach (var drawBufferManager in drawBufferManagers)
            {
                drawManager.BindTexture(drawBufferManager.TileSetInfo.Texture);

                foreach (var buffer in drawBufferManager.Buffers)
                {
                    if (buffer.ShouldDrawBuffer == false || buffer.NumberOfVisibleVertices == 0)
                    {
                        continue;
                    }

                    drawManager.DrawBuffer(buffer.QuadsVertexBuffer, buffer.IndexBuffer, 0,
                                           buffer.NumberOfVisiblePrimitives);
                }
            }

            drawManager.PopEffect();
        }