Universe.Physics.BulletSPlugin.BSTerrainManager.UpdateTerrain C# (CSharp) Method

UpdateTerrain() private method

private UpdateTerrain ( uint id, float heightMap ) : void
id uint
heightMap float
return void
        void UpdateTerrain(uint id, float[] heightMap)
        {
            DetailLog("{0},BSTerrainManager.UpdateTerrain,call,id={1}",
                BSScene.DetailLogZero, id);

            if (m_terrain != null)
            {
                // There is already a terrain in this spot. Free the old and build the new.
                DetailLog("{0},BSTErrainManager.UpdateTerrain:UpdateExisting,call,id={1}",
                    BSScene.DetailLogZero, id);

                // Release any physical memory it may be using.
                m_terrain.Dispose();

                m_terrain = BuildPhysicalTerrain(id, heightMap);

                m_terrainModified = true;
            }
            else
            {
                // We don't know about this terrain so either we are creating a new terrain or
                //    our mega-prim child is giving us a new terrain to add to the phys world

                // if this is a child terrain, calculate a unique terrain id
                uint newTerrainID = id;
                if (newTerrainID >= BSScene.CHILDTERRAIN_ID)
                    newTerrainID = ++m_terrainCount;

                DetailLog("{0},BSTerrainManager.UpdateTerrain:NewTerrain,taint,newID={1}",
                    BSScene.DetailLogZero, newTerrainID);
                m_terrain = BuildPhysicalTerrain(id, heightMap);

                m_terrainModified = true;
            }
        }