aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs50
1 files changed, 25 insertions, 25 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
index 9e3f0db..b04e1b6 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs
@@ -36,8 +36,8 @@ public class BSLinkset
36{ 36{
37 private static string LogHeader = "[BULLETSIM LINKSET]"; 37 private static string LogHeader = "[BULLETSIM LINKSET]";
38 38
39 private BSPrim m_linksetRoot; 39 private BSPhysObject m_linksetRoot;
40 public BSPrim LinksetRoot { get { return m_linksetRoot; } } 40 public BSPhysObject LinksetRoot { get { return m_linksetRoot; } }
41 41
42 private BSScene m_physicsScene; 42 private BSScene m_physicsScene;
43 public BSScene PhysicsScene { get { return m_physicsScene; } } 43 public BSScene PhysicsScene { get { return m_physicsScene; } }
@@ -46,7 +46,7 @@ public class BSLinkset
46 public int LinksetID { get; private set; } 46 public int LinksetID { get; private set; }
47 47
48 // The children under the root in this linkset 48 // The children under the root in this linkset
49 private List<BSPrim> m_children; 49 private List<BSPhysObject> m_children;
50 50
51 // We lock the diddling of linkset classes to prevent any badness. 51 // We lock the diddling of linkset classes to prevent any badness.
52 // This locks the modification of the instances of this class. Changes 52 // This locks the modification of the instances of this class. Changes
@@ -74,7 +74,7 @@ public class BSLinkset
74 get { return ComputeLinksetGeometricCenter(); } 74 get { return ComputeLinksetGeometricCenter(); }
75 } 75 }
76 76
77 public BSLinkset(BSScene scene, BSPrim parent) 77 public BSLinkset(BSScene scene, BSPhysObject parent)
78 { 78 {
79 // A simple linkset of one (no children) 79 // A simple linkset of one (no children)
80 LinksetID = m_nextLinksetID++; 80 LinksetID = m_nextLinksetID++;
@@ -83,14 +83,14 @@ public class BSLinkset
83 m_nextLinksetID = 1; 83 m_nextLinksetID = 1;
84 m_physicsScene = scene; 84 m_physicsScene = scene;
85 m_linksetRoot = parent; 85 m_linksetRoot = parent;
86 m_children = new List<BSPrim>(); 86 m_children = new List<BSPhysObject>();
87 m_mass = parent.MassRaw; 87 m_mass = parent.MassRaw;
88 } 88 }
89 89
90 // Link to a linkset where the child knows the parent. 90 // Link to a linkset where the child knows the parent.
91 // Parent changing should not happen so do some sanity checking. 91 // Parent changing should not happen so do some sanity checking.
92 // We return the parent's linkset so the child can track its membership. 92 // We return the parent's linkset so the child can track its membership.
93 public BSLinkset AddMeToLinkset(BSPrim child) 93 public BSLinkset AddMeToLinkset(BSPhysObject child)
94 { 94 {
95 lock (m_linksetActivityLock) 95 lock (m_linksetActivityLock)
96 { 96 {
@@ -102,7 +102,7 @@ public class BSLinkset
102 // Remove a child from a linkset. 102 // Remove a child from a linkset.
103 // Returns a new linkset for the child which is a linkset of one (just the 103 // Returns a new linkset for the child which is a linkset of one (just the
104 // orphened child). 104 // orphened child).
105 public BSLinkset RemoveMeFromLinkset(BSPrim child) 105 public BSLinkset RemoveMeFromLinkset(BSPhysObject child)
106 { 106 {
107 lock (m_linksetActivityLock) 107 lock (m_linksetActivityLock)
108 { 108 {
@@ -129,7 +129,7 @@ public class BSLinkset
129 } 129 }
130 130
131 // Return 'true' if the passed object is the root object of this linkset 131 // Return 'true' if the passed object is the root object of this linkset
132 public bool IsRoot(BSPrim requestor) 132 public bool IsRoot(BSPhysObject requestor)
133 { 133 {
134 return (requestor.LocalID == m_linksetRoot.LocalID); 134 return (requestor.LocalID == m_linksetRoot.LocalID);
135 } 135 }
@@ -140,12 +140,12 @@ public class BSLinkset
140 public bool HasAnyChildren { get { return (m_children.Count > 0); } } 140 public bool HasAnyChildren { get { return (m_children.Count > 0); } }
141 141
142 // Return 'true' if this child is in this linkset 142 // Return 'true' if this child is in this linkset
143 public bool HasChild(BSPrim child) 143 public bool HasChild(BSPhysObject child)
144 { 144 {
145 bool ret = false; 145 bool ret = false;
146 lock (m_linksetActivityLock) 146 lock (m_linksetActivityLock)
147 { 147 {
148 foreach (BSPrim bp in m_children) 148 foreach (BSPhysObject bp in m_children)
149 { 149 {
150 if (child.LocalID == bp.LocalID) 150 if (child.LocalID == bp.LocalID)
151 { 151 {
@@ -160,7 +160,7 @@ public class BSLinkset
160 private float ComputeLinksetMass() 160 private float ComputeLinksetMass()
161 { 161 {
162 float mass = m_linksetRoot.MassRaw; 162 float mass = m_linksetRoot.MassRaw;
163 foreach (BSPrim bp in m_children) 163 foreach (BSPhysObject bp in m_children)
164 { 164 {
165 mass += bp.MassRaw; 165 mass += bp.MassRaw;
166 } 166 }
@@ -174,7 +174,7 @@ public class BSLinkset
174 174
175 lock (m_linksetActivityLock) 175 lock (m_linksetActivityLock)
176 { 176 {
177 foreach (BSPrim bp in m_children) 177 foreach (BSPhysObject bp in m_children)
178 { 178 {
179 com += bp.Position * bp.MassRaw; 179 com += bp.Position * bp.MassRaw;
180 totalMass += bp.MassRaw; 180 totalMass += bp.MassRaw;
@@ -192,7 +192,7 @@ public class BSLinkset
192 192
193 lock (m_linksetActivityLock) 193 lock (m_linksetActivityLock)
194 { 194 {
195 foreach (BSPrim bp in m_children) 195 foreach (BSPhysObject bp in m_children)
196 { 196 {
197 com += bp.Position * bp.MassRaw; 197 com += bp.Position * bp.MassRaw;
198 } 198 }
@@ -204,7 +204,7 @@ public class BSLinkset
204 204
205 // When physical properties are changed the linkset needs to recalculate 205 // When physical properties are changed the linkset needs to recalculate
206 // its internal properties. 206 // its internal properties.
207 public void Refresh(BSPrim requestor) 207 public void Refresh(BSPhysObject requestor)
208 { 208 {
209 // If there are no children, there aren't any constraints to recompute 209 // If there are no children, there aren't any constraints to recompute
210 if (!HasAnyChildren) 210 if (!HasAnyChildren)
@@ -230,7 +230,7 @@ public class BSLinkset
230 float linksetMass = LinksetMass; 230 float linksetMass = LinksetMass;
231 lock (m_linksetActivityLock) 231 lock (m_linksetActivityLock)
232 { 232 {
233 foreach (BSPrim child in m_children) 233 foreach (BSPhysObject child in m_children)
234 { 234 {
235 BSConstraint constrain; 235 BSConstraint constrain;
236 if (m_physicsScene.Constraints.TryGetConstraint(LinksetRoot.Body, child.Body, out constrain)) 236 if (m_physicsScene.Constraints.TryGetConstraint(LinksetRoot.Body, child.Body, out constrain))
@@ -255,14 +255,14 @@ public class BSLinkset
255 255
256 // I am the root of a linkset and a new child is being added 256 // I am the root of a linkset and a new child is being added
257 // Called while LinkActivity is locked. 257 // Called while LinkActivity is locked.
258 private void AddChildToLinkset(BSPrim child) 258 private void AddChildToLinkset(BSPhysObject child)
259 { 259 {
260 if (!HasChild(child)) 260 if (!HasChild(child))
261 { 261 {
262 m_children.Add(child); 262 m_children.Add(child);
263 263
264 BSPrim rootx = LinksetRoot; // capture the root as of now 264 BSPhysObject rootx = LinksetRoot; // capture the root as of now
265 BSPrim childx = child; 265 BSPhysObject childx = child;
266 m_physicsScene.TaintedObject("AddChildToLinkset", delegate() 266 m_physicsScene.TaintedObject("AddChildToLinkset", delegate()
267 { 267 {
268 DetailLog("{0},AddChildToLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID); 268 DetailLog("{0},AddChildToLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID);
@@ -277,7 +277,7 @@ public class BSLinkset
277 // it's still connected to the linkset. 277 // it's still connected to the linkset.
278 // Normal OpenSimulator operation will never do this because other SceneObjectPart information 278 // Normal OpenSimulator operation will never do this because other SceneObjectPart information
279 // has to be updated also (like pointer to prim's parent). 279 // has to be updated also (like pointer to prim's parent).
280 private void RemoveChildFromOtherLinkset(BSPrim pchild) 280 private void RemoveChildFromOtherLinkset(BSPhysObject pchild)
281 { 281 {
282 pchild.Linkset = new BSLinkset(m_physicsScene, pchild); 282 pchild.Linkset = new BSLinkset(m_physicsScene, pchild);
283 RemoveChildFromLinkset(pchild); 283 RemoveChildFromLinkset(pchild);
@@ -285,12 +285,12 @@ public class BSLinkset
285 285
286 // I am the root of a linkset and one of my children is being removed. 286 // I am the root of a linkset and one of my children is being removed.
287 // Safe to call even if the child is not really in my linkset. 287 // Safe to call even if the child is not really in my linkset.
288 private void RemoveChildFromLinkset(BSPrim child) 288 private void RemoveChildFromLinkset(BSPhysObject child)
289 { 289 {
290 if (m_children.Remove(child)) 290 if (m_children.Remove(child))
291 { 291 {
292 BSPrim rootx = LinksetRoot; // capture the root as of now 292 BSPhysObject rootx = LinksetRoot; // capture the root as of now
293 BSPrim childx = child; 293 BSPhysObject childx = child;
294 m_physicsScene.TaintedObject("RemoveChildFromLinkset", delegate() 294 m_physicsScene.TaintedObject("RemoveChildFromLinkset", delegate()
295 { 295 {
296 DetailLog("{0},RemoveChildFromLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID); 296 DetailLog("{0},RemoveChildFromLinkset,taint,child={1}", m_linksetRoot.LocalID, child.LocalID);
@@ -310,7 +310,7 @@ public class BSLinkset
310 310
311 // Create a constraint between me (root of linkset) and the passed prim (the child). 311 // Create a constraint between me (root of linkset) and the passed prim (the child).
312 // Called at taint time! 312 // Called at taint time!
313 private void PhysicallyLinkAChildToRoot(BSPrim rootPrim, BSPrim childPrim) 313 private void PhysicallyLinkAChildToRoot(BSPhysObject rootPrim, BSPhysObject childPrim)
314 { 314 {
315 // Zero motion for children so they don't interpolate 315 // Zero motion for children so they don't interpolate
316 childPrim.ZeroMotion(); 316 childPrim.ZeroMotion();
@@ -383,7 +383,7 @@ public class BSLinkset
383 383
384 // Remove linkage between myself and a particular child 384 // Remove linkage between myself and a particular child
385 // Called at taint time! 385 // Called at taint time!
386 private void PhysicallyUnlinkAChildFromRoot(BSPrim rootPrim, BSPrim childPrim) 386 private void PhysicallyUnlinkAChildFromRoot(BSPhysObject rootPrim, BSPhysObject childPrim)
387 { 387 {
388 DetailLog("{0},PhysicallyUnlinkAChildFromRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID); 388 DetailLog("{0},PhysicallyUnlinkAChildFromRoot,taint,root={1},child={2}", rootPrim.LocalID, rootPrim.LocalID, childPrim.LocalID);
389 389
@@ -396,7 +396,7 @@ public class BSLinkset
396 396
397 // Remove linkage between myself and any possible children I might have 397 // Remove linkage between myself and any possible children I might have
398 // Called at taint time! 398 // Called at taint time!
399 private void PhysicallyUnlinkAllChildrenFromRoot(BSPrim rootPrim) 399 private void PhysicallyUnlinkAllChildrenFromRoot(BSPhysObject rootPrim)
400 { 400 {
401 DetailLog("{0},PhysicallyUnlinkAllChildren,taint", rootPrim.LocalID); 401 DetailLog("{0},PhysicallyUnlinkAllChildren,taint", rootPrim.LocalID);
402 402