diff options
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs')
-rw-r--r-- | OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs index 24b3f50..f704835 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/TerrainModule.cs | |||
@@ -54,6 +54,12 @@ namespace OpenSim.Region.Environment.Modules.Terrain | |||
54 | void RunEffect(ITerrainChannel map, double strength); | 54 | void RunEffect(ITerrainChannel map, double strength); |
55 | } | 55 | } |
56 | 56 | ||
57 | public interface ITerrainLoader | ||
58 | { | ||
59 | ITerrainChannel LoadFile(string filename); | ||
60 | void SaveFile(string filename); | ||
61 | } | ||
62 | |||
57 | /// <summary> | 63 | /// <summary> |
58 | /// A new version of the old Channel class, simplified | 64 | /// A new version of the old Channel class, simplified |
59 | /// </summary> | 65 | /// </summary> |
@@ -126,6 +132,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain | |||
126 | new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); | 132 | new Dictionary<StandardTerrainEffects, ITerrainPaintableEffect>(); |
127 | private Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects = | 133 | private Dictionary<StandardTerrainEffects, ITerrainFloodEffect> m_floodeffects = |
128 | new Dictionary<StandardTerrainEffects, ITerrainFloodEffect>(); | 134 | new Dictionary<StandardTerrainEffects, ITerrainFloodEffect>(); |
135 | private Dictionary<string, ITerrainLoader> m_loaders = new Dictionary<string, ITerrainLoader>(); | ||
129 | Scene m_scene; | 136 | Scene m_scene; |
130 | ITerrainChannel m_channel; | 137 | ITerrainChannel m_channel; |
131 | private IConfigSource m_gConfig; | 138 | private IConfigSource m_gConfig; |
@@ -134,6 +141,34 @@ namespace OpenSim.Region.Environment.Modules.Terrain | |||
134 | { | 141 | { |
135 | m_painteffects[StandardTerrainEffects.Raise] = new PaintBrushes.RaiseSphere(); | 142 | m_painteffects[StandardTerrainEffects.Raise] = new PaintBrushes.RaiseSphere(); |
136 | m_floodeffects[StandardTerrainEffects.Raise] = new FloodBrushes.RaiseArea(); | 143 | m_floodeffects[StandardTerrainEffects.Raise] = new FloodBrushes.RaiseArea(); |
144 | |||
145 | // Float[256,256] array format (RAW32) | ||
146 | m_loaders[".r32"] = new FileLoaders.RAW32(); | ||
147 | m_loaders[".f32"] = m_loaders[".r32"]; | ||
148 | } | ||
149 | |||
150 | public void LoadFromFile(string filename) | ||
151 | { | ||
152 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | ||
153 | { | ||
154 | if (filename.EndsWith(loader.Key)) | ||
155 | { | ||
156 | loader.Value.LoadFile(filename); | ||
157 | return; | ||
158 | } | ||
159 | } | ||
160 | } | ||
161 | |||
162 | public void SaveToFile(string filename) | ||
163 | { | ||
164 | foreach (KeyValuePair<string, ITerrainLoader> loader in m_loaders) | ||
165 | { | ||
166 | if (filename.EndsWith(loader.Key)) | ||
167 | { | ||
168 | loader.Value.SaveFile(filename); | ||
169 | return; | ||
170 | } | ||
171 | } | ||
137 | } | 172 | } |
138 | 173 | ||
139 | public void Initialise(Scene scene, IConfigSource config) | 174 | public void Initialise(Scene scene, IConfigSource config) |