aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs249
1 files changed, 169 insertions, 80 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index b7030f1..817cc22 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -227,13 +227,11 @@ namespace OpenSim.Region.Physics.OdePlugin
227 227
228 public int bodyFramesAutoDisable = 20; 228 public int bodyFramesAutoDisable = 20;
229 229
230 private float[] _heightmap; 230
231 231
232 private float[] _watermap; 232 private float[] _watermap;
233 private bool m_filterCollisions = true; 233 private bool m_filterCollisions = true;
234 234
235 private float[] _origheightmap; // Used for Fly height. Kitto Flora
236
237 private d.NearCallback nearCallback; 235 private d.NearCallback nearCallback;
238 public d.TriCallback triCallback; 236 public d.TriCallback triCallback;
239 public d.TriArrayCallback triArrayCallback; 237 public d.TriArrayCallback triArrayCallback;
@@ -257,6 +255,8 @@ namespace OpenSim.Region.Physics.OdePlugin
257 private Object externalJointRequestsLock = new Object(); 255 private Object externalJointRequestsLock = new Object();
258 private readonly Dictionary<String, PhysicsJoint> SOPName_to_activeJoint = new Dictionary<String, PhysicsJoint>(); 256 private readonly Dictionary<String, PhysicsJoint> SOPName_to_activeJoint = new Dictionary<String, PhysicsJoint>();
259 private readonly Dictionary<String, PhysicsJoint> SOPName_to_pendingJoint = new Dictionary<String, PhysicsJoint>(); 257 private readonly Dictionary<String, PhysicsJoint> SOPName_to_pendingJoint = new Dictionary<String, PhysicsJoint>();
258 private readonly DoubleDictionary<Vector3, IntPtr, IntPtr> RegionTerrain = new DoubleDictionary<Vector3, IntPtr, IntPtr>();
259 private readonly Dictionary<IntPtr,float[]> TerrainHeightFieldHeights = new Dictionary<IntPtr, float[]>();
260 260
261 private d.Contact contact; 261 private d.Contact contact;
262 private d.Contact TerrainContact; 262 private d.Contact TerrainContact;
@@ -311,6 +311,10 @@ namespace OpenSim.Region.Physics.OdePlugin
311 311
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;
315 public Vector2 WorldExtents = new Vector2((int)Constants.RegionSize, (int)Constants.RegionSize);
316 private PhysicsScene m_parentScene = null;
317
314 private ODERayCastRequestManager m_rayCastManager; 318 private ODERayCastRequestManager m_rayCastManager;
315 319
316 /// <summary> 320 /// <summary>
@@ -347,11 +351,7 @@ namespace OpenSim.Region.Physics.OdePlugin
347 #endif 351 #endif
348 } 352 }
349 353
350 // zero out a heightmap array float array (single dimension [flattened])) 354
351 if ((int)Constants.RegionSize == 256)
352 _heightmap = new float[514*514];
353 else
354 _heightmap = new float[(((int)Constants.RegionSize + 2) * ((int)Constants.RegionSize + 2))];
355 _watermap = new float[258 * 258]; 355 _watermap = new float[258 * 258];
356 356
357 // Zero out the prim spaces array (we split our space into smaller spaces so 357 // Zero out the prim spaces array (we split our space into smaller spaces so
@@ -1556,28 +1556,65 @@ namespace OpenSim.Region.Physics.OdePlugin
1556 } 1556 }
1557 1557
1558 #endregion 1558 #endregion
1559 1559
1560 public override void Combine(PhysicsScene pScene, Vector3 offset, Vector3 extents)
1561 {
1562 m_worldOffset = offset;
1563 WorldExtents = new Vector2(extents.X, extents.Y);
1564 m_parentScene = pScene;
1565
1566 }
1560// Recovered for use by fly height. Kitto Flora 1567// Recovered for use by fly height. Kitto Flora
1561 public float GetTerrainHeightAtXY(float x, float y) 1568 public float GetTerrainHeightAtXY(float x, float y)
1562 { 1569 {
1563 1570
1564 int index; 1571 int offsetX = ((int) (x/256)) * 256;
1572 int offsetY = ((int) (y/256)) * 256;
1565 1573
1566 // Teravus: Kitto, this code causes recurring errors that stall physics permenantly unless 1574 IntPtr heightFieldGeom = IntPtr.Zero;
1567 // the values are checked, so checking below.
1568 // Is there any reason that we don't do this in ScenePresence?
1569 // The only physics engine that benefits from it in the physics plugin is this one
1570 1575
1571 if ((int)x > Constants.RegionSize || (int)y > Constants.RegionSize || 1576 if (RegionTerrain.TryGetValue(new Vector3(offsetX,offsetY,0), out heightFieldGeom))
1572 (int)x < 0.001f || (int)y < 0.001f) 1577 {
1573 return 0; 1578 if (heightFieldGeom != IntPtr.Zero)
1579 {
1580 if (TerrainHeightFieldHeights.ContainsKey(heightFieldGeom))
1581 {
1582
1583 int index;
1584
1585
1586 if ((int)x > WorldExtents.X || (int)y > WorldExtents.Y ||
1587 (int)x < 0.001f || (int)y < 0.001f)
1588 return 0;
1574 1589
1575 index = (int) ((int)y * Constants.RegionSize + (int)x); 1590 x = x - offsetX;
1591 y = y - offsetY;
1576 1592
1577 if (index < _origheightmap.Length) 1593 index = (int)((int)y * (int)Constants.RegionSize + (int)x);
1578 return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x]; 1594
1595 if (index < TerrainHeightFieldHeights[heightFieldGeom].Length)
1596 return (float)TerrainHeightFieldHeights[heightFieldGeom][(int)y * (int)Constants.RegionSize + (int)x];
1597 else
1598 return 0f;
1599 }
1600 else
1601 {
1602 return 0f;
1603 }
1604
1605 }
1606 else
1607 {
1608 return 0f;
1609 }
1610
1611 }
1579 else 1612 else
1580 return 0; 1613 {
1614 return 0f;
1615 }
1616
1617
1581 } 1618 }
1582// End recovered. Kitto Flora 1619// End recovered. Kitto Flora
1583 1620
@@ -1646,6 +1683,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1646 private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation, 1683 private PhysicsActor AddPrim(String name, PhysicsVector position, PhysicsVector size, Quaternion rotation,
1647 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical) 1684 IMesh mesh, PrimitiveBaseShape pbs, bool isphysical)
1648 { 1685 {
1686
1649 PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z); 1687 PhysicsVector pos = new PhysicsVector(position.X, position.Y, position.Z);
1650 //pos.X = position.X; 1688 //pos.X = position.X;
1651 //pos.Y = position.Y; 1689 //pos.Y = position.Y;
@@ -2548,6 +2586,9 @@ namespace OpenSim.Region.Physics.OdePlugin
2548 if (framecount >= int.MaxValue) 2586 if (framecount >= int.MaxValue)
2549 framecount = 0; 2587 framecount = 0;
2550 2588
2589 //if (m_worldOffset != Vector3.Zero)
2590 // return 0;
2591
2551 framecount++; 2592 framecount++;
2552 2593
2553 float fps = 0; 2594 float fps = 0;
@@ -3006,14 +3047,14 @@ namespace OpenSim.Region.Physics.OdePlugin
3006 public float[] ResizeTerrain512NearestNeighbour(float[] heightMap) 3047 public float[] ResizeTerrain512NearestNeighbour(float[] heightMap)
3007 { 3048 {
3008 float[] returnarr = new float[262144]; 3049 float[] returnarr = new float[262144];
3009 float[,] resultarr = new float[m_regionWidth, m_regionHeight]; 3050 float[,] resultarr = new float[(int)WorldExtents.X, (int)WorldExtents.Y];
3010 3051
3011 // Filling out the array into its multi-dimensional components 3052 // Filling out the array into its multi-dimensional components
3012 for (int y = 0; y < m_regionHeight; y++) 3053 for (int y = 0; y < WorldExtents.Y; y++)
3013 { 3054 {
3014 for (int x = 0; x < m_regionWidth; x++) 3055 for (int x = 0; x < WorldExtents.X; x++)
3015 { 3056 {
3016 resultarr[y, x] = heightMap[y * m_regionWidth + x]; 3057 resultarr[y, x] = heightMap[y * (int)WorldExtents.Y + x];
3017 } 3058 }
3018 } 3059 }
3019 3060
@@ -3077,21 +3118,21 @@ namespace OpenSim.Region.Physics.OdePlugin
3077 // on single loop. 3118 // on single loop.
3078 3119
3079 float[,] resultarr2 = new float[512, 512]; 3120 float[,] resultarr2 = new float[512, 512];
3080 for (int y = 0; y < m_regionHeight; y++) 3121 for (int y = 0; y < WorldExtents.Y; y++)
3081 { 3122 {
3082 for (int x = 0; x < m_regionWidth; x++) 3123 for (int x = 0; x < WorldExtents.X; x++)
3083 { 3124 {
3084 resultarr2[y * 2, x * 2] = resultarr[y, x]; 3125 resultarr2[y * 2, x * 2] = resultarr[y, x];
3085 3126
3086 if (y < m_regionHeight) 3127 if (y < WorldExtents.Y)
3087 { 3128 {
3088 resultarr2[(y * 2) + 1, x * 2] = resultarr[y, x]; 3129 resultarr2[(y * 2) + 1, x * 2] = resultarr[y, x];
3089 } 3130 }
3090 if (x < m_regionWidth) 3131 if (x < WorldExtents.X)
3091 { 3132 {
3092 resultarr2[y * 2, (x * 2) + 1] = resultarr[y, x]; 3133 resultarr2[y * 2, (x * 2) + 1] = resultarr[y, x];
3093 } 3134 }
3094 if (x < m_regionWidth && y < m_regionHeight) 3135 if (x < WorldExtents.X && y < WorldExtents.Y)
3095 { 3136 {
3096 resultarr2[(y * 2) + 1, (x * 2) + 1] = resultarr[y, x]; 3137 resultarr2[(y * 2) + 1, (x * 2) + 1] = resultarr[y, x];
3097 } 3138 }
@@ -3119,14 +3160,14 @@ namespace OpenSim.Region.Physics.OdePlugin
3119 public float[] ResizeTerrain512Interpolation(float[] heightMap) 3160 public float[] ResizeTerrain512Interpolation(float[] heightMap)
3120 { 3161 {
3121 float[] returnarr = new float[262144]; 3162 float[] returnarr = new float[262144];
3122 float[,] resultarr = new float[m_regionWidth,m_regionHeight]; 3163 float[,] resultarr = new float[512,512];
3123 3164
3124 // Filling out the array into its multi-dimensional components 3165 // Filling out the array into its multi-dimensional components
3125 for (int y = 0; y < m_regionHeight; y++) 3166 for (int y = 0; y < 256; y++)
3126 { 3167 {
3127 for (int x = 0; x < m_regionWidth; x++) 3168 for (int x = 0; x < 256; x++)
3128 { 3169 {
3129 resultarr[y, x] = heightMap[y*m_regionWidth + x]; 3170 resultarr[y, x] = heightMap[y * 256 + x];
3130 } 3171 }
3131 } 3172 }
3132 3173
@@ -3190,17 +3231,17 @@ namespace OpenSim.Region.Physics.OdePlugin
3190 // on single loop. 3231 // on single loop.
3191 3232
3192 float[,] resultarr2 = new float[512,512]; 3233 float[,] resultarr2 = new float[512,512];
3193 for (int y = 0; y < m_regionHeight; y++) 3234 for (int y = 0; y < (int)Constants.RegionSize; y++)
3194 { 3235 {
3195 for (int x = 0; x < m_regionWidth; x++) 3236 for (int x = 0; x < (int)Constants.RegionSize; x++)
3196 { 3237 {
3197 resultarr2[y*2, x*2] = resultarr[y, x]; 3238 resultarr2[y*2, x*2] = resultarr[y, x];
3198 3239
3199 if (y < m_regionHeight) 3240 if (y < (int)Constants.RegionSize)
3200 { 3241 {
3201 if (y + 1 < m_regionHeight) 3242 if (y + 1 < (int)Constants.RegionSize)
3202 { 3243 {
3203 if (x + 1 < m_regionWidth) 3244 if (x + 1 < (int)Constants.RegionSize)
3204 { 3245 {
3205 resultarr2[(y*2) + 1, x*2] = ((resultarr[y, x] + resultarr[y + 1, x] + 3246 resultarr2[(y*2) + 1, x*2] = ((resultarr[y, x] + resultarr[y + 1, x] +
3206 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4); 3247 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4);
@@ -3215,11 +3256,11 @@ namespace OpenSim.Region.Physics.OdePlugin
3215 resultarr2[(y*2) + 1, x*2] = resultarr[y, x]; 3256 resultarr2[(y*2) + 1, x*2] = resultarr[y, x];
3216 } 3257 }
3217 } 3258 }
3218 if (x < m_regionWidth) 3259 if (x < (int)Constants.RegionSize)
3219 { 3260 {
3220 if (x + 1 < m_regionWidth) 3261 if (x + 1 < (int)Constants.RegionSize)
3221 { 3262 {
3222 if (y + 1 < m_regionHeight) 3263 if (y + 1 < (int)Constants.RegionSize)
3223 { 3264 {
3224 resultarr2[y*2, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] + 3265 resultarr2[y*2, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] +
3225 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4); 3266 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4);
@@ -3234,9 +3275,9 @@ namespace OpenSim.Region.Physics.OdePlugin
3234 resultarr2[y*2, (x*2) + 1] = resultarr[y, x]; 3275 resultarr2[y*2, (x*2) + 1] = resultarr[y, x];
3235 } 3276 }
3236 } 3277 }
3237 if (x < m_regionWidth && y < m_regionHeight) 3278 if (x < (int)Constants.RegionSize && y < (int)Constants.RegionSize)
3238 { 3279 {
3239 if ((x + 1 < m_regionWidth) && (y + 1 < m_regionHeight)) 3280 if ((x + 1 < (int)Constants.RegionSize) && (y + 1 < (int)Constants.RegionSize))
3240 { 3281 {
3241 resultarr2[(y*2) + 1, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] + 3282 resultarr2[(y*2) + 1, (x*2) + 1] = ((resultarr[y, x] + resultarr[y + 1, x] +
3242 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4); 3283 resultarr[y, x + 1] + resultarr[y + 1, x + 1])/4);
@@ -3271,41 +3312,68 @@ namespace OpenSim.Region.Physics.OdePlugin
3271 3312
3272 public override void SetTerrain(float[] heightMap) 3313 public override void SetTerrain(float[] heightMap)
3273 { 3314 {
3274 // this._heightmap[i] = (double)heightMap[i]; 3315 if (m_worldOffset != Vector3.Zero && m_parentScene != null)
3275 // dbm (danx0r) -- creating a buffer zone of one extra sample all around
3276 _origheightmap = heightMap; // Used for Fly height. Kitto Flora
3277 uint heightmapWidth = m_regionWidth + 1;
3278 uint heightmapHeight = m_regionHeight + 1;
3279
3280 uint heightmapWidthSamples;
3281
3282 uint heightmapHeightSamples;
3283 if (((int)Constants.RegionSize) == 256)
3284 { 3316 {
3285 heightmapWidthSamples = 2*m_regionWidth + 2; 3317 if (m_parentScene is OdeScene)
3286 heightmapHeightSamples = 2*m_regionHeight + 2; 3318 {
3287 heightmapWidth++; 3319 ((OdeScene)m_parentScene).SetTerrain(heightMap, m_worldOffset);
3288 heightmapHeight++; 3320 }
3289 } 3321 }
3290 else 3322 else
3291 { 3323 {
3292 heightmapWidthSamples = m_regionWidth + 1; 3324 SetTerrain(heightMap, m_worldOffset);
3293 heightmapHeightSamples = m_regionHeight + 1;
3294 } 3325 }
3326 }
3327
3328 public void SetTerrain(float[] heightMap, Vector3 pOffset)
3329 {
3330 // this._heightmap[i] = (double)heightMap[i];
3331 // dbm (danx0r) -- creating a buffer zone of one extra sample all around
3332 //_origheightmap = heightMap;
3333
3334 float[] _heightmap;
3335
3336 // zero out a heightmap array float array (single dimension [flattened]))
3337 //if ((int)Constants.RegionSize == 256)
3338 // _heightmap = new float[514 * 514];
3339 //else
3340
3341 _heightmap = new float[(((int)Constants.RegionSize + 2) * ((int)Constants.RegionSize + 2))];
3342
3343 uint heightmapWidth = Constants.RegionSize + 1;
3344 uint heightmapHeight = Constants.RegionSize + 1;
3345
3346 uint heightmapWidthSamples;
3347
3348 uint heightmapHeightSamples;
3349
3350 //if (((int)Constants.RegionSize) == 256)
3351 //{
3352 // heightmapWidthSamples = 2 * (uint)Constants.RegionSize + 2;
3353 // heightmapHeightSamples = 2 * (uint)Constants.RegionSize + 2;
3354 // heightmapWidth++;
3355 // heightmapHeight++;
3356 //}
3357 //else
3358 //{
3359
3360 heightmapWidthSamples = (uint)Constants.RegionSize + 1;
3361 heightmapHeightSamples = (uint)Constants.RegionSize + 1;
3362 //}
3295 3363
3296 const float scale = 1.0f; 3364 const float scale = 1.0f;
3297 const float offset = 0.0f; 3365 const float offset = 0.0f;
3298 const float thickness = 0.2f; 3366 const float thickness = 0.2f;
3299 const int wrap = 0; 3367 const int wrap = 0;
3300
3301 3368
3369 int regionsize = (int) Constants.RegionSize;
3302 //Double resolution 3370 //Double resolution
3303 if (((int)Constants.RegionSize) == 256) 3371 //if (((int)Constants.RegionSize) == 256)
3304 heightMap = ResizeTerrain512Interpolation(heightMap); 3372 // heightMap = ResizeTerrain512Interpolation(heightMap);
3305 3373
3306 int regionsize = (int)Constants.RegionSize; 3374
3307 if (regionsize == 256) 3375 // if (((int)Constants.RegionSize) == 256 && (int)Constants.RegionSize == 256)
3308 regionsize = 512; 3376 // regionsize = 512;
3309 3377
3310 float hfmin = 2000; 3378 float hfmin = 2000;
3311 float hfmax = -2000; 3379 float hfmax = -2000;
@@ -3316,8 +3384,8 @@ namespace OpenSim.Region.Physics.OdePlugin
3316 int xx = Util.Clip(x - 1, 0, regionsize - 1); 3384 int xx = Util.Clip(x - 1, 0, regionsize - 1);
3317 int yy = Util.Clip(y - 1, 0, regionsize - 1); 3385 int yy = Util.Clip(y - 1, 0, regionsize - 1);
3318 3386
3319 float val = heightMap[yy*regionsize + xx]; 3387 float val = heightMap[yy * regionsize + xx];
3320 _heightmap[x*heightmapHeightSamples + y] = val; 3388 _heightmap[x * heightmapHeightSamples + y] = val;
3321 hfmin = (val < hfmin) ? val : hfmin; 3389 hfmin = (val < hfmin) ? val : hfmin;
3322 hfmax = (val > hfmax) ? val : hfmax; 3390 hfmax = (val > hfmax) ? val : hfmax;
3323 } 3391 }
@@ -3325,23 +3393,34 @@ namespace OpenSim.Region.Physics.OdePlugin
3325 3393
3326 lock (OdeLock) 3394 lock (OdeLock)
3327 { 3395 {
3328 if (LandGeom != IntPtr.Zero) 3396 IntPtr GroundGeom = IntPtr.Zero;
3397 if (RegionTerrain.TryGetValue(pOffset, out GroundGeom))
3329 { 3398 {
3330 d.SpaceRemove(space, LandGeom); 3399 RegionTerrain.Remove(pOffset);
3400 if (GroundGeom != IntPtr.Zero)
3401 {
3402 if (TerrainHeightFieldHeights.ContainsKey(GroundGeom))
3403 {
3404 TerrainHeightFieldHeights.Remove(GroundGeom);
3405 }
3406 d.SpaceRemove(space, GroundGeom);
3407 d.GeomDestroy(GroundGeom);
3408 }
3409
3331 } 3410 }
3332 IntPtr HeightmapData = d.GeomHeightfieldDataCreate(); 3411 IntPtr HeightmapData = d.GeomHeightfieldDataCreate();
3333 d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, heightmapWidth, heightmapHeight, 3412 d.GeomHeightfieldDataBuildSingle(HeightmapData, _heightmap, 0, heightmapWidth, heightmapHeight,
3334 (int) heightmapWidthSamples, (int) heightmapHeightSamples, scale, 3413 (int)heightmapWidthSamples, (int)heightmapHeightSamples, scale,
3335 offset, thickness, wrap); 3414 offset, thickness, wrap);
3336 d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1 , hfmax + 1); 3415 d.GeomHeightfieldDataSetBounds(HeightmapData, hfmin - 1, hfmax + 1);
3337 LandGeom = d.CreateHeightfield(space, HeightmapData, 1); 3416 GroundGeom = d.CreateHeightfield(space, HeightmapData, 1);
3338 if (LandGeom != IntPtr.Zero) 3417 if (GroundGeom != IntPtr.Zero)
3339 { 3418 {
3340 d.GeomSetCategoryBits(LandGeom, (int)(CollisionCategories.Land)); 3419 d.GeomSetCategoryBits(GroundGeom, (int)(CollisionCategories.Land));
3341 d.GeomSetCollideBits(LandGeom, (int)(CollisionCategories.Space)); 3420 d.GeomSetCollideBits(GroundGeom, (int)(CollisionCategories.Space));
3342 3421
3343 } 3422 }
3344 geom_name_map[LandGeom] = "Terrain"; 3423 geom_name_map[GroundGeom] = "Terrain";
3345 3424
3346 d.Matrix3 R = new d.Matrix3(); 3425 d.Matrix3 R = new d.Matrix3();
3347 3426
@@ -3349,15 +3428,23 @@ namespace OpenSim.Region.Physics.OdePlugin
3349 Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f); 3428 Quaternion q2 = Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), 1.5707f);
3350 //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1)); 3429 //Axiom.Math.Quaternion q3 = Axiom.Math.Quaternion.FromAngleAxis(3.14f, new Axiom.Math.Vector3(0, 0, 1));
3351 3430
3352 q1 = q1*q2; 3431 q1 = q1 * q2;
3353 //q1 = q1 * q3; 3432 //q1 = q1 * q3;
3354 Vector3 v3; 3433 Vector3 v3;
3355 float angle; 3434 float angle;
3356 q1.GetAxisAngle(out v3, out angle); 3435 q1.GetAxisAngle(out v3, out angle);
3357 3436
3358 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle); 3437 d.RFromAxisAndAngle(out R, v3.X, v3.Y, v3.Z, angle);
3359 d.GeomSetRotation(LandGeom, ref R); 3438 d.GeomSetRotation(GroundGeom, ref R);
3360 d.GeomSetPosition(LandGeom, (int)Constants.RegionSize * 0.5f, (int)Constants.RegionSize * 0.5f, 0); 3439 d.GeomSetPosition(GroundGeom, pOffset.X + ((int)Constants.RegionSize * 0.5f), pOffset.Y + ((int)Constants.RegionSize * 0.5f), 0);
3440 IntPtr testGround = IntPtr.Zero;
3441 if (RegionTerrain.TryGetValue(pOffset, out testGround))
3442 {
3443 RegionTerrain.Remove(pOffset);
3444 }
3445 RegionTerrain.Add(pOffset, GroundGeom, GroundGeom);
3446 TerrainHeightFieldHeights.Add(GroundGeom,_heightmap);
3447
3361 } 3448 }
3362 } 3449 }
3363 3450
@@ -3370,6 +3457,8 @@ namespace OpenSim.Region.Physics.OdePlugin
3370 return waterlevel; 3457 return waterlevel;
3371 } 3458 }
3372 3459
3460
3461
3373 public override void SetWaterLevel(float baseheight) 3462 public override void SetWaterLevel(float baseheight)
3374 { 3463 {
3375 waterlevel = baseheight; 3464 waterlevel = baseheight;