diff options
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs index 6bf5be1..fbc6134 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/ODEPrim.cs | |||
@@ -57,7 +57,6 @@ using OdeAPI; | |||
57 | using OpenSim.Framework; | 57 | using OpenSim.Framework; |
58 | using OpenSim.Region.Physics.Manager; | 58 | using OpenSim.Region.Physics.Manager; |
59 | 59 | ||
60 | |||
61 | namespace OpenSim.Region.Physics.OdePlugin | 60 | namespace OpenSim.Region.Physics.OdePlugin |
62 | { | 61 | { |
63 | public class OdePrim : PhysicsActor | 62 | public class OdePrim : PhysicsActor |
@@ -538,24 +537,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
538 | { | 537 | { |
539 | set | 538 | set |
540 | { | 539 | { |
541 | /* | ||
542 | IMesh mesh = null; | ||
543 | if (_parent_scene.needsMeshing(value)) | ||
544 | { | ||
545 | bool convex; | ||
546 | if (m_shapetype == 0) | ||
547 | convex = false; | ||
548 | else | ||
549 | convex = true; | ||
550 | mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, (int)LevelOfDetail.High, true, convex); | ||
551 | } | ||
552 | |||
553 | if (mesh != null) | ||
554 | { | ||
555 | lock (m_meshlock) | ||
556 | m_mesh = mesh; | ||
557 | } | ||
558 | */ | ||
559 | AddChange(changes.Shape, value); | 540 | AddChange(changes.Shape, value); |
560 | } | 541 | } |
561 | } | 542 | } |
@@ -1092,18 +1073,21 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1092 | CalcPrimBodyData(); | 1073 | CalcPrimBodyData(); |
1093 | 1074 | ||
1094 | m_mesh = null; | 1075 | m_mesh = null; |
1095 | if (_parent_scene.needsMeshing(pbs)) | 1076 | if (_parent_scene.needsMeshing(pbs) && (pbs.SculptData.Length > 0)) |
1096 | { | 1077 | { |
1097 | bool convex; | 1078 | bool convex; |
1079 | int clod = (int)LevelOfDetail.High; | ||
1098 | if (m_shapetype == 0) | 1080 | if (m_shapetype == 0) |
1099 | convex = false; | 1081 | convex = false; |
1100 | else | 1082 | else |
1083 | { | ||
1101 | convex = true; | 1084 | convex = true; |
1102 | 1085 | if (_pbs.SculptType != (byte)SculptType.Mesh) | |
1103 | m_mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, (int)LevelOfDetail.High, true, convex); | 1086 | clod = (int)LevelOfDetail.Low; |
1087 | } | ||
1088 | m_mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, clod, true, convex); | ||
1104 | } | 1089 | } |
1105 | 1090 | ||
1106 | |||
1107 | m_building = true; // control must set this to false when done | 1091 | m_building = true; // control must set this to false when done |
1108 | 1092 | ||
1109 | AddChange(changes.Add, null); | 1093 | AddChange(changes.Add, null); |
@@ -1354,18 +1338,23 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1354 | 1338 | ||
1355 | IMesh mesh = null; | 1339 | IMesh mesh = null; |
1356 | 1340 | ||
1357 | |||
1358 | lock (m_meshlock) | 1341 | lock (m_meshlock) |
1359 | { | 1342 | { |
1360 | if (m_mesh == null) | 1343 | if (m_mesh == null) |
1361 | { | 1344 | { |
1362 | bool convex; | 1345 | bool convex; |
1346 | int clod = (int)LevelOfDetail.High; | ||
1347 | |||
1363 | if (m_shapetype == 0) | 1348 | if (m_shapetype == 0) |
1364 | convex = false; | 1349 | convex = false; |
1365 | else | 1350 | else |
1351 | { | ||
1366 | convex = true; | 1352 | convex = true; |
1353 | if (_pbs.SculptType != (byte)SculptType.Mesh) | ||
1354 | clod = (int)LevelOfDetail.Low; | ||
1355 | } | ||
1367 | 1356 | ||
1368 | mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, (int)LevelOfDetail.High, true, convex); | 1357 | mesh = _parent_scene.mesher.CreateMesh(Name, _pbs, _size, clod, true, convex); |
1369 | } | 1358 | } |
1370 | else | 1359 | else |
1371 | { | 1360 | { |
@@ -1373,7 +1362,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1373 | } | 1362 | } |
1374 | 1363 | ||
1375 | if (mesh == null) | 1364 | if (mesh == null) |
1376 | { | 1365 | { |
1377 | m_log.WarnFormat("[PHYSICS]: CreateMesh Failed on prim {0} at <{1},{2},{3}>.", Name, _position.X, _position.Y, _position.Z); | 1366 | m_log.WarnFormat("[PHYSICS]: CreateMesh Failed on prim {0} at <{1},{2},{3}>.", Name, _position.X, _position.Y, _position.Z); |
1378 | return false; | 1367 | return false; |
1379 | } | 1368 | } |
@@ -1394,7 +1383,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1394 | hasOOBoffsetFromMesh = true; | 1383 | hasOOBoffsetFromMesh = true; |
1395 | 1384 | ||
1396 | mesh.releaseSourceMeshData(); | 1385 | mesh.releaseSourceMeshData(); |
1397 | m_mesh = null; | 1386 | m_mesh = mesh; |
1398 | } | 1387 | } |
1399 | 1388 | ||
1400 | IntPtr geo = IntPtr.Zero; | 1389 | IntPtr geo = IntPtr.Zero; |
@@ -1536,7 +1525,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1536 | d.GeomTriMeshDataDestroy(_triMeshData); | 1525 | d.GeomTriMeshDataDestroy(_triMeshData); |
1537 | _triMeshData = IntPtr.Zero; | 1526 | _triMeshData = IntPtr.Zero; |
1538 | } | 1527 | } |
1528 | |||
1539 | } | 1529 | } |
1530 | |||
1531 | |||
1540 | // catch (System.AccessViolationException) | 1532 | // catch (System.AccessViolationException) |
1541 | catch (Exception e) | 1533 | catch (Exception e) |
1542 | { | 1534 | { |
@@ -1550,6 +1542,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1550 | { | 1542 | { |
1551 | m_log.ErrorFormat("[PHYSICS]: PrimGeom destruction BAD {0}", Name); | 1543 | m_log.ErrorFormat("[PHYSICS]: PrimGeom destruction BAD {0}", Name); |
1552 | } | 1544 | } |
1545 | |||
1546 | if (m_mesh != null) | ||
1547 | { | ||
1548 | _parent_scene.mesher.ReleaseMesh(m_mesh); | ||
1549 | m_mesh = null; | ||
1550 | } | ||
1551 | |||
1553 | Body = IntPtr.Zero; | 1552 | Body = IntPtr.Zero; |
1554 | hasOOBoffsetFromMesh = false; | 1553 | hasOOBoffsetFromMesh = false; |
1555 | } | 1554 | } |