Ejemplo n.º 1
0
        public void Draw(GraphicsDevice graphics, Camera camera)
        {
            ChunkMesh mesh;

            _solidEffect.Parameters["Projection"].SetValue(camera.Projection);
            _solidEffect.Parameters["View"].SetValue(camera.View);
            _solidEffect.Parameters["SkyLightDir"].SetValue(Vector3.Normalize(new Vector3(0.5f, 0.75f, 1.0f)));
            _solidEffect.Parameters["FogColor"].SetValue(Color.CornflowerBlue.ToVector4());

            while (_solidMeshRenderQueue.Count > 0)
            {
                mesh = _solidMeshRenderQueue.Dequeue();

                _solidEffect.Parameters["World"].SetValue(Matrix.CreateTranslation(mesh.Position));

                graphics.SetVertexBuffer(mesh.VertexBuffer);

                foreach (EffectPass pass in _solidEffect.CurrentTechnique.Passes)
                {
                    pass.Apply();
                    graphics.DrawPrimitives(PrimitiveType.TriangleList, 0, mesh.VertexBuffer.VertexCount / 3);
                }
            }
        }
Ejemplo n.º 2
0
 public void Draw(GraphicsDevice graphics, Camera camera)
 {
     ChunkRenderer.CullMeshes(ref PlayerPosition, ref camera.ViewFrustum);
     ChunkRenderer.Draw(graphics, camera);
 }