From cfce2529ad7dd41ca3c82f378f41491f1b38d9c4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 5 Nov 2011 02:04:48 +0000 Subject: refactor: In sit code, compare against Vector3.Zero and Quaternion.Identity instead of individual components of a vector/quat --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4156f21..0ff93f6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -320,7 +320,10 @@ namespace OpenSim.Region.Framework.Scenes } #region Client Camera - // Position of agent's camera in world (region cordinates) + + /// + /// Position of agent's camera in world (region cordinates) + /// protected Vector3 m_lastCameraPosition; protected Vector3 m_CameraPosition; @@ -1911,14 +1914,12 @@ namespace OpenSim.Region.Framework.Scenes foreach (SceneObjectPart part in partArray) { // Is a sit target available? - Vector3 avSitOffSet = part.SitTargetPosition; + Vector3 avSitOffset = part.SitTargetPosition; Quaternion avSitOrientation = part.SitTargetOrientation; UUID avOnTargetAlready = part.SitTargetAvatar; - bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); - bool SitTargetisSet = - (!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && avSitOrientation.W == 1f && - avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f)); + bool SitTargetUnOccupied = avOnTargetAlready == UUID.Zero; + bool SitTargetisSet = avSitOffset != Vector3.Zero || avSitOrientation != Quaternion.Identity; if (SitTargetisSet && SitTargetUnOccupied) { @@ -1940,7 +1941,6 @@ namespace OpenSim.Region.Framework.Scenes Vector3 cameraAtOffset = Vector3.Zero; bool forceMouselook = false; - //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); SceneObjectPart part = FindNextAvailableSitTarget(targetID); if (part != null) { @@ -1954,9 +1954,9 @@ namespace OpenSim.Region.Framework.Scenes bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); bool SitTargetisSet = - (!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && + (!(avSitOffSet == Vector3.Zero && ( - avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 1f // Valid Zero Rotation quaternion + avSitOrientation == Quaternion.Identity // Valid Zero Rotation quaternion || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f && avSitOrientation.W == 0f // W-Z Mapping was invalid at one point || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 0f // Invalid Quaternion ) @@ -2008,6 +2008,7 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendSitResponse(targetID, offset, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook); m_requestedSitTargetUUID = targetID; + // This calls HandleAgentSit twice, once from here, and the client calls // HandleAgentSit itself after it gets to the location // It doesn't get to the location until we've moved them there though @@ -2292,15 +2293,13 @@ namespace OpenSim.Region.Framework.Scenes //Quaternion result = (sitTargetOrient * vq) * nq; - m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z); - m_pos += SIT_TARGET_ADJUSTMENT; + m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT; Rotation = sitTargetOrient; ParentPosition = part.AbsolutePosition; } else { m_pos -= part.AbsolutePosition; - ParentPosition = part.AbsolutePosition; // m_log.DebugFormat( @@ -2313,6 +2312,7 @@ namespace OpenSim.Region.Framework.Scenes return; } } + ParentID = m_requestedSitTargetID; Velocity = Vector3.Zero; -- cgit v1.1 From e3885625a069e5d6a59ad0300215c13c89ea00f8 Mon Sep 17 00:00:00 2001 From: nebadon Date: Sat, 5 Nov 2011 02:26:25 -0700 Subject: Don't rotate child prims, if only the root prim is rotated. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 4d6c4cb..3f4e112 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2926,8 +2926,8 @@ namespace OpenSim.Region.Framework.Scenes axPos *= Quaternion.Inverse(axRot); prim.OffsetPosition = axPos; Quaternion primsRot = prim.RotationOffset; - Quaternion newRot = primsRot * oldParentRot; - newRot *= Quaternion.Inverse(axRot); + Quaternion newRot = oldParentRot * primsRot; + newRot = Quaternion.Inverse(axRot) * newRot; prim.RotationOffset = newRot; prim.ScheduleTerseUpdate(); prim.IgnoreUndoUpdate = false; -- cgit v1.1 From f0d2fcfbe9a868f67638cd25c8943c5b01d88c58 Mon Sep 17 00:00:00 2001 From: nebadon Date: Sat, 5 Nov 2011 02:35:19 -0700 Subject: add Mana Janus and SpotOn3D to contributors.txt last patch was courtesy of Mana Janus I failed to mention that, sorry! --- CONTRIBUTORS.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 2620a20..25bc79f 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -102,6 +102,7 @@ what it is today. * lulurun * M.Igarashi * maimedleech +* Mana Janus * Mic Bowman * Michelle Argus * Michael Cortez (The Flotsam Project, http://osflotsam.org/) @@ -133,6 +134,7 @@ what it is today. * Salahzar Stenvaag * sempuki * SignpostMarv +* SpotOn3D * Strawberry Fride * tglion * tlaukkan/Tommil (Tommi S. E. Laukkanen, Bubble Cloud) -- cgit v1.1 From 4797ed6eddea8a0b2adec14825e8129e38b08c98 Mon Sep 17 00:00:00 2001 From: nebadon Date: Sat, 5 Nov 2011 02:42:21 -0700 Subject: Multiple lines in welcome message use '\n' in the welcome message to start a new line. --- OpenSim/Services/LLLoginService/LLLoginService.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 6fec276..8578c59 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -126,6 +126,9 @@ namespace OpenSim.Services.LLLoginService if (accountService == string.Empty || authService == string.Empty) throw new Exception("LoginService is missing service specifications"); + // replace newlines in welcome message + m_WelcomeMessage = m_WelcomeMessage.Replace("\\n", "\n"); + Object[] args = new Object[] { config }; m_UserAccountService = ServerUtils.LoadPlugin(accountService, args); m_GridUserService = ServerUtils.LoadPlugin(gridUserService, args); -- cgit v1.1 From e182cc198d3b0151b2a891f6470e664f77e42d79 Mon Sep 17 00:00:00 2001 From: nebadon Date: Sat, 5 Nov 2011 02:56:52 -0700 Subject: Fix avatar height, removes the hip offset hack Author: Mana Janus --- OpenSim/Framework/AvatarAppearance.cs | 36 ++++++++---------------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 -- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 72b580b..6c2a954 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -53,7 +53,6 @@ namespace OpenSim.Framework protected AvatarWearable[] m_wearables; protected Dictionary> m_attachments; protected float m_avatarHeight = 0; - protected float m_hipOffset = 0; public virtual int Serial { @@ -89,11 +88,6 @@ namespace OpenSim.Framework set { m_avatarHeight = value; } } - public virtual float HipOffset - { - get { return m_hipOffset; } - } - public AvatarAppearance() { // m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance"); @@ -184,7 +178,6 @@ namespace OpenSim.Framework m_visualparams = (byte[])appearance.VisualParams.Clone(); m_avatarHeight = appearance.m_avatarHeight; - m_hipOffset = appearance.m_hipOffset; // Copy the attachment, force append mode since that ensures consistency m_attachments = new Dictionary>(); @@ -332,20 +325,18 @@ namespace OpenSim.Framework public virtual void SetHeight() { - m_avatarHeight = 1.23077f // Shortest possible avatar height - + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height - + 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size - + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length - + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height - + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height - + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; // Neck length - - m_hipOffset = (((1.23077f // Half of avatar - + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height - + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length - + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height - + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height - ) / 2) - m_avatarHeight / 2) * 0.31f - 0.0425f; + // Start with shortest possible female avatar height + m_avatarHeight = 1.14597f; + // Add offset for male avatars + if (m_visualparams[(int)VPElement.SHAPE_MALE] != 0) + m_avatarHeight += 0.0848f; + // Add offsets for visual params + m_avatarHeight += 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f + + 0.08117f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f + + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f + + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f + + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f + + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; } public virtual void SetWearable(int wearableId, AvatarWearable wearable) @@ -578,7 +569,6 @@ namespace OpenSim.Framework data["serial"] = OSD.FromInteger(m_serial); data["height"] = OSD.FromReal(m_avatarHeight); - data["hipoffset"] = OSD.FromReal(m_hipOffset); // Wearables OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); @@ -621,8 +611,6 @@ namespace OpenSim.Framework m_serial = data["serial"].AsInteger(); if ((data != null) && (data["height"] != null)) m_avatarHeight = (float)data["height"].AsReal(); - if ((data != null) && (data["hipoffset"] != null)) - m_hipOffset = (float)data["hipoffset"].AsReal(); try { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0ff93f6..e961bdd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2445,9 +2445,6 @@ namespace OpenSim.Region.Framework.Scenes // server. if (remoteClient.IsActive) { - Vector3 pos = m_pos; - pos.Z += Appearance.HipOffset; - //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); remoteClient.SendEntityUpdate( -- cgit v1.1 From e8a8e462edd33d1879f5f35aba2ba1ded1d5999c Mon Sep 17 00:00:00 2001 From: nebadon Date: Sat, 5 Nov 2011 03:03:57 -0700 Subject: add myself to the contributors.txt --- CONTRIBUTORS.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index 25bc79f..7a25d3f 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -14,6 +14,7 @@ people that make the day to day of OpenSim happen. * Marck * Mic Bowman (Intel) * BlueWall (James Hughes) +* Nebadon Izumi (Michael Cerquoni, OSgrid) * Snoopy Pfeffer * Richard Adams (Intel) -- cgit v1.1