Esempio n. 1
0
        void ComputeAndMergeStartLine(Octant octant, ShadowLine shadowLine)
        {
            int     mainStep = 0;
            Vector2 currentPosition;

            for (int sideStep = 1; sideStep <= LINE_PATCH && _visibleMap.Contains(currentPosition = octant.GetPosition(mainStep, sideStep)); sideStep++) // 边缘方向从1开始,跳过观察者所在的位置
            {
                Shadow projection = ShadowLine.GetQuadProjection(mainStep, sideStep);
                DrawShadow(shadowLine, currentPosition, projection);
                UpdateShadowLine(currentPosition, shadowLine, projection);
            }
        }
Esempio n. 2
0
        bool ComputeAndMergeALineAndGetIsFullShadow(Octant octant, int mainStep, ShadowLine shadowLine)
        {
            /*
             *  循环到一行结束或地图边界
             *  {
             *      获取投影
             *      通过投影判断可见度并存入视野
             *      通过投影判断是否遮挡视线并存入阴影线
             *  }
             *  返回阴影是否覆盖了整个八分角
             */
            Vector2 currentPosition;

            for (int sideStep = 0; sideStep <= mainStep + LINE_PATCH && _visibleMap.Contains(currentPosition = octant.GetPosition(mainStep, sideStep)); sideStep++)
            {
                Shadow projection = ShadowLine.GetQuadProjection(mainStep, sideStep);
                DrawShadow(shadowLine, currentPosition, projection);
                UpdateShadowLine(currentPosition, shadowLine, projection);
            }

            return(shadowLine.IsFullShadow());
        }