aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMW2007-07-03 20:10:20 +0000
committerMW2007-07-03 20:10:20 +0000
commitbd8018fa1cb32aa42e2a1a41ebb01fc0f1b0a04b (patch)
treec2b75501b3947186c462d71b49ca89e7c9378ac6 /OpenSim
parent*Fixed storage issue as noted in last commit of the OGS1 GridServer (diff)
downloadopensim-SC_OLD-bd8018fa1cb32aa42e2a1a41ebb01fc0f1b0a04b.zip
opensim-SC_OLD-bd8018fa1cb32aa42e2a1a41ebb01fc0f1b0a04b.tar.gz
opensim-SC_OLD-bd8018fa1cb32aa42e2a1a41ebb01fc0f1b0a04b.tar.bz2
opensim-SC_OLD-bd8018fa1cb32aa42e2a1a41ebb01fc0f1b0a04b.tar.xz
Today's work on Building support/tools. Think I am slowly getting there.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/General/Interfaces/IClientAPI.cs2
-rw-r--r--OpenSim/Framework/General/Types/PrimitiveBaseShape.cs1
-rw-r--r--OpenSim/Framework/Servers/CheckSumServer.cs9
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs4
-rw-r--r--OpenSim/Region/Capabilities/Caps.cs33
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs3
-rw-r--r--OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs79
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs130
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs82
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs17
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs24
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs1
13 files changed, 327 insertions, 60 deletions
diff --git a/OpenSim/Framework/General/Interfaces/IClientAPI.cs b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
index b5a0a0b..c3291c4 100644
--- a/OpenSim/Framework/General/Interfaces/IClientAPI.cs
+++ b/OpenSim/Framework/General/Interfaces/IClientAPI.cs
@@ -56,6 +56,7 @@ namespace OpenSim.Framework.Interfaces
56 public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient); 56 public delegate void UpdatePrimTexture(uint localID, byte[] texture, IClientAPI remoteClient);
57 public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient); 57 public delegate void UpdateVector(uint localID, LLVector3 pos, IClientAPI remoteClient);
58 public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient); 58 public delegate void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient);
59 public delegate void UpdatePrimGroupRotation(uint localID,LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient);
59 public delegate void StatusChange(bool status); 60 public delegate void StatusChange(bool status);
60 public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status); 61 public delegate void NewAvatar(IClientAPI remoteClient, LLUUID agentID, bool status);
61 public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation); 62 public delegate void UpdateAgent(IClientAPI remoteClient, uint flags, LLQuaternion bodyRotation);
@@ -100,6 +101,7 @@ namespace OpenSim.Framework.Interfaces
100 event UpdatePrimTexture OnUpdatePrimTexture; 101 event UpdatePrimTexture OnUpdatePrimTexture;
101 event UpdateVector OnUpdatePrimPosition; 102 event UpdateVector OnUpdatePrimPosition;
102 event UpdatePrimRotation OnUpdatePrimRotation; 103 event UpdatePrimRotation OnUpdatePrimRotation;
104 event UpdatePrimGroupRotation OnUpdatePrimGroupRotation;
103 event UpdateVector OnUpdatePrimScale; 105 event UpdateVector OnUpdatePrimScale;
104 event StatusChange OnChildAgentStatus; 106 event StatusChange OnChildAgentStatus;
105 event GenericCall2 OnStopMovement; 107 event GenericCall2 OnStopMovement;
diff --git a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs
index 1357e06..a6671d1 100644
--- a/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs
+++ b/OpenSim/Framework/General/Types/PrimitiveBaseShape.cs
@@ -12,6 +12,7 @@ namespace OpenSim.Framework.Types
12 Prism, 12 Prism,
13 Scuplted, 13 Scuplted,
14 Cylinder, 14 Cylinder,
15 Foliage,
15 Unknown 16 Unknown
16 } 17 }
17 18
diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs
index 104de94..89ec095 100644
--- a/OpenSim/Framework/Servers/CheckSumServer.cs
+++ b/OpenSim/Framework/Servers/CheckSumServer.cs
@@ -26,8 +26,8 @@
26* 26*
27*/ 27*/
28namespace OpenSim.Framework.Servers 28namespace OpenSim.Framework.Servers
29{ 29{/*
30/* public class CheckSumServer : UDPServerBase 30 public class CheckSumServer : UDPServerBase
31 { 31 {
32 //protected ConsoleBase m_log; 32 //protected ConsoleBase m_log;
33 33
@@ -121,6 +121,7 @@ namespace OpenSim.Framework.Servers
121 { 121 {
122 this.Server.SendTo(buffer, size, flags, endp); 122 this.Server.SendTo(buffer, size, flags, endp);
123 } 123 }
124 * 124 * }
125 }*/ 125 */
126
126} \ No newline at end of file 127} \ No newline at end of file
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index e976fe3..17a32cf 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -51,7 +51,7 @@ namespace OpenSim
51 public class OpenSimMain : RegionApplicationBase, conscmd_callback 51 public class OpenSimMain : RegionApplicationBase, conscmd_callback
52 { 52 {
53 protected CommunicationsManager commsManager; 53 protected CommunicationsManager commsManager;
54 // private CheckSumServer checkServer; 54 // private CheckSumServer checkServer;
55 55
56 private bool m_silent; 56 private bool m_silent;
57 private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log"; 57 private string m_logFilename = "region-console-" + Guid.NewGuid().ToString() + ".log";
@@ -96,7 +96,7 @@ namespace OpenSim
96 { 96 {
97 this.SetupLocalGridServers(); 97 this.SetupLocalGridServers();
98 // this.checkServer = new CheckSumServer(12036); 98 // this.checkServer = new CheckSumServer(12036);
99 // this.checkServer.ServerListener(); 99 // this.checkServer.ServerListener();
100 this.commsManager = new CommunicationsLocal(this.serversData); 100 this.commsManager = new CommunicationsLocal(this.serversData);
101 } 101 }
102 else 102 else
diff --git a/OpenSim/Region/Capabilities/Caps.cs b/OpenSim/Region/Capabilities/Caps.cs
index b38979d..d9d6f51 100644
--- a/OpenSim/Region/Capabilities/Caps.cs
+++ b/OpenSim/Region/Capabilities/Caps.cs
@@ -98,13 +98,6 @@ namespace OpenSim.Region.Capabilities
98 /// <returns></returns> 98 /// <returns></returns>
99 protected LLSDCapsDetails GetCapabilities() 99 protected LLSDCapsDetails GetCapabilities()
100 { 100 {
101 /* string capURLS = "";
102 capURLS += "<key>MapLayer</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + mapLayerPath + "</string>";
103 capURLS += "<key>NewFileAgentInventory</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + newInventory + "</string>";
104 //capURLS += "<key>RequestTextureDownload</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + requestTexture + "</string>";
105 //capURLS += "<key>EventQueueGet</key><string>http://" + httpListenerAddress + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath + eventQueue + "</string>";
106 return capURLS;*/
107
108 LLSDCapsDetails caps = new LLSDCapsDetails(); 101 LLSDCapsDetails caps = new LLSDCapsDetails();
109 string capsBaseUrl = "http://" + httpListenerHostName + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath; 102 string capsBaseUrl = "http://" + httpListenerHostName + ":" + httpListenPort.ToString() + "/CAPS/" + capsObjectPath;
110 103
@@ -131,8 +124,6 @@ namespace OpenSim.Region.Capabilities
131 LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse(); 124 LLSDMapLayerResponse mapResponse= new LLSDMapLayerResponse();
132 mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse()); 125 mapResponse.LayerData.Array.Add(this.BuildLLSDMapLayerResponse());
133 string res = LLSDHelpers.SerialiseLLSDReply(mapResponse); 126 string res = LLSDHelpers.SerialiseLLSDReply(mapResponse);
134
135 //Console.WriteLine(" Maplayer response is " + res);
136 127
137 return res; 128 return res;
138 } 129 }
@@ -172,27 +163,23 @@ namespace OpenSim.Region.Capabilities
172 163
173 public string CreateEstablishAgentComms(string caps, string ipAddressPort) 164 public string CreateEstablishAgentComms(string caps, string ipAddressPort)
174 { 165 {
175 string res = "<llsd><map><key>id</key><integer>" + eventQueueCount + "</integer>"; 166 LLSDCapEvent eventItem = new LLSDCapEvent();
176 res += "<key>events</key><array><map>"; 167 eventItem.id = eventQueueCount;
177 res += "<key>message</key><string>EstablishAgentCommunication</string>"; 168 //should be creating a EstablishAgentComms item, but there isn't a class for it yet
178 res += "<key>body</key><map>"; 169 eventItem.events.Array.Add(new LLSDEmpty());
179 res += "<key>sim-ip-and-port</key><string>" + ipAddressPort + "</string>"; 170 string res = LLSDHelpers.SerialiseLLSDReply(eventItem);
180 res += "<key>seed-capability</key><string>" + caps + "</string>";
181 res += "<key>agent-id</key><uuid>" + this.agentID.ToStringHyphenated() + "</uuid>";
182 res += "</map>";
183 res += "</map></array>";
184 res += "</map></llsd>";
185 eventQueueCount++; 171 eventQueueCount++;
172
186 this.CapsEventQueue.Enqueue(res); 173 this.CapsEventQueue.Enqueue(res);
187 return res; 174 return res;
188 } 175 }
189 176
190 public string CreateEmptyEventResponse() 177 public string CreateEmptyEventResponse()
191 { 178 {
192 string res = "<llsd><map><key>id</key><integer>" + eventQueueCount + "</integer>"; 179 LLSDCapEvent eventItem = new LLSDCapEvent();
193 res += "<key>events</key><array><map>"; 180 eventItem.id = eventQueueCount;
194 res += "</map></array>"; 181 eventItem.events.Array.Add(new LLSDEmpty());
195 res += "</map></llsd>"; 182 string res = LLSDHelpers.SerialiseLLSDReply(eventItem);
196 eventQueueCount++; 183 eventQueueCount++;
197 return res; 184 return res;
198 } 185 }
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index 40e0021..6de6af6 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -64,6 +64,7 @@ namespace OpenSim.Region.ClientStack
64 public event UpdatePrimTexture OnUpdatePrimTexture; 64 public event UpdatePrimTexture OnUpdatePrimTexture;
65 public event UpdateVector OnUpdatePrimPosition; 65 public event UpdateVector OnUpdatePrimPosition;
66 public event UpdatePrimRotation OnUpdatePrimRotation; 66 public event UpdatePrimRotation OnUpdatePrimRotation;
67 public event UpdatePrimGroupRotation OnUpdatePrimGroupRotation;
67 public event UpdateVector OnUpdatePrimScale; 68 public event UpdateVector OnUpdatePrimScale;
68 public event StatusChange OnChildAgentStatus; 69 public event StatusChange OnChildAgentStatus;
69 public event GenericCall2 OnStopMovement; 70 public event GenericCall2 OnStopMovement;
@@ -644,7 +645,7 @@ namespace OpenSim.Region.ClientStack
644 byte[] pb = pos.GetBytes(); 645 byte[] pb = pos.GetBytes();
645 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length); 646 Array.Copy(pb, 0, outPacket.ObjectData[0].ObjectData, 0, pb.Length);
646 byte[] rot = rotation.GetBytes(); 647 byte[] rot = rotation.GetBytes();
647 Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 48, rot.Length); 648 Array.Copy(rot, 0, outPacket.ObjectData[0].ObjectData, 36, rot.Length);
648 OutPacket(outPacket); 649 OutPacket(outPacket);
649 } 650 }
650 651
diff --git a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
index e4512d1..0b6c4f6 100644
--- a/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
+++ b/OpenSim/Region/ClientStack/ClientView.PacketHandlers.cs
@@ -101,8 +101,10 @@ namespace OpenSim.Region.ClientStack
101 protected bool MultipleObjUpdate(ClientView simClient, Packet packet) 101 protected bool MultipleObjUpdate(ClientView simClient, Packet packet)
102 { 102 {
103 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet; 103 MultipleObjectUpdatePacket multipleupdate = (MultipleObjectUpdatePacket)packet;
104 // Console.WriteLine("new multi update packet " + multipleupdate.ToString());
104 for (int i = 0; i < multipleupdate.ObjectData.Length; i++) 105 for (int i = 0; i < multipleupdate.ObjectData.Length; i++)
105 { 106 {
107 #region position
106 if (multipleupdate.ObjectData[i].Type == 9) //change position 108 if (multipleupdate.ObjectData[i].Type == 9) //change position
107 { 109 {
108 if (OnUpdatePrimPosition != null) 110 if (OnUpdatePrimPosition != null)
@@ -110,24 +112,95 @@ namespace OpenSim.Region.ClientStack
110 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0); 112 LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
111 OnUpdatePrimPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this); 113 OnUpdatePrimPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
112 } 114 }
113 //should update stored position of the prim 115
116 }
117 else if (multipleupdate.ObjectData[i].Type == 1) //single item of group change position
118 {
119 if (OnUpdatePrimPosition != null)
120 {
121 // libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
122 //OnUpdatePrimPosition(multipleupdate.ObjectData[i].ObjectLocalID, pos, this);
123 }
114 } 124 }
115 else if (multipleupdate.ObjectData[i].Type == 10)//rotation 125 #endregion position
126 #region rotation
127 else if (multipleupdate.ObjectData[i].Type == 2)// single item of group rotation from tab
116 { 128 {
117 if (OnUpdatePrimRotation != null) 129 if (OnUpdatePrimRotation != null)
118 { 130 {
119 LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true); 131 LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
132 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
133 OnUpdatePrimRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
134 }
135 }
136 else if (multipleupdate.ObjectData[i].Type == 3)// single item of group rotation from mouse
137 {
138 if (OnUpdatePrimRotation != null)
139 {
140 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
141 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
142 OnUpdatePrimRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
143 }
144 }
145 else if (multipleupdate.ObjectData[i].Type == 10)//group rotation from object tab
146 {
147 if (OnUpdatePrimRotation != null)
148 {
149 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 0, true);
150 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
120 OnUpdatePrimRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this); 151 OnUpdatePrimRotation(multipleupdate.ObjectData[i].ObjectLocalID, rot, this);
121 } 152 }
122 } 153 }
123 else if (multipleupdate.ObjectData[i].Type == 13)//scale 154 else if (multipleupdate.ObjectData[i].Type == 11)//group rotation from mouse
155 {
156 if (OnUpdatePrimGroupRotation != null)
157 {
158 libsecondlife.LLVector3 pos = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
159 libsecondlife.LLQuaternion rot = new LLQuaternion(multipleupdate.ObjectData[i].Data, 12, true);
160 //Console.WriteLine("new rotation position is " + pos.X + " , " + pos.Y + " , " + pos.Z);
161 // Console.WriteLine("new rotation is " + rot.X + " , " + rot.Y + " , " + rot.Z + " , " + rot.W);
162 OnUpdatePrimGroupRotation(multipleupdate.ObjectData[i].ObjectLocalID, pos, rot, this);
163 }
164 }
165 #endregion
166 #region scale
167 else if (multipleupdate.ObjectData[i].Type == 13)//group scale from object tab
124 { 168 {
125 if (OnUpdatePrimScale != null) 169 if (OnUpdatePrimScale != null)
126 { 170 {
127 LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12); 171 LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
172 //Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
173 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
174 }
175 }
176 else if (multipleupdate.ObjectData[i].Type == 29)//group scale from mouse
177 {
178 if (OnUpdatePrimScale != null)
179 {
180 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 0);
181 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z );
182 // OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
183 }
184 }
185 else if (multipleupdate.ObjectData[i].Type == 5)//single scale from object tab
186 {
187 if (OnUpdatePrimScale != null)
188 {
189 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
190 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
191 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
192 }
193 }
194 else if (multipleupdate.ObjectData[i].Type == 21)//single scale from mouse
195 {
196 if (OnUpdatePrimScale != null)
197 {
198 libsecondlife.LLVector3 scale = new LLVector3(multipleupdate.ObjectData[i].Data, 12);
199 // Console.WriteLine("new scale is " + scale.X + " , " + scale.Y + " , " + scale.Z);
128 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this); 200 OnUpdatePrimScale(multipleupdate.ObjectData[i].ObjectLocalID, scale, this);
129 } 201 }
130 } 202 }
203 #endregion
131 } 204 }
132 return true; 205 return true;
133 } 206 }
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index a8eb9ce..2874ae2 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment.Scenes
55 } 55 }
56 } 56 }
57 57
58 public Quaternion _rotation; 58 public Quaternion _rotation = new Quaternion(0,0,1,0);
59 59
60 public virtual Quaternion rotation 60 public virtual Quaternion rotation
61 { 61 {
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index a767bd2..803bd28 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -42,7 +42,7 @@ namespace OpenSim.Region.Environment.Scenes
42 private PrimitiveBaseShape m_Shape; 42 private PrimitiveBaseShape m_Shape;
43 43
44 public SceneObject m_RootParent; 44 public SceneObject m_RootParent;
45 public bool isRootPrim; 45 public bool isRootPrim;
46 public EntityBase m_Parent; 46 public EntityBase m_Parent;
47 47
48 public override LLVector3 Pos 48 public override LLVector3 Pos
@@ -60,7 +60,11 @@ namespace OpenSim.Region.Environment.Scenes
60 } 60 }
61 set 61 set
62 { 62 {
63 this.m_pos = m_Parent.Pos - value; //should we being subtracting the parent position 63 if (isRootPrim)
64 {
65 m_Parent.Pos = value;
66 }
67 this.m_pos = value - m_Parent.Pos;
64 } 68 }
65 69
66 } 70 }
@@ -77,7 +81,19 @@ namespace OpenSim.Region.Environment.Scenes
77 } 81 }
78 } 82 }
79 83
80 public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent , SceneObject rootObject) 84 public LLVector3 Scale
85 {
86 set
87 {
88 this.m_Shape.Scale = value;
89 }
90 get
91 {
92 return this.m_Shape.Scale;
93 }
94 }
95
96 public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject)
81 { 97 {
82 m_regionHandle = regionHandle; 98 m_regionHandle = regionHandle;
83 m_world = world; 99 m_world = world;
@@ -86,12 +102,13 @@ namespace OpenSim.Region.Environment.Scenes
86 this.isRootPrim = isRoot; 102 this.isRootPrim = isRoot;
87 this.m_RootParent = rootObject; 103 this.m_RootParent = rootObject;
88 this.CreateFromPacket(addPacket, ownerID, localID); 104 this.CreateFromPacket(addPacket, ownerID, localID);
105 this.rotation = Axiom.MathLib.Quaternion.Identity;
89 } 106 }
90 107
91 /// <summary> 108 /// <summary>
92 /// 109 ///
93 /// </summary> 110 /// </summary>
94 public override void update() 111 public override void update()
95 { 112 {
96 if (this.updateFlag == 1) // is a new prim just been created/reloaded or has major changes 113 if (this.updateFlag == 1) // is a new prim just been created/reloaded or has major changes
97 { 114 {
@@ -104,7 +121,10 @@ namespace OpenSim.Region.Environment.Scenes
104 this.updateFlag = 0; 121 this.updateFlag = 0;
105 } 122 }
106 123
107 base.update(); 124 foreach (EntityBase child in children)
125 {
126 child.update();
127 }
108 } 128 }
109 129
110 /// <summary> 130 /// <summary>
@@ -150,9 +170,13 @@ namespace OpenSim.Region.Environment.Scenes
150 this.updateFlag = 1; 170 this.updateFlag = 1;
151 } 171 }
152 172
173 /// <summary>
174 ///
175 /// </summary>
176 /// <param name="linkObject"></param>
153 public void AddNewChildren(SceneObject linkObject) 177 public void AddNewChildren(SceneObject linkObject)
154 { 178 {
155 // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")"); 179 // Console.WriteLine("linking new prims " + linkObject.rootLocalID + " to me (" + this.LocalId + ")");
156 //TODO check permissions 180 //TODO check permissions
157 this.children.Add(linkObject.rootPrimitive); 181 this.children.Add(linkObject.rootPrimitive);
158 linkObject.rootPrimitive.SetNewParent(this, this.m_RootParent); 182 linkObject.rootPrimitive.SetNewParent(this, this.m_RootParent);
@@ -161,30 +185,73 @@ namespace OpenSim.Region.Environment.Scenes
161 linkObject.DeleteAllChildren(); 185 linkObject.DeleteAllChildren();
162 } 186 }
163 187
188 /// <summary>
189 ///
190 /// </summary>
191 /// <param name="newParent"></param>
192 /// <param name="rootParent"></param>
164 public void SetNewParent(Primitive newParent, SceneObject rootParent) 193 public void SetNewParent(Primitive newParent, SceneObject rootParent)
165 { 194 {
166 LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z); 195 LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z);
167 //Console.WriteLine("have a new parent and my old position is " + this.Pos.X + " , " + this.Pos.Y + " , " + this.Pos.Z);
168 this.isRootPrim = false; 196 this.isRootPrim = false;
169 this.m_Parent = newParent; 197 this.m_Parent = newParent;
170 this.ParentID = newParent.LocalId; 198 this.ParentID = newParent.LocalId;
171 this.SetRootParent(rootParent); 199 this.SetRootParent(rootParent);
172 // Console.WriteLine("have a new parent and its position is " + this.m_Parent.Pos.X + " , " + this.m_Parent.Pos.Y + " , " + this.m_Parent.Pos.Z);
173 this.Pos = oldPos; 200 this.Pos = oldPos;
174 // Console.WriteLine("have a new parent so my new offset position is " + this.Pos.X + " , " + this.Pos.Y + " , " + this.Pos.Z); 201 Axiom.MathLib.Vector3 axPos = new Axiom.MathLib.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z);
202 axPos = this.m_Parent.rotation.Inverse() * axPos;
203 this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
204 this.rotation = this.rotation * this.m_Parent.rotation.Inverse();
175 this.updateFlag = 1; 205 this.updateFlag = 1;
176 206
177 } 207 }
178 208
209 /// <summary>
210 ///
211 /// </summary>
212 /// <param name="newRoot"></param>
179 public void SetRootParent(SceneObject newRoot) 213 public void SetRootParent(SceneObject newRoot)
180 { 214 {
181 this.m_RootParent = newRoot; 215 this.m_RootParent = newRoot;
216 this.m_RootParent.AddChildToList(this);
182 foreach (Primitive child in children) 217 foreach (Primitive child in children)
183 { 218 {
184 child.SetRootParent(newRoot); 219 child.SetRootParent(newRoot);
185 } 220 }
186 } 221 }
187 222
223 public void AddOffsetToChildren(LLVector3 offset)
224 {
225 foreach (Primitive prim in this.children)
226 {
227 prim.m_pos += offset;
228 prim.updateFlag = 2;
229 }
230 }
231
232 #region Resizing/Scale
233 public void ResizeGoup(LLVector3 scale)
234 {
235 LLVector3 offset = (scale - this.m_Shape.Scale);
236 offset.X /= 2;
237 offset.Y /= 2;
238 offset.Z /= 2;
239 if (this.isRootPrim)
240 {
241 this.m_Parent.Pos += offset;
242 }
243 else
244 {
245 this.m_pos += offset;
246 }
247
248 this.AddOffsetToChildren(new LLVector3(-offset.X, -offset.Y, -offset.Z));
249 this.m_Shape.Scale = scale;
250
251 this.updateFlag = 1;
252 }
253 #endregion
254
188 /// <summary> 255 /// <summary>
189 /// 256 ///
190 /// </summary> 257 /// </summary>
@@ -192,14 +259,47 @@ namespace OpenSim.Region.Environment.Scenes
192 public void UpdatePosition(LLVector3 pos) 259 public void UpdatePosition(LLVector3 pos)
193 { 260 {
194 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z); 261 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
195 if (this.isRootPrim) 262
196 {
197 this.m_Parent.Pos = newPos;
198 }
199 this.Pos = newPos; 263 this.Pos = newPos;
200 this.updateFlag = 2; 264 this.updateFlag = 2;
201 } 265 }
202 266
267 public void UpdateRotation(LLQuaternion rot)
268 {
269 this.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
270 this.updateFlag = 2;
271 }
272
273 public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot)
274 {
275 this.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
276 this.Pos = pos;
277 this.updateFlag = 2;
278 }
279
280 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
281 {
282 this.m_Shape.PathBegin = shapeBlock.PathBegin;
283 this.m_Shape.PathEnd = shapeBlock.PathEnd;
284 this.m_Shape.PathScaleX = shapeBlock.PathScaleX;
285 this.m_Shape.PathScaleY = shapeBlock.PathScaleY;
286 this.m_Shape.PathShearX = shapeBlock.PathShearX;
287 this.m_Shape.PathShearY = shapeBlock.PathShearY;
288 this.m_Shape.PathSkew = shapeBlock.PathSkew;
289 this.m_Shape.ProfileBegin = shapeBlock.ProfileBegin;
290 this.m_Shape.ProfileEnd = shapeBlock.ProfileEnd;
291 this.m_Shape.PathCurve = shapeBlock.PathCurve;
292 this.m_Shape.ProfileCurve = shapeBlock.ProfileCurve;
293 this.m_Shape.ProfileHollow = shapeBlock.ProfileHollow;
294 this.m_Shape.PathRadiusOffset = shapeBlock.PathRadiusOffset;
295 this.m_Shape.PathRevolutions = shapeBlock.PathRevolutions;
296 this.m_Shape.PathTaperX = shapeBlock.PathTaperX;
297 this.m_Shape.PathTaperY = shapeBlock.PathTaperY;
298 this.m_Shape.PathTwist = shapeBlock.PathTwist;
299 this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin;
300 this.updateFlag = 1;
301 }
302
203 #region Client Update Methods 303 #region Client Update Methods
204 304
205 /// <summary> 305 /// <summary>
@@ -226,8 +326,10 @@ namespace OpenSim.Region.Environment.Scenes
226 { 326 {
227 LLVector3 lPos; 327 LLVector3 lPos;
228 lPos = this.Pos; 328 lPos = this.Pos;
329 LLQuaternion lRot;
330 lRot = new LLQuaternion(this.rotation.x, this.rotation.y, this.rotation.z, this.rotation.w);
229 331
230 remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID, this.Text, this.ParentID); 332 remoteClient.SendPrimitiveToClient(this.m_regionHandle, 64096, this.LocalId, this.m_Shape, lPos, lRot, new LLUUID("00000000-0000-0000-9999-000000000005"), this.flags, this.uuid, this.OwnerID, this.Text, this.ParentID);
231 } 333 }
232 334
233 /// <summary> 335 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 669039f..0927903 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -233,7 +233,19 @@ namespace OpenSim.Region.Environment.Scenes
233 /// <param name="shapeBlock"></param> 233 /// <param name="shapeBlock"></param>
234 public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock) 234 public void UpdatePrimShape(uint primLocalID, ObjectShapePacket.ObjectDataBlock shapeBlock)
235 { 235 {
236 236 Primitive prim = null;
237 foreach (EntityBase ent in Entities.Values)
238 {
239 if (ent is SceneObject)
240 {
241 prim = ((SceneObject)ent).HasChildPrim(primLocalID);
242 if (prim != null)
243 {
244 prim.UpdateShape(shapeBlock);
245 break;
246 }
247 }
248 }
237 } 249 }
238 250
239 /// <summary> 251 /// <summary>
@@ -263,7 +275,7 @@ namespace OpenSim.Region.Environment.Scenes
263 /// <param name="description"></param> 275 /// <param name="description"></param>
264 public void PrimDescription(uint primLocalID, string description) 276 public void PrimDescription(uint primLocalID, string description)
265 { 277 {
266 Primitive prim = null; 278 Primitive prim = null;
267 foreach (EntityBase ent in Entities.Values) 279 foreach (EntityBase ent in Entities.Values)
268 { 280 {
269 if (ent is SceneObject) 281 if (ent is SceneObject)
@@ -271,7 +283,7 @@ namespace OpenSim.Region.Environment.Scenes
271 prim = ((SceneObject)ent).HasChildPrim(primLocalID); 283 prim = ((SceneObject)ent).HasChildPrim(primLocalID);
272 if (prim != null) 284 if (prim != null)
273 { 285 {
274 prim.Description = description; 286 prim.Description = description;
275 break; 287 break;
276 } 288 }
277 } 289 }
@@ -341,12 +353,41 @@ namespace OpenSim.Region.Environment.Scenes
341 /// <param name="remoteClient"></param> 353 /// <param name="remoteClient"></param>
342 public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient) 354 public void UpdatePrimPosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
343 { 355 {
344 foreach (Entity ent in Entities.Values) 356 Primitive prim = null;
357 foreach (EntityBase ent in Entities.Values)
345 { 358 {
346 if (ent.LocalId == localID) 359 if (ent is SceneObject)
347 { 360 {
348 ((PrimitiveOld)ent).UpdatePosition(pos); 361 prim = ((SceneObject)ent).HasChildPrim(localID);
349 break; 362 if (prim != null)
363 {
364 prim.UpdatePosition(pos);
365 break;
366 }
367 }
368 }
369 }
370
371 /// <summary>
372 ///
373 /// </summary>
374 /// <param name="localID"></param>
375 /// <param name="pos"></param>
376 /// <param name="rot"></param>
377 /// <param name="remoteClient"></param>
378 public void UpdatePrimRotation(uint localID, LLVector3 pos, LLQuaternion rot, IClientAPI remoteClient)
379 {
380 Primitive prim = null;
381 foreach (EntityBase ent in Entities.Values)
382 {
383 if (ent is SceneObject)
384 {
385 prim = ((SceneObject)ent).HasChildPrim(localID);
386 if (prim != null)
387 {
388 prim.UpdateGroupMouseRotation( pos, rot);
389 break;
390 }
350 } 391 }
351 } 392 }
352 } 393 }
@@ -359,7 +400,19 @@ namespace OpenSim.Region.Environment.Scenes
359 /// <param name="remoteClient"></param> 400 /// <param name="remoteClient"></param>
360 public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient) 401 public void UpdatePrimRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
361 { 402 {
362 403 Primitive prim = null;
404 foreach (EntityBase ent in Entities.Values)
405 {
406 if (ent is SceneObject)
407 {
408 prim = ((SceneObject)ent).HasChildPrim(localID);
409 if (prim != null)
410 {
411 prim.UpdateRotation(rot);
412 break;
413 }
414 }
415 }
363 } 416 }
364 417
365 /// <summary> 418 /// <summary>
@@ -370,6 +423,19 @@ namespace OpenSim.Region.Environment.Scenes
370 /// <param name="remoteClient"></param> 423 /// <param name="remoteClient"></param>
371 public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) 424 public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient)
372 { 425 {
426 Primitive prim = null;
427 foreach (EntityBase ent in Entities.Values)
428 {
429 if (ent is SceneObject)
430 {
431 prim = ((SceneObject)ent).HasChildPrim(localID);
432 if (prim != null)
433 {
434 prim.ResizeGoup(scale);
435 break;
436 }
437 }
438 }
373 } 439 }
374 440
375 /// <summary> 441 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index d13b3ab..838d722 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -452,7 +452,11 @@ namespace OpenSim.Region.Environment.Scenes
452 client.OnChatFromViewer += this.SimChat; 452 client.OnChatFromViewer += this.SimChat;
453 client.OnRequestWearables += this.InformClientOfNeighbours; 453 client.OnRequestWearables += this.InformClientOfNeighbours;
454 client.OnAddPrim += this.AddNewPrim; 454 client.OnAddPrim += this.AddNewPrim;
455 //client.OnUpdatePrimPosition += this.UpdatePrimPosition; 455 client.OnUpdatePrimPosition += this.UpdatePrimPosition;
456 client.OnUpdatePrimRotation += this.UpdatePrimRotation;
457 client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation;
458 client.OnUpdatePrimScale += this.UpdatePrimScale;
459 client.OnUpdatePrimShape += this.UpdatePrimShape;
456 client.OnRequestMapBlocks += this.RequestMapBlocks; 460 client.OnRequestMapBlocks += this.RequestMapBlocks;
457 client.OnTeleportLocationRequest += this.RequestTeleportLocation; 461 client.OnTeleportLocationRequest += this.RequestTeleportLocation;
458 client.OnObjectSelect += this.SelectPrim; 462 client.OnObjectSelect += this.SelectPrim;
@@ -596,6 +600,17 @@ namespace OpenSim.Region.Environment.Scenes
596 return false; 600 return false;
597 } 601 }
598 602
603 public void SendAllSceneObjectsToClient(IClientAPI client)
604 {
605 foreach (EntityBase ent in Entities.Values)
606 {
607 if (ent is SceneObject)
608 {
609 ((SceneObject)ent).SendAllChildPrimsToClient(client);
610 }
611 }
612 }
613
599 #region RegionCommsHost 614 #region RegionCommsHost
600 615
601 /// <summary> 616 /// <summary>
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index 04ed408..3d97a06 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -63,6 +63,7 @@ namespace OpenSim.Region.Environment.Scenes
63 return this.LocalId; 63 return this.LocalId;
64 } 64 }
65 } 65 }
66
66 /// <summary> 67 /// <summary>
67 /// 68 ///
68 /// </summary> 69 /// </summary>
@@ -72,8 +73,8 @@ namespace OpenSim.Region.Environment.Scenes
72 m_world = world; 73 m_world = world;
73 this.Pos = addPacket.ObjectData.RayEnd; 74 this.Pos = addPacket.ObjectData.RayEnd;
74 this.CreateRootFromPacket(addPacket, ownerID, localID); 75 this.CreateRootFromPacket(addPacket, ownerID, localID);
75
76 } 76 }
77
77 /// <summary> 78 /// <summary>
78 /// 79 ///
79 /// </summary> 80 /// </summary>
@@ -115,6 +116,13 @@ namespace OpenSim.Region.Environment.Scenes
115 this.rootPrimitive.AddNewChildren(primObject); 116 this.rootPrimitive.AddNewChildren(primObject);
116 } 117 }
117 118
119 public void AddChildToList(Primitive prim)
120 {
121 if (!this.ChildPrimitives.ContainsKey(prim.uuid))
122 {
123 this.ChildPrimitives.Add(prim.uuid, prim);
124 }
125 }
118 /// <summary> 126 /// <summary>
119 /// 127 ///
120 /// </summary> 128 /// </summary>
@@ -130,10 +138,15 @@ namespace OpenSim.Region.Environment.Scenes
130 return null; 138 return null;
131 } 139 }
132 140
141 /// <summary>
142 ///
143 /// </summary>
144 /// <param name="localID"></param>
145 /// <returns></returns>
133 public Primitive HasChildPrim(uint localID) 146 public Primitive HasChildPrim(uint localID)
134 { 147 {
135 Primitive returnPrim = null; 148 Primitive returnPrim = null;
136 foreach (Primitive prim in this.children) 149 foreach (Primitive prim in this.ChildPrimitives.Values)
137 { 150 {
138 if (prim.LocalId == localID) 151 if (prim.LocalId == localID)
139 { 152 {
@@ -144,6 +157,11 @@ namespace OpenSim.Region.Environment.Scenes
144 return returnPrim; 157 return returnPrim;
145 } 158 }
146 159
160 public void SendAllChildPrimsToClient(IClientAPI client)
161 {
162 this.rootPrimitive.SendFullUpdateForAllChildren(client);
163 }
164
147 /// <summary> 165 /// <summary>
148 /// 166 ///
149 /// </summary> 167 /// </summary>
@@ -160,7 +178,7 @@ namespace OpenSim.Region.Environment.Scenes
160 /// <param name="remoteClient"></param> 178 /// <param name="remoteClient"></param>
161 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 179 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
162 { 180 {
163 this.Pos = pos; 181 //this.Pos = pos;
164 this.rootPrimitive.Pos = pos; 182 this.rootPrimitive.Pos = pos;
165 this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); 183 this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient);
166 } 184 }
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index dcca848..98fa2ed 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -384,6 +384,7 @@ namespace OpenSim.Region.Environment.Scenes
384 public void SendOurAppearance(IClientAPI OurClient) 384 public void SendOurAppearance(IClientAPI OurClient)
385 { 385 {
386 this.ControllingClient.SendWearables(this.Wearables); 386 this.ControllingClient.SendWearables(this.Wearables);
387 this.m_world.SendAllSceneObjectsToClient(this.ControllingClient);
387 } 388 }
388 389
389 /// <summary> 390 /// <summary>