예제 #1
0
        /// <summary>
        /// Does a check for either FrontZ or BackZ
        /// </summary>
        /// <param name="box">Box</param>
        /// <param name="side">Side</param>
        /// <param name="visMatrix">Visibility matrix</param>
        /// <param name="z">Z coordinate</param>
        /// <param name="x1">X1 coordinate</param>
        /// <param name="x2">X2 coordinate</param>
        /// <param name="y1">Y1 coordinate</param>
        /// <param name="y2">Y2 coordinate</param>
        /// <param name="hiddenFaces">Hidden sides reference</param>
        private static void CheckHiddenZ(ClientBox box, int side, BinaryMatrix3D visMatrix, int z, ref int x1, ref int x2, ref int y1, ref int y2, ref int hiddenFaces)
        {
            box.HiddenSides[side] = true;
            for (int x = x1; x <= x2; x++)
            {
                for (int y = y1; y <= y2; y++)
                {
                    if (!visMatrix.Get(ref x, ref y, ref z))
                    {
                        box.HiddenSides[side] = false;
                        break;
                    }
                }

                if (!box.HiddenSides[side])
                {
                    break;
                }
            }

            if (box.HiddenSides[side])
            {
                hiddenFaces++;
            }
        }
예제 #2
0
        /// <summary>
        /// Checks whether the box side is blocked by the neighbour's blocking
        /// side.
        /// </summary>
        /// <param name="box">Box</param>
        /// <param name="side">Side</param>
        /// <param name="neighbours">Neighbours array</param>
        /// <param name="hiddenFaces">Hidden sides reference</param>
        /// <returns>True if the box side is blocked</returns>
        private bool CheckHidden(ClientBox box, int side, ref ClientSegment[] neighbours, ref int hiddenFaces)
        {
            if (neighbours[side]._Flags[side])
            {
                hiddenFaces++;
                box.HiddenSides[side] = true;

                return(true);
            }

            return(false);
        }