aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/ChOdePlugin
diff options
context:
space:
mode:
authorUbitUmarov2012-03-21 12:57:46 +0000
committerUbitUmarov2012-03-21 12:57:46 +0000
commit316f272b621741e694f2b522910594a0e5879634 (patch)
tree54cf9f0069ed9b53b29ea625c1354a9fb9000879 /OpenSim/Region/Physics/ChOdePlugin
parentMerge branch 'master' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff)
downloadopensim-SC_OLD-316f272b621741e694f2b522910594a0e5879634.zip
opensim-SC_OLD-316f272b621741e694f2b522910594a0e5879634.tar.gz
opensim-SC_OLD-316f272b621741e694f2b522910594a0e5879634.tar.bz2
opensim-SC_OLD-316f272b621741e694f2b522910594a0e5879634.tar.xz
shapetype support on chOde so it can also request a simple convex hull 'mesh'
Diffstat (limited to 'OpenSim/Region/Physics/ChOdePlugin')
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs36
-rw-r--r--OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs44
2 files changed, 46 insertions, 34 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
index f9548d2..4cf88d8 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/ODEPrim.cs
@@ -179,6 +179,9 @@ namespace OpenSim.Region.Physics.OdePlugin
179 public bool m_outofBounds; 179 public bool m_outofBounds;
180 private float m_density = 10.000006836f; // Aluminum g/cm3; 180 private float m_density = 10.000006836f; // Aluminum g/cm3;
181 181
182 private byte m_shapetype;
183 private byte m_taintshapetype;
184
182 public bool _zeroFlag; // if body has been stopped 185 public bool _zeroFlag; // if body has been stopped
183 private bool m_lastUpdateSent; 186 private bool m_lastUpdateSent;
184 187
@@ -315,7 +318,8 @@ namespace OpenSim.Region.Physics.OdePlugin
315 } 318 }
316 319
317 public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size, 320 public OdePrim(String primName, OdeScene parent_scene, Vector3 pos, Vector3 size,
318 Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical,bool pisPhantom, CollisionLocker dode, uint localid) 321 Quaternion rotation, IMesh mesh, PrimitiveBaseShape pbs, bool pisPhysical,
322 bool pisPhantom,byte shapetype, CollisionLocker dode, uint localid)
319 { 323 {
320 m_localID = localid; 324 m_localID = localid;
321 ode = dode; 325 ode = dode;
@@ -360,6 +364,8 @@ namespace OpenSim.Region.Physics.OdePlugin
360 m_taintrot = _orientation; 364 m_taintrot = _orientation;
361 _mesh = mesh; 365 _mesh = mesh;
362 _pbs = pbs; 366 _pbs = pbs;
367 m_shapetype = shapetype;
368 m_taintshapetype = shapetype;
363 369
364 _parent_scene = parent_scene; 370 _parent_scene = parent_scene;
365 m_targetSpace = (IntPtr)0; 371 m_targetSpace = (IntPtr)0;
@@ -605,6 +611,19 @@ namespace OpenSim.Region.Physics.OdePlugin
605 } 611 }
606 } 612 }
607 613
614 public override byte PhysicsShapeType
615 {
616 get
617 {
618 return m_shapetype;
619 }
620 set
621 {
622 m_taintshapetype = value;
623 _parent_scene.AddPhysicsActorTaint(this);
624 }
625 }
626
608 public override Vector3 Velocity 627 public override Vector3 Velocity
609 { 628 {
610 get 629 get
@@ -1535,6 +1554,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1535 changesize(timestep); 1554 changesize(timestep);
1536 // 1555 //
1537 1556
1557 if(m_taintshapetype != m_shapetype)
1558 {
1559 m_shapetype = m_taintshapetype;
1560 changeshape(timestep);
1561 }
1562
1538 if (m_taintshape) 1563 if (m_taintshape)
1539 changeshape(timestep); 1564 changeshape(timestep);
1540 // 1565 //
@@ -2476,9 +2501,16 @@ namespace OpenSim.Region.Physics.OdePlugin
2476 2501
2477 if (IsPhysical) 2502 if (IsPhysical)
2478 meshlod = _parent_scene.MeshSculptphysicalLOD; 2503 meshlod = _parent_scene.MeshSculptphysicalLOD;
2504
2505 bool convex;
2506 if (m_shapetype == 2)
2507 convex = true;
2508 else
2509 convex = false;
2510
2479 try 2511 try
2480 { 2512 {
2481 mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, (int)LevelOfDetail.High, true); 2513 mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, (int)LevelOfDetail.High, true, convex);
2482 } 2514 }
2483 catch 2515 catch
2484 { 2516 {
diff --git a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
index ea89d87..00f5122 100644
--- a/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/ChOdePlugin/OdePlugin.cs
@@ -1720,7 +1720,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1720 } 1720 }
1721 1721
1722 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation, 1722 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
1723 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical, uint localid) 1723 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical, bool isphantom, byte shapetype, uint localid)
1724 { 1724 {
1725 1725
1726 Vector3 pos = position; 1726 Vector3 pos = position;
@@ -1730,27 +1730,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1730 OdePrim newPrim; 1730 OdePrim newPrim;
1731 lock (OdeLock) 1731 lock (OdeLock)
1732 { 1732 {
1733 newPrim = new OdePrim(name, this, pos, siz, rot, mesh, pbs, isphysical,false, ode, localid); 1733 newPrim = new OdePrim(name, this, pos, siz, rot, mesh, pbs, isphysical, isphantom, shapetype, ode, localid);
1734
1735 lock (_prims)
1736 _prims.Add(newPrim);
1737 }
1738
1739 return newPrim;
1740 }
1741
1742 private PhysicsActor AddPrim(String name, Vector3 position, Vector3 size, Quaternion rotation,
1743 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical, bool isphantom, uint localid)
1744 {
1745
1746 Vector3 pos = position;
1747 Vector3 siz = size;
1748 Quaternion rot = rotation;
1749
1750 OdePrim newPrim;
1751 lock (OdeLock)
1752 {
1753 newPrim = new OdePrim(name, this, pos, siz, rot, mesh, pbs, isphysical, isphantom, ode, localid);
1754 1734
1755 lock (_prims) 1735 lock (_prims)
1756 _prims.Add(newPrim); 1736 _prims.Add(newPrim);
@@ -1781,7 +1761,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1781 if (needsMeshing(pbs)) 1761 if (needsMeshing(pbs))
1782 mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true); 1762 mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true);
1783 1763
1784 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, localid); 1764 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical,false,0, localid);
1785 1765
1786 return result; 1766 return result;
1787 } 1767 }
@@ -1795,25 +1775,25 @@ namespace OpenSim.Region.Physics.OdePlugin
1795 if (needsMeshing(pbs)) 1775 if (needsMeshing(pbs))
1796 mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true); 1776 mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true);
1797 1777
1798 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, isPhantom, localid); 1778 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, isPhantom,0, localid);
1799 1779
1800 return result; 1780 return result;
1801 } 1781 }
1802 1782
1803 1783 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
1804 1784 Vector3 size, Quaternion rotation, bool isPhysical, bool isPhantom, byte shapetype, uint localid)
1805/*
1806 public override PhysicsActor AddPrimShape(string primName, PhysicsActor parent, PrimitiveBaseShape pbs, Vector3 position,
1807 uint localid, byte[] sdata)
1808 { 1785 {
1809 PhysicsActor result; 1786 PhysicsActor result;
1787 IMesh mesh = null;
1810 1788
1811 result = AddPrim(primName, position, parent, 1789 if (needsMeshing(pbs))
1812 pbs, localid, sdata); 1790 mesh = mesher.CreateMesh(primName, pbs, size, (int)LevelOfDetail.High, true);
1791
1792 result = AddPrim(primName, position, size, rotation, mesh, pbs, isPhysical, isPhantom, shapetype, localid);
1813 1793
1814 return result; 1794 return result;
1815 } 1795 }
1816*/ 1796
1817 public override float TimeDilation 1797 public override float TimeDilation
1818 { 1798 {
1819 get { return m_timeDilation; } 1799 get { return m_timeDilation; }