diff options
author | UbitUmarov | 2016-09-17 16:42:40 +0100 |
---|---|---|
committer | UbitUmarov | 2016-09-17 16:42:40 +0100 |
commit | 71bd3ce49f1159251ec4339d098d93c2119729f0 (patch) | |
tree | b9d73349600abc18b63ee5201fc60b8a1d810334 /OpenSim/Data/PGSQL | |
parent | add to databases a table to store baked terrain. (diff) | |
download | opensim-SC_OLD-71bd3ce49f1159251ec4339d098d93c2119729f0.zip opensim-SC_OLD-71bd3ce49f1159251ec4339d098d93c2119729f0.tar.gz opensim-SC_OLD-71bd3ce49f1159251ec4339d098d93c2119729f0.tar.bz2 opensim-SC_OLD-71bd3ce49f1159251ec4339d098d93c2119729f0.tar.xz |
add load baked terrain methods
Diffstat (limited to 'OpenSim/Data/PGSQL')
-rwxr-xr-x | OpenSim/Data/PGSQL/PGSQLSimulationData.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs index e6161a2..902aae0 100755 --- a/OpenSim/Data/PGSQL/PGSQLSimulationData.cs +++ b/OpenSim/Data/PGSQL/PGSQLSimulationData.cs | |||
@@ -573,6 +573,39 @@ namespace OpenSim.Data.PGSQL | |||
573 | return terrData; | 573 | return terrData; |
574 | } | 574 | } |
575 | 575 | ||
576 | public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) | ||
577 | { | ||
578 | TerrainData terrData = null; | ||
579 | |||
580 | string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from bakedterrain | ||
581 | where ""RegionUUID"" = :RegionUUID; "; | ||
582 | |||
583 | using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString)) | ||
584 | { | ||
585 | using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn)) | ||
586 | { | ||
587 | // PGSqlParameter param = new PGSqlParameter(); | ||
588 | cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID)); | ||
589 | conn.Open(); | ||
590 | using (NpgsqlDataReader reader = cmd.ExecuteReader()) | ||
591 | { | ||
592 | int rev; | ||
593 | if (reader.Read()) | ||
594 | { | ||
595 | rev = Convert.ToInt32(reader["Revision"]); | ||
596 | if ((reader["Heightfield"] != DBNull.Value)) | ||
597 | { | ||
598 | byte[] blob = (byte[])reader["Heightfield"]; | ||
599 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | ||
600 | } | ||
601 | } | ||
602 | } | ||
603 | } | ||
604 | } | ||
605 | |||
606 | return terrData; | ||
607 | } | ||
608 | |||
576 | // Legacy entry point for when terrain was always a 256x256 heightmap | 609 | // Legacy entry point for when terrain was always a 256x256 heightmap |
577 | public void StoreTerrain(double[,] terrain, UUID regionID) | 610 | public void StoreTerrain(double[,] terrain, UUID regionID) |
578 | { | 611 | { |