reduce math on use of camerarotation (need to add a lock there). Fix a bug on sits AToffset for some reason ATaxis got in there (needs testing)

LSLKeyTest
UbitUmarov 2016-08-27 22:33:16 +01:00
parent 9128c88d9b
commit e7b0963db8
1 changed files with 14 additions and 8 deletions

View File

@ -542,10 +542,7 @@ namespace OpenSim.Region.Framework.Scenes
public Vector3 CameraPosition { get; set; } public Vector3 CameraPosition { get; set; }
public Quaternion CameraRotation public Quaternion CameraRotation { get; private set; }
{
get { return Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); }
}
// Use these three vectors to figure out what the agent is looking at // Use these three vectors to figure out what the agent is looking at
// Convert it to a Matrix and/or Quaternion // Convert it to a Matrix and/or Quaternion
@ -2696,9 +2693,13 @@ namespace OpenSim.Region.Framework.Scenes
CameraPosition = agentData.CameraCenter; CameraPosition = agentData.CameraCenter;
// Use these three vectors to figure out what the agent is looking at // Use these three vectors to figure out what the agent is looking at
// Convert it to a Matrix and/or Quaternion // Convert it to a Matrix and/or Quaternion
// this my need lock
CameraAtAxis = agentData.CameraAtAxis; CameraAtAxis = agentData.CameraAtAxis;
CameraLeftAxis = agentData.CameraLeftAxis; CameraLeftAxis = agentData.CameraLeftAxis;
CameraUpAxis = agentData.CameraUpAxis; CameraUpAxis = agentData.CameraUpAxis;
Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis);
CameraRotation = camRot;
// The Agent's Draw distance setting // The Agent's Draw distance setting
// When we get to the point of re-computing neighbors everytime this // When we get to the point of re-computing neighbors everytime this
@ -3171,9 +3172,9 @@ namespace OpenSim.Region.Framework.Scenes
offset = offset * part.RotationOffset; offset = offset * part.RotationOffset;
offset += part.OffsetPosition; offset += part.OffsetPosition;
if (CameraAtAxis == Vector3.Zero && cameraEyeOffset == Vector3.Zero) if (cameraAtOffset == Vector3.Zero && cameraEyeOffset == Vector3.Zero)
{ {
CameraAtAxis = part.ParentGroup.RootPart.GetCameraAtOffset(); cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset();
cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset(); cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset();
} }
else else
@ -3311,9 +3312,9 @@ namespace OpenSim.Region.Framework.Scenes
offset = offset * part.RotationOffset; offset = offset * part.RotationOffset;
offset += part.OffsetPosition; offset += part.OffsetPosition;
if (CameraAtAxis == Vector3.Zero && cameraEyeOffset == Vector3.Zero) if (cameraAtOffset == Vector3.Zero && cameraEyeOffset == Vector3.Zero)
{ {
CameraAtAxis = part.ParentGroup.RootPart.GetCameraAtOffset(); cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset();
cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset(); cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset();
} }
else else
@ -4571,6 +4572,11 @@ namespace OpenSim.Region.Framework.Scenes
CameraAtAxis = cAgent.AtAxis; CameraAtAxis = cAgent.AtAxis;
CameraLeftAxis = cAgent.LeftAxis; CameraLeftAxis = cAgent.LeftAxis;
CameraUpAxis = cAgent.UpAxis; CameraUpAxis = cAgent.UpAxis;
Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis);
CameraRotation = camRot;
ParentUUID = cAgent.ParentPart; ParentUUID = cAgent.ParentPart;
PrevSitOffset = cAgent.SitOffset; PrevSitOffset = cAgent.SitOffset;