using System;
using Microsoft.Xna.Framework.Graphics;
using TrueCraft.Core.World;
using Microsoft.Xna.Framework;
namespace TrueCraft.Client.Rendering
{
///
///
///
public class ChunkMesh : Mesh
{
///
///
///
public ReadOnlyChunk Chunk { get; set; }
///
///
///
///
///
///
///
public ChunkMesh(ReadOnlyChunk chunk, GraphicsDevice device, VertexPositionNormalTexture[] vertices, int[] indices)
: base(device, 1, true)
{
Chunk = chunk;
Vertices = vertices;
SetSubmesh(0, indices);
}
///
///
///
///
///
protected override BoundingBox RecalculateBounds(VertexPositionNormalTexture[] vertices)
{
return new BoundingBox(
new Vector3(Chunk.X * TrueCraft.Core.World.Chunk.Width, 0, Chunk.Z * TrueCraft.Core.World.Chunk.Depth),
new Vector3(Chunk.X * TrueCraft.Core.World.Chunk.Width
+ TrueCraft.Core.World.Chunk.Width, TrueCraft.Core.World.Chunk.Height,
Chunk.Z * TrueCraft.Core.World.Chunk.Depth + TrueCraft.Core.World.Chunk.Depth));
}
}
}