From 9a1c8db443ee1de3a0153b4ea177280b8036cf6f Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Oct 2010 05:15:47 +0200 Subject: Convert worldview to GET --- .../World/WorldView/WorldViewRequestHandler.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs index 5e744bf..bfdcdb4 100644 --- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs +++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView protected Object m_RequestLock = new Object(); public WorldViewRequestHandler(WorldViewModule fmodule, string rid) - : base("POST", "/worldview/" + rid) + : base("GET", "/worldview/" + rid) { m_WorldViewModule = fmodule; } @@ -58,24 +58,28 @@ namespace OpenSim.Region.OptionalModules.World.WorldView public override byte[] Handle(string path, Stream requestData, OSHttpRequest httpRequest, OSHttpResponse httpResponse) { - StreamReader sr = new StreamReader(requestData); - string body = sr.ReadToEnd(); - sr.Close(); - body = body.Trim(); + httpResponse.ContentType = "image/jpeg"; + +// StreamReader sr = new StreamReader(requestData); +// string body = sr.ReadToEnd(); +// sr.Close(); +// body = body.Trim(); try { lock (m_RequestLock) { Dictionary request = - ServerUtils.ParseQueryString(body); + new Dictionary(); + foreach (string name in httpRequest.QueryString) + request[name] = httpRequest.QueryString[name]; return SendWorldView(request); } } catch (Exception e) { - m_log.Debug("[WORLDVIEW]: Exception {0}" + e.ToString()); + m_log.Debug("[WORLDVIEW]: Exception: " + e.ToString()); } return new Byte[0]; -- cgit v1.1 From d45276b3f6a309f77ddfac1e83dbe2db377883fa Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 6 Oct 2010 05:44:19 +0100 Subject: Add and plumb the usetex URL parameter to worldview. Required but not yet functional --- .../CoreModules/World/LegacyMap/MapImageModule.cs | 2 +- .../CoreModules/World/Warp3DMap/MapImageModule.cs | 20 +++++++++++--------- OpenSim/Region/Framework/Interfaces/ITerrain.cs | 2 +- .../World/WorldView/WorldViewModule.cs | 4 ++-- .../World/WorldView/WorldViewRequestHandler.cs | 6 +++++- 5 files changed, 20 insertions(+), 14 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs index c9ef1f4..f86c790 100644 --- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs @@ -560,7 +560,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap return returnpt; } - public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height) + public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures) { return null; } diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs index eca85d3..00b506e 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/MapImageModule.cs @@ -128,16 +128,16 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap { Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f); Viewport viewport = new Viewport(camPos, -Vector3.UnitZ, 1024f, 0.1f, (int)Constants.RegionSize, (int)Constants.RegionSize, (float)Constants.RegionSize, (float)Constants.RegionSize); - return CreateMapTile(viewport); + return CreateMapTile(viewport, false); } - public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height) + public Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures) { Viewport viewport = new Viewport(camPos, camDir, fov, (float)Constants.RegionSize, 0.1f, width, height); - return CreateMapTile(viewport); + return CreateMapTile(viewport, useTextures); } - public Bitmap CreateMapTile(Viewport viewport) + public Bitmap CreateMapTile(Viewport viewport, bool useTextures) { bool drawPrimVolume = true; bool textureTerrain = true; @@ -198,7 +198,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap CreateWater(renderer); CreateTerrain(renderer, textureTerrain); if (drawPrimVolume) - CreateAllPrims(renderer); + CreateAllPrims(renderer, useTextures); renderer.Render(); Bitmap bitmap = renderer.Scene.getImage(); @@ -325,7 +325,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap renderer.SetObjectMaterial("Terrain", "TerrainColor"); } - private void CreateAllPrims(WarpRenderer renderer) + private void CreateAllPrims(WarpRenderer renderer, bool useTextures) { if (m_primMesher == null) return; @@ -333,14 +333,15 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap m_scene.ForEachSOG( delegate(SceneObjectGroup group) { - CreatePrim(renderer, group.RootPart); + CreatePrim(renderer, group.RootPart, useTextures); foreach (SceneObjectPart child in group.Parts) - CreatePrim(renderer, child); + CreatePrim(renderer, child, useTextures); } ); } - private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim) + private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim, + bool useTextures) { const float MIN_SIZE = 2f; @@ -371,6 +372,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap string primID = prim.UUID.ToString(); // Create the prim faces + // TODO: Implement the useTextures flag behavior for (int i = 0; i < renderMesh.Faces.Count; i++) { Face face = renderMesh.Faces[i]; diff --git a/OpenSim/Region/Framework/Interfaces/ITerrain.cs b/OpenSim/Region/Framework/Interfaces/ITerrain.cs index 38cf020..815a2d8 100644 --- a/OpenSim/Region/Framework/Interfaces/ITerrain.cs +++ b/OpenSim/Region/Framework/Interfaces/ITerrain.cs @@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Interfaces public interface IMapImageGenerator { System.Drawing.Bitmap CreateMapTile(); - System.Drawing.Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height); + System.Drawing.Bitmap CreateViewImage(Vector3 camPos, Vector3 camDir, float fov, int width, int height, bool useTextures); byte[] WriteJpeg2000Image(); } } diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs index 55be9ba..d4b7020 100644 --- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs +++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs @@ -104,13 +104,13 @@ namespace OpenSim.Region.OptionalModules.World.WorldView } public byte[] GenerateWorldView(Vector3 pos, Vector3 rot, float fov, - int width, int height) + int width, int height, bool usetex) { if (!m_Enabled) return new Byte[0]; Bitmap bmp = m_Generator.CreateViewImage(pos, rot, fov, width, - height); + height, usetex); MemoryStream str = new MemoryStream(); diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs index bfdcdb4..f47d9c7 100644 --- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs +++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewRequestHandler.cs @@ -96,6 +96,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView float fov; int width; int height; + bool usetex; if (!request.ContainsKey("posX")) return new Byte[0]; @@ -115,6 +116,8 @@ namespace OpenSim.Region.OptionalModules.World.WorldView return new Byte[0]; if (!request.ContainsKey("height")) return new Byte[0]; + if (!request.ContainsKey("usetex")) + return new Byte[0]; try { @@ -127,6 +130,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView fov = Convert.ToSingle(request["fov"]); width = Convert.ToInt32(request["width"]); height = Convert.ToInt32(request["height"]); + usetex = Convert.ToBoolean(request["usetex"]); } catch { @@ -137,7 +141,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView Vector3 rot = new Vector3(rotX, rotY, rotZ); return m_WorldViewModule.GenerateWorldView(pos, rot, fov, width, - height); + height, usetex); } } } -- cgit v1.1