mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +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>
|
||||
|
||||
@@ -1182,3 +1182,16 @@ BEGIN TRANSACTION;
|
||||
ALTER TABLE prims ADD "RotationAxisLocks" smallint NOT NULL DEFAULT (0);
|
||||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 44 #---- add baked terrain store
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
|
||||
CREATE TABLE bakedterrain
|
||||
(
|
||||
"RegionUUID" uuid NULL,
|
||||
"Revision" int NULL,
|
||||
"Heightfield" bytea NULL
|
||||
);
|
||||
|
||||
COMMIT;
|
||||
|
||||
Reference in New Issue
Block a user