diff options
author | Justin Clark-Casey (justincc) | 2011-07-31 01:03:52 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-07-31 01:03:52 +0100 |
commit | d0412765172e9431813dee3a30473c8f28c184bc (patch) | |
tree | dd5e0a5cc5527082b0a63130975f58c4a844cf7c /OpenSim/Region | |
parent | refactor: Remove argument to pass in an initial mesh to OdePrim since this is... (diff) | |
download | opensim-SC_OLD-d0412765172e9431813dee3a30473c8f28c184bc.zip opensim-SC_OLD-d0412765172e9431813dee3a30473c8f28c184bc.tar.gz opensim-SC_OLD-d0412765172e9431813dee3a30473c8f28c184bc.tar.bz2 opensim-SC_OLD-d0412765172e9431813dee3a30473c8f28c184bc.tar.xz |
Remove _mesh field since the mesh data no longer needs to be stored after it's initially used.
This may improve memory usage for regions using mesh and sculpts, though I suspect that it doesn't address the current memory leak.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 65 |
1 files changed, 16 insertions, 49 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index cd6a0fb..fdb95cf 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -154,7 +154,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
154 | private List<Vector3> m_forcelist = new List<Vector3>(); | 154 | private List<Vector3> m_forcelist = new List<Vector3>(); |
155 | private List<Vector3> m_angularforcelist = new List<Vector3>(); | 155 | private List<Vector3> m_angularforcelist = new List<Vector3>(); |
156 | 156 | ||
157 | private IMesh _mesh; | ||
158 | private PrimitiveBaseShape _pbs; | 157 | private PrimitiveBaseShape _pbs; |
159 | private OdeScene _parent_scene; | 158 | private OdeScene _parent_scene; |
160 | 159 | ||
@@ -1356,7 +1355,7 @@ Console.WriteLine("ZProcessTaints for " + Name); | |||
1356 | /// Create a geometry for the given mesh in the given target space. | 1355 | /// Create a geometry for the given mesh in the given target space. |
1357 | /// </summary> | 1356 | /// </summary> |
1358 | /// <param name="m_targetSpace"></param> | 1357 | /// <param name="m_targetSpace"></param> |
1359 | /// <param name="mesh">/param> | 1358 | /// <param name="mesh">If null, then a mesh is used that is based on the profile shape data.</param> |
1360 | public void CreateGeom(IntPtr m_targetSpace, IMesh mesh) | 1359 | public void CreateGeom(IntPtr m_targetSpace, IMesh mesh) |
1361 | { | 1360 | { |
1362 | #if SPAM | 1361 | #if SPAM |
@@ -1447,15 +1446,14 @@ Console.WriteLine("CreateGeom:"); | |||
1447 | 1446 | ||
1448 | m_targetSpace = targetspace; | 1447 | m_targetSpace = targetspace; |
1449 | 1448 | ||
1450 | if (_mesh == null) | 1449 | IMesh mesh = null; |
1450 | |||
1451 | if (_parent_scene.needsMeshing(_pbs)) | ||
1451 | { | 1452 | { |
1452 | if (_parent_scene.needsMeshing(_pbs)) | 1453 | // Don't need to re-enable body.. it's done in SetMesh |
1453 | { | 1454 | mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical); |
1454 | // Don't need to re-enable body.. it's done in SetMesh | 1455 | // createmesh returns null when it's a shape that isn't a cube. |
1455 | _mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, _parent_scene.meshSculptLOD, IsPhysical); | 1456 | // m_log.Debug(m_localID); |
1456 | // createmesh returns null when it's a shape that isn't a cube. | ||
1457 | // m_log.Debug(m_localID); | ||
1458 | } | ||
1459 | } | 1457 | } |
1460 | 1458 | ||
1461 | lock (_parent_scene.OdeLock) | 1459 | lock (_parent_scene.OdeLock) |
@@ -1463,7 +1461,7 @@ Console.WriteLine("CreateGeom:"); | |||
1463 | #if SPAM | 1461 | #if SPAM |
1464 | Console.WriteLine("changeadd 1"); | 1462 | Console.WriteLine("changeadd 1"); |
1465 | #endif | 1463 | #endif |
1466 | CreateGeom(m_targetSpace, _mesh); | 1464 | CreateGeom(m_targetSpace, mesh); |
1467 | 1465 | ||
1468 | if (prim_geom != IntPtr.Zero) | 1466 | if (prim_geom != IntPtr.Zero) |
1469 | { | 1467 | { |
@@ -1888,7 +1886,6 @@ Console.WriteLine(" JointCreateFixed"); | |||
1888 | { | 1886 | { |
1889 | d.GeomDestroy(prim_geom); | 1887 | d.GeomDestroy(prim_geom); |
1890 | prim_geom = IntPtr.Zero; | 1888 | prim_geom = IntPtr.Zero; |
1891 | _mesh = null; | ||
1892 | } | 1889 | } |
1893 | catch (System.AccessViolationException) | 1890 | catch (System.AccessViolationException) |
1894 | { | 1891 | { |
@@ -1933,12 +1930,6 @@ Console.WriteLine(" JointCreateFixed"); | |||
1933 | if (_size.Y <= 0) _size.Y = 0.01f; | 1930 | if (_size.Y <= 0) _size.Y = 0.01f; |
1934 | if (_size.Z <= 0) _size.Z = 0.01f; | 1931 | if (_size.Z <= 0) _size.Z = 0.01f; |
1935 | 1932 | ||
1936 | // Cleanup of old prim geometry | ||
1937 | if (_mesh != null) | ||
1938 | { | ||
1939 | // TODO: Cleanup meshing here | ||
1940 | } | ||
1941 | |||
1942 | //kill body to rebuild | 1933 | //kill body to rebuild |
1943 | if (IsPhysical && Body != IntPtr.Zero) | 1934 | if (IsPhysical && Body != IntPtr.Zero) |
1944 | { | 1935 | { |
@@ -1966,6 +1957,8 @@ Console.WriteLine(" JointCreateFixed"); | |||
1966 | prim_geom = IntPtr.Zero; | 1957 | prim_geom = IntPtr.Zero; |
1967 | // we don't need to do space calculation because the client sends a position update also. | 1958 | // we don't need to do space calculation because the client sends a position update also. |
1968 | 1959 | ||
1960 | IMesh mesh = null; | ||
1961 | |||
1969 | // Construction of new prim | 1962 | // Construction of new prim |
1970 | if (_parent_scene.needsMeshing(_pbs)) | 1963 | if (_parent_scene.needsMeshing(_pbs)) |
1971 | { | 1964 | { |
@@ -1975,27 +1968,11 @@ Console.WriteLine(" JointCreateFixed"); | |||
1975 | meshlod = _parent_scene.MeshSculptphysicalLOD; | 1968 | meshlod = _parent_scene.MeshSculptphysicalLOD; |
1976 | // Don't need to re-enable body.. it's done in SetMesh | 1969 | // Don't need to re-enable body.. it's done in SetMesh |
1977 | 1970 | ||
1978 | IMesh mesh = null; | ||
1979 | |||
1980 | if (_parent_scene.needsMeshing(_pbs)) | 1971 | if (_parent_scene.needsMeshing(_pbs)) |
1981 | mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); | 1972 | mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); |
1982 | |||
1983 | #if SPAM | ||
1984 | Console.WriteLine("changesize 1"); | ||
1985 | #endif | ||
1986 | CreateGeom(m_targetSpace, mesh); | ||
1987 | } | ||
1988 | else | ||
1989 | { | ||
1990 | _mesh = null; | ||
1991 | |||
1992 | #if SPAM | ||
1993 | Console.WriteLine("changesize 2"); | ||
1994 | #endif | ||
1995 | |||
1996 | CreateGeom(m_targetSpace, _mesh); | ||
1997 | } | 1973 | } |
1998 | 1974 | ||
1975 | CreateGeom(m_targetSpace, mesh); | ||
1999 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 1976 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
2000 | d.Quaternion myrot = new d.Quaternion(); | 1977 | d.Quaternion myrot = new d.Quaternion(); |
2001 | myrot.X = _orientation.X; | 1978 | myrot.X = _orientation.X; |
@@ -2083,6 +2060,8 @@ Console.WriteLine("changesize 2"); | |||
2083 | if (_size.Z <= 0) _size.Z = 0.01f; | 2060 | if (_size.Z <= 0) _size.Z = 0.01f; |
2084 | // Construction of new prim | 2061 | // Construction of new prim |
2085 | 2062 | ||
2063 | IMesh mesh = null; | ||
2064 | |||
2086 | if (_parent_scene.needsMeshing(_pbs)) | 2065 | if (_parent_scene.needsMeshing(_pbs)) |
2087 | { | 2066 | { |
2088 | // Don't need to re-enable body.. it's done in CreateMesh | 2067 | // Don't need to re-enable body.. it's done in CreateMesh |
@@ -2092,22 +2071,10 @@ Console.WriteLine("changesize 2"); | |||
2092 | meshlod = _parent_scene.MeshSculptphysicalLOD; | 2071 | meshlod = _parent_scene.MeshSculptphysicalLOD; |
2093 | 2072 | ||
2094 | // createmesh returns null when it doesn't mesh. | 2073 | // createmesh returns null when it doesn't mesh. |
2095 | IMesh mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); | 2074 | mesh = _parent_scene.mesher.CreateMesh(oldname, _pbs, _size, meshlod, IsPhysical); |
2096 | #if SPAM | ||
2097 | Console.WriteLine("changeshape needed meshing"); | ||
2098 | #endif | ||
2099 | CreateGeom(m_targetSpace, mesh); | ||
2100 | } | ||
2101 | else | ||
2102 | { | ||
2103 | _mesh = null; | ||
2104 | |||
2105 | #if SPAM | ||
2106 | Console.WriteLine("changeshape not need meshing"); | ||
2107 | #endif | ||
2108 | CreateGeom(m_targetSpace, null); | ||
2109 | } | 2075 | } |
2110 | 2076 | ||
2077 | CreateGeom(m_targetSpace, mesh); | ||
2111 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); | 2078 | d.GeomSetPosition(prim_geom, _position.X, _position.Y, _position.Z); |
2112 | d.Quaternion myrot = new d.Quaternion(); | 2079 | d.Quaternion myrot = new d.Quaternion(); |
2113 | //myrot.W = _orientation.w; | 2080 | //myrot.W = _orientation.w; |