diff options
author | UbitUmarov | 2016-09-17 15:45:11 +0100 |
---|---|---|
committer | UbitUmarov | 2016-09-17 15:45:11 +0100 |
commit | 3f9f10529548599d1810ca8a630734586ed3fa9d (patch) | |
tree | c889183859774ec4eb1032af2502ecf294b505cd /OpenSim/Data/PGSQL | |
parent | stop using legacy storeterrain in scene.cs (diff) | |
download | opensim-SC_OLD-3f9f10529548599d1810ca8a630734586ed3fa9d.zip opensim-SC_OLD-3f9f10529548599d1810ca8a630734586ed3fa9d.tar.gz opensim-SC_OLD-3f9f10529548599d1810ca8a630734586ed3fa9d.tar.bz2 opensim-SC_OLD-3f9f10529548599d1810ca8a630734586ed3fa9d.tar.xz |
add to databases a table to store baked terrain.
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Data/PGSQL/PGSQLSimulationData.cs | 43 | ||||
-rw-r--r-- | OpenSim/Data/PGSQL/Resources/RegionStore.migrations | 13 |
2 files changed, 56 insertions, 0 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs index 25e1a7f..e6161a2 100755 --- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs +++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs | |||
@@ -624,6 +624,49 @@ namespace OpenSim.Data.PGSQL | |||
624 | } | 624 | } |
625 | 625 | ||
626 | /// <summary> | 626 | /// <summary> |
627 | /// Stores the baked terrain map to DB. | ||
628 | /// </summary> | ||
629 | /// <param name="terrain">terrain map data.</param> | ||
630 | /// <param name="regionID">regionID.</param> | ||
631 | public void StoreBakedTerrain(TerrainData terrData, UUID regionID) | ||
632 | { | ||
633 | //Delete old terrain map | ||
634 | string sql = @"delete from bakedterrain where ""RegionUUID""=:RegionUUID"; | ||
635 | using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) | ||
636 | { | ||
637 | using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) | ||
638 | { | ||
639 | cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID)); | ||
640 | conn.Open(); | ||
641 | cmd.ExecuteNonQuery(); | ||
642 | |||
643 | _Log.InfoFormat("{0} Deleted bakedterrain id = {1}", LogHeader, regionID); | ||
644 | } | ||
645 | } | ||
646 | |||
647 | int terrainDBRevision; | ||
648 | Array terrainDBblob; | ||
649 | terrData.GetDatabaseBlob(out terrainDBRevision, out terrainDBblob); | ||
650 | |||
651 | sql = @"insert into bakedterrain(""RegionUUID"", ""Revision"", ""Heightfield"") values(:RegionUUID, :Revision, :Heightfield)"; | ||
652 | |||
653 | using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) | ||
654 | { | ||
655 | using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) | ||
656 | { | ||
657 | cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID)); | ||
658 | cmd.Parameters.Add(_Database.CreateParameter("Revision", terrainDBRevision)); | ||
659 | cmd.Parameters.Add(_Database.CreateParameter("Heightfield", terrainDBblob)); | ||
660 | conn.Open(); | ||
661 | cmd.ExecuteNonQuery(); | ||
662 | |||
663 | _Log.InfoFormat("{0} Stored bakedterrain id = {1}, terrainSize = <{2},{3}>", | ||
664 | LogHeader, regionID, terrData.SizeX, terrData.SizeY); | ||
665 | } | ||
666 | } | ||
667 | } | ||
668 | |||
669 | /// <summary> | ||
627 | /// Loads all the land objects of a region. | 670 | /// Loads all the land objects of a region. |
628 | /// </summary> | 671 | /// </summary> |
629 | /// <param name="regionUUID">The region UUID.</param> | 672 | /// <param name="regionUUID">The region UUID.</param> |
diff --git a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations index 9a2c19b..c085939 100644 --- a/OpenSim/Data/PGSQL/Resources/RegionStore.migrations +++ b/OpenSim/Data/PGSQL/Resources/RegionStore.migrations | |||
@@ -1182,3 +1182,16 @@ BEGIN TRANSACTION; | |||
1182 | ALTER TABLE prims ADD "RotationAxisLocks" smallint NOT NULL DEFAULT (0); | 1182 | ALTER TABLE prims ADD "RotationAxisLocks" smallint NOT NULL DEFAULT (0); |
1183 | 1183 | ||
1184 | COMMIT; | 1184 | COMMIT; |
1185 | |||
1186 | :VERSION 44 #---- add baked terrain store | ||
1187 | |||
1188 | BEGIN TRANSACTION; | ||
1189 | |||
1190 | CREATE TABLE bakedterrain | ||
1191 | ( | ||
1192 | "RegionUUID" uuid NULL, | ||
1193 | "Revision" int NULL, | ||
1194 | "Heightfield" bytea NULL | ||
1195 | ); | ||
1196 | |||
1197 | COMMIT; | ||