Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-10-06 05:45:29 +01:00
commit ca50f6a82c
5 changed files with 20 additions and 14 deletions

View File

@ -560,7 +560,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
return returnpt; 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; return null;
} }

View File

@ -128,16 +128,16 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
{ {
Vector3 camPos = new Vector3(127.5f, 127.5f, 221.7025033688163f); 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); 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); 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 drawPrimVolume = true;
bool textureTerrain = true; bool textureTerrain = true;
@ -198,7 +198,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
CreateWater(renderer); CreateWater(renderer);
CreateTerrain(renderer, textureTerrain); CreateTerrain(renderer, textureTerrain);
if (drawPrimVolume) if (drawPrimVolume)
CreateAllPrims(renderer); CreateAllPrims(renderer, useTextures);
renderer.Render(); renderer.Render();
Bitmap bitmap = renderer.Scene.getImage(); Bitmap bitmap = renderer.Scene.getImage();
@ -325,7 +325,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
renderer.SetObjectMaterial("Terrain", "TerrainColor"); renderer.SetObjectMaterial("Terrain", "TerrainColor");
} }
private void CreateAllPrims(WarpRenderer renderer) private void CreateAllPrims(WarpRenderer renderer, bool useTextures)
{ {
if (m_primMesher == null) if (m_primMesher == null)
return; return;
@ -333,14 +333,15 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
m_scene.ForEachSOG( m_scene.ForEachSOG(
delegate(SceneObjectGroup group) delegate(SceneObjectGroup group)
{ {
CreatePrim(renderer, group.RootPart); CreatePrim(renderer, group.RootPart, useTextures);
foreach (SceneObjectPart child in group.Parts) 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; const float MIN_SIZE = 2f;
@ -371,6 +372,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
string primID = prim.UUID.ToString(); string primID = prim.UUID.ToString();
// Create the prim faces // Create the prim faces
// TODO: Implement the useTextures flag behavior
for (int i = 0; i < renderMesh.Faces.Count; i++) for (int i = 0; i < renderMesh.Faces.Count; i++)
{ {
Face face = renderMesh.Faces[i]; Face face = renderMesh.Faces[i];

View File

@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Interfaces
public interface IMapImageGenerator public interface IMapImageGenerator
{ {
System.Drawing.Bitmap CreateMapTile(); 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(); byte[] WriteJpeg2000Image();
} }
} }

View File

@ -104,13 +104,13 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
} }
public byte[] GenerateWorldView(Vector3 pos, Vector3 rot, float fov, public byte[] GenerateWorldView(Vector3 pos, Vector3 rot, float fov,
int width, int height) int width, int height, bool usetex)
{ {
if (!m_Enabled) if (!m_Enabled)
return new Byte[0]; return new Byte[0];
Bitmap bmp = m_Generator.CreateViewImage(pos, rot, fov, width, Bitmap bmp = m_Generator.CreateViewImage(pos, rot, fov, width,
height); height, usetex);
MemoryStream str = new MemoryStream(); MemoryStream str = new MemoryStream();

View File

@ -96,6 +96,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
float fov; float fov;
int width; int width;
int height; int height;
bool usetex;
if (!request.ContainsKey("posX")) if (!request.ContainsKey("posX"))
return new Byte[0]; return new Byte[0];
@ -115,6 +116,8 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
return new Byte[0]; return new Byte[0];
if (!request.ContainsKey("height")) if (!request.ContainsKey("height"))
return new Byte[0]; return new Byte[0];
if (!request.ContainsKey("usetex"))
return new Byte[0];
try try
{ {
@ -127,6 +130,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
fov = Convert.ToSingle(request["fov"]); fov = Convert.ToSingle(request["fov"]);
width = Convert.ToInt32(request["width"]); width = Convert.ToInt32(request["width"]);
height = Convert.ToInt32(request["height"]); height = Convert.ToInt32(request["height"]);
usetex = Convert.ToBoolean(request["usetex"]);
} }
catch catch
{ {
@ -137,7 +141,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
Vector3 rot = new Vector3(rotX, rotY, rotZ); Vector3 rot = new Vector3(rotX, rotY, rotZ);
return m_WorldViewModule.GenerateWorldView(pos, rot, fov, width, return m_WorldViewModule.GenerateWorldView(pos, rot, fov, width,
height); height, usetex);
} }
} }
} }