aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-07-30 23:44:47 +0100
committerJustin Clark-Casey (justincc)2011-07-30 23:44:47 +0100
commite08be91c846d898fdc79a88e79ac1feb491cb63d (patch)
treea8c4dd860bed209fc2126ee6e2a2caf1e2bde3c2 /OpenSim/Region/Physics
parentrefactor: Rename ODEPrim.ParentPrim() to AddChildPrim() for code readability (diff)
downloadopensim-SC-e08be91c846d898fdc79a88e79ac1feb491cb63d.zip
opensim-SC-e08be91c846d898fdc79a88e79ac1feb491cb63d.tar.gz
opensim-SC-e08be91c846d898fdc79a88e79ac1feb491cb63d.tar.bz2
opensim-SC-e08be91c846d898fdc79a88e79ac1feb491cb63d.tar.xz
Refactor: Replace instances of m_isphysical with IsPhysical rather than have some code reference the private var and other the public var without any functionality difference.
Add some method doc to IsPhysical
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs73
1 files changed, 40 insertions, 33 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 9c323a4..879d30f 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -61,6 +61,22 @@ namespace OpenSim.Region.Physics.OdePlugin
61 { 61 {
62 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 62 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
63 63
64 private bool m_isphysical;
65
66 /// <summary>
67 /// Is this prim subject to physics? Even if not, it's still solid for collision purposes.
68 /// </summary>
69 public override bool IsPhysical
70 {
71 get { return m_isphysical; }
72 set
73 {
74 m_isphysical = value;
75 if (!m_isphysical) // Zero the remembered last velocity
76 m_lastVelocity = Vector3.Zero;
77 }
78 }
79
64 private Vector3 _position; 80 private Vector3 _position;
65 private Vector3 _velocity; 81 private Vector3 _velocity;
66 private Vector3 _torque; 82 private Vector3 _torque;
@@ -153,7 +169,6 @@ namespace OpenSim.Region.Physics.OdePlugin
153 private List<OdePrim> childrenPrim = new List<OdePrim>(); 169 private List<OdePrim> childrenPrim = new List<OdePrim>();
154 170
155 private bool iscolliding; 171 private bool iscolliding;
156 private bool m_isphysical;
157 private bool m_isSelected; 172 private bool m_isSelected;
158 173
159 internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively 174 internal bool m_isVolumeDetect; // If true, this prim only detects collisions but doesn't collide actively
@@ -240,13 +255,15 @@ namespace OpenSim.Region.Physics.OdePlugin
240 m_targetSpace = (IntPtr)0; 255 m_targetSpace = (IntPtr)0;
241 256
242 if (pos.Z < 0) 257 if (pos.Z < 0)
243 m_isphysical = false; 258 {
259 IsPhysical = false;
260 }
244 else 261 else
245 { 262 {
246 m_isphysical = pisPhysical; 263 IsPhysical = pisPhysical;
247 // If we're physical, we need to be in the master space for now. 264 // If we're physical, we need to be in the master space for now.
248 // linksets *should* be in a space together.. but are not currently 265 // linksets *should* be in a space together.. but are not currently
249 if (m_isphysical) 266 if (IsPhysical)
250 m_targetSpace = _parent_scene.space; 267 m_targetSpace = _parent_scene.space;
251 } 268 }
252 269
@@ -289,7 +306,7 @@ namespace OpenSim.Region.Physics.OdePlugin
289 // through it while it's selected 306 // through it while it's selected
290 m_collisionscore = 0; 307 m_collisionscore = 0;
291 308
292 if ((m_isphysical && !_zeroFlag) || !value) 309 if ((IsPhysical && !_zeroFlag) || !value)
293 { 310 {
294 m_taintselected = value; 311 m_taintselected = value;
295 _parent_scene.AddPhysicsActorTaint(this); 312 _parent_scene.AddPhysicsActorTaint(this);
@@ -332,7 +349,7 @@ namespace OpenSim.Region.Physics.OdePlugin
332 { 349 {
333 if (!childPrim) 350 if (!childPrim)
334 { 351 {
335 if (m_isphysical && Body != IntPtr.Zero) 352 if (IsPhysical && Body != IntPtr.Zero)
336 { 353 {
337 d.BodyEnable(Body); 354 d.BodyEnable(Body);
338 if (m_vehicle.Type != Vehicle.TYPE_NONE) 355 if (m_vehicle.Type != Vehicle.TYPE_NONE)
@@ -347,7 +364,7 @@ namespace OpenSim.Region.Physics.OdePlugin
347 { 364 {
348 m_disabled = true; 365 m_disabled = true;
349 366
350 if (m_isphysical && Body != IntPtr.Zero) 367 if (IsPhysical && Body != IntPtr.Zero)
351 { 368 {
352 d.BodyDisable(Body); 369 d.BodyDisable(Body);
353 } 370 }
@@ -887,7 +904,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
887 } 904 }
888 } 905 }
889 906
890 if (m_taintPhysics != m_isphysical && !(m_taintparent != _parent)) 907 if (m_taintPhysics != IsPhysical && !(m_taintparent != _parent))
891 changePhysicsStatus(timestep); 908 changePhysicsStatus(timestep);
892 909
893 if (!_size.ApproxEquals(m_taintsize, 0f)) 910 if (!_size.ApproxEquals(m_taintsize, 0f))
@@ -1006,7 +1023,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
1006 } 1023 }
1007 1024
1008 _parent = m_taintparent; 1025 _parent = m_taintparent;
1009 m_taintPhysics = m_isphysical; 1026 m_taintPhysics = IsPhysical;
1010 } 1027 }
1011 1028
1012 /// <summary> 1029 /// <summary>
@@ -1159,7 +1176,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
1159 1176
1160 private void ChildSetGeom(OdePrim odePrim) 1177 private void ChildSetGeom(OdePrim odePrim)
1161 { 1178 {
1162 //if (m_isphysical && Body != IntPtr.Zero) 1179 //if (IsPhysical && Body != IntPtr.Zero)
1163 lock (childrenPrim) 1180 lock (childrenPrim)
1164 { 1181 {
1165 foreach (OdePrim prm in childrenPrim) 1182 foreach (OdePrim prm in childrenPrim)
@@ -1260,7 +1277,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
1260 // first 50 again. then the last 50 are disabled. then the first 50, which were just woken 1277 // first 50 again. then the last 50 are disabled. then the first 50, which were just woken
1261 // up, start simulating again, which in turn wakes up the last 50. 1278 // up, start simulating again, which in turn wakes up the last 50.
1262 1279
1263 if (m_isphysical) 1280 if (IsPhysical)
1264 { 1281 {
1265 disableBodySoft(); 1282 disableBodySoft();
1266 } 1283 }
@@ -1271,7 +1288,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
1271 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); 1288 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
1272 } 1289 }
1273 1290
1274 if (m_isphysical) 1291 if (IsPhysical)
1275 { 1292 {
1276 disableBodySoft(); 1293 disableBodySoft();
1277 } 1294 }
@@ -1280,7 +1297,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
1280 { 1297 {
1281 m_collisionCategories = CollisionCategories.Geom; 1298 m_collisionCategories = CollisionCategories.Geom;
1282 1299
1283 if (m_isphysical) 1300 if (IsPhysical)
1284 m_collisionCategories |= CollisionCategories.Body; 1301 m_collisionCategories |= CollisionCategories.Body;
1285 1302
1286 m_collisionFlags = m_default_collisionFlags; 1303 m_collisionFlags = m_default_collisionFlags;
@@ -1295,7 +1312,8 @@ Console.WriteLine("ZProcessTaints for " + Name);
1295 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories); 1312 d.GeomSetCategoryBits(prim_geom, (int)m_collisionCategories);
1296 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); 1313 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
1297 } 1314 }
1298 if (m_isphysical) 1315
1316 if (IsPhysical)
1299 { 1317 {
1300 if (Body != IntPtr.Zero) 1318 if (Body != IntPtr.Zero)
1301 { 1319 {
@@ -1314,7 +1332,7 @@ Console.WriteLine("ZProcessTaints for " + Name);
1314 { 1332 {
1315 m_taintposition = _position; 1333 m_taintposition = _position;
1316 m_taintrot = _orientation; 1334 m_taintrot = _orientation;
1317 m_taintPhysics = m_isphysical; 1335 m_taintPhysics = IsPhysical;
1318 m_taintselected = m_isSelected; 1336 m_taintselected = m_isSelected;
1319 m_taintsize = _size; 1337 m_taintsize = _size;
1320 m_taintshape = false; 1338 m_taintshape = false;
@@ -1442,7 +1460,7 @@ Console.WriteLine("changeadd 1");
1442 d.GeomSetQuaternion(prim_geom, ref myrot); 1460 d.GeomSetQuaternion(prim_geom, ref myrot);
1443 } 1461 }
1444 1462
1445 if (m_isphysical && Body == IntPtr.Zero) 1463 if (IsPhysical && Body == IntPtr.Zero)
1446 { 1464 {
1447 enableBody(); 1465 enableBody();
1448 } 1466 }
@@ -1458,7 +1476,7 @@ Console.WriteLine("changeadd 1");
1458 1476
1459 public void changemove(float timestep) 1477 public void changemove(float timestep)
1460 { 1478 {
1461 if (m_isphysical) 1479 if (IsPhysical)
1462 { 1480 {
1463 if (!m_disabled && !m_taintremove && !childPrim) 1481 if (!m_disabled && !m_taintremove && !childPrim)
1464 { 1482 {
@@ -1791,7 +1809,7 @@ Console.WriteLine(" JointCreateFixed");
1791 { 1809 {
1792 // KF: If this is a root prim do BodySet 1810 // KF: If this is a root prim do BodySet
1793 d.BodySetQuaternion(Body, ref myrot); 1811 d.BodySetQuaternion(Body, ref myrot);
1794 if (m_isphysical) 1812 if (IsPhysical)
1795 { 1813 {
1796 if (!m_angularlock.ApproxEquals(Vector3.One, 0f)) 1814 if (!m_angularlock.ApproxEquals(Vector3.One, 0f))
1797 createAMotor(m_angularlock); 1815 createAMotor(m_angularlock);
@@ -1828,7 +1846,7 @@ Console.WriteLine(" JointCreateFixed");
1828 1846
1829 public void changePhysicsStatus(float timestep) 1847 public void changePhysicsStatus(float timestep)
1830 { 1848 {
1831 if (m_isphysical == true) 1849 if (IsPhysical)
1832 { 1850 {
1833 if (Body == IntPtr.Zero) 1851 if (Body == IntPtr.Zero)
1834 { 1852 {
@@ -1848,8 +1866,6 @@ Console.WriteLine(" JointCreateFixed");
1848 { 1866 {
1849 if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim) 1867 if (_pbs.SculptEntry && _parent_scene.meshSculptedPrim)
1850 { 1868 {
1851
1852
1853 if (prim_geom != IntPtr.Zero) 1869 if (prim_geom != IntPtr.Zero)
1854 { 1870 {
1855 try 1871 try
@@ -1867,6 +1883,7 @@ Console.WriteLine(" JointCreateFixed");
1867//Console.WriteLine("changePhysicsStatus for " + Name); 1883//Console.WriteLine("changePhysicsStatus for " + Name);
1868 changeadd(2f); 1884 changeadd(2f);
1869 } 1885 }
1886
1870 if (childPrim) 1887 if (childPrim)
1871 { 1888 {
1872 if (_parent != null) 1889 if (_parent != null)
@@ -1885,7 +1902,7 @@ Console.WriteLine(" JointCreateFixed");
1885 changeSelectedStatus(timestep); 1902 changeSelectedStatus(timestep);
1886 1903
1887 resetCollisionAccounting(); 1904 resetCollisionAccounting();
1888 m_taintPhysics = m_isphysical; 1905 m_taintPhysics = IsPhysical;
1889 } 1906 }
1890 1907
1891 public void changesize(float timestamp) 1908 public void changesize(float timestamp)
@@ -2218,16 +2235,6 @@ Console.WriteLine("changeshape not need meshing");
2218 m_taintVelocity = Vector3.Zero; 2235 m_taintVelocity = Vector3.Zero;
2219 } 2236 }
2220 2237
2221 public override bool IsPhysical
2222 {
2223 get { return m_isphysical; }
2224 set {
2225 m_isphysical = value;
2226 if (!m_isphysical) // Zero the remembered last velocity
2227 m_lastVelocity = Vector3.Zero;
2228 }
2229 }
2230
2231 public void setPrimForRemoval() 2238 public void setPrimForRemoval()
2232 { 2239 {
2233 m_taintremove = true; 2240 m_taintremove = true;
@@ -2406,7 +2413,7 @@ Console.WriteLine("changeshape not need meshing");
2406 { 2413 {
2407 get 2414 get
2408 { 2415 {
2409 if (!m_isphysical || Body == IntPtr.Zero) 2416 if (!IsPhysical || Body == IntPtr.Zero)
2410 return Vector3.Zero; 2417 return Vector3.Zero;
2411 2418
2412 return _torque; 2419 return _torque;