From 44e5ff33df48da8ce9c4534d41c3b6c2b8919e13 Mon Sep 17 00:00:00 2001
From: MW
Date: Sun, 10 Jun 2007 15:49:59 +0000
Subject: Added a Couple of summary comments
---
OpenSim/OpenSim.Region/World/Primitive.cs | 90 ++++++++-
OpenSim/OpenSim.RegionServer/ClientView.API.cs | 251 +++++++++++++++++--------
2 files changed, 258 insertions(+), 83 deletions(-)
diff --git a/OpenSim/OpenSim.Region/World/Primitive.cs b/OpenSim/OpenSim.Region/World/Primitive.cs
index d540a3b..c800f21 100644
--- a/OpenSim/OpenSim.Region/World/Primitive.cs
+++ b/OpenSim/OpenSim.Region/World/Primitive.cs
@@ -45,6 +45,7 @@ namespace OpenSim.Region
this._physActor = value;
}
}
+
public override LLVector3 Pos
{
get
@@ -58,6 +59,12 @@ namespace OpenSim.Region
}
#endregion
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public Primitive(Dictionary clientThreads, ulong regionHandle, World world)
{
m_clientThreads = clientThreads;
@@ -66,6 +73,15 @@ namespace OpenSim.Region
inventoryItems = new Dictionary();
}
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public Primitive(Dictionary clientThreads, ulong regionHandle, World world, LLUUID owner, LLUUID fullID, uint localID)
{
m_clientThreads = clientThreads;
@@ -102,7 +118,10 @@ namespace OpenSim.Region
this.updateFlag = 1;
}
-
+ ///
+ ///
+ ///
+ ///
public byte[] GetByteArray()
{
byte[] result = null;
@@ -139,6 +158,9 @@ namespace OpenSim.Region
#region Overridden Methods
+ ///
+ ///
+ ///
public override void update()
{
if (this.updateFlag == 1)
@@ -148,6 +170,9 @@ namespace OpenSim.Region
}
}
+ ///
+ ///
+ ///
public override void BackUp()
{
@@ -157,11 +182,19 @@ namespace OpenSim.Region
#region Packet handlers
+ ///
+ ///
+ ///
+ ///
public void UpdatePosition(LLVector3 pos)
{
}
+ ///
+ ///
+ ///
+ ///
public void UpdateShape(ObjectShapePacket.ObjectDataBlock addPacket)
{
this.primData.PathBegin = addPacket.PathBegin;
@@ -184,22 +217,38 @@ namespace OpenSim.Region
this.primData.PathTwistBegin = addPacket.PathTwistBegin;
}
+ ///
+ ///
+ ///
+ ///
public void UpdateTexture(byte[] tex)
{
this.primData.Texture = tex;
//this.dirtyFlag = true;
}
+ ///
+ ///
+ ///
+ ///
public void UpdateObjectFlags(ObjectFlagUpdatePacket pack)
{
}
+ ///
+ ///
+ ///
+ ///
public void AssignToParent(Primitive prim)
{
}
+ ///
+ ///
+ ///
+ ///
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?
+ ///
+ ///
+ ///
+ ///
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"));
}
+ ///
+ ///
+ ///
public void SendFullUpdateToAllClients()
{
List avatars = this.m_world.RequestAvatarList();
@@ -312,6 +368,10 @@ namespace OpenSim.Region
}
}
+ ///
+ ///
+ ///
+ ///
public void SendTerseUpdateToClient(IClientAPI RemoteClient)
{
LLVector3 lPos;
@@ -331,6 +391,9 @@ namespace OpenSim.Region
}
+ ///
+ ///
+ ///
public void SendTerseUpdateToALLClients()
{
List avatars = this.m_world.RequestAvatarList();
@@ -344,6 +407,12 @@ namespace OpenSim.Region
#region Create Methods
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public void CreateFromPacket(ObjectAddPacket addPacket, LLUUID ownerID, uint localID)
{
PrimData PData = new PrimData();
@@ -380,16 +449,31 @@ namespace OpenSim.Region
this.updateFlag = 1;
}
+ ///
+ ///
+ ///
+ ///
public void CreateFromBytes(byte[] data)
{
}
+ ///
+ ///
+ ///
+ ///
public void CreateFromPrimData(PrimData primData)
{
this.CreateFromPrimData(primData, primData.Position, primData.LocalID, false);
}
-
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
public void CreateFromPrimData(PrimData primData, LLVector3 posi, uint localID, bool newprim)
{
diff --git a/OpenSim/OpenSim.RegionServer/ClientView.API.cs b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
index f59e170..fe46fcb 100644
--- a/OpenSim/OpenSim.RegionServer/ClientView.API.cs
+++ b/OpenSim/OpenSim.RegionServer/ClientView.API.cs
@@ -182,56 +182,7 @@ namespace OpenSim
this.OutPacket(reply);
}
- ///
- ///
- ///
- ///
- 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);
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- 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);
- }
-
+
///
/// Send the region heightmap to the client
///
@@ -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
+
+ ///
+ ///
+ ///
+ ///
+ 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);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ 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
///
///
@@ -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);
-
+
}
+
///
///
///
@@ -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);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ 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
--
cgit v1.1