static BlockVertexData()
        {
            textureOffset = 32f / 2048f;
            bleedingFix   = 1f / 2048f;
            _blockData    = new List <BlockVertexData>();

            BlockVertexData debugBlock = new BlockVertexData();

            debugBlock.UpVertices    = CalculateUpVertices(0);
            debugBlock.UpIndices     = BlockIndices.UpIndices;
            debugBlock.DownVertices  = CalculateDownVertices(4);
            debugBlock.DownIndices   = BlockIndices.DownIndices;
            debugBlock.NorthVertices = CalculateNorthVertices(5);
            debugBlock.NorthIndices  = BlockIndices.NorthIndices;
            debugBlock.EastVertices  = CalculateEastVertices(1);
            debugBlock.EastIndices   = BlockIndices.EastIndices;
            debugBlock.SouthVertices = CalculateSouthVertices(2);
            debugBlock.SouthIndices  = BlockIndices.SouthIndices;
            debugBlock.WestVertices  = CalculateWestVertices(3);
            debugBlock.WestIndices   = BlockIndices.WestIndices;
            debugBlock.CalculateNormals();

            BlockVertexData soil = new BlockVertexData();

            soil.UpVertices    = CalculateUpVertices(6);
            soil.UpIndices     = BlockIndices.UpIndices;
            soil.DownVertices  = CalculateDownVertices(8);
            soil.DownIndices   = BlockIndices.DownIndices;
            soil.NorthVertices = CalculateNorthVertices(7);
            soil.NorthIndices  = BlockIndices.NorthIndices;
            soil.EastVertices  = CalculateEastVertices(7);
            soil.EastIndices   = BlockIndices.EastIndices;
            soil.SouthVertices = CalculateSouthVertices(7);
            soil.SouthIndices  = BlockIndices.SouthIndices;
            soil.WestVertices  = CalculateWestVertices(7);
            soil.WestIndices   = BlockIndices.WestIndices;
            soil.CalculateNormals();

            _blockData.Add(new BlockVertexData());
            _blockData.Add(debugBlock);
            _blockData.Add(soil);
        }
        public BlockVertexData Copy()
        {
            BlockVertexData toCopy   = this;
            BlockVertexData toReturn = new BlockVertexData();

            toReturn.UpIndices     = toCopy.UpIndices;
            toReturn.UpVertices    = toCopy.UpVertices;
            toReturn.DownIndices   = toCopy.DownIndices;
            toReturn.DownVertices  = toCopy.DownVertices;
            toReturn.NorthIndices  = toCopy.NorthIndices;
            toReturn.NorthVertices = toCopy.NorthVertices;
            toReturn.EastIndices   = toCopy.EastIndices;
            toReturn.EastVertices  = toCopy.EastVertices;
            toReturn.SouthIndices  = toCopy.SouthIndices;
            toReturn.SouthVertices = toCopy.SouthVertices;
            toReturn.WestIndices   = toCopy.WestIndices;
            toReturn.WestVertices  = toCopy.WestVertices;

            return(toReturn);
        }
        public static BlockVertexData GetCopyOfBlockMasBlockVertexData(BlockMask blockMask)
        {
            BlockVertexData toCopy   = GetBlockMaskVertexData(blockMask);
            BlockVertexData toReturn = new BlockVertexData();

            toReturn.UpIndices     = toCopy.UpIndices;
            toReturn.UpVertices    = toCopy.UpVertices;
            toReturn.DownIndices   = toCopy.DownIndices;
            toReturn.DownVertices  = toCopy.DownVertices;
            toReturn.NorthIndices  = toCopy.NorthIndices;
            toReturn.NorthVertices = toCopy.NorthVertices;
            toReturn.EastIndices   = toCopy.EastIndices;
            toReturn.EastVertices  = toCopy.EastVertices;
            toReturn.SouthIndices  = toCopy.SouthIndices;
            toReturn.SouthVertices = toCopy.SouthVertices;
            toReturn.WestIndices   = toCopy.WestIndices;
            toReturn.WestVertices  = toCopy.WestVertices;

            return(toReturn);
        }
        public void Merge(BlockVertexData vertexData)
        {
            // prepare verts
            List <VertexPositionNormalTexture> upVertices    = new List <VertexPositionNormalTexture>();
            List <VertexPositionNormalTexture> downVertices  = new List <VertexPositionNormalTexture>();
            List <VertexPositionNormalTexture> northVertices = new List <VertexPositionNormalTexture>();
            List <VertexPositionNormalTexture> eastVertices  = new List <VertexPositionNormalTexture>();
            List <VertexPositionNormalTexture> southVertices = new List <VertexPositionNormalTexture>();
            List <VertexPositionNormalTexture> westVertices  = new List <VertexPositionNormalTexture>();

            // merge verts
            upVertices.AddRange(UpVertices);
            downVertices.AddRange(DownVertices);
            northVertices.AddRange(NorthVertices);
            eastVertices.AddRange(EastVertices);
            southVertices.AddRange(SouthVertices);
            westVertices.AddRange(WestVertices);
            upVertices.AddRange(vertexData.UpVertices);
            downVertices.AddRange(vertexData.DownVertices);
            northVertices.AddRange(vertexData.NorthVertices);
            eastVertices.AddRange(vertexData.EastVertices);
            southVertices.AddRange(vertexData.SouthVertices);
            westVertices.AddRange(vertexData.WestVertices);

            //prepare indices
            List <ushort> upIndices    = new List <ushort>();
            List <ushort> downIndices  = new List <ushort>();
            List <ushort> northIndices = new List <ushort>();
            List <ushort> eastIndices  = new List <ushort>();
            List <ushort> southIndices = new List <ushort>();
            List <ushort> westIndices  = new List <ushort>();

            // merge indices
            ushort upOffset    = (ushort)UpVertices.Length;
            ushort downOffset  = (ushort)DownVertices.Length;
            ushort northOffset = (ushort)NorthVertices.Length;
            ushort eastOffset  = (ushort)EastVertices.Length;
            ushort southOffset = (ushort)SouthVertices.Length;
            ushort westOffset  = (ushort)WestVertices.Length;

            foreach (ushort index in UpIndices)
            {
                upIndices.Add(index);
            }
            foreach (ushort index in vertexData.UpIndices)
            {
                upIndices.Add((ushort)(index + upOffset));
            }
            foreach (ushort index in DownIndices)
            {
                downIndices.Add(index);
            }
            foreach (ushort index in vertexData.DownIndices)
            {
                downIndices.Add((ushort)(index + downOffset));
            }
            foreach (ushort index in NorthIndices)
            {
                northIndices.Add(index);
            }
            foreach (ushort index in vertexData.NorthIndices)
            {
                northIndices.Add((ushort)(index + northOffset));
            }
            foreach (ushort index in EastIndices)
            {
                eastIndices.Add(index);
            }
            foreach (ushort index in vertexData.EastIndices)
            {
                eastIndices.Add((ushort)(index + eastOffset));
            }
            foreach (ushort index in SouthIndices)
            {
                southIndices.Add(index);
            }
            foreach (ushort index in vertexData.SouthIndices)
            {
                southIndices.Add((ushort)(index + southOffset));
            }
            foreach (ushort index in WestIndices)
            {
                westIndices.Add(index);
            }
            foreach (ushort index in vertexData.WestIndices)
            {
                westIndices.Add((ushort)(index + westOffset));
            }

            // set to object
            UpVertices    = upVertices.ToArray();
            DownVertices  = downVertices.ToArray();
            NorthVertices = northVertices.ToArray();
            EastVertices  = eastVertices.ToArray();
            SouthVertices = southVertices.ToArray();
            WestVertices  = westVertices.ToArray();
            UpIndices     = upIndices.ToArray();
            DownIndices   = downIndices.ToArray();
            NorthIndices  = northIndices.ToArray();
            EastIndices   = eastIndices.ToArray();
            SouthIndices  = southIndices.ToArray();
            WestIndices   = westIndices.ToArray();
        }