/// <summary>
        /// The fastest form of visibility updates -- radius-based, no line of sights checks.
        /// </summary>
        protected void RevealUsingRadius(IMangoFogRevealer r, float worldToTex)
        {
            // Position relative to the fog of war
            Vector3 pos = (r.GetPosition() - chunkOrigin) * worldToTex;

            //Vector3 pos = (r.GetPosition() - chunkOrigin) * worldToTex;
            float radius = r.GetRadius() * worldToTex;

            // Coordinates we'll be dealing with
            int xmin = Mathf.RoundToInt(pos.x - radius);
            int xmax = Mathf.RoundToInt(pos.x + radius);

            int ymin, ymax, cy;

            //use z for 3d, and y for 2d
            if (orientation == MangoFogOrientation.Perspective3D)
            {
                ymin = Mathf.RoundToInt(pos.z - radius);
                ymax = Mathf.RoundToInt(pos.z + radius);
                cy   = Mathf.RoundToInt(pos.z);
            }
            else
            {
                ymin = Mathf.RoundToInt(pos.y - radius);
                ymax = Mathf.RoundToInt(pos.y + radius);
                cy   = Mathf.RoundToInt(pos.y);
            }

            int cx = Mathf.RoundToInt(pos.x);

            int radiusSqr = Mathf.RoundToInt(radius * radius);

            for (int y = ymin; y < ymax; ++y)
            {
                if (y > -1 && y < textureSize)
                {
                    int yw = y * textureSize;
                    for (int x = xmin; x < xmax; ++x)
                    {
                        int xd   = x - cx;
                        int yd   = y - cy;
                        int dist = xd * xd + yd * yd;

                        if (x > -1 && x < textureSize)
                        {
                            // Reveal this pixel
                            if (dist < radiusSqr)
                            {
                                buffer1[x + yw].r = 255;
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Reveal the map around the revealer performing line-of-sight checks.
        /// </summary>
        void RevealUsingLOS(IMangoFogRevealer r, float worldToTex)
        {
            // Position relative to the fog of war
            Vector3 pos = r.GetPosition() - chunkOrigin;

            int ymin, ymax, xmin, xmax, cx, cy, gh;

            // Coordinates we'll be dealing with
            //use z for 3d, and y for 2d
            if (orientation == MangoFogOrientation.Perspective3D)
            {
                ymin = Mathf.RoundToInt((pos.z - r.GetLOSOuterRadius()) * worldToTex);
                ymax = Mathf.RoundToInt((pos.z + r.GetLOSOuterRadius()) * worldToTex);
                cy   = Mathf.RoundToInt(pos.z * worldToTex);
                gh   = WorldToGridHeight(r.GetPosition().y);
            }
            else
            {
                ymin = Mathf.RoundToInt((pos.y - r.GetLOSOuterRadius()) * worldToTex);
                ymax = Mathf.RoundToInt((pos.y + r.GetLOSOuterRadius()) * worldToTex);
                cy   = Mathf.RoundToInt(pos.y * worldToTex);
                gh   = WorldToGridHeight(r.GetPosition().z);
            }

            cx = Mathf.RoundToInt(pos.x * worldToTex);

            xmin = Mathf.RoundToInt((pos.x - r.GetLOSOuterRadius()) * worldToTex);
            xmax = Mathf.RoundToInt((pos.x + r.GetLOSOuterRadius()) * worldToTex);

            xmin = Mathf.Clamp(xmin, 0, textureSize - 1);
            xmax = Mathf.Clamp(xmax, 0, textureSize - 1);
            ymin = Mathf.Clamp(ymin, 0, textureSize - 1);
            ymax = Mathf.Clamp(ymax, 0, textureSize - 1);

            cx = Mathf.Clamp(cx, 0, textureSize - 1);
            cy = Mathf.Clamp(cy, 0, textureSize - 1);

            int     minRange = Mathf.RoundToInt(r.GetLOSInnerRadius() * r.GetLOSInnerRadius() * worldToTex * worldToTex);
            int     maxRange = Mathf.RoundToInt(r.GetLOSOuterRadius() * r.GetLOSOuterRadius() * worldToTex * worldToTex);
            int     variance = Mathf.RoundToInt(Mathf.Clamp01(MangoFogInstance.Instance.margin / (MangoFogInstance.Instance.heightRange.y - MangoFogInstance.Instance.heightRange.x)) * 255);
            Color32 white    = new Color32(255, 255, 255, 255);

            // Leave the edges unrevealed
            int limit = textureSize - 1;

            for (int y = ymin; y < ymax; ++y)
            {
                if (y > -1 && y < limit)
                {
                    for (int x = xmin; x < xmax; ++x)
                    {
                        if (x > -1 && x < limit)
                        {
                            int xd    = x - cx;
                            int yd    = y - cy;
                            int dist  = xd * xd + yd * yd;
                            int index = x + y * textureSize;

                            if (dist < minRange || (cx == x && cy == y))
                            {
                                buffer1[index] = white;
                            }
                            else if (dist < maxRange)
                            {
                                Vector2 v = new Vector2(xd, yd);
                                v.Normalize();
                                v *= r.GetRadius() / 2;

                                int sx = cx + Mathf.RoundToInt(v.x);
                                int sy = cy + Mathf.RoundToInt(v.y);

                                if (sx > -1 && sx < textureSize &&
                                    sy > -1 && sy < textureSize &&
                                    IsVisible(sx, sy, x, y, Mathf.Sqrt(dist), gh, variance, r.GetRot(), r.GetFOVCosine(), r.DoReverseLOSDirection()))
                                {
                                    buffer1[index] = white;
                                }
                            }
                        }
                    }
                }
            }
        }