Added a Couple of summary comments

Sugilite
MW 2007-06-10 15:49:59 +00:00
parent 488e716208
commit 44e5ff33df
2 changed files with 258 additions and 83 deletions

View File

@ -45,6 +45,7 @@ namespace OpenSim.Region
this._physActor = value;
}
}
public override LLVector3 Pos
{
get
@ -58,6 +59,12 @@ namespace OpenSim.Region
}
#endregion
/// <summary>
///
/// </summary>
/// <param name="clientThreads"></param>
/// <param name="regionHandle"></param>
/// <param name="world"></param>
public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world)
{
m_clientThreads = clientThreads;
@ -66,6 +73,15 @@ namespace OpenSim.Region
inventoryItems = new Dictionary<LLUUID, InventoryItem>();
}
/// <summary>
///
/// </summary>
/// <param name="clientThreads"></param>
/// <param name="regionHandle"></param>
/// <param name="world"></param>
/// <param name="owner"></param>
/// <param name="fullID"></param>
/// <param name="localID"></param>
public Primitive(Dictionary<uint, IClientAPI> clientThreads, ulong regionHandle, World world, LLUUID owner, LLUUID fullID, uint localID)
{
m_clientThreads = clientThreads;
@ -102,7 +118,10 @@ namespace OpenSim.Region
this.updateFlag = 1;
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public byte[] GetByteArray()
{
byte[] result = null;
@ -139,6 +158,9 @@ namespace OpenSim.Region
#region Overridden Methods
/// <summary>
///
/// </summary>
public override void update()
{
if (this.updateFlag == 1)
@ -148,6 +170,9 @@ namespace OpenSim.Region
}
}
/// <summary>
///
/// </summary>
public override void BackUp()
{
@ -157,11 +182,19 @@ namespace OpenSim.Region
#region Packet handlers
/// <summary>
///
/// </summary>
/// <param name="pos"></param>
public void UpdatePosition(LLVector3 pos)
{
}
/// <summary>
///
/// </summary>
/// <param name="addPacket"></param>
public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket)
{
this.primData.PathBegin = addPacket.PathBegin;
@ -184,22 +217,38 @@ namespace OpenSim.Region
this.primData.PathTwistBegin = addPacket.PathTwistBegin;
}
/// <summary>
///
/// </summary>
/// <param name="tex"></param>
public void UpdateTexture(byte[] tex)
{
this.primData.Texture = tex;
//this.dirtyFlag = true;
}
/// <summary>
///
/// </summary>
/// <param name="pack"></param>
public void UpdateObjectFlags(ObjectFlagUpdatePacket pack)
{
}
/// <summary>
///
/// </summary>
/// <param name="prim"></param>
public void AssignToParent(Primitive prim)
{
}
/// <summary>
///
/// </summary>
/// <param name="client"></param>
public void GetProperites(IClientAPI client)
{
ObjectPropertiesPacket proper = new ObjectPropertiesPacket();
@ -286,7 +335,11 @@ namespace OpenSim.Region
#region Update viewers Methods
//should change these mehtods, so that outgoing packets are sent through the avatar class
//should change these mehtods, so that outgoing packets are sent through the avatar class?
/// <summary>
///
/// </summary>
/// <param name="remoteClient"></param>
public void SendFullUpdateToClient(IClientAPI remoteClient)
{
LLVector3 lPos;
@ -303,6 +356,9 @@ namespace OpenSim.Region
remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.localid, this.primData, lPos, new LLUUID("00000000-0000-0000-5005-000000000005"));
}
/// <summary>
///
/// </summary>
public void SendFullUpdateToAllClients()
{
List<Avatar> avatars = this.m_world.RequestAvatarList();
@ -312,6 +368,10 @@ namespace OpenSim.Region
}
}
/// <summary>
///
/// </summary>
/// <param name="RemoteClient"></param>
public void SendTerseUpdateToClient(IClientAPI RemoteClient)
{
LLVector3 lPos;
@ -331,6 +391,9 @@ namespace OpenSim.Region
}
/// <summary>
///
/// </summary>
public void SendTerseUpdateToALLClients()
{
List<Avatar> avatars = this.m_world.RequestAvatarList();
@ -344,6 +407,12 @@ namespace OpenSim.Region
#region Create Methods
/// <summary>
///
/// </summary>
/// <param name="addPacket"></param>
/// <param name="ownerID"></param>
/// <param name="localID"></param>
public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
{
PrimData PData = new PrimData();
@ -380,16 +449,31 @@ namespace OpenSim.Region
this.updateFlag = 1;
}
/// <summary>
///
/// </summary>
/// <param name="data"></param>
public void CreateFromBytes(byte[] data)
{
}
/// <summary>
///
/// </summary>
/// <param name="primData"></param>
public void CreateFromPrimData(PrimData primData)
{
this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false);
}
/// <summary>
///
/// </summary>
/// <param name="primData"></param>
/// <param name="posi"></param>
/// <param name="localID"></param>
/// <param name="newprim"></param>
public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim)
{

View File

@ -182,56 +182,7 @@ namespace OpenSim
this.OutPacket(reply);
}
/// <summary>
///
/// </summary>
/// <param name="wearables"></param>
public void SendWearables(AvatarWearable[] wearables)
{
AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
aw.AgentData.AgentID = this.AgentID;
aw.AgentData.SerialNum = 0;
aw.AgentData.SessionID = this.SessionID;
aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
AgentWearablesUpdatePacket.WearableDataBlock awb;
for (int i = 0; i < wearables.Length; i++)
{
awb = new AgentWearablesUpdatePacket.WearableDataBlock();
awb.WearableType = (byte)i;
awb.AssetID = wearables[i].AssetID;
awb.ItemID = wearables[i].ItemID;
aw.WearableData[i] = awb;
}
this.OutPacket(aw);
}
/// <summary>
///
/// </summary>
/// <param name="agentID"></param>
/// <param name="visualParams"></param>
/// <param name="textureEntry"></param>
public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry)
{
AvatarAppearancePacket avp = new AvatarAppearancePacket();
avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
avp.ObjectData.TextureEntry = textureEntry;
AvatarAppearancePacket.VisualParamBlock avblock = null;
for (int i = 0; i < visualParams.Length; i++)
{
avblock = new AvatarAppearancePacket.VisualParamBlock();
avblock.ParamValue = visualParams[i];
avp.VisualParam[i] = avblock;
}
avp.Sender.IsTrial = false;
avp.Sender.ID = agentID;
OutPacket(avp);
}
/// <summary>
/// Send the region heightmap to the client
/// </summary>
@ -287,7 +238,91 @@ namespace OpenSim
OpenSim.Framework.Console.MainConsole.Instance.WriteLine(OpenSim.Framework.Console.LogPriority.MEDIUM, "ClientView API .cs: SendLayerData() - Failed with exception " + e.ToString());
}
}
public void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort)
{
EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
enablesimpacket.SimulatorInfo.Handle = neighbourHandle;
byte[] byteIP = neighbourIP.GetAddressBytes();
enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24;
enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16;
enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8;
enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0];
enablesimpacket.SimulatorInfo.Port = neighbourPort;
OutPacket(enablesimpacket);
}
public AgentCircuitData RequestClientInfo()
{
AgentCircuitData agentData = new AgentCircuitData();
agentData.AgentID = this.AgentId;
agentData.SessionID = this.SessionID;
agentData.SecureSessionID = this.SecureSessionID;
agentData.circuitcode = this.CircuitCode;
agentData.child = false;
agentData.firstname = this.firstName;
agentData.lastname = this.lastName;
return agentData;
}
#region Appearance/ Wearables Methods
/// <summary>
///
/// </summary>
/// <param name="wearables"></param>
public void SendWearables(AvatarWearable[] wearables)
{
AgentWearablesUpdatePacket aw = new AgentWearablesUpdatePacket();
aw.AgentData.AgentID = this.AgentID;
aw.AgentData.SerialNum = 0;
aw.AgentData.SessionID = this.SessionID;
aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
AgentWearablesUpdatePacket.WearableDataBlock awb;
for (int i = 0; i < wearables.Length; i++)
{
awb = new AgentWearablesUpdatePacket.WearableDataBlock();
awb.WearableType = (byte)i;
awb.AssetID = wearables[i].AssetID;
awb.ItemID = wearables[i].ItemID;
aw.WearableData[i] = awb;
}
this.OutPacket(aw);
}
/// <summary>
///
/// </summary>
/// <param name="agentID"></param>
/// <param name="visualParams"></param>
/// <param name="textureEntry"></param>
public void SendAppearance(LLUUID agentID, byte[] visualParams, byte[] textureEntry)
{
AvatarAppearancePacket avp = new AvatarAppearancePacket();
avp.VisualParam = new AvatarAppearancePacket.VisualParamBlock[218];
avp.ObjectData.TextureEntry = textureEntry;
AvatarAppearancePacket.VisualParamBlock avblock = null;
for (int i = 0; i < visualParams.Length; i++)
{
avblock = new AvatarAppearancePacket.VisualParamBlock();
avblock.ParamValue = visualParams[i];
avp.VisualParam[i] = avblock;
}
avp.Sender.IsTrial = false;
avp.Sender.ID = agentID;
OutPacket(avp);
}
#endregion
#region Avatar Packet/data sending Methods
/// <summary>
///
@ -316,11 +351,12 @@ namespace OpenSim
libsecondlife.LLVector3 pos2 = new LLVector3((float)Pos.X, (float)Pos.Y, (float)Pos.Z);
byte[] pb = pos2.GetBytes();
Array.Copy(pb, 0, objupdate.ObjectData[0].ObjectData, 16, pb.Length);
OutPacket(objupdate);
}
/// <summary>
///
/// </summary>
@ -384,34 +420,7 @@ namespace OpenSim
return objdata;
}
public void InformClientOfNeighbour(ulong neighbourHandle, System.Net.IPAddress neighbourIP, ushort neighbourPort)
{
EnableSimulatorPacket enablesimpacket = new EnableSimulatorPacket();
enablesimpacket.SimulatorInfo = new EnableSimulatorPacket.SimulatorInfoBlock();
enablesimpacket.SimulatorInfo.Handle = neighbourHandle;
byte[] byteIP = neighbourIP.GetAddressBytes();
enablesimpacket.SimulatorInfo.IP = (uint)byteIP[3] << 24;
enablesimpacket.SimulatorInfo.IP += (uint)byteIP[2] << 16;
enablesimpacket.SimulatorInfo.IP += (uint)byteIP[1] << 8;
enablesimpacket.SimulatorInfo.IP += (uint)byteIP[0];
enablesimpacket.SimulatorInfo.Port = neighbourPort;
OutPacket(enablesimpacket);
}
public AgentCircuitData RequestClientInfo()
{
AgentCircuitData agentData = new AgentCircuitData();
agentData.AgentID = this.AgentId;
agentData.SessionID = this.SessionID;
agentData.SecureSessionID = this.SecureSessionID;
agentData.circuitcode = this.CircuitCode;
agentData.child = false;
agentData.firstname = this.firstName;
agentData.lastname = this.lastName;
return agentData;
}
#endregion
#region Primitive Packet/data Sending Methods
@ -508,6 +517,88 @@ namespace OpenSim
objectData.PathTwist = primData.PathTwist;
objectData.PathTwistBegin = primData.PathTwistBegin;
}
public void SendPrimTerseUpdate(ulong regionHandle, ushort timeDilation, uint localID, LLVector3 position, LLQuaternion rotation)
{
ImprovedTerseObjectUpdatePacket terse = new ImprovedTerseObjectUpdatePacket();
terse.RegionData.RegionHandle = regionHandle;
terse.RegionData.TimeDilation = timeDilation;
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = this.CreatePrimImprovedBlock(localID, position, rotation);
this.OutPacket(terse);
}
/// <summary>
///
/// </summary>
/// <param name="localID"></param>
/// <param name="position"></param>
/// <param name="rotation"></param>
/// <returns></returns>
protected ImprovedTerseObjectUpdatePacket.ObjectDataBlock CreatePrimImprovedBlock(uint localID, LLVector3 position, LLQuaternion rotation)
{
uint ID = localID;
byte[] bytes = new byte[60];
int i = 0;
ImprovedTerseObjectUpdatePacket.ObjectDataBlock dat = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock();
dat.TextureEntry = new byte[0];
bytes[i++] = (byte)(ID % 256);
bytes[i++] = (byte)((ID >> 8) % 256);
bytes[i++] = (byte)((ID >> 16) % 256);
bytes[i++] = (byte)((ID >> 24) % 256);
bytes[i++] = 0;
bytes[i++] = 0;
byte[] pb = position.GetBytes();
Array.Copy(pb, 0, bytes, i, pb.Length);
i += 12;
ushort ac = 32767;
//vel
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
//accel
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
ushort rw, rx, ry, rz;
rw = (ushort)(32768 * (rotation.W + 1));
rx = (ushort)(32768 * (rotation.X + 1));
ry = (ushort)(32768 * (rotation.Y + 1));
rz = (ushort)(32768 * (rotation.Z + 1));
//rot
bytes[i++] = (byte)(rx % 256);
bytes[i++] = (byte)((rx >> 8) % 256);
bytes[i++] = (byte)(ry % 256);
bytes[i++] = (byte)((ry >> 8) % 256);
bytes[i++] = (byte)(rz % 256);
bytes[i++] = (byte)((rz >> 8) % 256);
bytes[i++] = (byte)(rw % 256);
bytes[i++] = (byte)((rw >> 8) % 256);
//rotation vel
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
bytes[i++] = (byte)(ac % 256);
bytes[i++] = (byte)((ac >> 8) % 256);
dat.Data = bytes;
return dat;
}
#endregion
#endregion