diff options
author | Adam Frisby | 2008-02-26 16:18:57 +0000 |
---|---|---|
committer | Adam Frisby | 2008-02-26 16:18:57 +0000 |
commit | 5dc5214c5e7377df743a7e489811c8acdb6a5689 (patch) | |
tree | e8155c2b9541664b56d7d54df1f4cfb3a6d0cffb | |
parent | Update svn properties. (diff) | |
download | opensim-SC-5dc5214c5e7377df743a7e489811c8acdb6a5689.zip opensim-SC-5dc5214c5e7377df743a7e489811c8acdb6a5689.tar.gz opensim-SC-5dc5214c5e7377df743a7e489811c8acdb6a5689.tar.bz2 opensim-SC-5dc5214c5e7377df743a7e489811c8acdb6a5689.tar.xz |
* Implemented - Terragen File Format Loader for new Terrain Module.
Diffstat (limited to '')
3 files changed, 37 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FloodBrushes/RaiseArea.cs b/OpenSim/Region/Environment/Modules/Terrain/FloodBrushes/RaiseArea.cs index 8fd957b..258b363 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FloodBrushes/RaiseArea.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FloodBrushes/RaiseArea.cs | |||
@@ -6,7 +6,7 @@ using OpenSim.Region.Environment.Interfaces; | |||
6 | 6 | ||
7 | namespace OpenSim.Region.Environment.Modules.Terrain.FloodBrushes | 7 | namespace OpenSim.Region.Environment.Modules.Terrain.FloodBrushes |
8 | { | 8 | { |
9 | class RaiseArea : ITerrainFloodEffect | 9 | public class RaiseArea : ITerrainFloodEffect |
10 | { | 10 | { |
11 | #region ITerrainFloodEffect Members | 11 | #region ITerrainFloodEffect Members |
12 | 12 | ||
diff --git a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs index be4a0b7..ff7ec0b 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/PaintBrushes/RaiseSphere.cs | |||
@@ -6,7 +6,7 @@ using OpenSim.Region.Environment.Interfaces; | |||
6 | 6 | ||
7 | namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes | 7 | namespace OpenSim.Region.Environment.Modules.Terrain.PaintBrushes |
8 | { | 8 | { |
9 | class RaiseSphere : ITerrainPaintableEffect | 9 | public class RaiseSphere : ITerrainPaintableEffect |
10 | { | 10 | { |
11 | #region ITerrainPaintableEffect Members | 11 | #region ITerrainPaintableEffect Members |
12 | 12 | ||
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) |