예제 #1
0
        private void RevertSphere(bool[] allowMask, ref bool[] editMask, float rx, float ry, float rz, float size, float seconds)
        {
            float[] heightmap = m_terrain.GetHeightmap();
            float[] revertMap = m_terrain.GetOriginalHeightmap();

            float s = (size + 1.0f) * 1.35f;

            float margin = s + 0.5f;
            int   xFrom  = (int)(rx - margin);
            int   xTo    = (int)(rx + margin) + 1;
            int   yFrom  = (int)(ry - margin);
            int   yTo    = (int)(ry + margin) + 1;

            if (xFrom < 0)
            {
                xFrom = 0;
            }
            if (yFrom < 0)
            {
                yFrom = 0;
            }
            if (xTo > 256)
            {
                xTo = 256;
            }
            if (yTo > 256)
            {
                yTo = 256;
            }

            for (int y = yFrom; y < yTo; y++)
            {
                for (int x = xFrom; x < xTo; x++)
                {
                    // Check the allow mask to see if we are allowed to edit this part of the heightmap
                    if (!allowMask[(y / 4) * 64 + (x / 4)])
                    {
                        continue;
                    }

                    // FIXME: Finish this
                }
            }
        }