Exemplo n.º 1
0
        // assign values to the extra borders of the heightmap.
        public void PrepareSides()
        {
            int end = m_resolution - 1;

            ProfilerShort.Begin("Copy Range");
            Front.CopyRange(new Vector2I(0, -1), new Vector2I(end, -1), Top, new Vector2I(0, end), new Vector2I(end, end));
            Front.CopyRange(new Vector2I(0, m_resolution), new Vector2I(end, m_resolution), Bottom, new Vector2I(end, end), new Vector2I(0, end));
            Front.CopyRange(new Vector2I(-1, 0), new Vector2I(-1, end), Left, new Vector2I(end, 0), new Vector2I(end, end));
            Front.CopyRange(new Vector2I(m_resolution, 0), new Vector2I(m_resolution, end), Right, new Vector2I(0, 0), new Vector2I(0, end));

            Back.CopyRange(new Vector2I(end, -1), new Vector2I(0, -1), Top, new Vector2I(0, 0), new Vector2I(end, 0));
            Back.CopyRange(new Vector2I(end, m_resolution), new Vector2I(0, m_resolution), Bottom, new Vector2I(end, 0), new Vector2I(0, 0));
            Back.CopyRange(new Vector2I(-1, 0), new Vector2I(-1, end), Right, new Vector2I(end, 0), new Vector2I(end, end));
            Back.CopyRange(new Vector2I(m_resolution, 0), new Vector2I(m_resolution, end), Left, new Vector2I(0, 0), new Vector2I(0, end));

            Left.CopyRange(new Vector2I(end, -1), new Vector2I(0, -1), Top, new Vector2I(0, end), new Vector2I(0, 0));
            Left.CopyRange(new Vector2I(end, m_resolution), new Vector2I(0, m_resolution), Bottom, new Vector2I(end, end), new Vector2I(end, 0));
            Left.CopyRange(new Vector2I(m_resolution, 0), new Vector2I(m_resolution, end), Front, new Vector2I(0, 0), new Vector2I(0, end));
            Left.CopyRange(new Vector2I(-1, 0), new Vector2I(-1, end), Back, new Vector2I(end, 0), new Vector2I(end, end));

            Right.CopyRange(new Vector2I(end, -1), new Vector2I(0, -1), Top, new Vector2I(end, 0), new Vector2I(end, end));
            Right.CopyRange(new Vector2I(end, m_resolution), new Vector2I(0, m_resolution), Bottom, new Vector2I(0, 0), new Vector2I(0, end));
            Right.CopyRange(new Vector2I(m_resolution, 0), new Vector2I(m_resolution, end), Back, new Vector2I(0, 0), new Vector2I(0, end));
            Right.CopyRange(new Vector2I(-1, 0), new Vector2I(-1, end), Front, new Vector2I(end, 0), new Vector2I(end, end));

            Top.CopyRange(new Vector2I(0, m_resolution), new Vector2I(end, m_resolution), Front, new Vector2I(0, 0), new Vector2I(end, 0));
            Top.CopyRange(new Vector2I(0, -1), new Vector2I(end, -1), Back, new Vector2I(end, 0), new Vector2I(0, 0));
            Top.CopyRange(new Vector2I(m_resolution, 0), new Vector2I(m_resolution, end), Right, new Vector2I(end, 0), new Vector2I(0, 0));
            Top.CopyRange(new Vector2I(-1, 0), new Vector2I(-1, end), Left, new Vector2I(0, 0), new Vector2I(end, 0));

            Bottom.CopyRange(new Vector2I(0, m_resolution), new Vector2I(end, m_resolution), Front, new Vector2I(end, end), new Vector2I(0, end));
            Bottom.CopyRange(new Vector2I(0, -1), new Vector2I(end, -1), Back, new Vector2I(0, end), new Vector2I(end, end));
            Bottom.CopyRange(new Vector2I(-1, 0), new Vector2I(-1, end), Right, new Vector2I(end, end), new Vector2I(0, end));
            Bottom.CopyRange(new Vector2I(m_resolution, 0), new Vector2I(m_resolution, end), Left, new Vector2I(0, end), new Vector2I(end, end));

            ProfilerShort.BeginNextBlock("Assign Borders");
            for (int i = 0; i < 6; ++i)
            {
                Faces[i].FinishFace(string.Format("{0}_{1}", Name, MyCubemapHelpers.GetNameForFace(i)));
            }
            ProfilerShort.End();
        }