* AssetServerBase: _ProcessRequest is now called GetAsset

* PrimitiveBaseShape: The textures are now exposed as a 'TextureEntry Textures'; all serialization still using the 'byte[] TextureEntry' for backwards compatibility.
* Scene: Re-added AddTree, since the Tree type isn't gone from libsl, merely relocated.
afrisby
lbsa71 2007-12-27 14:00:30 +00:00
parent dfbc6e101e
commit 87e2a694e2
13 changed files with 82 additions and 39 deletions

View File

@ -72,7 +72,7 @@ namespace OpenSim.Framework.Communications.Cache
} }
} }
protected override AssetBase _ProcessRequest(AssetRequest req) protected override AssetBase GetAsset(AssetRequest req)
{ {
byte[] idata = null; byte[] idata = null;
bool found = false; bool found = false;

View File

@ -54,16 +54,16 @@ namespace OpenSim.Framework.Communications.Cache
/// </summary> /// </summary>
/// <param name="req"></param> /// <param name="req"></param>
/// <returns></returns> /// <returns></returns>
protected abstract AssetBase _ProcessRequest(AssetRequest req); protected abstract AssetBase GetAsset(AssetRequest req);
/// <summary> /// <summary>
/// Process an asset request. This method will call _ProcessRequest(AssetRequest req) /// Process an asset request. This method will call GetAsset(AssetRequest req)
/// on the subclass. /// on the subclass.
/// </summary> /// </summary>
/// <param name="req"></param> /// <param name="req"></param>
protected void ProcessRequest(AssetRequest req) protected virtual void ProcessRequest(AssetRequest req)
{ {
AssetBase asset = _ProcessRequest(req); AssetBase asset = GetAsset(req);
if (asset != null) if (asset != null)
{ {

View File

@ -47,7 +47,7 @@ namespace OpenSim.Framework.Communications.Cache
#region IAssetServer Members #region IAssetServer Members
protected override AssetBase _ProcessRequest(AssetRequest req) protected override AssetBase GetAsset(AssetRequest req)
{ {
Stream s = null; Stream s = null;
try try

View File

@ -77,7 +77,7 @@ namespace OpenSim.Framework.Communications.Cache
m_assetProviderPlugin.CommitAssets(); m_assetProviderPlugin.CommitAssets();
} }
protected override AssetBase _ProcessRequest(AssetRequest req) protected override AssetBase GetAsset(AssetRequest req)
{ {
AssetBase asset; AssetBase asset;
lock (syncLock) lock (syncLock)

View File

@ -916,7 +916,10 @@ namespace OpenSim.Framework.Data.MySQL
s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]);
s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]);
s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
s.TextureEntry = (byte[])row["Texture"];
byte[] textureEntry = (byte[])row["Texture"];
s.TextureEntry = textureEntry;
s.ExtraParams = (byte[])row["ExtraParams"]; s.ExtraParams = (byte[])row["ExtraParams"];
return s; return s;

View File

@ -28,6 +28,7 @@
using System.Xml.Serialization; using System.Xml.Serialization;
using libsecondlife; using libsecondlife;
using System;
namespace OpenSim.Framework namespace OpenSim.Framework
{ {
@ -63,9 +64,10 @@ namespace OpenSim.Framework
Flexible = 128 Flexible = 128
} }
[Serializable]
public class PrimitiveBaseShape public class PrimitiveBaseShape
{ {
private static readonly byte[] m_defaultTextureEntry; private static readonly LLObject.TextureEntry m_defaultTexture;
public byte State; public byte State;
public byte PCode; public byte PCode;
@ -88,7 +90,35 @@ namespace OpenSim.Framework
public sbyte PathTaperY; public sbyte PathTaperY;
public sbyte PathTwist; public sbyte PathTwist;
public sbyte PathTwistBegin; public sbyte PathTwistBegin;
public byte[] TextureEntry; // a LL textureEntry in byte[] format
[XmlIgnore]
public LLObject.TextureEntry Textures
{
get
{
return new LLObject.TextureEntry(m_textureEntry, 0, m_textureEntry.Length);
}
set
{
m_textureEntry = value.ToBytes();
}
}
private byte[] m_textureEntry;
public byte[] TextureEntry
{
get
{
return m_textureEntry;
}
set
{
m_textureEntry = value;
}
}
public byte[] ExtraParams; public byte[] ExtraParams;
public ProfileShape ProfileShape public ProfileShape ProfileShape
@ -117,17 +147,19 @@ namespace OpenSim.Framework
get { return Scale; } get { return Scale; }
} }
static PrimitiveBaseShape() static PrimitiveBaseShape()
{ {
m_defaultTextureEntry = m_defaultTexture =
new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")).ToBytes(); new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005"));
} }
public PrimitiveBaseShape() public PrimitiveBaseShape()
{ {
PCode = (byte) PCodeEnum.Primitive; PCode = (byte) PCodeEnum.Primitive;
ExtraParams = new byte[1]; ExtraParams = new byte[1];
TextureEntry = m_defaultTextureEntry; Textures = m_defaultTexture;
} }
public static PrimitiveBaseShape Create() public static PrimitiveBaseShape Create()

View File

@ -3474,7 +3474,7 @@ namespace OpenSim.Region.ClientStack
shape.PathTwist = addPacket.ObjectData.PathTwist; shape.PathTwist = addPacket.ObjectData.PathTwist;
shape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin; shape.PathTwistBegin = addPacket.ObjectData.PathTwistBegin;
LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005")); LLObject.TextureEntry ntex = new LLObject.TextureEntry(new LLUUID("00000000-0000-0000-9999-000000000005"));
shape.TextureEntry = ntex.ToBytes(); shape.Textures = ntex;
return shape; return shape;
} }

