Ejemplo n.º 1
0
        public SpriteBatcher(GraphicsDevice graphicsDevice, int maxBatchSize)
        {
            this.graphicsDevice = graphicsDevice;
            this.maxBatchSize   = maxBatchSize;

            spriteList = new List <SpriteInfo>();
            fontVertex = new FontVertex[maxBatchSize];

            renderBatches = new List <RenderBatchInfo>();

            vertexBuffer = new VertexBuffer(graphicsDevice, BufferUsage.Dynamic);
            vertexBuffer.SetData(fontVertex);

            sampler = new LeaSamplerState();
            sampler.GenerateSamplers(graphicsDevice);

            CreateEffect();
            CreateBlendSates();

            effect.SetVariable("textureAtlasResWidthHeight", "startUp", 512, ShaderType.GeometryShader);
            effect.SetSampler(sampler, 0, ShaderType.PixelShader);
        }