예제 #1
0
        public static bool Face(BlockClass[][][] blocks, GeometryData landGeometry, GeometryData waterGeometry)
        {
            landGeometry.Clear();
            waterGeometry.Clear();

            for (var Z = 0; Z < BlockProperties.ChunkSize; Z++)
            {
                for (var Y = 0; Y < BlockProperties.ChunkSize; Y++)
                {
                    for (var X = 0; X < BlockProperties.ChunkSize; X++)
                    {
                        var V = new Vector3Int(X, Y, Z);
                        BlockClass.BlockData currentData = blocks[V.x + 1][V.y + 1][V.z + 1].Data;
                        if (currentData.Type == BlockClass.BlockType.Water)
                        {
                            for (byte Dir = 0; Dir < 6; Dir++)
                            {
                                if (blocks[1 + V.x + BlockProperties.DirectionVector[Dir].x][1 + V.y + BlockProperties.DirectionVector[Dir].y][1 + V.z + BlockProperties.DirectionVector[Dir].z].Data.Type == BlockClass.BlockType.Air)
                                {
                                    AddFaceWater(blocks, waterGeometry, Dir, V);
                                }
                            }
                        }
                        else
                        {
                            for (byte Dir = 0; Dir < 6; Dir++)
                            {
                                var B0 = (byte)(currentData.Occlude & (1 << Dir));
                                if (B0 <= 0)
                                {
                                    continue;
                                }
                                var B1 = (byte)(blocks[1 + V.x + BlockProperties.DirectionVector[Dir].x][1 + V.y + BlockProperties.DirectionVector[Dir].y][1 + V.z + BlockProperties.DirectionVector[Dir].z].Data.Occlude &
                                                (1 << (5 - Dir)));
                                if (B1 == 0)
                                {
                                    AddFace(blocks, landGeometry, Dir, V);
                                }
                            }
                        }
                    }
                }
            }

            return(true);
        }
예제 #2
0
 public new void Clear()
 {
     base.Clear();
     matrixChanged = false;
     drawCallList.QuickClear();
     fillStyles?.QuickClear();
     strokeStyles?.QuickClear();
     transforms.size     = 0;
     objectDataList.size = 0;
     geometry.Clear();
     currentMatrix           = Matrix4x4.identity;
     currentFillStyle        = SVGXFillStyle.Default;
     currentStrokeStyle      = SVGXStrokeStyle.Default;
     currentShapeRange       = default;
     currentFixedRenderState = new FixedRenderState(BlendState.Default, DepthState.Default);
     transforms.Add(currentMatrix);
     if (renderStateList != null)
     {
         renderStateList.size = 0;
     }
 }