aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorMW2007-07-04 19:07:27 +0000
committerMW2007-07-04 19:07:27 +0000
commitbeb3073bec9438a439e13eaec40a8320a9279adc (patch)
tree04ad41c83427605d910a0d4ed2cfa560a30a8066 /OpenSim/Region/Environment/Scenes
parent* re-fixed the utf-16 bug in xmlRpcResponse serialization (diff)
downloadopensim-SC_OLD-beb3073bec9438a439e13eaec40a8320a9279adc.zip
opensim-SC_OLD-beb3073bec9438a439e13eaec40a8320a9279adc.tar.gz
opensim-SC_OLD-beb3073bec9438a439e13eaec40a8320a9279adc.tar.bz2
opensim-SC_OLD-beb3073bec9438a439e13eaec40a8320a9279adc.tar.xz
A bit more work on Building tools/support.
updated Axiom.MathLib.dll.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/EntityBase.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Primitive.cs124
-rw-r--r--OpenSim/Region/Environment/Scenes/PrimitiveOld.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs60
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObject.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs2
7 files changed, 179 insertions, 16 deletions
diff --git a/OpenSim/Region/Environment/Scenes/EntityBase.cs b/OpenSim/Region/Environment/Scenes/EntityBase.cs
index 2874ae2..99ca021 100644
--- a/OpenSim/Region/Environment/Scenes/EntityBase.cs
+++ b/OpenSim/Region/Environment/Scenes/EntityBase.cs
@@ -1,5 +1,5 @@
1using System.Collections.Generic; 1using System.Collections.Generic;
2using Axiom.MathLib; 2using Axiom.Math;
3using libsecondlife; 3using libsecondlife;
4 4
5namespace OpenSim.Region.Environment.Scenes 5namespace OpenSim.Region.Environment.Scenes
diff --git a/OpenSim/Region/Environment/Scenes/Primitive.cs b/OpenSim/Region/Environment/Scenes/Primitive.cs
index 803bd28..24dc115 100644
--- a/OpenSim/Region/Environment/Scenes/Primitive.cs
+++ b/OpenSim/Region/Environment/Scenes/Primitive.cs
@@ -1,6 +1,6 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using Axiom.MathLib; 3using Axiom.Math;
4using libsecondlife; 4using libsecondlife;
5using libsecondlife.Packets; 5using libsecondlife.Packets;
6using OpenSim.Framework.Interfaces; 6using OpenSim.Framework.Interfaces;
@@ -45,6 +45,7 @@ namespace OpenSim.Region.Environment.Scenes
45 public bool isRootPrim; 45 public bool isRootPrim;
46 public EntityBase m_Parent; 46 public EntityBase m_Parent;
47 47
48 #region Properties
48 public override LLVector3 Pos 49 public override LLVector3 Pos
49 { 50 {
50 get 51 get
@@ -69,6 +70,22 @@ namespace OpenSim.Region.Environment.Scenes
69 70
70 } 71 }
71 72
73 public LLVector3 WorldPos
74 {
75 get
76 {
77 if (!this.isRootPrim)
78 {
79 Primitive parentPrim = (Primitive)this.m_Parent;
80 return this.m_pos + parentPrim.WorldPos;
81 }
82 else
83 {
84 return this.Pos;
85 }
86 }
87 }
88
72 public string Description 89 public string Description
73 { 90 {
74 get 91 get
@@ -92,7 +109,9 @@ namespace OpenSim.Region.Environment.Scenes
92 return this.m_Shape.Scale; 109 return this.m_Shape.Scale;
93 } 110 }
94 } 111 }
112 #endregion
95 113
114 #region Constructors
96 public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject) 115 public Primitive(ulong regionHandle, Scene world, ObjectAddPacket addPacket, LLUUID ownerID, uint localID, bool isRoot, EntityBase parent, SceneObject rootObject)
97 { 116 {
98 m_regionHandle = regionHandle; 117 m_regionHandle = regionHandle;
@@ -102,9 +121,11 @@ namespace OpenSim.Region.Environment.Scenes
102 this.isRootPrim = isRoot; 121 this.isRootPrim = isRoot;
103 this.m_RootParent = rootObject; 122 this.m_RootParent = rootObject;
104 this.CreateFromPacket(addPacket, ownerID, localID); 123 this.CreateFromPacket(addPacket, ownerID, localID);
105 this.rotation = Axiom.MathLib.Quaternion.Identity; 124 this.rotation = Axiom.Math.Quaternion.Identity;
106 } 125 }
126 #endregion
107 127
128 #region Override from EntityBase
108 /// <summary> 129 /// <summary>
109 /// 130 ///
110 /// </summary> 131 /// </summary>
@@ -126,7 +147,9 @@ namespace OpenSim.Region.Environment.Scenes
126 child.update(); 147 child.update();
127 } 148 }
128 } 149 }
150 #endregion
129 151
152 #region Setup
130 /// <summary> 153 /// <summary>
131 /// 154 ///
132 /// </summary> 155 /// </summary>
@@ -169,7 +192,9 @@ namespace OpenSim.Region.Environment.Scenes
169 192
170 this.updateFlag = 1; 193 this.updateFlag = 1;
171 } 194 }
195 #endregion
172 196
197 #region Linking / unlinking
173 /// <summary> 198 /// <summary>
174 /// 199 ///
175 /// </summary> 200 /// </summary>
@@ -196,28 +221,49 @@ namespace OpenSim.Region.Environment.Scenes
196 this.isRootPrim = false; 221 this.isRootPrim = false;
197 this.m_Parent = newParent; 222 this.m_Parent = newParent;
198 this.ParentID = newParent.LocalId; 223 this.ParentID = newParent.LocalId;
199 this.SetRootParent(rootParent); 224 this.m_RootParent = rootParent;
225 this.m_RootParent.AddChildToList(this);
200 this.Pos = oldPos; 226 this.Pos = oldPos;
201 Axiom.MathLib.Vector3 axPos = new Axiom.MathLib.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z); 227 Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z);
202 axPos = this.m_Parent.rotation.Inverse() * axPos; 228 axPos = this.m_Parent.rotation.Inverse() * axPos;
203 this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z); 229 this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
204 this.rotation = this.rotation * this.m_Parent.rotation.Inverse(); 230 this.rotation = this.rotation * this.m_Parent.rotation.Inverse();
205 this.updateFlag = 1; 231 this.updateFlag = 1;
206 232
233 foreach (Primitive child in children)
234 {
235 child.SetRootParent(rootParent, newParent, oldPos);
236 }
237 children.Clear();
238
239
207 } 240 }
208 241
209 /// <summary> 242 /// <summary>
210 /// 243 ///
211 /// </summary> 244 /// </summary>
212 /// <param name="newRoot"></param> 245 /// <param name="newRoot"></param>
213 public void SetRootParent(SceneObject newRoot) 246 public void SetRootParent(SceneObject newRoot , Primitive newParent, LLVector3 oldParentPosition)
214 { 247 {
248 LLVector3 oldPos = new LLVector3(this.Pos.X, this.Pos.Y, this.Pos.Z);
249 oldPos += oldParentPosition;
250 this.isRootPrim = false;
251 this.m_Parent = newParent;
252 this.ParentID = newParent.LocalId;
253 newParent.AddToChildrenList(this);
215 this.m_RootParent = newRoot; 254 this.m_RootParent = newRoot;
216 this.m_RootParent.AddChildToList(this); 255 this.m_RootParent.AddChildToList(this);
256 this.Pos = oldPos;
257 Axiom.Math.Vector3 axPos = new Axiom.Math.Vector3(this.m_pos.X, m_pos.Y, m_pos.Z);
258 axPos = this.m_Parent.rotation.Inverse() * axPos;
259 this.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
260 this.rotation = this.rotation * this.m_Parent.rotation.Inverse();
261 this.updateFlag = 1;
217 foreach (Primitive child in children) 262 foreach (Primitive child in children)
218 { 263 {
219 child.SetRootParent(newRoot); 264 child.SetRootParent(newRoot, newParent, oldPos);
220 } 265 }
266 children.Clear();
221 } 267 }
222 268
223 public void AddOffsetToChildren(LLVector3 offset) 269 public void AddOffsetToChildren(LLVector3 offset)
@@ -229,6 +275,12 @@ namespace OpenSim.Region.Environment.Scenes
229 } 275 }
230 } 276 }
231 277
278 public void AddToChildrenList(Primitive prim)
279 {
280 this.children.Add(prim);
281 }
282 #endregion
283
232 #region Resizing/Scale 284 #region Resizing/Scale
233 public void ResizeGoup(LLVector3 scale) 285 public void ResizeGoup(LLVector3 scale)
234 { 286 {
@@ -252,6 +304,7 @@ namespace OpenSim.Region.Environment.Scenes
252 } 304 }
253 #endregion 305 #endregion
254 306
307 #region Position
255 /// <summary> 308 /// <summary>
256 /// 309 ///
257 /// </summary> 310 /// </summary>
@@ -264,19 +317,73 @@ namespace OpenSim.Region.Environment.Scenes
264 this.updateFlag = 2; 317 this.updateFlag = 2;
265 } 318 }
266 319
320 public void UpdateSinglePosition(LLVector3 pos)
321 {
322 //Console.WriteLine("updating single prim position");
323 if (this.isRootPrim)
324 {
325 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
326 LLVector3 oldPos = new LLVector3(Pos.X, Pos.Y, Pos.Z);
327 LLVector3 diff = oldPos - newPos;
328 Axiom.Math.Vector3 axDiff = new Vector3(diff.X, diff.Y, diff.Z);
329 axDiff = this.rotation.Inverse() * axDiff;
330 diff.X = axDiff.x;
331 diff.Y = axDiff.y;
332 diff.Z = axDiff.z;
333 this.Pos = newPos;
334
335 foreach (Primitive prim in this.children)
336 {
337 prim.m_pos += diff;
338 prim.updateFlag = 2;
339 }
340 this.updateFlag = 2;
341 }
342 else
343 {
344 LLVector3 newPos = new LLVector3(pos.X, pos.Y, pos.Z);
345 this.m_pos = newPos;
346 this.updateFlag = 2;
347 }
348 }
349
350 #endregion
351
352 #region Rotation
267 public void UpdateRotation(LLQuaternion rot) 353 public void UpdateRotation(LLQuaternion rot)
268 { 354 {
269 this.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); 355 this.rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
356 this.updateFlag = 2;
357 }
358
359 public void UpdateSingleRotation(LLQuaternion rot)
360 {
361 Axiom.Math.Quaternion axRot = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
362 Axiom.Math.Quaternion oldParentRot = new Quaternion(this.rotation.w, this.rotation.x, this.rotation.y, this.rotation.z);
363 this.rotation = axRot;
364 foreach (Primitive prim in this.children)
365 {
366 Axiom.Math.Vector3 axPos = new Vector3(prim.m_pos.X, prim.m_pos.Y, prim.m_pos.Z);
367 axPos = oldParentRot * axPos;
368 axPos = axRot.Inverse() * axPos;
369 prim.m_pos = new LLVector3(axPos.x, axPos.y, axPos.z);
370 prim.rotation = prim.rotation * oldParentRot;
371 prim.rotation = prim.rotation * axRot.Inverse();
372 prim.updateFlag = 2;
373 }
270 this.updateFlag = 2; 374 this.updateFlag = 2;
271 } 375 }
272 376
273 public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot) 377 public void UpdateGroupMouseRotation(LLVector3 pos, LLQuaternion rot)
274 { 378 {
275 this.rotation = new Axiom.MathLib.Quaternion(rot.W, rot.X, rot.Y, rot.Z); 379 this.rotation = new Axiom.Math.Quaternion(rot.W, rot.X, rot.Y, rot.Z);
276 this.Pos = pos; 380 this.Pos = pos;
277 this.updateFlag = 2; 381 this.updateFlag = 2;
278 } 382 }
279 383
384 #endregion
385
386 #region Shape
280 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock) 387 public void UpdateShape(ObjectShapePacket.ObjectDataBlock shapeBlock)
281 { 388 {
282 this.m_Shape.PathBegin = shapeBlock.PathBegin; 389 this.m_Shape.PathBegin = shapeBlock.PathBegin;
@@ -299,6 +406,7 @@ namespace OpenSim.Region.Environment.Scenes
299 this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin; 406 this.m_Shape.PathTwistBegin = shapeBlock.PathTwistBegin;
300 this.updateFlag = 1; 407 this.updateFlag = 1;
301 } 408 }
409 #endregion
302 410
303 #region Client Update Methods 411 #region Client Update Methods
304 412
diff --git a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs
index 4213a18..247ff87 100644
--- a/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs
+++ b/OpenSim/Region/Environment/Scenes/PrimitiveOld.cs
@@ -29,7 +29,7 @@
29using System; 29using System;
30using System.Collections.Generic; 30using System.Collections.Generic;
31using System.Text; 31using System.Text;
32using Axiom.MathLib; 32using Axiom.Math;
33using libsecondlife; 33using libsecondlife;
34using libsecondlife.Packets; 34using libsecondlife.Packets;
35using OpenSim.Framework.Interfaces; 35using OpenSim.Framework.Interfaces;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index 0927903..b3d9d15 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Region.Environment.Scenes
107 /// <param name="fromAgentID"></param> 107 /// <param name="fromAgentID"></param>
108 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID) 108 public void SimChat(byte[] message, byte type, LLVector3 fromPos, string fromName, LLUUID fromAgentID)
109 { 109 {
110 Console.WriteLine("Chat message"); 110 // Console.WriteLine("Chat message");
111 ScenePresence avatar = null; 111 ScenePresence avatar = null;
112 foreach (IClientAPI client in m_clientThreads.Values) 112 foreach (IClientAPI client in m_clientThreads.Values)
113 { 113 {
@@ -118,7 +118,7 @@ namespace OpenSim.Region.Environment.Scenes
118 avatar = this.Avatars[client.AgentId]; 118 avatar = this.Avatars[client.AgentId];
119 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y)); 119 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
120 dis= (int)avatar.Pos.GetDistanceTo(fromPos); 120 dis= (int)avatar.Pos.GetDistanceTo(fromPos);
121 Console.WriteLine("found avatar at " +dis); 121 //Console.WriteLine("found avatar at " +dis);
122 122
123 } 123 }
124 124
@@ -314,13 +314,27 @@ namespace OpenSim.Region.Environment.Scenes
314 314
315 public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 315 public void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
316 { 316 {
317 Primitive prim = null;
318 foreach (EntityBase ent in Entities.Values)
319 {
320 if (ent is SceneObject)
321 {
322 prim = ((SceneObject)ent).HasChildPrim(objectID);
323 if (prim != null)
324 {
325 ((SceneObject)ent).GrapMovement(offset, pos, remoteClient);
326 break;
327 }
328 }
329 }
330 /*
317 if (this.Entities.ContainsKey(objectID)) 331 if (this.Entities.ContainsKey(objectID))
318 { 332 {
319 if (this.Entities[objectID] is SceneObject) 333 if (this.Entities[objectID] is SceneObject)
320 { 334 {
321 ((SceneObject)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient); 335 ((SceneObject)this.Entities[objectID]).GrapMovement(offset, pos, remoteClient);
322 } 336 }
323 } 337 }*/
324 } 338 }
325 339
326 /// <summary> 340 /// <summary>
@@ -368,6 +382,23 @@ namespace OpenSim.Region.Environment.Scenes
368 } 382 }
369 } 383 }
370 384
385 public void UpdatePrimSinglePosition(uint localID, LLVector3 pos, IClientAPI remoteClient)
386 {
387 Primitive prim = null;
388 foreach (EntityBase ent in Entities.Values)
389 {
390 if (ent is SceneObject)
391 {
392 prim = ((SceneObject)ent).HasChildPrim(localID);
393 if (prim != null)
394 {
395 prim.UpdateSinglePosition(pos);
396 break;
397 }
398 }
399 }
400 }
401
371 /// <summary> 402 /// <summary>
372 /// 403 ///
373 /// </summary> 404 /// </summary>
@@ -419,6 +450,29 @@ namespace OpenSim.Region.Environment.Scenes
419 /// 450 ///
420 /// </summary> 451 /// </summary>
421 /// <param name="localID"></param> 452 /// <param name="localID"></param>
453 /// <param name="rot"></param>
454 /// <param name="remoteClient"></param>
455 public void UpdatePrimSingleRotation(uint localID, LLQuaternion rot, IClientAPI remoteClient)
456 {
457 Primitive prim = null;
458 foreach (EntityBase ent in Entities.Values)
459 {
460 if (ent is SceneObject)
461 {
462 prim = ((SceneObject)ent).HasChildPrim(localID);
463 if (prim != null)
464 {
465 prim.UpdateSingleRotation(rot);
466 break;
467 }
468 }
469 }
470 }
471
472 /// <summary>
473 ///
474 /// </summary>
475 /// <param name="localID"></param>
422 /// <param name="scale"></param> 476 /// <param name="scale"></param>
423 /// <param name="remoteClient"></param> 477 /// <param name="remoteClient"></param>
424 public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient) 478 public void UpdatePrimScale(uint localID, LLVector3 scale, IClientAPI remoteClient)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 838d722..0797566 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -453,8 +453,10 @@ namespace OpenSim.Region.Environment.Scenes
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.OnUpdatePrimSinglePosition += this.UpdatePrimSinglePosition;
456 client.OnUpdatePrimRotation += this.UpdatePrimRotation; 457 client.OnUpdatePrimRotation += this.UpdatePrimRotation;
457 client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation; 458 client.OnUpdatePrimGroupRotation += this.UpdatePrimRotation;
459 client.OnUpdatePrimSingleRotation += this.UpdatePrimSingleRotation;
458 client.OnUpdatePrimScale += this.UpdatePrimScale; 460 client.OnUpdatePrimScale += this.UpdatePrimScale;
459 client.OnUpdatePrimShape += this.UpdatePrimShape; 461 client.OnUpdatePrimShape += this.UpdatePrimShape;
460 client.OnRequestMapBlocks += this.RequestMapBlocks; 462 client.OnRequestMapBlocks += this.RequestMapBlocks;
diff --git a/OpenSim/Region/Environment/Scenes/SceneObject.cs b/OpenSim/Region/Environment/Scenes/SceneObject.cs
index 9a46fbf..00d7c63 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObject.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObject.cs
@@ -178,8 +178,7 @@ namespace OpenSim.Region.Environment.Scenes
178 /// <param name="remoteClient"></param> 178 /// <param name="remoteClient"></param>
179 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient) 179 public void GrapMovement(LLVector3 offset, LLVector3 pos, IClientAPI remoteClient)
180 { 180 {
181 //this.Pos = pos; 181 this.rootPrimitive.Pos = pos ;
182 this.rootPrimitive.Pos = pos;
183 this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient); 182 this.rootPrimitive.SendTerseUpdateForAllChildren(remoteClient);
184 } 183 }
185 184
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 98fa2ed..14b7b2f 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -28,7 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31using Axiom.MathLib; 31using Axiom.Math;
32using libsecondlife; 32using libsecondlife;
33using libsecondlife.Packets; 33using libsecondlife.Packets;
34using OpenSim.Framework.Console; 34using OpenSim.Framework.Console;