本文整理汇总了C#中ITerrainChannel.GetDoubles方法的典型用法代码示例。如果您正苦于以下问题:C# ITerrainChannel.GetDoubles方法的具体用法?C# ITerrainChannel.GetDoubles怎么用?C# ITerrainChannel.GetDoubles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ITerrainChannel
的用法示例。
在下文中一共展示了ITerrainChannel.GetDoubles方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadWorldWaterMap
/// <summary>
/// Loads the World heightmap
/// </summary>
public void LoadWorldWaterMap()
{
if (!m_use3DWater)
return;
try
{
double[,] map = m_scene.SimulationDataService.LoadWater(m_scene.RegionInfo.RegionID, false, m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY);
if (map == null)
{
m_log.Info("[TERRAIN]: No default water. Generating a new water.");
m_waterChannel = new TerrainChannel(m_scene);
m_scene.SimulationDataService.StoreWater(m_waterChannel.GetDoubles(m_scene), m_scene.RegionInfo.RegionID, false);
}
else
{
m_channel = new TerrainChannel(map, m_scene);
}
}
catch (IOException e)
{
m_log.Warn("[TERRAIN]: LoadWorldWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
// Non standard region size. If there's an old terrain in the database, it might read past the buffer
if (m_scene.RegionInfo.RegionSizeX != Constants.RegionSize || m_scene.RegionInfo.RegionSizeY != Constants.RegionSize)
{
m_waterChannel = new TerrainChannel(m_scene);
m_scene.SimulationDataService.StoreWater(m_waterChannel.GetDoubles(m_scene), m_scene.RegionInfo.RegionID, false);
}
}
catch (IndexOutOfRangeException e)
{
m_log.Warn("[TERRAIN]: LoadWorldWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
m_waterChannel = new TerrainChannel(m_scene);
m_scene.SimulationDataService.StoreWater(m_waterChannel.GetDoubles(m_scene), m_scene.RegionInfo.RegionID, false);
}
catch (ArgumentOutOfRangeException e)
{
m_log.Warn("[TERRAIN]: LoadWorldWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
m_waterChannel = new TerrainChannel(m_scene);
m_scene.SimulationDataService.StoreWater(m_waterChannel.GetDoubles(m_scene), m_scene.RegionInfo.RegionID, false);
}
catch (Exception e)
{
m_log.Warn("[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception " + e.ToString());
m_waterChannel = new TerrainChannel(m_scene);
m_scene.SimulationDataService.StoreWater(m_waterChannel.GetDoubles(m_scene), m_scene.RegionInfo.RegionID, false);
}
LoadRevertWaterMap();
}
示例2: LoadRevertWaterMap
/// <summary>
/// Loads the World Revert heightmap
/// </summary>
public void LoadRevertWaterMap()
{
try
{
double[,] map = m_scene.SimulationDataService.LoadWater(m_scene.RegionInfo.RegionID, true, m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY);
if (map == null)
{
m_waterRevert = m_waterChannel.MakeCopy();
m_scene.SimulationDataService.StoreWater(m_waterRevert.GetDoubles(m_scene), m_scene.RegionInfo.RegionID, true);
}
else
{
m_waterRevert = new TerrainChannel(map, m_scene);
}
}
catch (IOException e)
{
m_log.Warn("[TERRAIN]: LoadRevertWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
// Non standard region size. If there's an old terrain in the database, it might read past the buffer
if (m_scene.RegionInfo.RegionSizeX != Constants.RegionSize || m_scene.RegionInfo.RegionSizeY != Constants.RegionSize)
{
m_waterRevert = m_waterChannel.MakeCopy();
m_scene.SimulationDataService.StoreWater(m_waterRevert.GetDoubles(m_scene), m_scene.RegionInfo.RegionID, true);
}
}
catch (IndexOutOfRangeException e)
{
m_log.Warn("[TERRAIN]: LoadRevertWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
m_waterRevert = m_waterChannel.MakeCopy();
m_scene.SimulationDataService.StoreWater(m_waterRevert.GetDoubles(m_scene), m_scene.RegionInfo.RegionID, true);
}
catch (ArgumentOutOfRangeException e)
{
m_log.Warn("[TERRAIN]: LoadRevertWaterMap() - Failed with exception " + e.ToString() + " Regenerating");
m_waterRevert = m_waterChannel.MakeCopy();
m_scene.SimulationDataService.StoreWater(m_waterRevert.GetDoubles(m_scene), m_scene.RegionInfo.RegionID, true);
}
catch (Exception e)
{
m_log.Warn("[TERRAIN]: LoadRevertWaterMap() - Failed with exception " + e.ToString());
m_waterRevert = m_waterChannel.MakeCopy();
m_scene.SimulationDataService.StoreWater(m_waterRevert.GetDoubles(m_scene), m_scene.RegionInfo.RegionID, true);
}
}
示例3: SaveRevertTerrain
/// <summary>
/// Store the revert terrain in the persistant data store
/// </summary>
public void SaveRevertTerrain(ITerrainChannel channel)
{
SimulationDataService.StoreTerrain(channel.GetDoubles(), RegionInfo.RegionID, true);
}
示例4: applyModification
protected void applyModification(ITerrainChannel map, TerrainModifierData data)
{
bool[,] mask;
int xMax;
int yMax;
int xMid;
int yMid;
if (data.shape == "ellipse")
{
mask = this.ellipticalMask(data.dx, data.dy);
xMax = mask.GetLength(0);
yMax = mask.GetLength(1);
xMid = xMax / 2 + xMax % 2;
yMid = yMax / 2 + yMax % 2;
}
else
{
mask = this.rectangularMask(data.dx, data.dy);
xMax = mask.GetLength(0);
yMax = mask.GetLength(1);
xMid = 0;
yMid = 0;
}
// m_log.DebugFormat("Apply {0} mask {1}x{2} @ {3},{4}", data.shape, xMax, yMax, xMid, yMid);
double[,] buffer = map.GetDoubles();
int yDim = yMax;
while(--yDim >= 0)
{
int yPos = data.y0 + yDim - yMid;
if ((yPos >= 0) && (yPos < map.Height))
{
int xDim = xMax;
while(--xDim >= 0)
{
int xPos = data.x0 + xDim - xMid;
if ((xPos >= 0) && (xPos < map.Width) && (mask[xDim, yDim]))
{
double endElevation = this.operate(buffer, data, xPos, yPos);
map[xPos, yPos] = endElevation;
}
}
}
}
}
示例5: LoadWorldHeightmap
/// <summary>
/// Loads the World heightmap
/// </summary>
public void LoadWorldHeightmap()
{
try
{
double[,] map = m_scene.SimulationDataService.LoadTerrain(m_scene.RegionInfo.RegionID, false);
if (map == null)
{
m_log.Info("[TERRAIN]: No default terrain. Generating a new terrain.");
m_channel = new TerrainChannel(m_scene);
m_scene.SimulationDataService.StoreTerrain(m_channel.GetDoubles(m_scene), m_scene.RegionInfo.RegionID, false);
}
else
{
m_channel = new TerrainChannel(map, m_scene);
}
}
catch (IOException e)
{
m_log.Warn("[TERRAIN]: LoadWorldMap() - Failed with exception " + e.ToString() + " Regenerating");
#pragma warning disable 0162
// Non standard region size. If there's an old terrain in the database, it might read past the buffer
if ((int)Constants.RegionSize != 256)
{
m_channel = new TerrainChannel(m_scene);
m_scene.SimulationDataService.StoreTerrain(m_channel.GetDoubles(m_scene), m_scene.RegionInfo.RegionID, false);
}
#pragma warning restore 0162
}
catch (Exception e)
{
m_log.Warn("[TERRAIN]: Scene.cs: LoadWorldMap() - Failed with exception " + e.ToString());
}
m_scene.RegisterModuleInterface<ITerrainChannel>(m_channel);
}