示例#1
0
        public GridBufferPosition[,] CreatePositionGrid(IPointDataChunk segmentBuffer, short entrySize)
        {
            // create tile position counters (always buffer)
            var tilePositions = new GridBufferPosition[m_grid.SizeY + 1, m_grid.SizeX + 1];

            {
                var index = 0;
                foreach (var tile in GetCellOrdering())
                {
                    var count = m_grid.Data[tile.Row, tile.Col];
                    var pos   = new GridBufferPosition(segmentBuffer, index, count, entrySize);
                    tilePositions[tile.Row, tile.Col] = pos;

                    index += count;
                }

                // buffer the edges for overflow
                for (var x = 0; x < m_grid.SizeX; x++)
                {
                    tilePositions[m_grid.SizeY, x] = tilePositions[m_grid.SizeY - 1, x];
                }
                for (var y = 0; y <= m_grid.SizeY; y++)
                {
                    tilePositions[y, m_grid.SizeX] = tilePositions[y, m_grid.SizeX - 1];
                }
            }

            return(tilePositions);
        }
示例#2
0
        public GridBufferPosition[,] CreatePositionGrid(IPointDataChunk segmentBuffer, short entrySize)
        {
            // create tile position counters (always buffer)
            var tilePositions = new GridBufferPosition[m_grid.SizeY + 1, m_grid.SizeX + 1];
            {
                var index = 0;
                foreach (var tile in GetCellOrdering())
                {
                    var count = m_grid.Data[tile.Row, tile.Col];
                    var pos = new GridBufferPosition(segmentBuffer, index, count, entrySize);
                    tilePositions[tile.Row, tile.Col] = pos;

                    index += count;
                }

                // buffer the edges for overflow
                for (var x = 0; x < m_grid.SizeX; x++)
                    tilePositions[m_grid.SizeY, x] = tilePositions[m_grid.SizeY - 1, x];
                for (var y = 0; y <= m_grid.SizeY; y++)
                    tilePositions[y, m_grid.SizeX] = tilePositions[y, m_grid.SizeX - 1];
            }

            return tilePositions;
        }