Пример #1
0
        public void DrawQuads(CCRawList <CCV3F_C4B_T2F_Quad> quads, int start, int n)
        {
            if (n == 0)
            {
                return;
            }

            CheckQuadsIndexBuffer(start + n);
            CheckQuadsVertexBuffer(start + n);

            quadsBuffer.UpdateBuffer(quads, start, n);

            graphicsDevice.SetVertexBuffer(quadsBuffer.VertexBuffer);
            graphicsDevice.Indices = quadsIndexBuffer.IndexBuffer;

            ApplyEffectParams();

            EffectPassCollection passes = currentEffect.CurrentTechnique.Passes;

            for (int i = 0; i < passes.Count; i++)
            {
                passes[i].Apply();
                graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, n * 4, start * 6, n * 2);
            }

            graphicsDevice.SetVertexBuffer(null);
            graphicsDevice.Indices = null;
        }
Пример #2
0
        // draws n quads from an index (offset).
        // n + start can't be greater than the capacity of the atlas
        public void DrawNumberOfQuads(int n, int start)
        {
            if (n == 0)
            {
                return;
            }

            CCDrawManager.SharedDrawManager.BindTexture(Texture);

            if (Dirty)
            {
                vertexBuffer.UpdateBuffer();
                Dirty = false;
            }

            CCDrawManager.SharedDrawManager.DrawQuadsBuffer(vertexBuffer, start, n);
        }