diff options
author | Justin Clark-Casey (justincc) | 2014-08-28 18:37:34 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-08-28 18:37:34 +0100 |
commit | 1a3ffda8524cfd19e1149a1831cf8e8defa97a57 (patch) | |
tree | 3b79368ea5d4b7ab69e7a9ed0dacc2eb93333cec /OpenSim/Region/Framework/Scenes | |
parent | On code section that rezzes single objects and attachments, reduce CPU use by... (diff) | |
download | opensim-SC-1a3ffda8524cfd19e1149a1831cf8e8defa97a57.zip opensim-SC-1a3ffda8524cfd19e1149a1831cf8e8defa97a57.tar.gz opensim-SC-1a3ffda8524cfd19e1149a1831cf8e8defa97a57.tar.bz2 opensim-SC-1a3ffda8524cfd19e1149a1831cf8e8defa97a57.tar.xz |
minor: Eliminate more unnecessary code copying individual parameters for Vector3 copying in Scene - this is not necessary as Vector3 is a value type
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e87500a..18376c3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2110,8 +2110,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2110 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); | 2110 | SceneObjectPart target = GetSceneObjectPart(RayTargetID); |
2111 | 2111 | ||
2112 | Vector3 direction = Vector3.Normalize(RayEnd - RayStart); | 2112 | Vector3 direction = Vector3.Normalize(RayEnd - RayStart); |
2113 | Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); | 2113 | Vector3 AXOrigin = RayStart; |
2114 | Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); | 2114 | Vector3 AXdirection = direction; |
2115 | 2115 | ||
2116 | if (target != null) | 2116 | if (target != null) |
2117 | { | 2117 | { |
@@ -2127,19 +2127,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
2127 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); | 2127 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, Quaternion.Identity, frontFacesOnly, FaceCenter); |
2128 | 2128 | ||
2129 | // Un-comment out the following line to Get Raytrace results printed to the console. | 2129 | // Un-comment out the following line to Get Raytrace results printed to the console. |
2130 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 2130 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
2131 | float ScaleOffset = 0.5f; | 2131 | float ScaleOffset = 0.5f; |
2132 | 2132 | ||
2133 | // If we hit something | 2133 | // If we hit something |
2134 | if (ei.HitTF) | 2134 | if (ei.HitTF) |
2135 | { | 2135 | { |
2136 | Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); | 2136 | Vector3 scaleComponent = ei.AAfaceNormal; |
2137 | if (scaleComponent.X != 0) ScaleOffset = scale.X; | 2137 | if (scaleComponent.X != 0) ScaleOffset = scale.X; |
2138 | if (scaleComponent.Y != 0) ScaleOffset = scale.Y; | 2138 | if (scaleComponent.Y != 0) ScaleOffset = scale.Y; |
2139 | if (scaleComponent.Z != 0) ScaleOffset = scale.Z; | 2139 | if (scaleComponent.Z != 0) ScaleOffset = scale.Z; |
2140 | ScaleOffset = Math.Abs(ScaleOffset); | 2140 | ScaleOffset = Math.Abs(ScaleOffset); |
2141 | Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2141 | Vector3 intersectionpoint = ei.ipoint; |
2142 | Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); | 2142 | Vector3 normal = ei.normal; |
2143 | // Set the position to the intersection point | 2143 | // Set the position to the intersection point |
2144 | Vector3 offset = (normal * (ScaleOffset / 2f)); | 2144 | Vector3 offset = (normal * (ScaleOffset / 2f)); |
2145 | pos = (intersectionpoint + offset); | 2145 | pos = (intersectionpoint + offset); |
@@ -2164,8 +2164,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2164 | 2164 | ||
2165 | if (ei.HitTF) | 2165 | if (ei.HitTF) |
2166 | { | 2166 | { |
2167 | pos = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 2167 | pos = ei.ipoint; |
2168 | } else | 2168 | } |
2169 | else | ||
2169 | { | 2170 | { |
2170 | // fall back to our stupid functionality | 2171 | // fall back to our stupid functionality |
2171 | pos = RayEnd; | 2172 | pos = RayEnd; |
@@ -3218,8 +3219,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3218 | if (target != null && target2 != null) | 3219 | if (target != null && target2 != null) |
3219 | { | 3220 | { |
3220 | Vector3 direction = Vector3.Normalize(RayEnd - RayStart); | 3221 | Vector3 direction = Vector3.Normalize(RayEnd - RayStart); |
3221 | Vector3 AXOrigin = new Vector3(RayStart.X, RayStart.Y, RayStart.Z); | 3222 | Vector3 AXOrigin = RayStart; |
3222 | Vector3 AXdirection = new Vector3(direction.X, direction.Y, direction.Z); | 3223 | Vector3 AXdirection = direction; |
3223 | 3224 | ||
3224 | pos = target2.AbsolutePosition; | 3225 | pos = target2.AbsolutePosition; |
3225 | //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()); | 3226 | //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()); |
@@ -3240,13 +3241,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3240 | if (ei.HitTF) | 3241 | if (ei.HitTF) |
3241 | { | 3242 | { |
3242 | Vector3 scale = target.Scale; | 3243 | Vector3 scale = target.Scale; |
3243 | Vector3 scaleComponent = new Vector3(ei.AAfaceNormal.X, ei.AAfaceNormal.Y, ei.AAfaceNormal.Z); | 3244 | Vector3 scaleComponent = ei.AAfaceNormal; |
3244 | if (scaleComponent.X != 0) ScaleOffset = scale.X; | 3245 | if (scaleComponent.X != 0) ScaleOffset = scale.X; |
3245 | if (scaleComponent.Y != 0) ScaleOffset = scale.Y; | 3246 | if (scaleComponent.Y != 0) ScaleOffset = scale.Y; |
3246 | if (scaleComponent.Z != 0) ScaleOffset = scale.Z; | 3247 | if (scaleComponent.Z != 0) ScaleOffset = scale.Z; |
3247 | ScaleOffset = Math.Abs(ScaleOffset); | 3248 | ScaleOffset = Math.Abs(ScaleOffset); |
3248 | Vector3 intersectionpoint = new Vector3(ei.ipoint.X, ei.ipoint.Y, ei.ipoint.Z); | 3249 | Vector3 intersectionpoint = ei.ipoint; |
3249 | Vector3 normal = new Vector3(ei.normal.X, ei.normal.Y, ei.normal.Z); | 3250 | Vector3 normal = ei.normal; |
3250 | Vector3 offset = normal * (ScaleOffset / 2f); | 3251 | Vector3 offset = normal * (ScaleOffset / 2f); |
3251 | pos = intersectionpoint + offset; | 3252 | pos = intersectionpoint + offset; |
3252 | 3253 | ||
@@ -3266,6 +3267,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3266 | { | 3267 | { |
3267 | copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity); | 3268 | copy = m_sceneGraph.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, Quaternion.Identity); |
3268 | } | 3269 | } |
3270 | |||
3269 | if (copy != null) | 3271 | if (copy != null) |
3270 | EventManager.TriggerObjectAddedToScene(copy); | 3272 | EventManager.TriggerObjectAddedToScene(copy); |
3271 | } | 3273 | } |
@@ -5098,7 +5100,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5098 | case PhysicsJointType.Ball: | 5100 | case PhysicsJointType.Ball: |
5099 | { | 5101 | { |
5100 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); | 5102 | Vector3 jointAnchor = PhysicsScene.GetJointAnchor(joint); |
5101 | Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z); | 5103 | Vector3 proxyPos = jointAnchor; |
5102 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update | 5104 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update |
5103 | } | 5105 | } |
5104 | break; | 5106 | break; |
@@ -5123,7 +5125,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
5123 | jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); | 5125 | jointErrorMessage(joint, "joint.TrackedBodyName is null, joint " + joint.ObjectNameInScene); |
5124 | } | 5126 | } |
5125 | 5127 | ||
5126 | Vector3 proxyPos = new Vector3(jointAnchor.X, jointAnchor.Y, jointAnchor.Z); | 5128 | Vector3 proxyPos = jointAnchor; |
5127 | Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; | 5129 | Quaternion q = trackedBody.RotationOffset * joint.LocalRotation; |
5128 | 5130 | ||
5129 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update | 5131 | jointProxyObject.ParentGroup.UpdateGroupPosition(proxyPos); // schedules the entire group for a terse update |
@@ -5224,8 +5226,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
5224 | y = Heightmap.Height - 1; | 5226 | y = Heightmap.Height - 1; |
5225 | 5227 | ||
5226 | Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]); | 5228 | Vector3 p0 = new Vector3(x, y, (float)Heightmap[(int)x, (int)y]); |
5227 | Vector3 p1 = new Vector3(p0); | 5229 | Vector3 p1 = p0; |
5228 | Vector3 p2 = new Vector3(p0); | 5230 | Vector3 p2 = p0; |
5229 | 5231 | ||
5230 | p1.X += 1.0f; | 5232 | p1.X += 1.0f; |
5231 | if (p1.X < Heightmap.Width) | 5233 | if (p1.X < Heightmap.Width) |