Ejemplo n.º 1
0
    public static void Build(Vector3i localPos, Vector3i worldPos, Map map, MeshBuilder mesh, bool onlyLight)
    {
        BlockData      block     = map.GetBlock(worldPos);
        CubeBlock      cube      = (CubeBlock)block.block;
        BlockDirection direction = block.GetDirection();

        for (int i = 0; i < 6; i++)
        {
            CubeFace face    = faces[i];
            Vector3i dir     = directions[i];
            Vector3i nearPos = worldPos + dir;
            if (IsFaceVisible(map, nearPos))
            {
                if (!onlyLight)
                {
                    BuildFace(face, cube, direction, localPos, mesh);
                }
                BuildFaceLight(face, map, worldPos, mesh);
            }
        }
    }
Ejemplo n.º 2
0
    /**
     * Build up a single cube at a given local "chunk" position and a specific worldPosition within a MeshData mesh.
     */
    public static void BuildCube(Vector3i localPos, Vector3i worldPos, MeshData mesh, bool onlyLight)
    {
        BlockData      block     = Map.Instance.GetBlock(worldPos);
        Cube           cube      = (Cube)block.block;
        BlockDirection direction = block.GetDirection();

        //Build up for each face
        for (int i = 0; i < 6; i++)
        {
            CubeFace face    = faces [i];
            Vector3i dir     = directions [i];
            Vector3i nearPos = worldPos + dir;
            if (IsFaceVisible(nearPos, cube))
            {
                if (!onlyLight)
                {
                    BuildFace(face, cube, direction, new Vector3(localPos.x, localPos.y, localPos.z), mesh);
                }
                BuildFaceLight(face, worldPos, mesh);
            }
        }
    }