* Implemented - Terragen File Format Loader for new Terrain Module.

0.6.0-stable
Adam Frisby 2008-02-26 16:18:57 +00:00
parent 74940c7b1d
commit 5dc5214c5e
3 changed files with 37 additions and 2 deletions

View File

@ -6,7 +6,7 @@ using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Modules.Terrain.FloodBrushes namespace OpenSim.Region.Environment.Modules.Terrain.FloodBrushes
{ {
class RaiseArea : ITerrainFloodEffect public class RaiseArea : ITerrainFloodEffect
{ {
#region ITerrainFloodEffect Members #region ITerrainFloodEffect Members

View File

@ -6,7 +6,7 @@ using OpenSim.Region.Environment.Interfaces;
namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes
{ {
class RaiseSphere : ITerrainPaintableEffect public class RaiseSphere : ITerrainPaintableEffect
{ {
#region ITerrainPaintableEffect Members #region ITerrainPaintableEffect Members

View File

@ -54,6 +54,12 @@ namespace OpenSim.Region.Environment.Modules.Terrain
void RunEffect(ITerrainChannel map, double strength); void RunEffect(ITerrainChannel map, double strength);
} }
public interface ITerrainLoader
{
ITerrainChannel LoadFile(string filename);
void SaveFile(string filename);
}
/// <summary> /// <summary>
/// A new version of the old Channel class, simplified /// A new version of the old Channel class, simplified
/// </summary> /// </summary>
@ -126,6 +132,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain
new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>();
private Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects = private Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects =
new Dictionary<StandardTerrainEffects, ITerrainFloodEffect>(); new Dictionary<StandardTerrainEffects, ITerrainFloodEffect>();
private Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>();
Scene m_scene; Scene m_scene;
ITerrainChannel m_channel; ITerrainChannel m_channel;
private IConfigSource m_gConfig; private IConfigSource m_gConfig;
@ -134,6 +141,34 @@ namespace OpenSim.Region.Environment.Modules.Terrain
{ {
m_painteffects[StandardTerrainEffects.Raise] = new PaintBrushes.RaiseSphere(); m_painteffects[StandardTerrainEffects.Raise] = new PaintBrushes.RaiseSphere();
m_floodeffects[StandardTerrainEffects.Raise] = new FloodBrushes.RaiseArea(); m_floodeffects[StandardTerrainEffects.Raise] = new FloodBrushes.RaiseArea();
// Float[256,256] array format (RAW32)
m_loaders[".r32"] = new FileLoaders.RAW32();
m_loaders[".f32"] = m_loaders[".r32"];
}
public void LoadFromFile(string filename)
{
foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
{
if (filename.EndsWith(loader.Key))
{
loader.Value.LoadFile(filename);
return;
}
}
}
public void SaveToFile(string filename)
{
foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders)
{
if (filename.EndsWith(loader.Key))
{
loader.Value.SaveFile(filename);
return;
}
}
} }
public void Initialise(Scene scene, IConfigSource config) public void Initialise(Scene scene, IConfigSource config)