diff options
author | UbitUmarov | 2016-09-17 12:44:52 +0100 |
---|---|---|
committer | UbitUmarov | 2016-09-17 12:44:52 +0100 |
commit | e5383604cb68710b1f9960d6a0aeb0812d2db3ea (patch) | |
tree | 844cb56f494c58c123cd167280673dae58f89f16 /OpenSim/Region/PhysicsModules | |
parent | forgot the dll (diff) | |
parent | change spinobject math, and a few minor things (diff) | |
download | opensim-SC-e5383604cb68710b1f9960d6a0aeb0812d2db3ea.zip opensim-SC-e5383604cb68710b1f9960d6a0aeb0812d2db3ea.tar.gz opensim-SC-e5383604cb68710b1f9960d6a0aeb0812d2db3ea.tar.bz2 opensim-SC-e5383604cb68710b1f9960d6a0aeb0812d2db3ea.tar.xz |
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Region/PhysicsModules')
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | 51 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs | 47 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | 49 |
3 files changed, 72 insertions, 75 deletions
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs index 3a5a936..9640e91 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs | |||
@@ -112,7 +112,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
112 | private bool _zeroFlag = false; | 112 | private bool _zeroFlag = false; |
113 | private bool m_haveLastFallVel = false; | 113 | private bool m_haveLastFallVel = false; |
114 | 114 | ||
115 | |||
116 | private uint m_localID = 0; | 115 | private uint m_localID = 0; |
117 | public bool m_returnCollisions = false; | 116 | public bool m_returnCollisions = false; |
118 | // taints and their non-tainted counterparts | 117 | // taints and their non-tainted counterparts |
@@ -149,7 +148,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
149 | 148 | ||
150 | public int m_eventsubscription = 0; | 149 | public int m_eventsubscription = 0; |
151 | private int m_cureventsubscription = 0; | 150 | private int m_cureventsubscription = 0; |
152 | private CollisionEventUpdate CollisionEventsThisFrame = null; | 151 | private CollisionEventUpdate CollisionEventsThisFrame = new CollisionEventUpdate(); |
153 | private bool SentEmptyCollisionsEvent; | 152 | private bool SentEmptyCollisionsEvent; |
154 | 153 | ||
155 | // unique UUID of this character object | 154 | // unique UUID of this character object |
@@ -1556,32 +1555,26 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1556 | 1555 | ||
1557 | public override float APIDDamping { set { return; } } | 1556 | public override float APIDDamping { set { return; } } |
1558 | 1557 | ||
1559 | |||
1560 | public override void SubscribeEvents(int ms) | 1558 | public override void SubscribeEvents(int ms) |
1561 | { | 1559 | { |
1562 | m_eventsubscription = ms; | 1560 | m_eventsubscription = ms; |
1563 | m_cureventsubscription = 0; | 1561 | m_cureventsubscription = 0; |
1564 | if (CollisionEventsThisFrame == null) | 1562 | CollisionEventsThisFrame.Clear(); |
1565 | CollisionEventsThisFrame = new CollisionEventUpdate(); | ||
1566 | SentEmptyCollisionsEvent = false; | 1563 | SentEmptyCollisionsEvent = false; |
1567 | } | 1564 | } |
1568 | 1565 | ||
1569 | public override void UnSubscribeEvents() | 1566 | public override void UnSubscribeEvents() |
1570 | { | 1567 | { |
1571 | if (CollisionEventsThisFrame != null) | ||
1572 | { | ||
1573 | CollisionEventsThisFrame.Clear(); | ||
1574 | CollisionEventsThisFrame = null; | ||
1575 | } | ||
1576 | m_eventsubscription = 0; | 1568 | m_eventsubscription = 0; |
1577 | _parent_scene.RemoveCollisionEventReporting(this); | 1569 | _parent_scene.RemoveCollisionEventReporting(this); |
1570 | lock(CollisionEventsThisFrame) | ||
1571 | CollisionEventsThisFrame.Clear(); | ||
1578 | } | 1572 | } |
1579 | 1573 | ||
1580 | public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) | 1574 | public override void AddCollisionEvent(uint CollidedWith, ContactPoint contact) |
1581 | { | 1575 | { |
1582 | if (CollisionEventsThisFrame == null) | 1576 | lock(CollisionEventsThisFrame) |
1583 | CollisionEventsThisFrame = new CollisionEventUpdate(); | 1577 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); |
1584 | CollisionEventsThisFrame.AddCollider(CollidedWith, contact); | ||
1585 | _parent_scene.AddCollisionEventReporting(this); | 1578 | _parent_scene.AddCollisionEventReporting(this); |
1586 | } | 1579 | } |
1587 | 1580 | ||
@@ -1590,28 +1583,28 @@ namespace OpenSim.Region.PhysicsModule.ubOde | |||
1590 | if (m_cureventsubscription < 50000) | 1583 | if (m_cureventsubscription < 50000) |
1591 | m_cureventsubscription += timestep; | 1584 | m_cureventsubscription += timestep; |
1592 | 1585 | ||
1593 | if (CollisionEventsThisFrame == null) | ||
1594 | return; | ||
1595 | |||
1596 | if (m_cureventsubscription < m_eventsubscription) | 1586 | if (m_cureventsubscription < m_eventsubscription) |
1597 | return; | 1587 | return; |
1598 | 1588 | ||
1599 | int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; | 1589 | lock(CollisionEventsThisFrame) |
1600 | |||
1601 | if (!SentEmptyCollisionsEvent || ncolisions > 0) | ||
1602 | { | 1590 | { |
1603 | base.SendCollisionUpdate(CollisionEventsThisFrame); | 1591 | int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; |
1604 | m_cureventsubscription = 0; | ||
1605 | 1592 | ||
1606 | if (ncolisions == 0) | 1593 | if (!SentEmptyCollisionsEvent || ncolisions > 0) |
1607 | { | 1594 | { |
1608 | SentEmptyCollisionsEvent = true; | 1595 | base.SendCollisionUpdate(CollisionEventsThisFrame); |
1609 | // _parent_scene.RemoveCollisionEventReporting(this); | 1596 | m_cureventsubscription = 0; |
1610 | } | 1597 | |
1611 | else | 1598 | if (ncolisions == 0) |
1612 | { | 1599 | { |
1613 | SentEmptyCollisionsEvent = false; | 1600 | SentEmptyCollisionsEvent = true; |
1614 | CollisionEventsThisFrame.Clear(); | 1601 | // _parent_scene.RemoveCollisionEventReporting(this); |
1602 | } | ||
1603 | else | ||
1604 | { | ||
1605 | SentEmptyCollisionsEvent = false; | ||
1606 | CollisionEventsThisFrame.Clear(); | ||
1607 | } | ||
1615 | } | 1608 | } |
1616 | } | 1609 | } |
1617 | } | 1610 | } |
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs index 5b1510f..d9ea4a4 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Mesh.cs | |||
@@ -588,38 +588,37 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
588 | Mesh mesh = new Mesh(); | 588 | Mesh mesh = new Mesh(); |
589 | mesh.releaseBuildingMeshData(); | 589 | mesh.releaseBuildingMeshData(); |
590 | 590 | ||
591 | BinaryReader br = new BinaryReader(st); | ||
592 | |||
593 | bool ok = true; | 591 | bool ok = true; |
594 | try | 592 | using(BinaryReader br = new BinaryReader(st)) |
595 | { | 593 | { |
596 | mesh.m_vertexCount = br.ReadInt32(); | 594 | try |
597 | mesh.m_indexCount = br.ReadInt32(); | 595 | { |
596 | mesh.m_vertexCount = br.ReadInt32(); | ||
597 | mesh.m_indexCount = br.ReadInt32(); | ||
598 | 598 | ||
599 | int n = 3 * mesh.m_vertexCount; | 599 | int n = 3 * mesh.m_vertexCount; |
600 | mesh.vertices = new float[n]; | 600 | mesh.vertices = new float[n]; |
601 | for (int i = 0; i < n; i++) | 601 | for (int i = 0; i < n; i++) |
602 | mesh.vertices[i] = br.ReadSingle(); | 602 | mesh.vertices[i] = br.ReadSingle(); |
603 | 603 | ||
604 | mesh.indexes = new int[mesh.m_indexCount]; | 604 | mesh.indexes = new int[mesh.m_indexCount]; |
605 | for (int i = 0; i < mesh.m_indexCount; i++) | 605 | for (int i = 0; i < mesh.m_indexCount; i++) |
606 | mesh.indexes[i] = br.ReadInt32(); | 606 | mesh.indexes[i] = br.ReadInt32(); |
607 | 607 | ||
608 | mesh.m_obb.X = br.ReadSingle(); | 608 | mesh.m_obb.X = br.ReadSingle(); |
609 | mesh.m_obb.Y = br.ReadSingle(); | 609 | mesh.m_obb.Y = br.ReadSingle(); |
610 | mesh.m_obb.Z = br.ReadSingle(); | 610 | mesh.m_obb.Z = br.ReadSingle(); |
611 | 611 | ||
612 | mesh.m_obboffset.X = br.ReadSingle(); | 612 | mesh.m_obboffset.X = br.ReadSingle(); |
613 | mesh.m_obboffset.Y = br.ReadSingle(); | 613 | mesh.m_obboffset.Y = br.ReadSingle(); |
614 | mesh.m_obboffset.Z = br.ReadSingle(); | 614 | mesh.m_obboffset.Z = br.ReadSingle(); |
615 | } | 615 | } |
616 | catch | 616 | catch |
617 | { | 617 | { |
618 | ok = false; | 618 | ok = false; |
619 | } | ||
619 | } | 620 | } |
620 | 621 | ||
621 | br.Close(); | ||
622 | |||
623 | if (ok) | 622 | if (ok) |
624 | { | 623 | { |
625 | mesh.pinMemory(); | 624 | mesh.pinMemory(); |
diff --git a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs index d9544db..ff10e7f 100644 --- a/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs +++ b/OpenSim/Region/PhysicsModules/ubOdeMeshing/Meshmerizer.cs | |||
@@ -60,7 +60,7 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
60 | 60 | ||
61 | private bool m_Enabled = false; | 61 | private bool m_Enabled = false; |
62 | 62 | ||
63 | public object diskLock = new object(); | 63 | public static object diskLock = new object(); |
64 | 64 | ||
65 | public bool doMeshFileCache = true; | 65 | public bool doMeshFileCache = true; |
66 | 66 | ||
@@ -1426,13 +1426,13 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1426 | { | 1426 | { |
1427 | if (File.Exists(filename)) | 1427 | if (File.Exists(filename)) |
1428 | { | 1428 | { |
1429 | FileStream stream = null; | ||
1430 | try | 1429 | try |
1431 | { | 1430 | { |
1432 | stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read); | 1431 | using(FileStream stream = File.Open(filename, FileMode.Open, FileAccess.Read, FileShare.Read)) |
1433 | BinaryFormatter bformatter = new BinaryFormatter(); | 1432 | { |
1434 | 1433 | // BinaryFormatter bformatter = new BinaryFormatter(); | |
1435 | mesh = Mesh.FromStream(stream, key); | 1434 | mesh = Mesh.FromStream(stream,key); |
1435 | } | ||
1436 | 1436 | ||
1437 | } | 1437 | } |
1438 | catch (Exception e) | 1438 | catch (Exception e) |
@@ -1443,13 +1443,17 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1443 | filename, e.Message, e.StackTrace); | 1443 | filename, e.Message, e.StackTrace); |
1444 | } | 1444 | } |
1445 | 1445 | ||
1446 | if (stream != null) | 1446 | try |
1447 | stream.Close(); | 1447 | { |
1448 | if (mesh == null || !ok) | ||
1449 | File.Delete(filename); | ||
1450 | else | ||
1451 | File.SetLastAccessTimeUtc(filename, DateTime.UtcNow); | ||
1452 | } | ||
1453 | catch | ||
1454 | { | ||
1455 | } | ||
1448 | 1456 | ||
1449 | if (mesh == null || !ok) | ||
1450 | File.Delete(filename); | ||
1451 | else | ||
1452 | File.SetLastAccessTimeUtc(filename, DateTime.UtcNow); | ||
1453 | } | 1457 | } |
1454 | } | 1458 | } |
1455 | 1459 | ||
@@ -1458,7 +1462,6 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1458 | 1462 | ||
1459 | private void StoreToFileCache(AMeshKey key, Mesh mesh) | 1463 | private void StoreToFileCache(AMeshKey key, Mesh mesh) |
1460 | { | 1464 | { |
1461 | Stream stream = null; | ||
1462 | bool ok = false; | 1465 | bool ok = false; |
1463 | 1466 | ||
1464 | // Make sure the target cache directory exists | 1467 | // Make sure the target cache directory exists |
@@ -1476,8 +1479,8 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1476 | Directory.CreateDirectory(dir); | 1479 | Directory.CreateDirectory(dir); |
1477 | } | 1480 | } |
1478 | 1481 | ||
1479 | stream = File.Open(filename, FileMode.Create); | 1482 | using(Stream stream = File.Open(filename, FileMode.Create)) |
1480 | ok = mesh.ToStream(stream); | 1483 | ok = mesh.ToStream(stream); |
1481 | } | 1484 | } |
1482 | catch (IOException e) | 1485 | catch (IOException e) |
1483 | { | 1486 | { |
@@ -1487,15 +1490,17 @@ namespace OpenSim.Region.PhysicsModule.ubODEMeshing | |||
1487 | ok = false; | 1490 | ok = false; |
1488 | } | 1491 | } |
1489 | 1492 | ||
1490 | if (stream != null) | 1493 | if (!ok && File.Exists(filename)) |
1491 | stream.Close(); | ||
1492 | |||
1493 | if (File.Exists(filename)) | ||
1494 | { | 1494 | { |
1495 | if (ok) | 1495 | try |
1496 | File.SetLastAccessTimeUtc(filename, DateTime.UtcNow); | 1496 | { |
1497 | else | ||
1498 | File.Delete(filename); | 1497 | File.Delete(filename); |
1498 | } | ||
1499 | catch (IOException e) | ||
1500 | { | ||
1501 | m_log.ErrorFormat( | ||
1502 | "[MESH CACHE]: Failed to delete file {0}",filename); | ||
1503 | } | ||
1499 | } | 1504 | } |
1500 | } | 1505 | } |
1501 | } | 1506 | } |