mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 03:15:41 +08:00
add to databases a table to store baked terrain.
This commit is contained in:
@@ -623,6 +623,49 @@ namespace OpenSim.Data.PGSQL
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stores the baked terrain map to DB.
|
||||
/// </summary>
|
||||
/// <param name="terrain">terrain map data.</param>
|
||||
/// <param name="regionID">regionID.</param>
|
||||
public void StoreBakedTerrain(TerrainData terrData, UUID regionID)
|
||||
{
|
||||
//Delete old terrain map
|
||||
string sql = @"delete from bakedterrain where ""RegionUUID""=:RegionUUID";
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
{
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
|
||||
conn.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
_Log.InfoFormat("{0} Deleted bakedterrain id = {1}", LogHeader, regionID);
|
||||
}
|
||||
}
|
||||
|
||||
int terrainDBRevision;
|
||||
Array terrainDBblob;
|
||||
terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
|
||||
|
||||
sql = @"insert into bakedterrain(""RegionUUID"", ""Revision"", ""Heightfield"") values(:RegionUUID, :Revision, :Heightfield)";
|
||||
|
||||
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||
{
|
||||
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||
{
|
||||
cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("Revision", terrainDBRevision));
|
||||
cmd.Parameters.Add(_Database.CreateParameter("Heightfield", terrainDBblob));
|
||||
conn.Open();
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
_Log.InfoFormat("{0} Stored bakedterrain id = {1}, terrainSize = <{2},{3}>",
|
||||
LogHeader, regionID, terrData.SizeX, terrData.SizeY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads all the land objects of a region.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user