aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs114
1 files changed, 70 insertions, 44 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 015ba12..999de9c 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1089,50 +1089,7 @@ namespace OpenSim.Region.Environment.Scenes
1089 if (target != null) 1089 if (target != null)
1090 { 1090 {
1091 pos = target.AbsolutePosition; 1091 pos = target.AbsolutePosition;
1092 1092 // TODO: Raytrace here
1093 //m_log.Info("[RAYTRACE]: " + pos.ToString());
1094 //EntityIntersection rayTracing = null;
1095 //ScenePresence presence = ((ScenePresence)GetScenePresence(ownerID));
1096 //if (presence != null)
1097 //{
1098 //Vector3 CameraPosition = presence.CameraPosition;
1099 //Vector3 rayEnd = new Vector3(pos.X, pos.Y, pos.Z);
1100
1101 //float rayMag = m_innerScene.Vector3Distance(CameraPosition, rayEnd);
1102 //LLVector3 rayDirectionLL = Util.GetNormal(pos);
1103
1104 //Vector3 rayDirection = new Vector3(rayDirectionLL.X, rayDirectionLL.Y, rayDirectionLL.Z);
1105
1106 //Ray rezRay = new Ray(CameraPosition, rayDirection);
1107
1108 //Vector3 RezDirectionFromCamera = rezRay.Direction;
1109
1110 //rayTracing = m_innerScene.GetClosestIntersectingPrim(rezRay);
1111 //}
1112
1113 //if ((rayTracing != null) && (rayTracing.HitTF))
1114 //{
1115 // We raytraced and found a prim in the way of the ground.. so
1116 // We will rez the object somewhere close to the prim. Better math needed. This is a Stub
1117 //Vector3 Newpos = new Vector3(rayTracing.obj.AbsolutePosition.X,rayTracing.obj.AbsolutePosition.Y,rayTracing.obj.AbsolutePosition.Z);
1118 //Vector3 Newpos = rayTracing.ipoint;
1119 //Vector3 NewScale =
1120 //new Vector3(rayTracing.obj.Scale.X, rayTracing.obj.Scale.Y, rayTracing.obj.Scale.Z);
1121
1122 //Quaternion ParentRot = rayTracing.obj.ParentGroup.Rotation;
1123 //Quaternion ParentRot = new Quaternion(primParentRot.W,primParentRot.X,primParentRot.Y,primParentRot.Z);
1124
1125 //LLQuaternion primLocalRot = rayTracing.obj.RotationOffset;
1126 //Quaternion LocalRot = new Quaternion(primLocalRot.W, primLocalRot.X, primLocalRot.Y, primLocalRot.Z);
1127
1128 //Quaternion NewRot = LocalRot * ParentRot;
1129
1130 //Vector3 RezPoint = Newpos;
1131
1132 //m_log.Info("[REZINFO]: Possible Rez Point:" + RezPoint.ToString());
1133 //pos = new LLVector3(RezPoint.x, RezPoint.y, RezPoint.z);
1134 //}
1135
1136 return pos; 1093 return pos;
1137 } 1094 }
1138 else 1095 else
@@ -1253,6 +1210,73 @@ namespace OpenSim.Region.Environment.Scenes
1253 m_sceneXmlLoader.SavePrimsToXml2(fileName); 1210 m_sceneXmlLoader.SavePrimsToXml2(fileName);
1254 } 1211 }
1255 1212
1213 public void CrossPrimGroupIntoNewRegion(LLVector3 position, SceneObjectGroup grp)
1214 {
1215 m_log.Warn("Prim crossing: " + grp.UUID.ToString());
1216 int thisx = (int)RegionInfo.RegionLocX;
1217 int thisy = (int)RegionInfo.RegionLocY;
1218 ulong newRegionHandle = 0;
1219 LLVector3 pos = grp.AbsolutePosition;
1220
1221 if (position.X > 255.6f)
1222 {
1223 pos.X = ((pos.X - 256) + 10);
1224
1225 newRegionHandle = Util.UIntsToLong((uint)((thisx + 1) * 256), (uint)(thisy * 256));
1226
1227 // x + 1
1228 }
1229 else if (position.X < 0.4f)
1230 {
1231 pos.X = ((pos.X + 256) - 10);
1232 newRegionHandle = Util.UIntsToLong((uint)((thisx - 1) * 256), (uint)(thisy * 256));
1233 // x - 1
1234 }
1235
1236 if (position.Y > 255.6f)
1237 {
1238 pos.Y = ((pos.Y - 256) + 10);
1239 newRegionHandle = Util.UIntsToLong((uint)(thisx * 256), (uint)((thisy + 1) * 256));
1240 // y + 1
1241 }
1242 else if (position.Y < 0.4f)
1243 {
1244 pos.Y = ((pos.Y + 256) - 10);
1245 newRegionHandle = Util.UIntsToLong((uint)(thisx * 256), (uint)((thisy - 1) * 256));
1246 // y - 1
1247 }
1248
1249 // Offset the positions for the new region across the border
1250 grp.OffsetForNewRegion(pos);
1251
1252 if (newRegionHandle != 0)
1253 {
1254 bool successYN = false;
1255 successYN = m_sceneGridService.PrimCrossToNeighboringRegion(newRegionHandle, grp.UUID, m_sceneXmlLoader.SavePrimGroupToXML2String(grp));
1256 if (successYN)
1257 {
1258 // We remove the object here
1259 try
1260 {
1261 DeleteSceneObjectGroup(grp);
1262 }
1263 catch (System.Exception)
1264 {
1265 m_log.Warn("[DATABASE]: exception when trying to remove the prim that crossed the border.");
1266 }
1267 }
1268 else
1269 {
1270 m_log.Warn("[INTERREGION]: Prim Crossing Failed!");
1271 }
1272 }
1273 }
1274 public void IncomingInterRegionPrimGroup(ulong regionHandle, LLUUID primID, string objXMLData)
1275 {
1276 m_log.Warn("{[INTERREGION]: OMG! A new prim arrived from a neighbor!.. Kyill eeehht! before it corrupts my entire database! AHHH! I feel so dirty now! yuck! ack! arg!");
1277 m_sceneXmlLoader.LoadGroupFromXml2String(objXMLData);
1278
1279 }
1256 #endregion 1280 #endregion
1257 1281
1258 #region Add/Remove Avatar Methods 1282 #region Add/Remove Avatar Methods
@@ -1527,6 +1551,7 @@ namespace OpenSim.Region.Environment.Scenes
1527 m_sceneGridService.OnCloseAgentConnection += CloseConnection; 1551 m_sceneGridService.OnCloseAgentConnection += CloseConnection;
1528 m_sceneGridService.OnRegionUp += OtherRegionUp; 1552 m_sceneGridService.OnRegionUp += OtherRegionUp;
1529 m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate; 1553 m_sceneGridService.OnChildAgentUpdate += IncomingChildAgentDataUpdate;
1554 m_sceneGridService.OnExpectPrim += IncomingInterRegionPrimGroup;
1530 1555
1531 1556
1532 1557
@@ -1540,6 +1565,7 @@ namespace OpenSim.Region.Environment.Scenes
1540 /// </summary> 1565 /// </summary>
1541 public void UnRegisterReginWithComms() 1566 public void UnRegisterReginWithComms()
1542 { 1567 {
1568 m_sceneGridService.OnExpectPrim -= IncomingInterRegionPrimGroup;
1543 m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate; 1569 m_sceneGridService.OnChildAgentUpdate -= IncomingChildAgentDataUpdate;
1544 m_sceneGridService.OnRegionUp -= OtherRegionUp; 1570 m_sceneGridService.OnRegionUp -= OtherRegionUp;
1545 m_sceneGridService.OnExpectUser -= NewUserConnection; 1571 m_sceneGridService.OnExpectUser -= NewUserConnection;