diff options
author | Teravus Ovares | 2008-06-10 00:18:00 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-06-10 00:18:00 +0000 |
commit | 8a93358405ba97697ece87887d2a36fadfeaca4f (patch) | |
tree | 9ced55cc99a902d2f51293301815abf760c5a239 | |
parent | actually create and populate the migrations table correctly. (diff) | |
download | opensim-SC_OLD-8a93358405ba97697ece87887d2a36fadfeaca4f.zip opensim-SC_OLD-8a93358405ba97697ece87887d2a36fadfeaca4f.tar.gz opensim-SC_OLD-8a93358405ba97697ece87887d2a36fadfeaca4f.tar.bz2 opensim-SC_OLD-8a93358405ba97697ece87887d2a36fadfeaca4f.tar.xz |
* This completes ObjectDuplicateOnRay.
* In English, that means that Copy Selection works now, including Copy Centers and Copy Rotates.
-rw-r--r-- | OpenSim/Region/Environment/Scenes/InnerScene.cs | 22 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 42 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 62 |
3 files changed, 76 insertions, 50 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index d7a6d5b..3cd32c6 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs | |||
@@ -1399,7 +1399,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1399 | } | 1399 | } |
1400 | 1400 | ||
1401 | /// <summary> | 1401 | /// <summary> |
1402 | /// Duplicate the given object. | 1402 | /// Duplicate the given object, Fire and Forget, No rotation, no return wrapper |
1403 | /// </summary> | 1403 | /// </summary> |
1404 | /// <param name="originalPrim"></param> | 1404 | /// <param name="originalPrim"></param> |
1405 | /// <param name="offset"></param> | 1405 | /// <param name="offset"></param> |
@@ -1408,6 +1408,18 @@ namespace OpenSim.Region.Environment.Scenes | |||
1408 | { | 1408 | { |
1409 | //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); | 1409 | //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); |
1410 | 1410 | ||
1411 | SceneObjectGroup dupe = DuplicateObject(originalPrim, offset, flags, AgentID, GroupID, Quaternion.Zero); | ||
1412 | } | ||
1413 | /// <summary> | ||
1414 | /// Duplicate the given object. | ||
1415 | /// </summary> | ||
1416 | /// <param name="originalPrim"></param> | ||
1417 | /// <param name="offset"></param> | ||
1418 | /// <param name="flags"></param> | ||
1419 | protected internal SceneObjectGroup DuplicateObject(uint originalPrim, LLVector3 offset, uint flags, LLUUID AgentID, LLUUID GroupID, Quaternion rot) | ||
1420 | { | ||
1421 | //m_log.DebugFormat("[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", originalPrim, offset, AgentID); | ||
1422 | |||
1411 | List<EntityBase> EntityList = GetEntities(); | 1423 | List<EntityBase> EntityList = GetEntities(); |
1412 | 1424 | ||
1413 | SceneObjectGroup originPrim = null; | 1425 | SceneObjectGroup originPrim = null; |
@@ -1445,16 +1457,22 @@ namespace OpenSim.Region.Environment.Scenes | |||
1445 | 1457 | ||
1446 | m_numPrim += copy.Children.Count; | 1458 | m_numPrim += copy.Children.Count; |
1447 | 1459 | ||
1460 | if (rot != Quaternion.Zero) | ||
1461 | { | ||
1462 | copy.UpdateGroupRotation(new LLQuaternion(rot.x, rot.y, rot.z, rot.w)); | ||
1463 | } | ||
1464 | |||
1448 | copy.StartScripts(); | 1465 | copy.StartScripts(); |
1449 | copy.ScheduleGroupForFullUpdate(); | 1466 | copy.ScheduleGroupForFullUpdate(); |
1467 | return copy; | ||
1450 | } | 1468 | } |
1451 | } | 1469 | } |
1452 | else | 1470 | else |
1453 | { | 1471 | { |
1454 | m_log.WarnFormat("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID); | 1472 | m_log.WarnFormat("[SCENE]: Attempted to duplicate nonexistant prim id {0}", GroupID); |
1455 | } | 1473 | } |
1474 | return null; | ||
1456 | } | 1475 | } |
1457 | |||
1458 | /// <summary> | 1476 | /// <summary> |
1459 | /// Calculates the distance between two Vector3s | 1477 | /// Calculates the distance between two Vector3s |
1460 | /// </summary> | 1478 | /// </summary> |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 8094e4c..d5d8629 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1759,7 +1759,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1759 | { | 1759 | { |
1760 | LLVector3 pos; | 1760 | LLVector3 pos; |
1761 | const bool frontFacesOnly = true; | 1761 | const bool frontFacesOnly = true; |
1762 | 1762 | //m_log.Info("HITTARGET: " + RayTargetObj.ToString() + ", COPYTARGET: " + localID.ToString()); | |
1763 | SceneObjectPart target = GetSceneObjectPart(localID); | 1763 | SceneObjectPart target = GetSceneObjectPart(localID); |
1764 | SceneObjectPart target2 = GetSceneObjectPart(RayTargetObj); | 1764 | SceneObjectPart target2 = GetSceneObjectPart(RayTargetObj); |
1765 | 1765 | ||
@@ -1781,10 +1781,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
1781 | Ray NewRay = new Ray(AXOrigin, AXdirection); | 1781 | Ray NewRay = new Ray(AXOrigin, AXdirection); |
1782 | 1782 | ||
1783 | // Ray Trace against target here | 1783 | // Ray Trace against target here |
1784 | EntityIntersection ei = target.TestIntersectionOBB(NewRay, new Quaternion(1, 0, 0, 0), frontFacesOnly, false); | 1784 | EntityIntersection ei = target2.TestIntersectionOBB(NewRay, new Quaternion(1, 0, 0, 0), frontFacesOnly, CopyCenters); |
1785 | 1785 | ||
1786 | // Un-comment out the following line to Get Raytrace results printed to the console. | 1786 | // Un-comment out the following line to Get Raytrace results printed to the console. |
1787 | // m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); | 1787 | //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei.HitTF.ToString() + " Point: " + ei.ipoint.ToString() + " Normal: " + ei.normal.ToString()); |
1788 | float ScaleOffset = 0.5f; | 1788 | float ScaleOffset = 0.5f; |
1789 | 1789 | ||
1790 | // If we hit something | 1790 | // If we hit something |
@@ -1801,31 +1801,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
1801 | LLVector3 offset = (normal * (ScaleOffset / 2f)); | 1801 | LLVector3 offset = (normal * (ScaleOffset / 2f)); |
1802 | pos = (intersectionpoint + offset); | 1802 | pos = (intersectionpoint + offset); |
1803 | 1803 | ||
1804 | if (CopyCenters) | 1804 | |
1805 | // stick in offset format from the original prim | ||
1806 | pos = pos - target.ParentGroup.AbsolutePosition; | ||
1807 | if (CopyRotates) | ||
1805 | { | 1808 | { |
1806 | // now we cast a ray from inside the prim(absolute position) to one of it's faces along the face normal. | 1809 | LLQuaternion worldRot = target2.GetWorldRotation(); |
1807 | LLVector3 direction2 = LLVector3.Norm(pos - target2.AbsolutePosition); | ||
1808 | Vector3 AXOrigin2 = new Vector3(target2.AbsolutePosition.X, target2.AbsolutePosition.Y, target2.AbsolutePosition.Z); | ||
1809 | Vector3 AXdirection2 = new Vector3(direction2.X, direction2.Y, direction2.Z); //ei.AAfaceNormal; | ||
1810 | Ray NewRay2 = new Ray(AXOrigin2, AXdirection2); | ||
1811 | EntityIntersection ei2 = target.TestIntersectionOBB(NewRay2, new Quaternion(1, 0, 0, 0), false, CopyCenters); | ||
1812 | if (ei2.HitTF) | ||
1813 | { | ||
1814 | //m_log.Info("[RAYTRACERESULTS]: Hit:" + ei2.HitTF.ToString() + " Point: " + ei2.ipoint.ToString() + " Normal: " + ei2.normal.ToString()); | ||
1815 | pos = new LLVector3(ei2.ipoint.x,ei2.ipoint.y,ei2.ipoint.z); | ||
1816 | normal.X = ei2.normal.x; | ||
1817 | normal.Y = ei2.normal.y; | ||
1818 | normal.Z = ei2.normal.z; | ||
1819 | } | ||
1820 | } | ||
1821 | |||
1822 | // Set the position to the intersection point | ||
1823 | offset = (normal * (ScaleOffset / 2f)); | ||
1824 | pos = (intersectionpoint + offset); | ||
1825 | 1810 | ||
1826 | // stick in offset format from the original prim | 1811 | SceneObjectGroup obj = m_innerScene.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID, new Quaternion(worldRot.W,worldRot.X,worldRot.Y,worldRot.Z)); |
1827 | pos = pos - target2.ParentGroup.AbsolutePosition; | 1812 | //obj.Rotation = new Quaternion(worldRot.W, worldRot.X, worldRot.Y, worldRot.Z); |
1828 | m_innerScene.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); | 1813 | //obj.UpdateGroupRotation(worldRot); |
1814 | } | ||
1815 | else | ||
1816 | { | ||
1817 | m_innerScene.DuplicateObject(localID, pos, target.GetEffectiveObjectFlags(), AgentID, GroupID); | ||
1818 | } | ||
1829 | } | 1819 | } |
1830 | 1820 | ||
1831 | return; | 1821 | return; |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 614726e..2515122 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -1352,14 +1352,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
1352 | AmBb = FaceB[i] - FaceC[i]; | 1352 | AmBb = FaceB[i] - FaceC[i]; |
1353 | d = normals[i].Dot(FaceB[i]); | 1353 | d = normals[i].Dot(FaceB[i]); |
1354 | 1354 | ||
1355 | if (faceCenters) | 1355 | //if (faceCenters) |
1356 | { | 1356 | //{ |
1357 | c = normals[i].Dot(normals[i]); | 1357 | // c = normals[i].Dot(normals[i]); |
1358 | } | 1358 | //} |
1359 | else | 1359 | //else |
1360 | { | 1360 | //{ |
1361 | c = iray.Direction.Dot(normals[i]); | 1361 | c = iray.Direction.Dot(normals[i]); |
1362 | } | 1362 | //} |
1363 | if (c == 0) | 1363 | if (c == 0) |
1364 | continue; | 1364 | continue; |
1365 | 1365 | ||
@@ -1375,21 +1375,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
1375 | if (iray.Direction.Dot(normals[i]) < 0 || !frontFacesOnly) | 1375 | if (iray.Direction.Dot(normals[i]) < 0 || !frontFacesOnly) |
1376 | { | 1376 | { |
1377 | 1377 | ||
1378 | if (faceCenters) | 1378 | //if (faceCenters) |
1379 | { //(FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f; | 1379 | //{ //(FaceA[i] + FaceB[i] + FaceC[1] + FaceD[i]) / 4f; |
1380 | q = iray.Origin + a * normals[i]; | 1380 | // q = iray.Origin + a * normals[i]; |
1381 | } | 1381 | //} |
1382 | else | 1382 | //else |
1383 | { | 1383 | //{ |
1384 | q = iray.Origin + a * iray.Direction; | 1384 | q = iray.Origin + a * iray.Direction; |
1385 | } | 1385 | //} |
1386 | 1386 | ||
1387 | float distance2 = (float)GetDistanceTo(q, AXpos); | 1387 | float distance2 = (float)GetDistanceTo(q, AXpos); |
1388 | // Is this the closest hit to the object's origin? | 1388 | // Is this the closest hit to the object's origin? |
1389 | if (faceCenters) | 1389 | //if (faceCenters) |
1390 | { | 1390 | //{ |
1391 | distance2 = (float)GetDistanceTo(q, iray.Origin); | 1391 | // distance2 = (float)GetDistanceTo(q, iray.Origin); |
1392 | } | 1392 | //} |
1393 | 1393 | ||
1394 | 1394 | ||
1395 | if (distance2 < returnresult.distance) | 1395 | if (distance2 < returnresult.distance) |
@@ -1397,10 +1397,28 @@ namespace OpenSim.Region.Environment.Scenes | |||
1397 | returnresult.distance = distance2; | 1397 | returnresult.distance = distance2; |
1398 | returnresult.HitTF = true; | 1398 | returnresult.HitTF = true; |
1399 | returnresult.ipoint = q; | 1399 | returnresult.ipoint = q; |
1400 | m_log.Info("[FACE]:" + i.ToString()); | 1400 | //m_log.Info("[FACE]:" + i.ToString()); |
1401 | m_log.Info("[POINT]: " + q.ToString()); | 1401 | //m_log.Info("[POINT]: " + q.ToString()); |
1402 | m_log.Info("[DIST]: " + distance2.ToString()); | 1402 | //m_log.Info("[DIST]: " + distance2.ToString()); |
1403 | returnresult.normal = normals[i]; | 1403 | if (faceCenters) |
1404 | { | ||
1405 | returnresult.normal = (AXrot * AAfacenormals[i]); | ||
1406 | |||
1407 | Vector3 scaleComponent = AAfacenormals[i]; | ||
1408 | float ScaleOffset = 0.5f; | ||
1409 | if (scaleComponent.x != 0) ScaleOffset = AXscale.x; | ||
1410 | if (scaleComponent.y != 0) ScaleOffset = AXscale.y; | ||
1411 | if (scaleComponent.z != 0) ScaleOffset = AXscale.z; | ||
1412 | ScaleOffset = Math.Abs(ScaleOffset); | ||
1413 | Vector3 offset = (returnresult.normal * ScaleOffset); | ||
1414 | returnresult.ipoint = (AXpos + offset ); | ||
1415 | |||
1416 | ///pos = (intersectionpoint + offset); | ||
1417 | } | ||
1418 | else | ||
1419 | { | ||
1420 | returnresult.normal = normals[i]; | ||
1421 | } | ||
1404 | returnresult.AAfaceNormal = AAfacenormals[i]; | 1422 | returnresult.AAfaceNormal = AAfacenormals[i]; |
1405 | 1423 | ||
1406 | } | 1424 | } |