Esempio n. 1
0
        private void AppendBlockRenderData(BlockDataManager buffer, int x, int y, int z)
        {
            Coord coord = new Coord(x, y, z);
            var   color = GetBlockColor(coord);

            if (color == 0)
            {
                return;
            }

            for (int face = 0; face < 6; ++face)
            {
                var faceDir = new Coord.Direction1(face);
                if (!IsNormalCubeBeside(coord, faceDir))
                {
                    buffer.AppendRenderData(new BlockRenderData
                    {
                        pos       = Translation + coord.ToVector4(1.0f) + faceDir.coord.ToVector4(0) * 0.5f,
                        col       = GetColorFromInt(color),
                        dir_u     = 0.5f * faceDir.U().coord.ToVector4(0),
                        dir_v     = 0.5f * faceDir.V().coord.ToVector4(0),
                        aooffset  = GetAOOffset(coord, face),
                        lightness = GetLightnessVec(coord, face),
                    });
                }
            }
        }
Esempio n. 2
0
 public void FlushRenderData(BlockDataManager buffer)
 {
     for (int gridZ = 0; gridZ < Height; ++gridZ)
     {
         for (int gridY = 0; gridY < Width; ++gridY)
         {
             for (int gridX = 0; gridX < Width; ++gridX)
             {
                 AppendBlockRenderData(buffer, gridX, gridY, gridZ);
             }
         }
     }
 }