aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2012-10-04 08:14:52 +0100
committerUbitUmarov2012-10-04 08:14:52 +0100
commit89d342b5ce9ac5d9fc4fd493eead8e050f99c91a (patch)
treed3065f478fc17ed546b7e0a610f6b0e921e6e3e8
parentapply cmic fix to multi layer wearables (diff)
downloadopensim-SC_OLD-89d342b5ce9ac5d9fc4fd493eead8e050f99c91a.zip
opensim-SC_OLD-89d342b5ce9ac5d9fc4fd493eead8e050f99c91a.tar.gz
opensim-SC_OLD-89d342b5ce9ac5d9fc4fd493eead8e050f99c91a.tar.bz2
opensim-SC_OLD-89d342b5ce9ac5d9fc4fd493eead8e050f99c91a.tar.xz
more changes and more non active code
-rw-r--r--OpenSim/Region/Physics/UbitMeshing/Mesh.cs10
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs11
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs140
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs12
4 files changed, 144 insertions, 29 deletions
diff --git a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs b/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
index 47e0cf4..c31ec08 100644
--- a/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
+++ b/OpenSim/Region/Physics/UbitMeshing/Mesh.cs
@@ -89,8 +89,6 @@ namespace OpenSim.Region.Physics.Meshing
89 m_obbYmax = float.MinValue; 89 m_obbYmax = float.MinValue;
90 m_obbZmin = float.MaxValue; 90 m_obbZmin = float.MaxValue;
91 m_obbZmax = float.MinValue; 91 m_obbZmax = float.MinValue;
92
93
94 } 92 }
95 93
96 public int RefCount { get; set; } 94 public int RefCount { get; set; }
@@ -99,8 +97,6 @@ namespace OpenSim.Region.Physics.Meshing
99 97
100 public void Scale(Vector3 scale) 98 public void Scale(Vector3 scale)
101 { 99 {
102
103
104 } 100 }
105 101
106 public Mesh Clone() 102 public Mesh Clone()
@@ -113,6 +109,12 @@ namespace OpenSim.Region.Physics.Meshing
113 } 109 }
114 result.m_centroid = m_centroid; 110 result.m_centroid = m_centroid;
115 result.m_centroidDiv = m_centroidDiv; 111 result.m_centroidDiv = m_centroidDiv;
112 result.m_obbXmin = m_obbXmin;
113 result.m_obbXmax = m_obbXmax;
114 result.m_obbYmin = m_obbYmin;
115 result.m_obbYmax = m_obbYmax;
116 result.m_obbZmin = m_obbZmin;
117 result.m_obbZmax = m_obbZmax;
116 return result; 118 return result;
117 } 119 }
118 120
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs
index 9bf3667..702c336 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEMeshWorker.cs
@@ -304,7 +304,7 @@ namespace OpenSim.Region.Physics.OdePlugin
304 if (GetTriMeshGeo(repData)) 304 if (GetTriMeshGeo(repData))
305 hasMesh = true; 305 hasMesh = true;
306 else 306 else
307 repData.canColide = false; 307 repData.NoColide = true;
308 } 308 }
309 309
310 if (!hasMesh) 310 if (!hasMesh)
@@ -350,6 +350,15 @@ namespace OpenSim.Region.Physics.OdePlugin
350 return repData; 350 return repData;
351 } 351 }
352 352
353 public void ChangeActorPhysRep(PhysicsActor actor, PrimitiveBaseShape pbs,
354 Vector3 size, byte shapetype, MeshWorkerChange what)
355 {
356 ODEPhysRepData repData = CreateActorPhysRep(actor, pbs, null, size, shapetype);
357 repData.changed |= what;
358 if (repData != null && actor != null)
359 ((OdePrim)actor).AddChange(changes.PhysRepData, repData);
360 }
361
353 private void CalculateBasicPrimVolume(ODEPhysRepData repData) 362 private void CalculateBasicPrimVolume(ODEPhysRepData repData)
354 { 363 {
355 PrimitiveBaseShape _pbs = repData.pbs; 364 PrimitiveBaseShape _pbs = repData.pbs;
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;
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index d426112..d758c85 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -77,8 +77,9 @@ namespace OpenSim.Region.Physics.OdePlugin
77 77
78 public float physCost = 0.0f; 78 public float physCost = 0.0f;
79 public float streamCost = 0; 79 public float streamCost = 0;
80 public MeshWorkerChange changed;
80 public byte shapetype = 0; 81 public byte shapetype = 0;
81 public bool canColide = true; 82 public bool NoColide = false;
82 public bool hasOBB = false; 83 public bool hasOBB = false;
83 public bool hasMeshVolume = false; 84 public bool hasMeshVolume = false;
84 } 85 }
@@ -132,6 +133,14 @@ namespace OpenSim.Region.Physics.OdePlugin
132 133
133 light = 7 // compatibility with old viewers 134 light = 7 // compatibility with old viewers
134 } 135 }
136 [Flags]
137 public enum MeshWorkerChange : uint
138 {
139 none = 0,
140 size = 1,
141 shape = 2,
142 shapetype = 3,
143 }
135 144
136 public enum changes : int 145 public enum changes : int
137 { 146 {
@@ -170,6 +179,7 @@ namespace OpenSim.Region.Physics.OdePlugin
170 179
171 Size, 180 Size,
172 Shape, 181 Shape,
182 PhysRepData,
173 183
174 CollidesWater, 184 CollidesWater,
175 VolumeDtc, 185 VolumeDtc,