View File

@ -182,7 +182,7 @@ namespace OpenSim.Region.Environment.Modules
LastAssetID = asset.FullID; LastAssetID = asset.FullID;
SceneObjectPart part = scene.GetSceneObjectPart(PrimID); SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
part.Shape.TextureEntry = new LLObject.TextureEntry(asset.FullID).ToBytes(); part.Shape.Textures = new LLObject.TextureEntry(asset.FullID);
part.ScheduleFullUpdate(); part.ScheduleFullUpdate();
} }
} }

View File

@ -1006,19 +1006,18 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
/* Tree has been removed from libSL
public void AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position, public void AddTree(LLVector3 scale, LLQuaternion rotation, LLVector3 position,
libsecondlife.ObjectManager.Tree treeType, bool newTree) Tree treeType, bool newTree)
{ {
PrimitiveBaseShape treeShape = new PrimitiveBaseShape(); PrimitiveBaseShape treeShape = new PrimitiveBaseShape();
treeShape.PathCurve = 16; treeShape.PathCurve = 16;
treeShape.PathEnd = 49900; treeShape.PathEnd = 49900;
treeShape.PCode = newTree ? (byte)libsecondlife.ObjectManager.PCode.NewTree : (byte)libsecondlife.ObjectManager.PCode.Tree; treeShape.PCode = newTree ? (byte)PCode.NewTree : (byte)PCode.Tree;
treeShape.Scale = scale; treeShape.Scale = scale;
treeShape.State = (byte)treeType; treeShape.State = (byte)treeType;
AddNewPrim(LLUUID.Random(), position, rotation, treeShape); AddNewPrim(LLUUID.Random(), position, rotation, treeShape);
} }
*/
public void RemovePrim(uint localID, LLUUID avatar_deleter) public void RemovePrim(uint localID, LLUUID avatar_deleter)
{ {
m_innerScene.RemovePrim(localID, avatar_deleter); m_innerScene.RemovePrim(localID, avatar_deleter);

View File

@ -1323,7 +1323,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="textureEntry"></param> /// <param name="textureEntry"></param>
public void UpdateTextureEntry(byte[] textureEntry) public void UpdateTextureEntry(byte[] textureEntry)
{ {
m_shape.TextureEntry = textureEntry; m_shape.Textures = new LLObject.TextureEntry( textureEntry, 0, textureEntry.Length );
ScheduleFullUpdate(); ScheduleFullUpdate();
} }

View File

@ -459,7 +459,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public void llSetColor(LSL_Types.Vector3 color, int face) public void llSetColor(LSL_Types.Vector3 color, int face)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(m_host.Shape.TextureEntry, 0, m_host.Shape.TextureEntry.Length); LLObject.TextureEntry tex = m_host.Shape.Textures;
LLColor texcolor; LLColor texcolor;
if (face > -1) if (face > -1)
{ {
@ -498,7 +498,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public double llGetAlpha(int face) public double llGetAlpha(int face)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(m_host.Shape.TextureEntry, 0, m_host.Shape.TextureEntry.Length); LLObject.TextureEntry tex = m_host.Shape.Textures;
if (face == -1) // TMP: Until we can determine number of sides, ALL_SIDES (-1) will return default color if (face == -1) // TMP: Until we can determine number of sides, ALL_SIDES (-1) will return default color
{ {
return (double)((tex.DefaultTexture.RGBA.A * 255) / 255); return (double)((tex.DefaultTexture.RGBA.A * 255) / 255);
@ -512,7 +512,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public void llSetAlpha(double alpha, int face) public void llSetAlpha(double alpha, int face)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(m_host.Shape.TextureEntry, 0, m_host.Shape.TextureEntry.Length); LLObject.TextureEntry tex = m_host.Shape.Textures;
LLColor texcolor; LLColor texcolor;
if (face > -1) if (face > -1)
{ {
@ -545,7 +545,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public LSL_Types.Vector3 llGetColor(int face) public LSL_Types.Vector3 llGetColor(int face)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(m_host.Shape.TextureEntry, 0, m_host.Shape.TextureEntry.Length); LLObject.TextureEntry tex = m_host.Shape.Textures;
LLColor texcolor; LLColor texcolor;
LSL_Types.Vector3 rgb; LSL_Types.Vector3 rgb;
if (face == -1) // TMP: Until we can determine number of sides, ALL_SIDES (-1) will return default color if (face == -1) // TMP: Until we can determine number of sides, ALL_SIDES (-1) will return default color
@ -570,7 +570,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public void llSetTexture(string texture, int face) public void llSetTexture(string texture, int face)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(m_host.Shape.TextureEntry, 0, m_host.Shape.TextureEntry.Length); LLObject.TextureEntry tex = m_host.Shape.Textures;
if (face > -1) if (face > -1)
{ {
LLObject.TextureEntryFace texface = tex.CreateFace((uint)face); LLObject.TextureEntryFace texface = tex.CreateFace((uint)face);
@ -598,7 +599,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public void llScaleTexture(double u, double v, int face) public void llScaleTexture(double u, double v, int face)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(m_host.Shape.TextureEntry, 0, m_host.Shape.TextureEntry.Length); LLObject.TextureEntry tex = m_host.Shape.Textures;
if (face > -1) if (face > -1)
{ {
LLObject.TextureEntryFace texface = tex.CreateFace((uint)face); LLObject.TextureEntryFace texface = tex.CreateFace((uint)face);
@ -629,7 +630,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public void llOffsetTexture(double u, double v, int face) public void llOffsetTexture(double u, double v, int face)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(m_host.Shape.TextureEntry, 0, m_host.Shape.TextureEntry.Length); LLObject.TextureEntry tex = m_host.Shape.Textures;
if (face > -1) if (face > -1)
{ {
LLObject.TextureEntryFace texface = tex.CreateFace((uint)face); LLObject.TextureEntryFace texface = tex.CreateFace((uint)face);
@ -660,7 +661,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public void llRotateTexture(double rotation, int face) public void llRotateTexture(double rotation, int face)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(m_host.Shape.TextureEntry, 0, m_host.Shape.TextureEntry.Length); LLObject.TextureEntry tex = m_host.Shape.Textures;
if (face > -1) if (face > -1)
{ {
LLObject.TextureEntryFace texface = tex.CreateFace((uint)face); LLObject.TextureEntryFace texface = tex.CreateFace((uint)face);
@ -688,7 +689,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public string llGetTexture(int face) public string llGetTexture(int face)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(m_host.Shape.TextureEntry, 0, m_host.Shape.TextureEntry.Length); LLObject.TextureEntry tex = m_host.Shape.Textures;
if (face == -1) if (face == -1)
{ {
face = 0; face = 0;
@ -1172,7 +1173,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknumber); SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknumber);
if (linknumber > -1) if (linknumber > -1)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(part.Shape.TextureEntry, 0, part.Shape.TextureEntry.Length); LLObject.TextureEntry tex = part.Shape.Textures;
LLColor texcolor; LLColor texcolor;
if (face > -1) if (face > -1)
{ {
@ -1219,7 +1220,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
{ {
linknumber = w; linknumber = w;
part = m_host.ParentGroup.GetLinkNumPart(linknumber); part = m_host.ParentGroup.GetLinkNumPart(linknumber);
LLObject.TextureEntry tex = new LLObject.TextureEntry(part.Shape.TextureEntry, 0, part.Shape.TextureEntry.Length); LLObject.TextureEntry tex = part.Shape.Textures;
LLColor texcolor; LLColor texcolor;
if (face > -1) if (face > -1)
{ {
@ -1467,7 +1468,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public LSL_Types.Vector3 llGetTextureOffset(int face) public LSL_Types.Vector3 llGetTextureOffset(int face)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(m_host.Shape.TextureEntry, 0, m_host.Shape.TextureEntry.Length); LLObject.TextureEntry tex = m_host.Shape.Textures;
LSL_Types.Vector3 offset; LSL_Types.Vector3 offset;
if (face == -1) if (face == -1)
{ {
@ -1481,7 +1482,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public LSL_Types.Vector3 llGetTextureScale(int side) public LSL_Types.Vector3 llGetTextureScale(int side)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(m_host.Shape.TextureEntry, 0, m_host.Shape.TextureEntry.Length); LLObject.TextureEntry tex = m_host.Shape.Textures;
LSL_Types.Vector3 scale; LSL_Types.Vector3 scale;
if (side == -1) if (side == -1)
{ {
@ -1495,7 +1496,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
public double llGetTextureRot(int face) public double llGetTextureRot(int face)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(m_host.Shape.TextureEntry, 0, m_host.Shape.TextureEntry.Length); LLObject.TextureEntry tex = m_host.Shape.Textures;
if (face == -1) if (face == -1)
{ {
face = 0; face = 0;
@ -2413,7 +2414,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknumber); SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknumber);
if (linknumber > -1) if (linknumber > -1)
{ {
LLObject.TextureEntry tex = new LLObject.TextureEntry(part.Shape.TextureEntry, 0, part.Shape.TextureEntry.Length); LLObject.TextureEntry tex = part.Shape.Textures;
LLColor texcolor; LLColor texcolor;
if (face > -1) if (face > -1)
{ {
@ -2452,7 +2453,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
{ {
linknumber = w; linknumber = w;
part = m_host.ParentGroup.GetLinkNumPart(linknumber); part = m_host.ParentGroup.GetLinkNumPart(linknumber);
LLObject.TextureEntry tex = new LLObject.TextureEntry(part.Shape.TextureEntry, 0, part.Shape.TextureEntry.Length); LLObject.TextureEntry tex = part.Shape.Textures;
LLColor texcolor; LLColor texcolor;
if (face > -1) if (face > -1)
{ {

View File

@ -634,9 +634,13 @@ namespace OpenSim.DataStore.MSSQL
s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]); s.ProfileEnd = Convert.ToUInt16(row["ProfileEnd"]);
s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]); s.ProfileCurve = Convert.ToByte(row["ProfileCurve"]);
s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
// text TODO: this isn't right] = but I'm not sure the right // text TODO: this isn't right] = but I'm not sure the right
// way to specify this as a blob atm // way to specify this as a blob atm
s.TextureEntry = (byte[])row["Texture"]; byte[] textureEntry = (byte[])row["Texture"];
s.TextureEntry = textureEntry;
s.ExtraParams = (byte[])row["ExtraParams"]; s.ExtraParams = (byte[])row["ExtraParams"];
// System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
// string texture = encoding.GetString((Byte[])row["Texture"]); // string texture = encoding.GetString((Byte[])row["Texture"]);

View File

@ -1014,7 +1014,11 @@ namespace OpenSim.DataStore.MonoSqlite
s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]); s.ProfileHollow = Convert.ToUInt16(row["ProfileHollow"]);
// text TODO: this isn't right] = but I'm not sure the right // text TODO: this isn't right] = but I'm not sure the right
// way to specify this as a blob atm // way to specify this as a blob atm
s.TextureEntry = (byte[]) row["Texture"];
byte[] textureEntry = (byte[])row["Texture"];
s.TextureEntry = textureEntry;
s.ExtraParams = (byte[]) row["ExtraParams"]; s.ExtraParams = (byte[]) row["ExtraParams"];
// System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); // System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
// string texture = encoding.GetString((Byte[])row["Texture"]); // string texture = encoding.GetString((Byte[])row["Texture"]);