diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r-- | OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | 28 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs | 46 |
2 files changed, 52 insertions, 22 deletions
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index 8408bf9..f86c790 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs | |||
@@ -59,7 +59,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
59 | public face[] trns; | 59 | public face[] trns; |
60 | } | 60 | } |
61 | 61 | ||
62 | public class MapImageModule : IMapImageGenerator, IRegionModule | 62 | public class MapImageModule : IMapImageGenerator, INonSharedRegionModule |
63 | { | 63 | { |
64 | private static readonly ILog m_log = | 64 | private static readonly ILog m_log = |
65 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 65 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -67,6 +67,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
67 | private Scene m_scene; | 67 | private Scene m_scene; |
68 | private IConfigSource m_config; | 68 | private IConfigSource m_config; |
69 | private IMapTileTerrainRenderer terrainRenderer; | 69 | private IMapTileTerrainRenderer terrainRenderer; |
70 | private bool m_Enabled = false; | ||
70 | 71 | ||
71 | #region IMapImageGenerator Members | 72 | #region IMapImageGenerator Members |
72 | 73 | ||
@@ -132,9 +133,8 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
132 | 133 | ||
133 | #region IRegionModule Members | 134 | #region IRegionModule Members |
134 | 135 | ||
135 | public void Initialise(Scene scene, IConfigSource source) | 136 | public void Initialise(IConfigSource source) |
136 | { | 137 | { |
137 | m_scene = scene; | ||
138 | m_config = source; | 138 | m_config = source; |
139 | 139 | ||
140 | IConfig startupConfig = m_config.Configs["Startup"]; | 140 | IConfig startupConfig = m_config.Configs["Startup"]; |
@@ -142,10 +142,24 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
142 | "MapImageModule") | 142 | "MapImageModule") |
143 | return; | 143 | return; |
144 | 144 | ||
145 | m_Enabled = true; | ||
146 | } | ||
147 | |||
148 | public void AddRegion(Scene scene) | ||
149 | { | ||
150 | if (!m_Enabled) | ||
151 | return; | ||
152 | |||
153 | m_scene = scene; | ||
154 | |||
145 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); | 155 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); |
146 | } | 156 | } |
147 | 157 | ||
148 | public void PostInitialise() | 158 | public void RegionLoaded(Scene scene) |
159 | { | ||
160 | } | ||
161 | |||
162 | public void RemoveRegion(Scene scene) | ||
149 | { | 163 | { |
150 | } | 164 | } |
151 | 165 | ||
@@ -158,9 +172,9 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
158 | get { return "MapImageModule"; } | 172 | get { return "MapImageModule"; } |
159 | } | 173 | } |
160 | 174 | ||
161 | public bool IsSharedModule | 175 | public Type ReplaceableInterface |
162 | { | 176 | { |
163 | get { return false; } | 177 | get { return null; } |
164 | } | 178 | } |
165 | 179 | ||
166 | #endregion | 180 | #endregion |
@@ -546,7 +560,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap | |||
546 | return returnpt; | 560 | return returnpt; |
547 | } | 561 | } |
548 | 562 | ||
549 | public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height) | 563 | public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures) |
550 | { | 564 | { |
551 | return null; | 565 | return null; |
552 | } | 566 | } |
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs index 803a33a..00b506e 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs | |||
@@ -49,7 +49,7 @@ using WarpRenderer = global::Warp3D.Warp3D; | |||
49 | 49 | ||
50 | namespace OpenSim.Region.CoreModules.World.Warp3DMap | 50 | namespace OpenSim.Region.CoreModules.World.Warp3DMap |
51 | { | 51 | { |
52 | public class Warp3DImageModule : IMapImageGenerator, IRegionModule | 52 | public class Warp3DImageModule : IMapImageGenerator, INonSharedRegionModule |
53 | { | 53 | { |
54 | private static readonly UUID TEXTURE_METADATA_MAGIC = new UUID("802dc0e0-f080-4931-8b57-d1be8611c4f3"); | 54 | private static readonly UUID TEXTURE_METADATA_MAGIC = new UUID("802dc0e0-f080-4931-8b57-d1be8611c4f3"); |
55 | private static readonly Color4 WATER_COLOR = new Color4(29, 71, 95, 216); | 55 | private static readonly Color4 WATER_COLOR = new Color4(29, 71, 95, 216); |
@@ -62,18 +62,28 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
62 | private IConfigSource m_config; | 62 | private IConfigSource m_config; |
63 | private Dictionary<UUID, Color4> m_colors = new Dictionary<UUID, Color4>(); | 63 | private Dictionary<UUID, Color4> m_colors = new Dictionary<UUID, Color4>(); |
64 | private bool m_useAntiAliasing = true; // TODO: Make this a config option | 64 | private bool m_useAntiAliasing = true; // TODO: Make this a config option |
65 | private bool m_Enabled = false; | ||
65 | 66 | ||
66 | #region IRegionModule Members | 67 | #region IRegionModule Members |
67 | 68 | ||
68 | public void Initialise(Scene scene, IConfigSource source) | 69 | public void Initialise(IConfigSource source) |
69 | { | 70 | { |
70 | m_scene = scene; | ||
71 | m_config = source; | 71 | m_config = source; |
72 | 72 | ||
73 | IConfig startupConfig = m_config.Configs["Startup"]; | 73 | IConfig startupConfig = m_config.Configs["Startup"]; |
74 | if (startupConfig.GetString("MapImageModule", "MapImageModule") != "Warp3DImageModule") | 74 | if (startupConfig.GetString("MapImageModule", "MapImageModule") != "Warp3DImageModule") |
75 | return; | 75 | return; |
76 | 76 | ||
77 | m_Enabled = true; | ||
78 | } | ||
79 | |||
80 | public void AddRegion(Scene scene) | ||
81 | { | ||
82 | if (!m_Enabled) | ||
83 | return; | ||
84 | |||
85 | m_scene = scene; | ||
86 | |||
77 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); | 87 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); |
78 | if (renderers.Count > 0) | 88 | if (renderers.Count > 0) |
79 | { | 89 | { |
@@ -88,7 +98,11 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
88 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); | 98 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); |
89 | } | 99 | } |
90 | 100 | ||
91 | public void PostInitialise() | 101 | public void RegionLoaded(Scene scene) |
102 | { | ||
103 | } | ||
104 | |||
105 | public void RemoveRegion(Scene scene) | ||
92 | { | 106 | { |
93 | } | 107 | } |
94 | 108 | ||
@@ -101,9 +115,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
101 | get { return "Warp3DImageModule"; } | 115 | get { return "Warp3DImageModule"; } |
102 | } | 116 | } |
103 | 117 | ||
104 | public bool IsSharedModule | 118 | public Type ReplaceableInterface |
105 | { | 119 | { |
106 | get { return false; } | 120 | get { return null; } |
107 | } | 121 | } |
108 | 122 | ||
109 | #endregion | 123 | #endregion |
@@ -114,16 +128,16 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
114 | { | 128 | { |
115 | Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f); | 129 | Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f); |
116 | Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, (int)Constants.RegionSize, (int)Constants.RegionSize, (float)Constants.RegionSize, (float)Constants.RegionSize); | 130 | Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, (int)Constants.RegionSize, (int)Constants.RegionSize, (float)Constants.RegionSize, (float)Constants.RegionSize); |
117 | return CreateMapTile(viewport); | 131 | return CreateMapTile(viewport, false); |
118 | } | 132 | } |
119 | 133 | ||
120 | public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height) | 134 | public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures) |
121 | { | 135 | { |
122 | Viewport viewport = new Viewport(camPos, camDir, fov, (float)Constants.RegionSize, 0.1f, width, height); | 136 | Viewport viewport = new Viewport(camPos, camDir, fov, (float)Constants.RegionSize, 0.1f, width, height); |
123 | return CreateMapTile(viewport); | 137 | return CreateMapTile(viewport, useTextures); |
124 | } | 138 | } |
125 | 139 | ||
126 | public Bitmap CreateMapTile(Viewport viewport) | 140 | public Bitmap CreateMapTile(Viewport viewport, bool useTextures) |
127 | { | 141 | { |
128 | bool drawPrimVolume = true; | 142 | bool drawPrimVolume = true; |
129 | bool textureTerrain = true; | 143 | bool textureTerrain = true; |
@@ -184,7 +198,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
184 | CreateWater(renderer); | 198 | CreateWater(renderer); |
185 | CreateTerrain(renderer, textureTerrain); | 199 | CreateTerrain(renderer, textureTerrain); |
186 | if (drawPrimVolume) | 200 | if (drawPrimVolume) |
187 | CreateAllPrims(renderer); | 201 | CreateAllPrims(renderer, useTextures); |
188 | 202 | ||
189 | renderer.Render(); | 203 | renderer.Render(); |
190 | Bitmap bitmap = renderer.Scene.getImage(); | 204 | Bitmap bitmap = renderer.Scene.getImage(); |
@@ -311,7 +325,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
311 | renderer.SetObjectMaterial("Terrain", "TerrainColor"); | 325 | renderer.SetObjectMaterial("Terrain", "TerrainColor"); |
312 | } | 326 | } |
313 | 327 | ||
314 | private void CreateAllPrims(WarpRenderer renderer) | 328 | private void CreateAllPrims(WarpRenderer renderer, bool useTextures) |
315 | { | 329 | { |
316 | if (m_primMesher == null) | 330 | if (m_primMesher == null) |
317 | return; | 331 | return; |
@@ -319,14 +333,15 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
319 | m_scene.ForEachSOG( | 333 | m_scene.ForEachSOG( |
320 | delegate(SceneObjectGroup group) | 334 | delegate(SceneObjectGroup group) |
321 | { | 335 | { |
322 | CreatePrim(renderer, group.RootPart); | 336 | CreatePrim(renderer, group.RootPart, useTextures); |
323 | foreach (SceneObjectPart child in group.Parts) | 337 | foreach (SceneObjectPart child in group.Parts) |
324 | CreatePrim(renderer, child); | 338 | CreatePrim(renderer, child, useTextures); |
325 | } | 339 | } |
326 | ); | 340 | ); |
327 | } | 341 | } |
328 | 342 | ||
329 | private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim) | 343 | private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim, |
344 | bool useTextures) | ||
330 | { | 345 | { |
331 | const float MIN_SIZE = 2f; | 346 | const float MIN_SIZE = 2f; |
332 | 347 | ||
@@ -357,6 +372,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
357 | string primID = prim.UUID.ToString(); | 372 | string primID = prim.UUID.ToString(); |
358 | 373 | ||
359 | // Create the prim faces | 374 | // Create the prim faces |
375 | // TODO: Implement the useTextures flag behavior | ||
360 | for (int i = 0; i < renderMesh.Faces.Count; i++) | 376 | for (int i = 0; i < renderMesh.Faces.Count; i++) |
361 | { | 377 | { |
362 | Face face = renderMesh.Faces[i]; | 378 | Face face = renderMesh.Faces[i]; |