aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
authorUbitUmarov2012-05-19 13:53:49 +0100
committerUbitUmarov2012-05-19 13:53:49 +0100
commit2c498baf58005be487b4e457455a9896a96b90d3 (patch)
tree05976958d4499c7394000a44efa25f965535b0e8 /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
parenttemp work: sounds simetric acording to materials, still 'window close' test ... (diff)
downloadopensim-SC_OLD-2c498baf58005be487b4e457455a9896a96b90d3.zip
opensim-SC_OLD-2c498baf58005be487b4e457455a9896a96b90d3.tar.gz
opensim-SC_OLD-2c498baf58005be487b4e457455a9896a96b90d3.tar.bz2
opensim-SC_OLD-2c498baf58005be487b4e457455a9896a96b90d3.tar.xz
a bit faster collision sound type verification plus a few fixes/changes
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs80
1 files changed, 60 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 467b625..5fddaed 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -329,7 +329,9 @@ namespace OpenSim.Region.Framework.Scenes
329 private Vector3 m_cameraAtOffset; 329 private Vector3 m_cameraAtOffset;
330 private bool m_forceMouselook; 330 private bool m_forceMouselook;
331 331
332 // TODO: Collision sound should have default. 332
333 // 0 for default collision sounds, -1 for script disabled sound 1 for script defined sound
334 private sbyte m_collisionSoundType;
333 private UUID m_collisionSound; 335 private UUID m_collisionSound;
334 private float m_collisionSoundVolume; 336 private float m_collisionSoundVolume;
335 337
@@ -1342,12 +1344,39 @@ namespace OpenSim.Region.Framework.Scenes
1342 1344
1343 public UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff"); 1345 public UUID invalidCollisionSoundUUID = new UUID("ffffffff-ffff-ffff-ffff-ffffffffffff");
1344 1346
1347 // 0 for default collision sounds, -1 for script disabled sound 1 for script defined sound
1348 // runtime thing.. do not persist
1349 [XmlIgnore]
1350 public sbyte CollisionSoundType
1351 {
1352 get
1353 {
1354 return m_collisionSoundType;
1355 }
1356 set
1357 {
1358 m_collisionSoundType = value;
1359 if (value == -1)
1360 m_collisionSound = invalidCollisionSoundUUID;
1361 else if (value == 0)
1362 m_collisionSound = UUID.Zero;
1363 }
1364 }
1365
1345 public UUID CollisionSound 1366 public UUID CollisionSound
1346 { 1367 {
1347 get { return m_collisionSound; } 1368 get { return m_collisionSound; }
1348 set 1369 set
1349 { 1370 {
1350 m_collisionSound = value; 1371 m_collisionSound = value;
1372
1373 if (value == invalidCollisionSoundUUID)
1374 m_collisionSoundType = -1;
1375 else if (value == UUID.Zero)
1376 m_collisionSoundType = 0;
1377 else
1378 m_collisionSoundType = 1;
1379
1351 aggregateScriptEvents(); 1380 aggregateScriptEvents();
1352 } 1381 }
1353 } 1382 }
@@ -2633,29 +2662,42 @@ namespace OpenSim.Region.Framework.Scenes
2633 else 2662 else
2634 { 2663 {
2635 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>(); 2664 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
2636 CollisionForSoundInfo soundinfo;
2637 ContactPoint curcontact;
2638 2665
2639 // calculate things that started colliding this time 2666 // calculate things that started colliding this time
2640 // and build up list of colliders this time 2667 // and build up list of colliders this time
2641 foreach (uint id in collissionswith.Keys) 2668 if (!VolumeDetectActive && CollisionSoundType >= 0)
2642 { 2669 {
2643 thisHitColliders.Add(id); 2670 CollisionForSoundInfo soundinfo;
2644 if (!m_lastColliders.Contains(id)) 2671 ContactPoint curcontact;
2645 {
2646 startedColliders.Add(id);
2647 2672
2648 curcontact = collissionswith[id]; 2673 foreach (uint id in collissionswith.Keys)
2649 if (Math.Abs(curcontact.RelativeSpeed) > 0.2) 2674 {
2675 thisHitColliders.Add(id);
2676 if (!m_lastColliders.Contains(id))
2650 { 2677 {
2651 soundinfo = new CollisionForSoundInfo(); 2678 startedColliders.Add(id);
2652 soundinfo.colliderID = id; 2679
2653 soundinfo.position = curcontact.Position; 2680 curcontact = collissionswith[id];
2654 soundinfo.relativeVel = curcontact.RelativeSpeed; 2681 if (Math.Abs(curcontact.RelativeSpeed) > 0.2)
2655 soundinfolist.Add(soundinfo); 2682 {
2683 soundinfo = new CollisionForSoundInfo();
2684 soundinfo.colliderID = id;
2685 soundinfo.position = curcontact.Position;
2686 soundinfo.relativeVel = curcontact.RelativeSpeed;
2687 soundinfolist.Add(soundinfo);
2688 }
2656 } 2689 }
2657 } 2690 }
2658 } 2691 }
2692 else
2693 {
2694 foreach (uint id in collissionswith.Keys)
2695 {
2696 thisHitColliders.Add(id);
2697 if (!m_lastColliders.Contains(id))
2698 startedColliders.Add(id);
2699 }
2700 }
2659 2701
2660 // calculate things that ended colliding 2702 // calculate things that ended colliding
2661 foreach (uint localID in m_lastColliders) 2703 foreach (uint localID in m_lastColliders)
@@ -2673,7 +2715,7 @@ namespace OpenSim.Region.Framework.Scenes
2673 m_lastColliders.Remove(localID); 2715 m_lastColliders.Remove(localID);
2674 2716
2675 // play sounds. 2717 // play sounds.
2676 if (soundinfolist.Count > 0 && !VolumeDetectActive && CollisionSound != invalidCollisionSoundUUID) 2718 if (soundinfolist.Count > 0)
2677 CollisionSounds.PartCollisionSound(this, soundinfolist); 2719 CollisionSounds.PartCollisionSound(this, soundinfolist);
2678 } 2720 }
2679 2721
@@ -4791,7 +4833,8 @@ namespace OpenSim.Region.Framework.Scenes
4791 4833
4792 pa.OnCollisionUpdate -= PhysicsCollision; 4834 pa.OnCollisionUpdate -= PhysicsCollision;
4793 4835
4794 bool hassound = ( CollisionSound != invalidCollisionSoundUUID); 4836 bool hassound = (CollisionSoundType >= 0 && !VolumeDetectActive);
4837
4795 scriptEvents CombinedEvents = AggregateScriptEvents; 4838 scriptEvents CombinedEvents = AggregateScriptEvents;
4796 4839
4797 // merge with root part 4840 // merge with root part
@@ -4800,10 +4843,7 @@ namespace OpenSim.Region.Framework.Scenes
4800 4843
4801 // submit to this part case 4844 // submit to this part case
4802 if (VolumeDetectActive) 4845 if (VolumeDetectActive)
4803 {
4804 CombinedEvents &= PhyscicsVolumeDtcSubsEvents; 4846 CombinedEvents &= PhyscicsVolumeDtcSubsEvents;
4805 hassound = false;
4806 }
4807 else if ((Flags & PrimFlags.Phantom) != 0) 4847 else if ((Flags & PrimFlags.Phantom) != 0)
4808 CombinedEvents &= PhyscicsPhantonSubsEvents; 4848 CombinedEvents &= PhyscicsPhantonSubsEvents;
4809 else 4849 else