diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Modules/FriendsModule.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Modules/InstantMessageModule.cs | 20 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 208 |
3 files changed, 227 insertions, 16 deletions
diff --git a/OpenSim/Region/Environment/Modules/FriendsModule.cs b/OpenSim/Region/Environment/Modules/FriendsModule.cs index e1d3e2a..4d06750 100644 --- a/OpenSim/Region/Environment/Modules/FriendsModule.cs +++ b/OpenSim/Region/Environment/Modules/FriendsModule.cs | |||
@@ -45,8 +45,8 @@ namespace OpenSim.Region.Environment.Modules | |||
45 | 45 | ||
46 | private List<Scene> m_scene = new List<Scene>(); | 46 | private List<Scene> m_scene = new List<Scene>(); |
47 | 47 | ||
48 | |||
49 | Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>(); | 48 | Dictionary<LLUUID, ulong> m_rootAgents = new Dictionary<LLUUID, ulong>(); |
49 | |||
50 | Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>(); | 50 | Dictionary<LLUUID, LLUUID> m_pendingFriendRequests = new Dictionary<LLUUID, LLUUID>(); |
51 | 51 | ||
52 | public void Initialise(Scene scene, IConfigSource config) | 52 | public void Initialise(Scene scene, IConfigSource config) |
@@ -66,9 +66,6 @@ namespace OpenSim.Region.Environment.Modules | |||
66 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; | 66 | scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; |
67 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; | 67 | scene.EventManager.OnMakeChildAgent += MakeChildAgent; |
68 | scene.EventManager.OnClientClosed += ClientLoggedOut; | 68 | scene.EventManager.OnClientClosed += ClientLoggedOut; |
69 | |||
70 | |||
71 | |||
72 | } | 69 | } |
73 | public XmlRpcResponse processPresenceUpdate(XmlRpcRequest req) | 70 | public XmlRpcResponse processPresenceUpdate(XmlRpcRequest req) |
74 | { | 71 | { |
@@ -90,10 +87,6 @@ namespace OpenSim.Region.Environment.Modules | |||
90 | client.OnDenyFriendRequest += OnDenyFriendRequest; | 87 | client.OnDenyFriendRequest += OnDenyFriendRequest; |
91 | client.OnTerminateFriendship += OnTerminateFriendship; | 88 | client.OnTerminateFriendship += OnTerminateFriendship; |
92 | 89 | ||
93 | |||
94 | |||
95 | |||
96 | |||
97 | } | 90 | } |
98 | 91 | ||
99 | private void ClientLoggedOut(LLUUID AgentId) | 92 | private void ClientLoggedOut(LLUUID AgentId) |
@@ -144,9 +137,9 @@ namespace OpenSim.Region.Environment.Modules | |||
144 | 137 | ||
145 | } | 138 | } |
146 | } | 139 | } |
147 | |||
148 | } | ||
149 | 140 | ||
141 | } | ||
142 | #region FriendRequestHandling | ||
150 | private void OnInstantMessage(IClientAPI client,LLUUID fromAgentID, | 143 | private void OnInstantMessage(IClientAPI client,LLUUID fromAgentID, |
151 | LLUUID fromAgentSession, LLUUID toAgentID, | 144 | LLUUID fromAgentSession, LLUUID toAgentID, |
152 | LLUUID imSessionID, uint timestamp, string fromAgentName, | 145 | LLUUID imSessionID, uint timestamp, string fromAgentName, |
@@ -293,7 +286,7 @@ namespace OpenSim.Region.Environment.Modules | |||
293 | new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID), | 286 | new LLVector3(msg.Position.x, msg.Position.y, msg.Position.z), new LLUUID(msg.RegionID), |
294 | msg.binaryBucket); | 287 | msg.binaryBucket); |
295 | } | 288 | } |
296 | 289 | #endregion | |
297 | private ScenePresence GetPresenceFromAgentID(LLUUID AgentID) | 290 | private ScenePresence GetPresenceFromAgentID(LLUUID AgentID) |
298 | { | 291 | { |
299 | ScenePresence returnAgent = null; | 292 | ScenePresence returnAgent = null; |
diff --git a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs index 8df2acb..70f3d99 100644 --- a/OpenSim/Region/Environment/Modules/InstantMessageModule.cs +++ b/OpenSim/Region/Environment/Modules/InstantMessageModule.cs | |||
@@ -26,27 +26,39 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | using System.Collections; | ||
29 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
30 | using libsecondlife; | 31 | using libsecondlife; |
31 | using Nini.Config; | 32 | using Nini.Config; |
33 | using Nwc.XmlRpc; | ||
32 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Console; | 35 | using OpenSim.Framework.Console; |
34 | using OpenSim.Region.Environment.Interfaces; | 36 | using OpenSim.Region.Environment.Interfaces; |
35 | using OpenSim.Region.Environment.Scenes; | 37 | using OpenSim.Region.Environment.Scenes; |
36 | 38 | ||
39 | |||
37 | namespace OpenSim.Region.Environment.Modules | 40 | namespace OpenSim.Region.Environment.Modules |
38 | { | 41 | { |
39 | public class InstantMessageModule : IRegionModule | 42 | public class InstantMessageModule : IRegionModule |
40 | { | 43 | { |
41 | private List<Scene> m_scenes = new List<Scene>(); | 44 | private List<Scene> m_scenes = new List<Scene>(); |
45 | private Hashtable m_RegionInfoCache = new Hashtable(); | ||
42 | 46 | ||
43 | public void Initialise(Scene scene, IConfigSource config) | 47 | public void Initialise(Scene scene, IConfigSource config) |
44 | { | 48 | { |
45 | if (!m_scenes.Contains(scene)) | 49 | lock (m_scenes) |
46 | { | 50 | { |
47 | m_scenes.Add(scene); | 51 | if (m_scenes.Count == 0) |
48 | scene.EventManager.OnNewClient += OnNewClient; | 52 | { |
49 | scene.EventManager.OnGridInstantMessageToIMModule += OnGridInstantMessage; | 53 | //scene.AddXmlRPCHandler("avatar_location_update", processPresenceUpdate); |
54 | } | ||
55 | |||
56 | if (!m_scenes.Contains(scene)) | ||
57 | { | ||
58 | m_scenes.Add(scene); | ||
59 | scene.EventManager.OnNewClient += OnNewClient; | ||
60 | scene.EventManager.OnGridInstantMessageToIMModule += OnGridInstantMessage; | ||
61 | } | ||
50 | } | 62 | } |
51 | } | 63 | } |
52 | 64 | ||
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 05dcd7a..62b6a7f 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | |||
@@ -353,6 +353,176 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
353 | } | 353 | } |
354 | 354 | ||
355 | break; | 355 | break; |
356 | case ProfileShape.Circle: | ||
357 | if (_pbs.PathCurve == (byte)Extrusion.Straight) | ||
358 | { | ||
359 | // Cylinder | ||
360 | float volume1 = (float)(Math.PI * Math.Pow(_size.X, 2) * _size.Z); | ||
361 | float volume2 = (float)(Math.PI * Math.Pow(_size.Y, 2) * _size.Z); | ||
362 | |||
363 | // Approximating the cylinder's irregularity. | ||
364 | if (volume1 > volume2) | ||
365 | { | ||
366 | volume = (float)volume1 - (volume1 - volume2); | ||
367 | } | ||
368 | else if (volume2 > volume1) | ||
369 | { | ||
370 | volume = (float)volume2 - (volume2 - volume1); | ||
371 | } | ||
372 | else | ||
373 | { | ||
374 | // Regular cylinder | ||
375 | volume = volume1; | ||
376 | } | ||
377 | } | ||
378 | else | ||
379 | { | ||
380 | // We don't know what the shape is yet, so use default | ||
381 | volume = _size.X * _size.Y * _size.Z; | ||
382 | } | ||
383 | // If the user has 'hollowed out' | ||
384 | // ProfileHollow is one of those 0 to 50000 values :P | ||
385 | // we like percentages better.. so turning into a percentage | ||
386 | |||
387 | if (((float)_pbs.ProfileHollow / 50000f) > 0.0) | ||
388 | { | ||
389 | float hollowAmount = (float)_pbs.ProfileHollow / 50000f; | ||
390 | |||
391 | // calculate the hollow volume by it's shape compared to the prim shape | ||
392 | float hollowVolume = 0; | ||
393 | switch (_pbs.HollowShape) | ||
394 | { | ||
395 | |||
396 | case HollowShape.Same: | ||
397 | case HollowShape.Circle: | ||
398 | // Hollow shape is a perfect cyllinder in respect to the cube's scale | ||
399 | // Cyllinder hollow volume calculation | ||
400 | float hRadius = _size.X / 2; | ||
401 | float hLength = _size.Z; | ||
402 | |||
403 | // pi * r2 * h | ||
404 | hollowVolume = ((float)(Math.PI * Math.Pow(hRadius, 2) * hLength) * hollowAmount); | ||
405 | break; | ||
406 | |||
407 | case HollowShape.Square: | ||
408 | // Cube Hollow volume calculation | ||
409 | float hollowsizex = _size.X * hollowAmount; | ||
410 | float hollowsizey = _size.Y * hollowAmount; | ||
411 | float hollowsizez = _size.Z * hollowAmount; | ||
412 | hollowVolume = hollowsizex * hollowsizey * hollowsizez; | ||
413 | break; | ||
414 | |||
415 | |||
416 | |||
417 | case HollowShape.Triangle: | ||
418 | // Equilateral Triangular Prism volume hollow calculation | ||
419 | // Triangle is an Equilateral Triangular Prism with aLength = to _size.Y | ||
420 | |||
421 | float aLength = _size.Y; | ||
422 | // 1/2 abh | ||
423 | hollowVolume = (float)((0.5 * aLength * _size.X * _size.Z) * hollowAmount); | ||
424 | break; | ||
425 | |||
426 | default: | ||
427 | hollowVolume = 0; | ||
428 | break; | ||
429 | } | ||
430 | volume = volume - hollowVolume; | ||
431 | } | ||
432 | break; | ||
433 | |||
434 | case ProfileShape.HalfCircle: | ||
435 | if (_pbs.PathCurve == (byte)Extrusion.Curve1) | ||
436 | { | ||
437 | if (_size.X == _size.Z && _size.Z == _size.X) | ||
438 | { | ||
439 | // regular sphere | ||
440 | // v = 4/3 * pi * r^3 | ||
441 | float sradius3 = (float)Math.Pow((_size.X / 2), 3); | ||
442 | volume = (float)((4 / 3) * Math.PI * sradius3); | ||
443 | } | ||
444 | else | ||
445 | { | ||
446 | // we treat this as a box currently | ||
447 | volume = _size.X * _size.Y * _size.Z; | ||
448 | } | ||
449 | |||
450 | } | ||
451 | else | ||
452 | { | ||
453 | // We don't know what the shape is yet, so use default | ||
454 | volume = _size.X * _size.Y * _size.Z; | ||
455 | } | ||
456 | break; | ||
457 | case ProfileShape.EquilateralTriangle: | ||
458 | /* | ||
459 | v = (abs((xB*yA-xA*yB)+(xC*yB-xB*yC)+(xA*yC-xC*yA))/2) * h | ||
460 | |||
461 | // seed mesh | ||
462 | Vertex MM = new Vertex(-0.25f, -0.45f, 0.0f); | ||
463 | Vertex PM = new Vertex(+0.5f, 0f, 0.0f); | ||
464 | Vertex PP = new Vertex(-0.25f, +0.45f, 0.0f); | ||
465 | */ | ||
466 | float xA = -0.25f * _size.X; | ||
467 | float yA = -0.45f * _size.Y; | ||
468 | |||
469 | float xB = 0.5f * _size.X; | ||
470 | float yB = 0; | ||
471 | |||
472 | float xC = -0.25f * _size.X; | ||
473 | float yC = 0.45f * _size.Y; | ||
474 | |||
475 | volume = (float)((Math.Abs((xB * yA - xA * yB) + (xC * yB - xB * yC) + (xA * yC - xC * yA)) / 2) * _size.Z); | ||
476 | |||
477 | // If the user has 'hollowed out' | ||
478 | // ProfileHollow is one of those 0 to 50000 values :P | ||
479 | // we like percentages better.. so turning into a percentage | ||
480 | float fhollowFactor = ((float)_pbs.ProfileHollow / 1.9f); | ||
481 | if (((float)fhollowFactor / 50000f) > 0.0) | ||
482 | { | ||
483 | float hollowAmount = (float)fhollowFactor / 50000f; | ||
484 | |||
485 | // calculate the hollow volume by it's shape compared to the prim shape | ||
486 | float hollowVolume = 0; | ||
487 | switch (_pbs.HollowShape) | ||
488 | { | ||
489 | |||
490 | case HollowShape.Same: | ||
491 | case HollowShape.Triangle: | ||
492 | // Equilateral Triangular Prism volume hollow calculation | ||
493 | // Triangle is an Equilateral Triangular Prism with aLength = to _size.Y | ||
494 | |||
495 | float aLength = _size.Y; | ||
496 | // 1/2 abh | ||
497 | hollowVolume = (float)((0.5 * aLength * _size.X * _size.Z) * hollowAmount); | ||
498 | break; | ||
499 | |||
500 | case HollowShape.Square: | ||
501 | // Cube Hollow volume calculation | ||
502 | float hollowsizex = _size.X * hollowAmount; | ||
503 | float hollowsizey = _size.Y * hollowAmount; | ||
504 | float hollowsizez = _size.Z * hollowAmount; | ||
505 | hollowVolume = hollowsizex * hollowsizey * hollowsizez; | ||
506 | break; | ||
507 | |||
508 | case HollowShape.Circle: | ||
509 | // Hollow shape is a perfect cyllinder in respect to the cube's scale | ||
510 | // Cyllinder hollow volume calculation | ||
511 | float hRadius = _size.X / 2; | ||
512 | float hLength = _size.Z; | ||
513 | |||
514 | // pi * r2 * h | ||
515 | hollowVolume = ((float)((Math.PI * Math.Pow(hRadius, 2) * hLength)/2) * hollowAmount); | ||
516 | break; | ||
517 | |||
518 | |||
519 | default: | ||
520 | hollowVolume = 0; | ||
521 | break; | ||
522 | } | ||
523 | volume = volume - hollowVolume; | ||
524 | } | ||
525 | break; | ||
356 | 526 | ||
357 | default: | 527 | default: |
358 | // we don't have all of the volume formulas yet so | 528 | // we don't have all of the volume formulas yet so |
@@ -383,9 +553,41 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
383 | 553 | ||
384 | volume = volume - (volume*pathCutAmount); | 554 | volume = volume - (volume*pathCutAmount); |
385 | } | 555 | } |
556 | UInt16 taperX = _pbs.PathScaleX; | ||
557 | UInt16 taperY = _pbs.PathScaleY; | ||
558 | float taperFactorX = 0; | ||
559 | float taperFactorY = 0; | ||
386 | 560 | ||
387 | // Mass = density * volume | 561 | // Mass = density * volume |
562 | if (taperX != 100) | ||
563 | { | ||
564 | if (taperX > 100) | ||
565 | { | ||
566 | taperFactorX = 1.0f - ((float)taperX / 200); | ||
567 | //m_log.Warn("taperTopFactorX: " + extr.taperTopFactorX.ToString()); | ||
568 | } | ||
569 | else | ||
570 | { | ||
571 | taperFactorX = 1.0f - ((100 - (float)taperX) / 100); | ||
572 | //m_log.Warn("taperBotFactorX: " + extr.taperBotFactorX.ToString()); | ||
573 | } | ||
574 | volume = (float)volume * ((taperFactorX / 3f) + 0.001f); | ||
575 | } | ||
388 | 576 | ||
577 | if (taperY != 100) | ||
578 | { | ||
579 | if (taperY > 100) | ||
580 | { | ||
581 | taperFactorY = 1.0f - ((float)taperY / 200); | ||
582 | //m_log.Warn("taperTopFactorY: " + extr.taperTopFactorY.ToString()); | ||
583 | } | ||
584 | else | ||
585 | { | ||
586 | taperFactorY = 1.0f - ((100 - (float)taperY) / 100); | ||
587 | //m_log.Warn("taperBotFactorY: " + extr.taperBotFactorY.ToString()); | ||
588 | } | ||
589 | volume = (float)volume * ((taperFactorY / 3f) + 0.001f); | ||
590 | } | ||
389 | returnMass = m_density*volume; | 591 | returnMass = m_density*volume; |
390 | 592 | ||
391 | return returnMass; | 593 | return returnMass; |
@@ -395,7 +597,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
395 | { | 597 | { |
396 | if (Body != (IntPtr) 0) | 598 | if (Body != (IntPtr) 0) |
397 | { | 599 | { |
398 | d.MassSetBoxTotal(out pMass, CalculateMass(), _size.X, _size.Y, _size.Z); | 600 | float newmass = CalculateMass(); |
601 | m_log.Info("[PHYSICS]: New Mass: " + newmass.ToString()); | ||
602 | |||
603 | if (newmass <= 0) newmass = 0.0001f; | ||
604 | d.MassSetBoxTotal(out pMass, newmass, _size.X, _size.Y, _size.Z); | ||
399 | d.BodySetMass(Body, ref pMass); | 605 | d.BodySetMass(Body, ref pMass); |
400 | } | 606 | } |
401 | } | 607 | } |