public void Render(Vector3 color) { graphicsDevice.SetTopology(PrimitiveTopology.TriangleList); graphicsDevice.SetVertexBuffer(vertexBuffer); graphicsDevice.SetIndexBuffer(indexBuffer, 0); effect.SetVariable("ViewProj", "TestX", viewProj, ShaderType.VertexShader); effect.Apply(); graphicsDevice.DrawIndexed(indices.Length, 0, 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); }