aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs6
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs101
4 files changed, 59 insertions, 52 deletions
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 139f898..5c46344 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -167,7 +167,7 @@ namespace OpenSim.Region.Physics.Manager
167 return false; 167 return false;
168 } 168 }
169 169
170 public virtual void Combine(PhysicsScene pScene, Vector3 offset) 170 public virtual void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents)
171 { 171 {
172 return; 172 return;
173 } 173 }
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 759692f..35433c6 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -161,7 +161,7 @@ namespace OpenSim.Region.Physics.OdePlugin
161 } 161 }
162 else 162 else
163 { 163 {
164 _position = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), parent_scene.GetTerrainHeightAtXY(128, 128) + 10); 164 _position = new PhysicsVector(((int)_parent_scene.WorldExtents.X * 0.5f), ((int)_parent_scene.WorldExtents.Y * 0.5f), parent_scene.GetTerrainHeightAtXY(128, 128) + 10);
165 m_taintPosition.X = _position.X; 165 m_taintPosition.X = _position.X;
166 m_taintPosition.Y = _position.Y; 166 m_taintPosition.Y = _position.Y;
167 m_taintPosition.Z = _position.Z; 167 m_taintPosition.Z = _position.Z;
@@ -1096,8 +1096,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1096 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) 1096 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
1097 if (vec.X < 0.0f) vec.X = 0.0f; 1097 if (vec.X < 0.0f) vec.X = 0.0f;
1098 if (vec.Y < 0.0f) vec.Y = 0.0f; 1098 if (vec.Y < 0.0f) vec.Y = 0.0f;
1099 if (vec.X > (int)Constants.RegionSize - 0.05f) vec.X = (int)Constants.RegionSize - 0.05f; 1099 if (vec.X > (int)_parent_scene.WorldExtents.X - 0.05f) vec.X = (int)_parent_scene.WorldExtents.X - 0.05f;
1100 if (vec.Y > (int)Constants.RegionSize - 0.05f) vec.Y = (int)Constants.RegionSize - 0.05f; 1100 if (vec.Y > (int)_parent_scene.WorldExtents.Y - 0.05f) vec.Y = (int)_parent_scene.WorldExtents.Y - 0.05f;
1101 1101
1102 _position.X = vec.X; 1102 _position.X = vec.X;
1103 _position.Y = vec.Y; 1103 _position.Y = vec.Y;
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 443788c..d0f77e6 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -2538,7 +2538,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2538 l_orientation.Z = ori.Z; 2538 l_orientation.Z = ori.Z;
2539 l_orientation.W = ori.W; 2539 l_orientation.W = ori.W;
2540 2540
2541 if (l_position.X > ((int)Constants.RegionSize - 0.05f) || l_position.X < 0f || l_position.Y > ((int)Constants.RegionSize - 0.05f) || l_position.Y < 0f) 2541 if (l_position.X > ((int)_parent_scene.WorldExtents.X - 0.05f) || l_position.X < 0f || l_position.Y > ((int)_parent_scene.WorldExtents.Y - 0.05f) || l_position.Y < 0f)
2542 { 2542 {
2543 //base.RaiseOutOfBounds(l_position); 2543 //base.RaiseOutOfBounds(l_position);
2544 2544
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 00163f6..3d25acd 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -312,7 +312,7 @@ namespace OpenSim.Region.Physics.OdePlugin
312 private volatile int m_global_contactcount = 0; 312 private volatile int m_global_contactcount = 0;
313 313
314 private Vector3 m_worldOffset = Vector3.Zero; 314 private Vector3 m_worldOffset = Vector3.Zero;
315 private Vector2 m_worldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize); 315 public Vector2 WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize);
316 316
317 private ODERayCastRequestManager m_rayCastManager; 317 private ODERayCastRequestManager m_rayCastManager;
318 318
@@ -351,10 +351,10 @@ namespace OpenSim.Region.Physics.OdePlugin
351 } 351 }
352 352
353 // zero out a heightmap array float array (single dimention [flattened])) 353 // zero out a heightmap array float array (single dimention [flattened]))
354 if ((int)Constants.RegionSize == 256) 354 if ((int)WorldExtents.X == 256 && (int)m_worldOffset.Y == 256)
355 _heightmap = new float[514*514]; 355 _heightmap = new float[514*514];
356 else 356 else
357 _heightmap = new float[(((int)Constants.RegionSize + 2) * ((int)Constants.RegionSize + 2))]; 357 _heightmap = new float[(((int)WorldExtents.Y + 2) * ((int)WorldExtents.X + 2))];
358 _watermap = new float[258 * 258]; 358 _watermap = new float[258 * 258];
359 359
360 360
@@ -1564,7 +1564,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1564 } 1564 }
1565 1565
1566 #endregion 1566 #endregion
1567 1567
1568 public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents)
1569 {
1570 m_worldOffset = offset;
1571 WorldExtents = new Vector2(extents.X, extents.Y);
1572 }
1568// Recovered for use by fly height. Kitto Flora 1573// Recovered for use by fly height. Kitto Flora
1569 public float GetTerrainHeightAtXY(float x, float y) 1574 public float GetTerrainHeightAtXY(float x, float y)
1570 { 1575 {
@@ -1576,14 +1581,14 @@ namespace OpenSim.Region.Physics.OdePlugin
1576 // Is there any reason that we don't do this in ScenePresence? 1581 // Is there any reason that we don't do this in ScenePresence?
1577 // The only physics engine that benefits from it in the physics plugin is this one 1582 // The only physics engine that benefits from it in the physics plugin is this one
1578 1583
1579 if ((int)x > Constants.RegionSize || (int)y > Constants.RegionSize || 1584 if ((int)x > WorldExtents.X || (int)y > WorldExtents.Y ||
1580 (int)x < 0.001f || (int)y < 0.001f) 1585 (int)x < 0.001f || (int)y < 0.001f)
1581 return 0; 1586 return 0;
1582 1587
1583 index = (int) ((int)y * Constants.RegionSize + (int)x); 1588 index = (int)((int)y * WorldExtents.Y + (int)x);
1584 1589
1585 if (index < _origheightmap.Length) 1590 if (index < _origheightmap.Length)
1586 return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x]; 1591 return (float)_origheightmap[(int)y * (int)WorldExtents.Y + (int)x];
1587 else 1592 else
1588 return 0; 1593 return 0;
1589 } 1594 }
@@ -3018,14 +3023,14 @@ namespace OpenSim.Region.Physics.OdePlugin
3018 public float[] ResizeTerrain512NearestNeighbour(float[] heightMap) 3023 public float[] ResizeTerrain512NearestNeighbour(float[] heightMap)
3019 { 3024 {
3020 float[] returnarr = new float[262144]; 3025 float[] returnarr = new float[262144];
3021 float[,] resultarr = new float[m_regionWidth, m_regionHeight]; 3026 float[,] resultarr = new float[(int)WorldExtents.X, (int)WorldExtents.Y];
3022 3027
3023 // Filling out the array into it's multi-dimentional components 3028 // Filling out the array into it's multi-dimentional components
3024 for (int y = 0; y < m_regionHeight; y++) 3029 for (int y = 0; y < WorldExtents.Y; y++)
3025 { 3030 {
3026 for (int x = 0; x < m_regionWidth; x++) 3031 for (int x = 0; x < WorldExtents.X; x++)
3027 { 3032 {
3028 resultarr[y, x] = heightMap[y * m_regionWidth + x]; 3033 resultarr[y, x] = heightMap[y * (int)WorldExtents.Y + x];
3029 } 3034 }
3030 } 3035 }
3031 3036
@@ -3089,21 +3094,21 @@ namespace OpenSim.Region.Physics.OdePlugin
3089 // on single loop. 3094 // on single loop.
3090 3095
3091 float[,] resultarr2 = new float[512, 512]; 3096 float[,] resultarr2 = new float[512, 512];
3092 for (int y = 0; y < m_regionHeight; y++) 3097 for (int y = 0; y < WorldExtents.Y; y++)
3093 { 3098 {
3094 for (int x = 0; x < m_regionWidth; x++) 3099 for (int x = 0; x < WorldExtents.X; x++)
3095 { 3100 {
3096 resultarr2[y * 2, x * 2] = resultarr[y, x]; 3101 resultarr2[y * 2, x * 2] = resultarr[y, x];
3097 3102
3098 if (y < m_regionHeight) 3103 if (y < WorldExtents.Y)
3099 { 3104 {
3100 resultarr2[(y * 2) + 1, x * 2] = resultarr[y, x]; 3105 resultarr2[(y * 2) + 1, x * 2] = resultarr[y, x];
3101 } 3106 }
3102 if (x < m_regionWidth) 3107 if (x < WorldExtents.X)
3103 { 3108 {
3104 resultarr2[y * 2, (x * 2) + 1] = resultarr[y, x]; 3109 resultarr2[y * 2, (x * 2) + 1] = resultarr[y, x];
3105 } 3110 }
3106 if (x < m_regionWidth && y < m_regionHeight) 3111 if (x < WorldExtents.X && y < WorldExtents.Y)
3107 { 3112 {
3108 resultarr2[(y * 2) + 1, (x * 2) + 1] = resultarr[y, x]; 3113 resultarr2[(y * 2) + 1, (x * 2) + 1] = resultarr[y, x];
3109 } 3114 }
@@ -3131,14 +3136,14 @@ namespace OpenSim.Region.Physics.OdePlugin
3131 public float[] ResizeTerrain512Interpolation(float[] heightMap) 3136 public float[] ResizeTerrain512Interpolation(float[] heightMap)
3132 { 3137 {
3133 float[] returnarr = new float[262144]; 3138 float[] returnarr = new float[262144];
3134 float[,] resultarr = new float[m_regionWidth,m_regionHeight]; 3139 float[,] resultarr = new float[(int)WorldExtents.X,(int)WorldExtents.Y];
3135 3140
3136 // Filling out the array into it's multi-dimentional components 3141 // Filling out the array into it's multi-dimentional components
3137 for (int y = 0; y < m_regionHeight; y++) 3142 for (int y = 0; y < WorldExtents.Y; y++)
3138 { 3143 {
3139 for (int x = 0; x < m_regionWidth; x++) 3144 for (int x = 0; x < WorldExtents.X; x++)
3140 { 3145 {
3141 resultarr[y, x] = heightMap[y*m_regionWidth + x]; 3146 resultarr[y, x] = heightMap[y*(int)WorldExtents.Y + x];
3142 } 3147 }
3143 } 3148 }
3144 3149
@@ -3202,17 +3207,17 @@ namespace OpenSim.Region.Physics.OdePlugin
3202 // on single loop. 3207 // on single loop.
3203 3208
3204 float[,] resultarr2 = new float[512,512]; 3209 float[,] resultarr2 = new float[512,512];
3205 for (int y = 0; y < m_regionHeight; y++) 3210 for (int y = 0; y < WorldExtents.Y; y++)
3206 { 3211 {
3207 for (int x = 0; x < m_regionWidth; x++) 3212 for (int x = 0; x < WorldExtents.X; x++)
3208 { 3213 {
3209 resultarr2[y*2, x*2] = resultarr[y, x]; 3214 resultarr2[y*2, x*2] = resultarr[y, x];
3210 3215
3211 if (y < m_regionHeight) 3216 if (y < WorldExtents.Y)
3212 { 3217 {
3213 if (y + 1 < m_regionHeight) 3218 if (y + 1 < WorldExtents.Y)
3214 { 3219 {
3215 if (x + 1 < m_regionWidth) 3220 if (x + 1 < WorldExtents.X)
3216 { 3221 {
3217 resultarr2[(y*2) + 1, x*2] = ((resultarr[y, x] + resultarr[y + 1, x] + 3222 resultarr2[(y*2) + 1, x*2] = ((resultarr[y, x] + resultarr[y + 1, x] +
3218 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4); 3223 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4);
@@ -3227,11 +3232,11 @@ namespace OpenSim.Region.Physics.OdePlugin
3227 resultarr2[(y*2) + 1, x*2] = resultarr[y, x]; 3232 resultarr2[(y*2) + 1, x*2] = resultarr[y, x];
3228 } 3233 }
3229 } 3234 }
3230 if (x < m_regionWidth) 3235 if (x < WorldExtents.X)
3231 { 3236 {
3232 if (x + 1 < m_regionWidth) 3237 if (x + 1 < WorldExtents.X)
3233 { 3238 {
3234 if (y + 1 < m_regionHeight) 3239 if (y + 1 < WorldExtents.Y)
3235 { 3240 {
3236 resultarr2[y*2, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] + 3241 resultarr2[y*2, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] +
3237 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4); 3242 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4);
@@ -3246,9 +3251,9 @@ namespace OpenSim.Region.Physics.OdePlugin
3246 resultarr2[y*2, (x*2) + 1] = resultarr[y, x]; 3251 resultarr2[y*2, (x*2) + 1] = resultarr[y, x];
3247 } 3252 }
3248 } 3253 }
3249 if (x < m_regionWidth && y < m_regionHeight) 3254 if (x < WorldExtents.X && y < WorldExtents.Y)
3250 { 3255 {
3251 if ((x + 1 < m_regionWidth) && (y + 1 < m_regionHeight)) 3256 if ((x + 1 < WorldExtents.X) && (y + 1 < WorldExtents.Y))
3252 { 3257 {
3253 resultarr2[(y*2) + 1, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] + 3258 resultarr2[(y*2) + 1, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] +
3254 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4); 3259 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4);
@@ -3286,24 +3291,26 @@ namespace OpenSim.Region.Physics.OdePlugin
3286 // this._heightmap[i] = (double)heightMap[i]; 3291 // this._heightmap[i] = (double)heightMap[i];
3287 // dbm (danx0r) -- creating a buffer zone of one extra sample all around 3292 // dbm (danx0r) -- creating a buffer zone of one extra sample all around
3288 _origheightmap = heightMap; // Used for Fly height. Kitto Flora 3293 _origheightmap = heightMap; // Used for Fly height. Kitto Flora
3289 uint heightmapWidth = m_regionWidth + 1; 3294 uint heightmapWidth = (uint)WorldExtents.X + 1;
3290 uint heightmapHeight = m_regionHeight + 1; 3295 uint heightmapHeight = (uint)WorldExtents.Y + 1;
3291 3296
3292 uint heightmapWidthSamples; 3297 uint heightmapWidthSamples;
3293 3298
3294 uint heightmapHeightSamples; 3299 uint heightmapHeightSamples;
3295 if (((int)Constants.RegionSize) == 256) 3300 /*
3301 if (((int)m_worldExtents.X) == 256 && (int)m_worldExtents.Y == 256)
3296 { 3302 {
3297 heightmapWidthSamples = 2*m_regionWidth + 2; 3303 heightmapWidthSamples = 2 * (uint)m_worldExtents.X + 2;
3298 heightmapHeightSamples = 2*m_regionHeight + 2; 3304 heightmapHeightSamples = 2*(uint)m_worldExtents.Y + 2;
3299 heightmapWidth++; 3305 heightmapWidth++;
3300 heightmapHeight++; 3306 heightmapHeight++;
3301 } 3307 }
3302 else 3308 else
3303 { 3309 {
3304 heightmapWidthSamples = m_regionWidth + 1; 3310 */
3305 heightmapHeightSamples = m_regionHeight + 1; 3311 heightmapWidthSamples = (uint)WorldExtents.X + 1;
3306 } 3312 heightmapHeightSamples = (uint)WorldExtents.Y + 1;
3313 //}
3307 3314
3308 const float scale = 1.0f; 3315 const float scale = 1.0f;
3309 const float offset = 0.0f; 3316 const float offset = 0.0f;
@@ -3312,12 +3319,12 @@ namespace OpenSim.Region.Physics.OdePlugin
3312 3319
3313 3320
3314 //Double resolution 3321 //Double resolution
3315 if (((int)Constants.RegionSize) == 256) 3322 //if (((int)m_worldExtents.X) == 256 && (int)m_worldExtents.Y == 256)
3316 heightMap = ResizeTerrain512Interpolation(heightMap); 3323 // heightMap = ResizeTerrain512Interpolation(heightMap);
3324
3317 3325
3318 int regionsize = (int)Constants.RegionSize; 3326 //if (((int)m_worldExtents.X) == 256 && (int)m_worldExtents.Y == 256)
3319 if (regionsize == 256) 3327 // regionsize = 512;
3320 regionsize = 512;
3321 3328
3322 float hfmin = 2000; 3329 float hfmin = 2000;
3323 float hfmax = -2000; 3330 float hfmax = -2000;
@@ -3325,10 +3332,10 @@ namespace OpenSim.Region.Physics.OdePlugin
3325 { 3332 {
3326 for (int y = 0; y < heightmapHeightSamples; y++) 3333 for (int y = 0; y < heightmapHeightSamples; y++)
3327 { 3334 {
3328 int xx = Util.Clip(x - 1, 0, regionsize - 1); 3335 int xx = Util.Clip(x - 1, 0, (int)WorldExtents.X - 1);
3329 int yy = Util.Clip(y - 1, 0, regionsize - 1); 3336 int yy = Util.Clip(y - 1, 0, (int)WorldExtents.Y - 1);
3330 3337
3331 float val = heightMap[yy*regionsize + xx]; 3338 float val = heightMap[yy*(int)WorldExtents.Y + xx];
3332 _heightmap[x*heightmapHeightSamples + y] = val; 3339 _heightmap[x*heightmapHeightSamples + y] = val;
3333 hfmin = (val < hfmin) ? val : hfmin; 3340 hfmin = (val < hfmin) ? val : hfmin;
3334 hfmax = (val > hfmax) ? val : hfmax; 3341 hfmax = (val > hfmax) ? val : hfmax;
@@ -3369,7 +3376,7 @@ namespace OpenSim.Region.Physics.OdePlugin
3369 3376
3370 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); 3377 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
3371 d.GeomSetRotation(LandGeom, ref R); 3378 d.GeomSetRotation(LandGeom, ref R);
3372 d.GeomSetPosition(LandGeom, (int)Constants.RegionSize * 0.5f, (int)Constants.RegionSize * 0.5f, 0); 3379 d.GeomSetPosition(LandGeom, (int)WorldExtents.X * 0.5f, (int)WorldExtents.Y * 0.5f, 0);
3373 } 3380 }
3374 } 3381 }
3375 3382