aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-07-09 00:35:30 +0100
committerJustin Clark-Casey (justincc)2011-07-09 00:35:30 +0100
commit5e8900dfd058bd103cb6dcf8a57dc94683efd878 (patch)
treea9962c79801fd6a3181fb72d026ae84e5c1097cd /OpenSim/Region/Physics
parentWhen loading library asset set, only store an asset if it's different from an... (diff)
downloadopensim-SC_OLD-5e8900dfd058bd103cb6dcf8a57dc94683efd878.zip
opensim-SC_OLD-5e8900dfd058bd103cb6dcf8a57dc94683efd878.tar.gz
opensim-SC_OLD-5e8900dfd058bd103cb6dcf8a57dc94683efd878.tar.bz2
opensim-SC_OLD-5e8900dfd058bd103cb6dcf8a57dc94683efd878.tar.xz
minor: code tidy and inserted log lines for future use.
Unable to get to the bottom of why resizing a mesh fails to properly reset the physics proxy, when toggling phantom does After a mesh is generated, the existing sculptdata is set to zero in PrimitiveBaseShape to save memory When phantom is toggled, the sculptdata is regenerated before remeshing. But on resize, the sculptdata is not regenerated. So clearly, resetting sculptdata is possible, but haven't quite been able to pin down how this is being done when phantom is toggled.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs5
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs52
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdeScene.cs5
3 files changed, 38 insertions, 24 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index e92e97b..b79e1a1 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -540,7 +540,6 @@ namespace OpenSim.Region.Physics.Meshing
540 540
541 profileBegin = 0.5f * profileBegin + 0.5f; 541 profileBegin = 0.5f * profileBegin + 0.5f;
542 profileEnd = 0.5f * profileEnd + 0.5f; 542 profileEnd = 0.5f * profileEnd + 0.5f;
543
544 } 543 }
545 544
546 int hollowSides = sides; 545 int hollowSides = sides;
@@ -660,7 +659,9 @@ namespace OpenSim.Region.Physics.Meshing
660 659
661 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) 660 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
662 { 661 {
663// m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName); 662#if SPAM
663 m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName);
664#endif
664 665
665 Mesh mesh = null; 666 Mesh mesh = null;
666 ulong key = 0; 667 ulong key = 0;
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index bc839e0..b63168a 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -38,6 +38,9 @@
38 * switch between 'VEHICLE' parameter use and general dynamics 38 * switch between 'VEHICLE' parameter use and general dynamics
39 * settings use. 39 * settings use.
40 */ 40 */
41
42//#define SPAM
43
41using System; 44using System;
42using System.Collections.Generic; 45using System.Collections.Generic;
43using System.Reflection; 46using System.Reflection;
@@ -746,7 +749,6 @@ namespace OpenSim.Region.Physics.OdePlugin
746 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); 749 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
747 } 750 }
748 751
749
750 d.BodyDestroy(Body); 752 d.BodyDestroy(Body);
751 lock (childrenPrim) 753 lock (childrenPrim)
752 { 754 {
@@ -775,7 +777,6 @@ namespace OpenSim.Region.Physics.OdePlugin
775 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags); 777 d.GeomSetCollideBits(prim_geom, (int)m_collisionFlags);
776 } 778 }
777 779
778
779 Body = IntPtr.Zero; 780 Body = IntPtr.Zero;
780 } 781 }
781 } 782 }
@@ -858,7 +859,7 @@ namespace OpenSim.Region.Physics.OdePlugin
858 859
859 public void ProcessTaints(float timestep) 860 public void ProcessTaints(float timestep)
860 { 861 {
861//Console.WriteLine("ProcessTaints for " + Name); 862Console.WriteLine("ProcessTaints for " + Name);
862 if (m_taintadd) 863 if (m_taintadd)
863 { 864 {
864 changeadd(timestep); 865 changeadd(timestep);
@@ -867,7 +868,7 @@ namespace OpenSim.Region.Physics.OdePlugin
867 if (prim_geom != IntPtr.Zero) 868 if (prim_geom != IntPtr.Zero)
868 { 869 {
869 if (!_position.ApproxEquals(m_taintposition, 0f)) 870 if (!_position.ApproxEquals(m_taintposition, 0f))
870 changemove(timestep); 871 changemove(timestep);
871 872
872 if (m_taintrot != _orientation) 873 if (m_taintrot != _orientation)
873 { 874 {
@@ -885,19 +886,15 @@ namespace OpenSim.Region.Physics.OdePlugin
885 rotate(timestep); 886 rotate(timestep);
886 } 887 }
887 } 888 }
888 //
889 889
890 if (m_taintPhysics != m_isphysical && !(m_taintparent != _parent)) 890 if (m_taintPhysics != m_isphysical && !(m_taintparent != _parent))
891 changePhysicsStatus(timestep); 891 changePhysicsStatus(timestep);
892 //
893 892
894 if (!_size.ApproxEquals(m_taintsize,0f)) 893 if (!_size.ApproxEquals(m_taintsize, 0f))
895 changesize(timestep); 894 changesize(timestep);
896 //
897 895
898 if (m_taintshape) 896 if (m_taintshape)
899 changeshape(timestep); 897 changeshape(timestep);
900 //
901 898
902 if (m_taintforce) 899 if (m_taintforce)
903 changeAddForce(timestep); 900 changeAddForce(timestep);
@@ -925,7 +922,6 @@ namespace OpenSim.Region.Physics.OdePlugin
925 922
926 if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f)) 923 if (!m_angularlock.ApproxEquals(m_taintAngularLock,0f))
927 changeAngularLock(timestep); 924 changeAngularLock(timestep);
928
929 } 925 }
930 else 926 else
931 { 927 {
@@ -1424,10 +1420,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1424 } 1420 }
1425 } 1421 }
1426 1422
1427
1428 lock (_parent_scene.OdeLock) 1423 lock (_parent_scene.OdeLock)
1429 { 1424 {
1430//Console.WriteLine("changeadd 1"); 1425#if SPAM
1426Console.WriteLine("changeadd 1");
1427#endif
1431 CreateGeom(m_targetSpace, _mesh); 1428 CreateGeom(m_targetSpace, _mesh);
1432 1429
1433 if (prim_geom != IntPtr.Zero) 1430 if (prim_geom != IntPtr.Zero)
@@ -1890,6 +1887,10 @@ Console.WriteLine(" JointCreateFixed");
1890 1887
1891 public void changesize(float timestamp) 1888 public void changesize(float timestamp)
1892 { 1889 {
1890#if SPAM
1891 m_log.DebugFormat("[ODE PRIM]: Called changesize");
1892#endif
1893
1893 string oldname = _parent_scene.geom_name_map[prim_geom]; 1894 string oldname = _parent_scene.geom_name_map[prim_geom];
1894 1895
1895 if (_size.X <= 0) _size.X = 0.01f; 1896 if (_size.X <= 0) _size.X = 0.01f;
@@ -1899,8 +1900,9 @@ Console.WriteLine(" JointCreateFixed");
1899 // Cleanup of old prim geometry 1900 // Cleanup of old prim geometry
1900 if (_mesh != null) 1901 if (_mesh != null)
1901 { 1902 {
1902 // Cleanup meshing here 1903 // TODO: Cleanup meshing here
1903 } 1904 }
1905
1904 //kill body to rebuild 1906 //kill body to rebuild
1905 if (IsPhysical && Body != IntPtr.Zero) 1907 if (IsPhysical && Body != IntPtr.Zero)
1906 { 1908 {
@@ -1917,11 +1919,13 @@ Console.WriteLine(" JointCreateFixed");
1917 disableBody(); 1919 disableBody();
1918 } 1920 }
1919 } 1921 }
1922
1920 if (d.SpaceQuery(m_targetSpace, prim_geom)) 1923 if (d.SpaceQuery(m_targetSpace, prim_geom))
1921 { 1924 {
1922 _parent_scene.waitForSpaceUnlock(m_targetSpace); 1925 _parent_scene.waitForSpaceUnlock(m_targetSpace);
1923 d.SpaceRemove(m_targetSpace, prim_geom); 1926 d.SpaceRemove(m_targetSpace, prim_geom);
1924 } 1927 }
1928
1925 d.GeomDestroy(prim_geom); 1929 d.GeomDestroy(prim_geom);
1926 prim_geom = IntPtr.Zero; 1930 prim_geom = IntPtr.Zero;
1927 // we don't need to do space calculation because the client sends a position update also. 1931 // we don't need to do space calculation because the client sends a position update also.
@@ -1941,13 +1945,19 @@ Console.WriteLine(" JointCreateFixed");
1941 mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); 1945 mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
1942 1946
1943 //IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); 1947 //IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
1944//Console.WriteLine("changesize 1"); 1948#if SPAM
1949Console.WriteLine("changesize 1");
1950#endif
1945 CreateGeom(m_targetSpace, mesh); 1951 CreateGeom(m_targetSpace, mesh);
1946 } 1952 }
1947 else 1953 else
1948 { 1954 {
1949 _mesh = null; 1955 _mesh = null;
1950//Console.WriteLine("changesize 2"); 1956
1957#if SPAM
1958Console.WriteLine("changesize 2");
1959#endif
1960
1951 CreateGeom(m_targetSpace, _mesh); 1961 CreateGeom(m_targetSpace, _mesh);
1952 } 1962 }
1953 1963
@@ -2030,6 +2040,7 @@ Console.WriteLine(" JointCreateFixed");
2030 prim_geom = IntPtr.Zero; 2040 prim_geom = IntPtr.Zero;
2031 m_log.ErrorFormat("[PHYSICS]: PrimGeom dead for {0}", Name); 2041 m_log.ErrorFormat("[PHYSICS]: PrimGeom dead for {0}", Name);
2032 } 2042 }
2043
2033 prim_geom = IntPtr.Zero; 2044 prim_geom = IntPtr.Zero;
2034 // we don't need to do space calculation because the client sends a position update also. 2045 // we don't need to do space calculation because the client sends a position update also.
2035 if (_size.X <= 0) _size.X = 0.01f; 2046 if (_size.X <= 0) _size.X = 0.01f;
@@ -2039,7 +2050,7 @@ Console.WriteLine(" JointCreateFixed");
2039 2050
2040 if (_parent_scene.needsMeshing(_pbs)) 2051 if (_parent_scene.needsMeshing(_pbs))
2041 { 2052 {
2042 // Don't need to re-enable body.. it's done in SetMesh 2053 // Don't need to re-enable body.. it's done in CreateMesh
2043 float meshlod = _parent_scene.meshSculptLOD; 2054 float meshlod = _parent_scene.meshSculptLOD;
2044 2055
2045 if (IsPhysical) 2056 if (IsPhysical)
@@ -2047,13 +2058,18 @@ Console.WriteLine(" JointCreateFixed");
2047 2058
2048 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); 2059 IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical);
2049 // createmesh returns null when it doesn't mesh. 2060 // createmesh returns null when it doesn't mesh.
2050//Console.WriteLine("changeshape needed meshing"); 2061#if SPAM
2062Console.WriteLine("changeshape needed meshing");
2063#endif
2051 CreateGeom(m_targetSpace, mesh); 2064 CreateGeom(m_targetSpace, mesh);
2052 } 2065 }
2053 else 2066 else
2054 { 2067 {
2055 _mesh = null; 2068 _mesh = null;
2056//Console.WriteLine("changeshape not need meshing"); 2069
2070#if SPAM
2071Console.WriteLine("changeshape not need meshing");
2072#endif
2057 CreateGeom(m_targetSpace, null); 2073 CreateGeom(m_targetSpace, null);
2058 } 2074 }
2059 2075
diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
index 87d22af..f5172aa 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs
@@ -26,7 +26,7 @@
26 */ 26 */
27 27
28//#define USE_DRAWSTUFF 28//#define USE_DRAWSTUFF
29//#define SPAM 29#define SPAM
30 30
31using System; 31using System;
32using System.Collections.Generic; 32using System.Collections.Generic;
@@ -312,7 +312,6 @@ namespace OpenSim.Region.Physics.OdePlugin
312 #endif 312 #endif
313 } 313 }
314 314
315
316 _watermap = new float[258 * 258]; 315 _watermap = new float[258 * 258];
317 316
318 // Zero out the prim spaces array (we split our space into smaller spaces so 317 // Zero out the prim spaces array (we split our space into smaller spaces so
@@ -2563,7 +2562,6 @@ namespace OpenSim.Region.Physics.OdePlugin
2563 if (pbs.SculptEntry && meshSculptedPrim) 2562 if (pbs.SculptEntry && meshSculptedPrim)
2564 iPropertiesNotSupportedDefault++; 2563 iPropertiesNotSupportedDefault++;
2565 2564
2566
2567 if (iPropertiesNotSupportedDefault == 0) 2565 if (iPropertiesNotSupportedDefault == 0)
2568 { 2566 {
2569#if SPAM 2567#if SPAM
@@ -2703,7 +2701,6 @@ namespace OpenSim.Region.Physics.OdePlugin
2703 { 2701 {
2704 foreach (OdeCharacter character in _taintedActors) 2702 foreach (OdeCharacter character in _taintedActors)
2705 { 2703 {
2706
2707 character.ProcessTaints(timeStep); 2704 character.ProcessTaints(timeStep);
2708 2705
2709 processedtaints = true; 2706 processedtaints = true;