diff options
author | UbitUmarov | 2012-10-04 08:14:52 +0100 |
---|---|---|
committer | UbitUmarov | 2012-10-04 08:14:52 +0100 |
commit | 89d342b5ce9ac5d9fc4fd493eead8e050f99c91a (patch) | |
tree | d3065f478fc17ed546b7e0a610f6b0e921e6e3e8 /OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |
parent | apply cmic fix to multi layer wearables (diff) | |
download | opensim-SC-89d342b5ce9ac5d9fc4fd493eead8e050f99c91a.zip opensim-SC-89d342b5ce9ac5d9fc4fd493eead8e050f99c91a.tar.gz opensim-SC-89d342b5ce9ac5d9fc4fd493eead8e050f99c91a.tar.bz2 opensim-SC-89d342b5ce9ac5d9fc4fd493eead8e050f99c91a.tar.xz |
more changes and more non active code
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 140 |
1 files changed, 117 insertions, 23 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index f328066..7650571 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -104,9 +104,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
104 | private float m_PIDTau; | 104 | private float m_PIDTau; |
105 | private bool m_usePID; | 105 | private bool m_usePID; |
106 | 106 | ||
107 | // KF: These next 7 params apply to llSetHoverHeight(float height, integer water, float tau), | ||
108 | // and are for non-VEHICLES only. | ||
109 | |||
110 | private float m_PIDHoverHeight; | 107 | private float m_PIDHoverHeight; |
111 | private float m_PIDHoverTau; | 108 | private float m_PIDHoverTau; |
112 | private bool m_useHoverPID; | 109 | private bool m_useHoverPID; |
@@ -395,6 +392,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
395 | if (value.IsFinite()) | 392 | if (value.IsFinite()) |
396 | { | 393 | { |
397 | AddChange(changes.Size, value); | 394 | AddChange(changes.Size, value); |
395 | |||
396 | // _parent_scene.m_meshWorker.ChangeActorPhysRep(this, _pbs, value, m_shapetype, MeshWorkerChange.size); | ||
398 | } | 397 | } |
399 | else | 398 | else |
400 | { | 399 | { |
@@ -529,6 +528,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
529 | set | 528 | set |
530 | { | 529 | { |
531 | AddChange(changes.Shape, value); | 530 | AddChange(changes.Shape, value); |
531 | // _parent_scene.m_meshWorker.ChangeActorPhysRep(this, value, _size, m_shapetype, MeshWorkerChange.shape); | ||
532 | } | 532 | } |
533 | } | 533 | } |
534 | 534 | ||
@@ -542,10 +542,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
542 | { | 542 | { |
543 | m_shapetype = value; | 543 | m_shapetype = value; |
544 | AddChange(changes.Shape, null); | 544 | AddChange(changes.Shape, null); |
545 | // _parent_scene.m_meshWorker.ChangeActorPhysRep(this, _pbs, _size, value, MeshWorkerChange.shapetype); | ||
545 | } | 546 | } |
546 | } | 547 | } |
547 | 548 | ||
548 | |||
549 | public override Vector3 Velocity | 549 | public override Vector3 Velocity |
550 | { | 550 | { |
551 | get | 551 | get |
@@ -1529,7 +1529,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1529 | { | 1529 | { |
1530 | if (prim_geom != IntPtr.Zero) | 1530 | if (prim_geom != IntPtr.Zero) |
1531 | { | 1531 | { |
1532 | // _parent_scene.geom_name_map.Remove(prim_geom); | ||
1533 | _parent_scene.actor_name_map.Remove(prim_geom); | 1532 | _parent_scene.actor_name_map.Remove(prim_geom); |
1534 | try | 1533 | try |
1535 | { | 1534 | { |
@@ -1539,11 +1538,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1539 | d.GeomTriMeshDataDestroy(_triMeshData); | 1538 | d.GeomTriMeshDataDestroy(_triMeshData); |
1540 | _triMeshData = IntPtr.Zero; | 1539 | _triMeshData = IntPtr.Zero; |
1541 | } | 1540 | } |
1542 | |||
1543 | } | 1541 | } |
1544 | |||
1545 | |||
1546 | // catch (System.AccessViolationException) | ||
1547 | catch (Exception e) | 1542 | catch (Exception e) |
1548 | { | 1543 | { |
1549 | m_log.ErrorFormat("[PHYSICS]: PrimGeom destruction failed for {0} exception {1}", Name, e); | 1544 | m_log.ErrorFormat("[PHYSICS]: PrimGeom destruction failed for {0} exception {1}", Name, e); |
@@ -1557,23 +1552,19 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1557 | m_log.ErrorFormat("[PHYSICS]: PrimGeom destruction BAD {0}", Name); | 1552 | m_log.ErrorFormat("[PHYSICS]: PrimGeom destruction BAD {0}", Name); |
1558 | } | 1553 | } |
1559 | 1554 | ||
1560 | if (m_mesh != null) | 1555 | lock (m_meshlock) |
1561 | { | 1556 | { |
1562 | _parent_scene.mesher.ReleaseMesh(m_mesh); | 1557 | if (m_mesh != null) |
1563 | m_mesh = null; | 1558 | { |
1559 | _parent_scene.mesher.ReleaseMesh(m_mesh); | ||
1560 | m_mesh = null; | ||
1561 | } | ||
1564 | } | 1562 | } |
1565 | 1563 | ||
1566 | Body = IntPtr.Zero; | 1564 | Body = IntPtr.Zero; |
1567 | hasOOBoffsetFromMesh = false; | 1565 | hasOOBoffsetFromMesh = false; |
1568 | } | 1566 | } |
1569 | /* | 1567 | |
1570 | private void ChildSetGeom(OdePrim odePrim) | ||
1571 | { | ||
1572 | // well.. | ||
1573 | DestroyBody(); | ||
1574 | MakeBody(); | ||
1575 | } | ||
1576 | */ | ||
1577 | //sets non physical prim m_targetSpace to right space in spaces grid for static prims | 1568 | //sets non physical prim m_targetSpace to right space in spaces grid for static prims |
1578 | // should only be called for non physical prims unless they are becoming non physical | 1569 | // should only be called for non physical prims unless they are becoming non physical |
1579 | private void SetInStaticSpace(OdePrim prim) | 1570 | private void SetInStaticSpace(OdePrim prim) |
@@ -1636,9 +1627,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1636 | 1627 | ||
1637 | if (Body != IntPtr.Zero) | 1628 | if (Body != IntPtr.Zero) |
1638 | { | 1629 | { |
1639 | // d.BodyDestroy(Body); | ||
1640 | // Body = IntPtr.Zero; | ||
1641 | // do a more complet destruction | ||
1642 | DestroyBody(); | 1630 | DestroyBody(); |
1643 | m_log.Warn("[PHYSICS]: MakeBody called having a body"); | 1631 | m_log.Warn("[PHYSICS]: MakeBody called having a body"); |
1644 | } | 1632 | } |
@@ -2500,6 +2488,26 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2500 | primOOBradiusSQ = primOOBsize.LengthSquared(); | 2488 | primOOBradiusSQ = primOOBsize.LengthSquared(); |
2501 | } | 2489 | } |
2502 | 2490 | ||
2491 | private void UpdatePrimBodyData() | ||
2492 | { | ||
2493 | primMass = m_density * primVolume; | ||
2494 | |||
2495 | if (primMass <= 0) | ||
2496 | primMass = 0.0001f;//ckrinke: Mass must be greater then zero. | ||
2497 | if (primMass > _parent_scene.maximumMassObject) | ||
2498 | primMass = _parent_scene.maximumMassObject; | ||
2499 | |||
2500 | _mass = primMass; // just in case | ||
2501 | |||
2502 | d.MassSetBoxTotal(out primdMass, primMass, primOOBsize.X, primOOBsize.Y, primOOBsize.Z); | ||
2503 | |||
2504 | d.MassTranslate(ref primdMass, | ||
2505 | primOOBoffset.X, | ||
2506 | primOOBoffset.Y, | ||
2507 | primOOBoffset.Z); | ||
2508 | |||
2509 | primOOBradiusSQ = primOOBsize.LengthSquared(); | ||
2510 | } | ||
2503 | 2511 | ||
2504 | #endregion | 2512 | #endregion |
2505 | 2513 | ||
@@ -3232,6 +3240,86 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3232 | changeprimsizeshape(); | 3240 | changeprimsizeshape(); |
3233 | } | 3241 | } |
3234 | 3242 | ||
3243 | |||
3244 | private void changePhysRepData(ODEPhysRepData repData) | ||
3245 | { | ||
3246 | CheckDelaySelect(); | ||
3247 | |||
3248 | OdePrim parent = (OdePrim)_parent; | ||
3249 | |||
3250 | bool chp = childPrim; | ||
3251 | |||
3252 | if (chp) | ||
3253 | { | ||
3254 | if (parent != null) | ||
3255 | { | ||
3256 | parent.DestroyBody(); | ||
3257 | } | ||
3258 | } | ||
3259 | else | ||
3260 | { | ||
3261 | DestroyBody(); | ||
3262 | } | ||
3263 | |||
3264 | RemoveGeom(); | ||
3265 | |||
3266 | prim_geom = repData.geo; | ||
3267 | _triMeshData = repData.triMeshData; | ||
3268 | _size = repData.size; | ||
3269 | _pbs = repData.pbs; | ||
3270 | m_mesh = repData.mesh; | ||
3271 | m_shapetype = repData.shapetype; | ||
3272 | |||
3273 | hasOOBoffsetFromMesh = repData.hasOBB; | ||
3274 | primOOBoffset = repData.OBBOffset; | ||
3275 | primOOBsize = repData.OBB; | ||
3276 | |||
3277 | m_NoColide = repData.NoColide; | ||
3278 | // m_physCost = repData.physCost; | ||
3279 | // m_streamCost = repData.streamCost; | ||
3280 | |||
3281 | primVolume = repData.volume; | ||
3282 | m_targetSpace = repData.curSpace; | ||
3283 | |||
3284 | UpdatePrimBodyData(); | ||
3285 | |||
3286 | _parent_scene.actor_name_map[prim_geom] = this; | ||
3287 | |||
3288 | if (prim_geom != IntPtr.Zero) | ||
3289 | { | ||
3290 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | ||
3291 | d.Quaternion myrot = new d.Quaternion(); | ||
3292 | myrot.X = _orientation.X; | ||
3293 | myrot.Y = _orientation.Y; | ||
3294 | myrot.Z = _orientation.Z; | ||
3295 | myrot.W = _orientation.W; | ||
3296 | d.GeomSetQuaternion(prim_geom, ref myrot); | ||
3297 | } | ||
3298 | |||
3299 | if (m_isphysical) | ||
3300 | { | ||
3301 | if (chp) | ||
3302 | { | ||
3303 | if (parent != null) | ||
3304 | { | ||
3305 | parent.MakeBody(); | ||
3306 | } | ||
3307 | } | ||
3308 | else | ||
3309 | MakeBody(); | ||
3310 | } | ||
3311 | |||
3312 | else | ||
3313 | { | ||
3314 | SetInStaticSpace(this); | ||
3315 | UpdateCollisionCatFlags(); | ||
3316 | ApplyCollisionCatFlags(); | ||
3317 | } | ||
3318 | |||
3319 | resetCollisionAccounting(); | ||
3320 | } | ||
3321 | |||
3322 | |||
3235 | private void changeFloatOnWater(bool newval) | 3323 | private void changeFloatOnWater(bool newval) |
3236 | { | 3324 | { |
3237 | m_collidesWater = newval; | 3325 | m_collidesWater = newval; |
@@ -3989,6 +4077,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3989 | changeShape((PrimitiveBaseShape)arg); | 4077 | changeShape((PrimitiveBaseShape)arg); |
3990 | break; | 4078 | break; |
3991 | 4079 | ||
4080 | case changes.PhysRepData: | ||
4081 | changePhysRepData((ODEPhysRepData) arg); | ||
4082 | break; | ||
4083 | |||
3992 | case changes.CollidesWater: | 4084 | case changes.CollidesWater: |
3993 | changeFloatOnWater((bool)arg); | 4085 | changeFloatOnWater((bool)arg); |
3994 | break; | 4086 | break; |
@@ -4077,6 +4169,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
4077 | donullchange(); | 4169 | donullchange(); |
4078 | break; | 4170 | break; |
4079 | 4171 | ||
4172 | |||
4173 | |||
4080 | default: | 4174 | default: |
4081 | donullchange(); | 4175 | donullchange(); |
4082 | break; | 4176 | break; |