minor: Eliminate more unnecessary code copying individual parameters for Vector3 copying in Scene - this is not necessary as Vector3 is a value type

0.8-extended
Justin Clark-Casey (justincc) 2014-08-28 18:37:34 +01:00 committed by Justin Clark-Casey
parent 5eb6b14854
commit 27299438d0
1 changed files with 19 additions and 17 deletions

View File

@ -2073,8 +2073,8 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectPart target = GetSceneObjectPart(RayTargetID); SceneObjectPart target = GetSceneObjectPart(RayTargetID);
Vector3 direction = Vector3.Normalize(RayEnd - RayStart); Vector3 direction = Vector3.Normalize(RayEnd - RayStart);
Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); Vector3 AXOrigin = RayStart;
Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); Vector3 AXdirection = direction;
if (target != null) if (target != null)
{ {
@ -2096,13 +2096,13 @@ namespace OpenSim.Region.Framework.Scenes
// If we hit something // If we hit something
if (ei.HitTF) if (ei.HitTF)
{ {
Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); Vector3 scaleComponent = ei.AAfaceNormal;
if (scaleComponent.X != 0) ScaleOffset = scale.X; if (scaleComponent.X != 0) ScaleOffset = scale.X;
if (scaleComponent.Y != 0) ScaleOffset = scale.Y; if (scaleComponent.Y != 0) ScaleOffset = scale.Y;
if (scaleComponent.Z != 0) ScaleOffset = scale.Z; if (scaleComponent.Z != 0) ScaleOffset = scale.Z;
ScaleOffset = Math.Abs(ScaleOffset); ScaleOffset = Math.Abs(ScaleOffset);
Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); Vector3 intersectionpoint = ei.ipoint;
Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); Vector3 normal = ei.normal;
// Set the position to the intersection point // Set the position to the intersection point
Vector3 offset = (normal * (ScaleOffset / 2f)); Vector3 offset = (normal * (ScaleOffset / 2f));
pos = (intersectionpoint + offset); pos = (intersectionpoint + offset);
@ -2127,8 +2127,9 @@ namespace OpenSim.Region.Framework.Scenes
if (ei.HitTF) if (ei.HitTF)
{ {
pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); pos = ei.ipoint;
} else }
else
{ {
// fall back to our stupid functionality // fall back to our stupid functionality
pos = RayEnd; pos = RayEnd;
@ -3181,8 +3182,8 @@ namespace OpenSim.Region.Framework.Scenes
if (target != null && target2 != null) if (target != null && target2 != null)
{ {
Vector3 direction = Vector3.Normalize(RayEnd - RayStart); Vector3 direction = Vector3.Normalize(RayEnd - RayStart);
Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); Vector3 AXOrigin = RayStart;
Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); Vector3 AXdirection = direction;
pos = target2.AbsolutePosition; pos = target2.AbsolutePosition;
//m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString()); //m_log.Info("[OBJECT_REZ]: TargetPos: " + pos.ToString() + ", RayStart: " + RayStart.ToString() + ", RayEnd: " + RayEnd.ToString() + ", Volume: " + Util.GetDistanceTo(RayStart,RayEnd).ToString() + ", mag1: " + Util.GetMagnitude(RayStart).ToString() + ", mag2: " + Util.GetMagnitude(RayEnd).ToString());
@ -3203,13 +3204,13 @@ namespace OpenSim.Region.Framework.Scenes
if (ei.HitTF) if (ei.HitTF)
{ {
Vector3 scale = target.Scale; Vector3 scale = target.Scale;
Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); Vector3 scaleComponent = ei.AAfaceNormal;
if (scaleComponent.X != 0) ScaleOffset = scale.X; if (scaleComponent.X != 0) ScaleOffset = scale.X;
if (scaleComponent.Y != 0) ScaleOffset = scale.Y; if (scaleComponent.Y != 0) ScaleOffset = scale.Y;
if (scaleComponent.Z != 0) ScaleOffset = scale.Z; if (scaleComponent.Z != 0) ScaleOffset = scale.Z;
ScaleOffset = Math.Abs(ScaleOffset); ScaleOffset = Math.Abs(ScaleOffset);
Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); Vector3 intersectionpoint = ei.ipoint;
Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); Vector3 normal = ei.normal;
Vector3 offset = normal * (ScaleOffset / 2f); Vector3 offset = normal * (ScaleOffset / 2f);
pos = intersectionpoint + offset; pos = intersectionpoint + offset;
@ -3229,6 +3230,7 @@ namespace OpenSim.Region.Framework.Scenes
{ {
copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity); copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity);
} }
if (copy != null) if (copy != null)
EventManager.TriggerObjectAddedToScene(copy); EventManager.TriggerObjectAddedToScene(copy);
} }
@ -5061,7 +5063,7 @@ namespace OpenSim.Region.Framework.Scenes
case PhysicsJointType.Ball: case PhysicsJointType.Ball:
{ {
Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint);
Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z); Vector3 proxyPos = jointAnchor;
jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update
} }
break; break;
@ -5086,7 +5088,7 @@ namespace OpenSim.Region.Framework.Scenes
jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene);
} }
Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z); Vector3 proxyPos = jointAnchor;
Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; Quaternion q = trackedBody.RotationOffset * joint.LocalRotation;
jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update
@ -5187,8 +5189,8 @@ namespace OpenSim.Region.Framework.Scenes
y = Heightmap.Height - 1; y = Heightmap.Height - 1;
Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]); Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]);
Vector3 p1 = new Vector3(p0); Vector3 p1 = p0;
Vector3 p2 = new Vector3(p0); Vector3 p2 = p0;
p1.X += 1.0f; p1.X += 1.0f;
if (p1.X < Heightmap.Width) if (p1.X < Heightmap.Width)