diff options
author | UbitUmarov | 2019-01-21 06:05:21 +0000 |
---|---|---|
committer | UbitUmarov | 2019-01-21 06:05:21 +0000 |
commit | 33a062612f9fafcb7b4c0e8ac60937c448ce3c10 (patch) | |
tree | e6d716b001e94e1d9274e0adc4e8513d2aa48148 /OpenSim/Region/Framework | |
parent | this looks more like ubode (diff) | |
download | opensim-SC-33a062612f9fafcb7b4c0e8ac60937c448ce3c10.zip opensim-SC-33a062612f9fafcb7b4c0e8ac60937c448ce3c10.tar.gz opensim-SC-33a062612f9fafcb7b4c0e8ac60937c448ce3c10.tar.bz2 opensim-SC-33a062612f9fafcb7b4c0e8ac60937c448ce3c10.tar.xz |
remove terraindata abstraction layer, since we only have heightmap type
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 89 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/TerrainChannel.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/TerrainCompressor.cs | 5 |
3 files changed, 47 insertions, 61 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 13b3ffb..abda29a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -410,8 +410,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
410 | m_particleSystem = Utils.EmptyBytes; | 410 | m_particleSystem = Utils.EmptyBytes; |
411 | Rezzed = DateTime.UtcNow; | 411 | Rezzed = DateTime.UtcNow; |
412 | Description = String.Empty; | 412 | Description = String.Empty; |
413 | DynAttrs = new DAMap(); | 413 | |
414 | |||
415 | // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, | 414 | // Prims currently only contain a single folder (Contents). From looking at the Second Life protocol, |
416 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from | 415 | // this appears to have the same UUID (!) as the prim. If this isn't the case, one can't drag items from |
417 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log | 416 | // the prim into an agent inventory (Linden client reports that the "Object not found for drop" in its log |
@@ -3475,7 +3474,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
3475 | private const float ANGVELOCITY_TOLERANCE = 0.005f; | 3474 | private const float ANGVELOCITY_TOLERANCE = 0.005f; |
3476 | private const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary | 3475 | private const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
3477 | private const double TIME_MS_TOLERANCE = 200.0; //llSetPos has a 200ms delay. This should NOT be 3 seconds. | 3476 | private const double TIME_MS_TOLERANCE = 200.0; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
3478 | 3477 | ||
3478 | private Vector3 ClampVectorForTerseUpdate(Vector3 v, float max) | ||
3479 | { | ||
3480 | float a, b; | ||
3481 | |||
3482 | a = Math.Abs(v.X); | ||
3483 | b = Math.Abs(v.Y); | ||
3484 | if (b > a) | ||
3485 | a = b; | ||
3486 | b = Math.Abs(v.Z); | ||
3487 | if (b > a) | ||
3488 | a = b; | ||
3489 | |||
3490 | if (a > max) | ||
3491 | { | ||
3492 | a = max / a; | ||
3493 | v.X *= a; | ||
3494 | v.Y *= a; | ||
3495 | v.Z *= a; | ||
3496 | } | ||
3497 | return v; | ||
3498 | } | ||
3499 | |||
3479 | /// <summary> | 3500 | /// <summary> |
3480 | /// Tell all the prims which have had updates scheduled | 3501 | /// Tell all the prims which have had updates scheduled |
3481 | /// </summary> | 3502 | /// </summary> |
@@ -3491,73 +3512,43 @@ namespace OpenSim.Region.Framework.Scenes | |||
3491 | 3512 | ||
3492 | if(current == PrimUpdateFlags.TerseUpdate) | 3513 | if(current == PrimUpdateFlags.TerseUpdate) |
3493 | { | 3514 | { |
3494 | Vector3 curvel = Velocity; | ||
3495 | Vector3 curacc = Acceleration; | ||
3496 | Vector3 angvel = AngularVelocity; | ||
3497 | |||
3498 | while(true) // just to avoid ugly goto | 3515 | while(true) // just to avoid ugly goto |
3499 | { | 3516 | { |
3500 | double elapsed = now - m_lastUpdateSentTime; | 3517 | double elapsed = now - m_lastUpdateSentTime; |
3501 | if (elapsed > TIME_MS_TOLERANCE) | 3518 | if (elapsed > TIME_MS_TOLERANCE) |
3502 | break; | 3519 | break; |
3503 | 3520 | ||
3504 | if( Math.Abs(curacc.X - m_lastAcceleration.X) > VELOCITY_TOLERANCE || | 3521 | if ( !Acceleration.ApproxEquals(m_lastAcceleration, VELOCITY_TOLERANCE)) |
3505 | Math.Abs(curacc.Y - m_lastAcceleration.Y) > VELOCITY_TOLERANCE || | ||
3506 | Math.Abs(curacc.Z - m_lastAcceleration.Z) > VELOCITY_TOLERANCE) | ||
3507 | break; | 3522 | break; |
3508 | 3523 | ||
3509 | if( Math.Abs(curvel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE || | 3524 | Vector3 curvel = ClampVectorForTerseUpdate(Velocity, 128f); |
3510 | Math.Abs(curvel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE || | 3525 | Vector3 tmp = ClampVectorForTerseUpdate(m_lastVelocity, 128f); |
3511 | Math.Abs(curvel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE) | 3526 | if (!curvel.ApproxEquals(tmp, VELOCITY_TOLERANCE)) |
3512 | break; | 3527 | break; |
3513 | 3528 | ||
3514 | float vx = Math.Abs(curvel.X); | 3529 | if (Math.Abs(curvel.X) < 1e-4 && Math.Abs(curvel.Y) < 1e-4 && Math.Abs(curvel.Z) < 1e-4) |
3515 | if(vx > 128.0) | ||
3516 | break; | ||
3517 | float vy = Math.Abs(curvel.Y); | ||
3518 | if(vy > 128.0) | ||
3519 | break; | ||
3520 | float vz = Math.Abs(curvel.Z); | ||
3521 | if(vz > 128.0) | ||
3522 | break; | ||
3523 | |||
3524 | if(vx < VELOCITY_TOLERANCE && vy < VELOCITY_TOLERANCE && vz < VELOCITY_TOLERANCE | ||
3525 | ) | ||
3526 | { | 3530 | { |
3527 | if(!AbsolutePosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) | 3531 | if (!AbsolutePosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE)) |
3528 | break; | 3532 | break; |
3529 | if(vx < 1e-4 && vy < 1e-4 && vz < 1e-4 && | 3533 | if ( Math.Abs(m_lastVelocity.X) > 1e-4 || |
3530 | ( | ||
3531 | Math.Abs(m_lastVelocity.X) > 1e-4 || | ||
3532 | Math.Abs(m_lastVelocity.Y) > 1e-4 || | 3534 | Math.Abs(m_lastVelocity.Y) > 1e-4 || |
3533 | Math.Abs(m_lastVelocity.Z) > 1e-4 | 3535 | Math.Abs(m_lastVelocity.Z) > 1e-4 |
3534 | )) | 3536 | ) |
3535 | break; | ||
3536 | } | ||
3537 | |||
3538 | if( Math.Abs(angvel.X - m_lastAngularVelocity.X) > ANGVELOCITY_TOLERANCE || | ||
3539 | Math.Abs(angvel.Y - m_lastAngularVelocity.Y) > ANGVELOCITY_TOLERANCE || | ||
3540 | Math.Abs(angvel.Z - m_lastAngularVelocity.Z) > ANGVELOCITY_TOLERANCE) | ||
3541 | break; | 3537 | break; |
3538 | } | ||
3542 | 3539 | ||
3543 | // viewer interpolators have a limit of 64rad/s | 3540 | Vector3 angvel = ClampVectorForTerseUpdate(AngularVelocity, 64f); |
3544 | float ax = Math.Abs(angvel.X); | 3541 | tmp = ClampVectorForTerseUpdate(m_lastAngularVelocity, 64f); |
3545 | if(ax > 64.0) | 3542 | if (!angvel.ApproxEquals(tmp, ANGVELOCITY_TOLERANCE)) |
3546 | break; | ||
3547 | float ay = Math.Abs(angvel.Y); | ||
3548 | if(ay > 64.0) | ||
3549 | break; | ||
3550 | float az = Math.Abs(angvel.Z); | ||
3551 | if(az > 64.0) | ||
3552 | break; | 3543 | break; |
3553 | 3544 | ||
3554 | if ( | 3545 | if ( Math.Abs(AngularVelocity.X) < 1e-4 && |
3555 | ax < ANGVELOCITY_TOLERANCE && | 3546 | Math.Abs(AngularVelocity.Y) < 1e-4 && |
3556 | ay < ANGVELOCITY_TOLERANCE && | 3547 | Math.Abs(AngularVelocity.Z) < 1e-4 && |
3557 | az < ANGVELOCITY_TOLERANCE && | ||
3558 | !RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) | 3548 | !RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) |
3559 | ) | 3549 | ) |
3560 | break; | 3550 | break; |
3551 | |||
3561 | return; | 3552 | return; |
3562 | } | 3553 | } |
3563 | } | 3554 | } |
diff --git a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs index 92fd314..96d2dc4 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainChannel.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainChannel.cs | |||
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
61 | // Default, not-often-used builder | 61 | // Default, not-often-used builder |
62 | public TerrainChannel() | 62 | public TerrainChannel() |
63 | { | 63 | { |
64 | m_terrainData = new HeightmapTerrainData((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); | 64 | m_terrainData = new TerrainData((int)Constants.RegionSize, (int)Constants.RegionSize, (int)Constants.RegionHeight); |
65 | FlatLand(); | 65 | FlatLand(); |
66 | // PinHeadIsland(); | 66 | // PinHeadIsland(); |
67 | } | 67 | } |
@@ -69,14 +69,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
69 | // Create terrain of given size | 69 | // Create terrain of given size |
70 | public TerrainChannel(int pX, int pY) | 70 | public TerrainChannel(int pX, int pY) |
71 | { | 71 | { |
72 | m_terrainData = new HeightmapTerrainData(pX, pY, (int)Constants.RegionHeight); | 72 | m_terrainData = new TerrainData(pX, pY, (int)Constants.RegionHeight); |
73 | } | 73 | } |
74 | 74 | ||
75 | // Create terrain of specified size and initialize with specified terrain. | 75 | // Create terrain of specified size and initialize with specified terrain. |
76 | // TODO: join this with the terrain initializers. | 76 | // TODO: join this with the terrain initializers. |
77 | public TerrainChannel(String type, int pX, int pY, int pZ) | 77 | public TerrainChannel(String type, int pX, int pY, int pZ) |
78 | { | 78 | { |
79 | m_terrainData = new HeightmapTerrainData(pX, pY, pZ); | 79 | m_terrainData = new TerrainData(pX, pY, pZ); |
80 | if (type.Equals("flat")) | 80 | if (type.Equals("flat")) |
81 | FlatLand(); | 81 | FlatLand(); |
82 | else | 82 | else |
@@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
90 | int hmSizeX = pM.GetLength(0); | 90 | int hmSizeX = pM.GetLength(0); |
91 | int hmSizeY = pM.GetLength(1); | 91 | int hmSizeY = pM.GetLength(1); |
92 | 92 | ||
93 | m_terrainData = new HeightmapTerrainData(pSizeX, pSizeY, pAltitude); | 93 | m_terrainData = new TerrainData(pSizeX, pSizeY, pAltitude); |
94 | 94 | ||
95 | for (int xx = 0; xx < pSizeX; xx++) | 95 | for (int xx = 0; xx < pSizeX; xx++) |
96 | for (int yy = 0; yy < pSizeY; yy++) | 96 | for (int yy = 0; yy < pSizeY; yy++) |
@@ -309,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
309 | int tmpY = baseY + baseY / 2; | 309 | int tmpY = baseY + baseY / 2; |
310 | int centreX = tmpX / 2; | 310 | int centreX = tmpX / 2; |
311 | int centreY = tmpY / 2; | 311 | int centreY = tmpY / 2; |
312 | TerrainData terrain_tmp = new HeightmapTerrainData(tmpX, tmpY, (int)Constants.RegionHeight); | 312 | TerrainData terrain_tmp = new TerrainData(tmpX, tmpY, (int)Constants.RegionHeight); |
313 | for (int xx = 0; xx < tmpX; xx++) | 313 | for (int xx = 0; xx < tmpX; xx++) |
314 | for (int yy = 0; yy < tmpY; yy++) | 314 | for (int yy = 0; yy < tmpY; yy++) |
315 | terrain_tmp[xx, yy] = -65535f; //use this height like an 'alpha' mask channel | 315 | terrain_tmp[xx, yy] = -65535f; //use this height like an 'alpha' mask channel |
@@ -483,7 +483,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
483 | byte[] dataArray = (byte[])serializer.Deserialize(xmlReader); | 483 | byte[] dataArray = (byte[])serializer.Deserialize(xmlReader); |
484 | int index = 0; | 484 | int index = 0; |
485 | 485 | ||
486 | m_terrainData = new HeightmapTerrainData(Height, Width, (int)Constants.RegionHeight); | 486 | m_terrainData = new TerrainData(Height, Width, (int)Constants.RegionHeight); |
487 | 487 | ||
488 | for (int y = 0; y < Height; y++) | 488 | for (int y = 0; y < Height; y++) |
489 | { | 489 | { |
@@ -530,7 +530,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
530 | { | 530 | { |
531 | XmlSerializer serializer = new XmlSerializer(typeof(TerrainChannelXMLPackage)); | 531 | XmlSerializer serializer = new XmlSerializer(typeof(TerrainChannelXMLPackage)); |
532 | TerrainChannelXMLPackage package = (TerrainChannelXMLPackage)serializer.Deserialize(xmlReader); | 532 | TerrainChannelXMLPackage package = (TerrainChannelXMLPackage)serializer.Deserialize(xmlReader); |
533 | m_terrainData = new HeightmapTerrainData(package.Map, package.CompressionFactor, package.SizeX, package.SizeY, package.SizeZ); | 533 | m_terrainData = new TerrainData(package.Map, package.CompressionFactor, package.SizeX, package.SizeY, package.SizeZ); |
534 | } | 534 | } |
535 | 535 | ||
536 | // Fill the heightmap with the center bump terrain | 536 | // Fill the heightmap with the center bump terrain |
diff --git a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs index 2070463..fa17102 100644 --- a/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs +++ b/OpenSim/Region/Framework/Scenes/TerrainCompressor.cs | |||
@@ -155,7 +155,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
155 | return iout; | 155 | return iout; |
156 | } | 156 | } |
157 | 157 | ||
158 | static double tt; | ||
159 | // new using terrain data and patchs indexes | 158 | // new using terrain data and patchs indexes |
160 | public static List<LayerDataPacket> CreateLayerDataPackets(TerrainData terrData, int[] map) | 159 | public static List<LayerDataPacket> CreateLayerDataPackets(TerrainData terrData, int[] map) |
161 | { | 160 | { |
@@ -180,15 +179,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
180 | bitpack.PackBitsFromByte(16); | 179 | bitpack.PackBitsFromByte(16); |
181 | bitpack.PackBitsFromByte(landPacketType); | 180 | bitpack.PackBitsFromByte(landPacketType); |
182 | 181 | ||
183 | tt = 0; | ||
184 | |||
185 | int s; | 182 | int s; |
186 | for (int i = 0; i < numberPatchs; i++) | 183 | for (int i = 0; i < numberPatchs; i++) |
187 | { | 184 | { |
188 | s = 2 * i; | 185 | s = 2 * i; |
189 | tt -= Util.GetTimeStampMS(); | ||
190 | CreatePatchFromTerrainData(bitpack, terrData, map[s], map[s + 1]); | 186 | CreatePatchFromTerrainData(bitpack, terrData, map[s], map[s + 1]); |
191 | tt += Util.GetTimeStampMS(); | ||
192 | 187 | ||
193 | if (bitpack.BytePos > 980 && i != numberPatchs - 1) | 188 | if (bitpack.BytePos > 980 && i != numberPatchs - 1) |
194 | { | 189 | { |