add load baked terrain methods
parent
3f9f105295
commit
71bd3ce49f
|
@ -733,6 +733,41 @@ namespace OpenSim.Data.MySQL
|
||||||
return terrData;
|
return terrData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
|
||||||
|
{
|
||||||
|
TerrainData terrData = null;
|
||||||
|
|
||||||
|
lock (m_dbLock)
|
||||||
|
{
|
||||||
|
using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
|
||||||
|
{
|
||||||
|
dbcon.Open();
|
||||||
|
|
||||||
|
using (MySqlCommand cmd = dbcon.CreateCommand())
|
||||||
|
{
|
||||||
|
cmd.CommandText = "select RegionUUID, Revision, Heightfield " +
|
||||||
|
"from bakedterrain where RegionUUID = ?RegionUUID ";
|
||||||
|
cmd.Parameters.AddWithValue("RegionUUID", regionID.ToString());
|
||||||
|
|
||||||
|
using (IDataReader reader = ExecuteReader(cmd))
|
||||||
|
{
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
int rev = Convert.ToInt32(reader["Revision"]);
|
||||||
|
if ((reader["Heightfield"] != DBNull.Value))
|
||||||
|
{
|
||||||
|
byte[] blob = (byte[])reader["Heightfield"];
|
||||||
|
terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return terrData;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual void RemoveLandObject(UUID globalID)
|
public virtual void RemoveLandObject(UUID globalID)
|
||||||
{
|
{
|
||||||
lock (m_dbLock)
|
lock (m_dbLock)
|
||||||
|
|
|
@ -175,6 +175,15 @@ namespace OpenSim.Data.Null
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
|
||||||
|
{
|
||||||
|
if (m_bakedterrains.ContainsKey(regionID))
|
||||||
|
{
|
||||||
|
return m_bakedterrains[regionID];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void RemoveLandObject(UUID globalID)
|
public void RemoveLandObject(UUID globalID)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -573,6 +573,39 @@ namespace OpenSim.Data.PGSQL
|
||||||
return terrData;
|
return terrData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
|
||||||
|
{
|
||||||
|
TerrainData terrData = null;
|
||||||
|
|
||||||
|
string sql = @"select ""RegionUUID"", ""Revision"", ""Heightfield"" from bakedterrain
|
||||||
|
where ""RegionUUID"" = :RegionUUID; ";
|
||||||
|
|
||||||
|
using (NpgsqlConnection conn = new NpgsqlConnection(m_connectionString))
|
||||||
|
{
|
||||||
|
using (NpgsqlCommand cmd = new NpgsqlCommand(sql, conn))
|
||||||
|
{
|
||||||
|
// PGSqlParameter param = new PGSqlParameter();
|
||||||
|
cmd.Parameters.Add(_Database.CreateParameter("RegionUUID", regionID));
|
||||||
|
conn.Open();
|
||||||
|
using (NpgsqlDataReader reader = cmd.ExecuteReader())
|
||||||
|
{
|
||||||
|
int rev;
|
||||||
|
if (reader.Read())
|
||||||
|
{
|
||||||
|
rev = Convert.ToInt32(reader["Revision"]);
|
||||||
|
if ((reader["Heightfield"] != DBNull.Value))
|
||||||
|
{
|
||||||
|
byte[] blob = (byte[])reader["Heightfield"];
|
||||||
|
terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return terrData;
|
||||||
|
}
|
||||||
|
|
||||||
// Legacy entry point for when terrain was always a 256x256 heightmap
|
// Legacy entry point for when terrain was always a 256x256 heightmap
|
||||||
public void StoreTerrain(double[,] terrain, UUID regionID)
|
public void StoreTerrain(double[,] terrain, UUID regionID)
|
||||||
{
|
{
|
||||||
|
|
|
@ -950,6 +950,34 @@ namespace OpenSim.Data.SQLite
|
||||||
return terrData;
|
return terrData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
|
||||||
|
{
|
||||||
|
TerrainData terrData = null;
|
||||||
|
|
||||||
|
lock (ds)
|
||||||
|
{
|
||||||
|
String sql = "select RegionUUID, Revision, Heightfield from backedterrain" +
|
||||||
|
" where RegionUUID=:RegionUUID";
|
||||||
|
|
||||||
|
using (SqliteCommand cmd = new SqliteCommand(sql, m_conn))
|
||||||
|
{
|
||||||
|
cmd.Parameters.Add(new SqliteParameter(":RegionUUID", regionID.ToString()));
|
||||||
|
|
||||||
|
using (IDataReader row = cmd.ExecuteReader())
|
||||||
|
{
|
||||||
|
int rev = 0;
|
||||||
|
if (row.Read())
|
||||||
|
{
|
||||||
|
rev = Convert.ToInt32(row["Revision"]);
|
||||||
|
byte[] blob = (byte[])row["Heightfield"];
|
||||||
|
terrData = TerrainData.CreateFromDatabaseBlobFactory(pSizeX, pSizeY, pSizeZ, rev, blob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return terrData;
|
||||||
|
}
|
||||||
|
|
||||||
public void RemoveLandObject(UUID globalID)
|
public void RemoveLandObject(UUID globalID)
|
||||||
{
|
{
|
||||||
lock (ds)
|
lock (ds)
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
void StoreTerrain(double[,] terrain, UUID regionID);
|
void StoreTerrain(double[,] terrain, UUID regionID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load the latest terrain revision from region storage
|
/// Load terrain from region storage
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="regionID">the region UUID</param>
|
/// <param name="regionID">the region UUID</param>
|
||||||
/// <param name="pSizeX">the X dimension of the terrain being filled</param>
|
/// <param name="pSizeX">the X dimension of the terrain being filled</param>
|
||||||
|
@ -101,6 +101,7 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <param name="pSizeZ">the Z dimension of the terrain being filled</param>
|
/// <param name="pSizeZ">the Z dimension of the terrain being filled</param>
|
||||||
/// <returns>Heightfield data</returns>
|
/// <returns>Heightfield data</returns>
|
||||||
TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ);
|
TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ);
|
||||||
|
TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ);
|
||||||
|
|
||||||
// Legacy version kept for downward compabibility
|
// Legacy version kept for downward compabibility
|
||||||
double[,] LoadTerrain(UUID regionID);
|
double[,] LoadTerrain(UUID regionID);
|
||||||
|
|
|
@ -124,6 +124,11 @@ namespace OpenSim.Services.SimulationService
|
||||||
return m_database.LoadTerrain(regionID, pSizeX, pSizeY, pSizeZ);
|
return m_database.LoadTerrain(regionID, pSizeX, pSizeY, pSizeZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
|
||||||
|
{
|
||||||
|
return m_database.LoadBakedTerrain(regionID, pSizeX, pSizeY, pSizeZ);
|
||||||
|
}
|
||||||
|
|
||||||
public void StoreLandObject(ILandObject Parcel)
|
public void StoreLandObject(ILandObject Parcel)
|
||||||
{
|
{
|
||||||
m_database.StoreLandObject(Parcel);
|
m_database.StoreLandObject(Parcel);
|
||||||
|
|
|
@ -89,6 +89,11 @@ namespace OpenSim.Data.Null
|
||||||
return m_store.LoadTerrain(regionID, pSizeX, pSizeY, pSizeZ);
|
return m_store.LoadTerrain(regionID, pSizeX, pSizeY, pSizeZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
|
||||||
|
{
|
||||||
|
return m_store.LoadBakedTerrain(regionID, pSizeX, pSizeY, pSizeZ);
|
||||||
|
}
|
||||||
|
|
||||||
public void StoreLandObject(ILandObject Parcel)
|
public void StoreLandObject(ILandObject Parcel)
|
||||||
{
|
{
|
||||||
m_store.StoreLandObject(Parcel);
|
m_store.StoreLandObject(Parcel);
|
||||||
|
@ -343,6 +348,14 @@ namespace OpenSim.Data.Null
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TerrainData LoadBakedTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ)
|
||||||
|
{
|
||||||
|
if (m_bakedterrains.ContainsKey(regionID))
|
||||||
|
return m_bakedterrains[regionID];
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public double[,] LoadTerrain(UUID regionID)
|
public double[,] LoadTerrain(UUID regionID)
|
||||||
{
|
{
|
||||||
if (m_terrains.ContainsKey(regionID))
|
if (m_terrains.ContainsKey(regionID))
|
||||||
|
|
Loading…
Reference in New Issue