mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
add to databases a table to store baked terrain.
This commit is contained in:
@@ -639,6 +639,53 @@ namespace OpenSim.Data.MySQL
|
||||
});
|
||||
}
|
||||
|
||||
public void StoreBakedTerrain(TerrainData terrData, UUID regionID)
|
||||
{
|
||||
Util.FireAndForget(delegate(object x)
|
||||
{
|
||||
m_log.Info("[REGION DB]: Storing Baked terrain");
|
||||
|
||||
lock (m_dbLock)
|
||||
{
|
||||
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||
{
|
||||
dbcon.Open();
|
||||
|
||||
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||
{
|
||||
cmd.CommandText = "delete from bakedterrain where RegionUUID = ?RegionUUID";
|
||||
cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
|
||||
|
||||
using (MySqlCommand cmd2 = dbcon.CreateCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd2.CommandText = "insert into bakedterrain (RegionUUID, " +
|
||||
"Revision, Heightfield) values (?RegionUUID, " +
|
||||
"?Revision, ?Heightfield)";
|
||||
|
||||
int terrainDBRevision;
|
||||
Array terrainDBblob;
|
||||
terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob);
|
||||
|
||||
cmd2.Parameters.AddWithValue("RegionUUID", regionID.ToString());
|
||||
cmd2.Parameters.AddWithValue("Revision", terrainDBRevision);
|
||||
cmd2.Parameters.AddWithValue("Heightfield", terrainDBblob);
|
||||
|
||||
ExecuteNonQuery(cmd);
|
||||
ExecuteNonQuery(cmd2);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat(e.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Legacy region loading
|
||||
public virtual double[,] LoadTerrain(UUID regionID)
|
||||
{
|
||||
|
||||
@@ -379,3 +379,14 @@ ALTER TABLE `prims` ADD COLUMN `RotationAxisLocks` tinyint(4) NOT NULL default '
|
||||
|
||||
COMMIT;
|
||||
|
||||
:VERSION 54 #----- add baked terrain store
|
||||
|
||||
BEGIN;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `bakedterrain` (
|
||||
`RegionUUID` varchar(255) DEFAULT NULL,
|
||||
`Revision` int(11) DEFAULT NULL,
|
||||
`Heightfield` longblob
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
COMMIT;
|
||||
|
||||
Reference in New Issue
Block a user