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/MySQL | |
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/MySQL')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLSimulationData.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/OpenSim/Data/MySQL/MySQLSimulationData.cs b/OpenSim/Data/MySQL/MySQLSimulationData.cs index 1a57199..ab24b76 100644 --- a/OpenSim/Data/MySQL/MySQLSimulationData.cs +++ b/OpenSim/Data/MySQL/MySQLSimulationData.cs | |||
@@ -733,6 +733,41 @@ namespace OpenSim.Data.MySQL | |||
733 | return terrData; | 733 | return terrData; |
734 | } | 734 | } |
735 | 735 | ||
736 | public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) | ||
737 | { | ||
738 | TerrainData terrData = null; | ||
739 | |||
740 | lock (m_dbLock) | ||
741 | { | ||
742 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
743 | { | ||
744 | dbcon.Open(); | ||
745 | |||
746 | using (MySqlCommand cmd = dbcon.CreateCommand()) | ||
747 | { | ||
748 | cmd.CommandText = "select RegionUUID, Revision, Heightfield " + | ||
749 | "from bakedterrain where RegionUUID = ?RegionUUID "; | ||
750 | cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString()); | ||
751 | |||
752 | using (IDataReader reader = ExecuteReader(cmd)) | ||
753 | { | ||
754 | while (reader.Read()) | ||
755 | { | ||
756 | int rev = Convert.ToInt32(reader["Revision"]); | ||
757 | if ((reader["Heightfield"] != DBNull.Value)) | ||
758 | { | ||
759 | byte[] blob = (byte[])reader["Heightfield"]; | ||
760 | terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob); | ||
761 | } | ||
762 | } | ||
763 | } | ||
764 | } | ||
765 | } | ||
766 | } | ||
767 | |||
768 | return terrData; | ||
769 | } | ||
770 | |||
736 | public virtual void RemoveLandObject(UUID globalID) | 771 | public virtual void RemoveLandObject(UUID globalID) |
737 | { | 772 | { |
738 | lock (m_dbLock) | 773 | lock (m_dbLock) |