OpenSim/Region/Framework/Scenes/TerrainCompressor.cs
/// <summary>
///     Add a patch of terrain to a BitPacker
/// </summary>
/// <param name="output">BitPacker to write the patch to</param>
/// <param name="heightmap">
///     Heightmap of the simulator. Presumed to be an sizeX*sizeY array.
/// </param>
/// <param name="patchX">
///     X offset of the patch to create.
/// </param>
/// <param name="patchY">
///     Y offset of the patch to create.
/// </param>
/// <param name="pRegionSizeX"></param>
/// <param name="pRegionSizeY"></param>
Add a patch of terrain to a BitPacker
Add a patch of terrain to a BitPacker
public static void CreatePatchFromHeightmap(BitPack output, TerrainData terrData, int patchX, int patchY)
        {
            TerrainPatch.Header header = PrescanPatch(terrData, patchX, patchY);
            header.QuantWBits = 136;
            if (terrData.SizeX > Constants.RegionSize || terrData.SizeY > Constants.RegionSize)
            {
                header.PatchIDs = (patchY & 0xFFFF);
                header.PatchIDs += (patchX << 16);
            }
            else
            {
                header.PatchIDs = (patchY & 0x1F);
                header.PatchIDs += (patchX << 5);
            }
            int wbits;
            int[] patch = CompressPatch(terrData, patchX, patchY, header, 10, out wbits);
            wbits = EncodePatchHeader(output, header, patch, (uint)terrData.SizeX, (uint)terrData.SizeY, wbits);
            EncodePatch(output, patch, 0, wbits);
        }
public static void CreatePatchFromHeightmap ( BitPack output , TerrainData terrData , int patchX , int patchY ) { TerrainPatch . Header header = PrescanPatch ( terrData , patchX , patchY ) ; header . QuantWBits = 136 ; if ( terrData . SizeX > Constants . RegionSize || terrData . SizeY > Constants . RegionSize ) { header . PatchIDs = ( patchY & 0xFFFF ) ; header . PatchIDs += ( patchX << 16 ) ; } else { header . PatchIDs = ( patchY & 0x1F ) ; header . PatchIDs += ( patchX << 5 ) ; } int wbits ; int [ ] patch = CompressPatch ( terrData , patchX , patchY , header , 10 , out wbits ) ; wbits = EncodePatchHeader ( output , header , patch , ( uint ) terrData . SizeX , ( uint ) terrData . SizeY , wbits ) ; EncodePatch ( output , patch , 0 , wbits ) ; }
Add a patch of terrain to a BitPacker
Add a patch of terrain to a BitPacker
// If larger than legacy region size, pack patch X and Y info differently. // m_log.DebugFormat("{0} CreatePatchFromHeightmap. patchX={1}, patchY={2}, DCOffset={3}, range={4}", //                         LogHeader, patchX, patchY, header.DCOffset, header.Range); // NOTE: No idea what prequant and postquant should be or what they do
output
BitPack
BitPacker to write the patch to
BitPacker to write the patch to
terrData
TerrainData
patchX
int
X offset of the patch to create.
X offset of the patch to create .
patchY
int
Y offset of the patch to create.
Y offset of the patch to create .
heightmap
Heightmap of the simulator. Presumed to be an sizeX*sizeY array.
Heightmap of the simulator . Presumed to be an sizeX * sizeY array .
pRegionSizeX
None
pRegionSizeY
None