diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index 9002a9f..3c48d07 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | |||
@@ -63,6 +63,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
63 | private bool m_useAntiAliasing = false; // TODO: Make this a config option | 63 | private bool m_useAntiAliasing = false; // TODO: Make this a config option |
64 | private bool m_Enabled = false; | 64 | private bool m_Enabled = false; |
65 | 65 | ||
66 | private Bitmap lastImage = null; | ||
67 | private DateTime lastImageTime = DateTime.MinValue; | ||
68 | |||
66 | #region IRegionModule Members | 69 | #region IRegionModule Members |
67 | 70 | ||
68 | public void Initialise(IConfigSource source) | 71 | public void Initialise(IConfigSource source) |
@@ -85,14 +88,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
85 | 88 | ||
86 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); | 89 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); |
87 | if (renderers.Count > 0) | 90 | if (renderers.Count > 0) |
88 | { | 91 | m_log.Info("[MAPTILE]: Loaded prim mesher " + renderers[0]); |
89 | m_primMesher = RenderingLoader.LoadRenderer(renderers[0]); | ||
90 | m_log.DebugFormat("[WARP 3D IMAGE MODULE]: Loaded prim mesher {0}", m_primMesher); | ||
91 | } | ||
92 | else | 92 | else |
93 | { | 93 | m_log.Info("[MAPTILE]: No prim mesher loaded, prim rendering will be disabled"); |
94 | m_log.Debug("[WARP 3D IMAGE MODULE]: No prim mesher loaded, prim rendering will be disabled"); | ||
95 | } | ||
96 | 94 | ||
97 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); | 95 | m_scene.RegisterModuleInterface<IMapImageGenerator>(this); |
98 | } | 96 | } |
@@ -125,9 +123,25 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
125 | 123 | ||
126 | public Bitmap CreateMapTile() | 124 | public Bitmap CreateMapTile() |
127 | { | 125 | { |
126 | if ((DateTime.Now - lastImageTime).TotalSeconds < 3600) | ||
127 | { | ||
128 | return lastImage.Clone(new Rectangle(0, 0, 256, 256), lastImage.PixelFormat); | ||
129 | } | ||
130 | |||
131 | List<string> renderers = RenderingLoader.ListRenderers(Util.ExecutingDirectory()); | ||
132 | if (renderers.Count > 0) | ||
133 | { | ||
134 | m_primMesher = RenderingLoader.LoadRenderer(renderers[0]); | ||
135 | } | ||
136 | |||
128 | Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f); | 137 | Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f); |
129 | Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, (int)Constants.RegionSize, (int)Constants.RegionSize, (float)Constants.RegionSize, (float)Constants.RegionSize); | 138 | Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, (int)Constants.RegionSize, (int)Constants.RegionSize, (float)Constants.RegionSize, (float)Constants.RegionSize); |
130 | return CreateMapTile(viewport, false); | 139 | Bitmap tile = CreateMapTile(viewport, false); |
140 | m_primMesher = null; | ||
141 | |||
142 | lastImage = tile; | ||
143 | lastImageTime = DateTime.Now; | ||
144 | return lastImage.Clone(new Rectangle(0, 0, 256, 256), lastImage.PixelFormat); | ||
131 | } | 145 | } |
132 | 146 | ||
133 | public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures) | 147 | public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures) |
@@ -673,4 +687,4 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap | |||
673 | return result; | 687 | return result; |
674 | } | 688 | } |
675 | } | 689 | } |
676 | } \ No newline at end of file | 690 | } |