Add and plumb the usetex URL parameter to worldview. Required but not yet

functional
viewer-2-initial-appearance
Melanie 2010-10-06 05:44:19 +01:00
parent 9a1c8db443
commit d45276b3f6
5 changed files with 20 additions and 14 deletions

View File

@ -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;
}

View File

@ -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];

View File

@ -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();
}
}

View File

@ -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();

View File

@ -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);
}
}
}