@@ -64,7 +64,6 @@ public sealed class BSPrim : PhysicsObject
private long _collidingStep;
private float _collisionScore;
private bool _floatOnWater;
private bool _flying;
private Vector3 _force;
private ulong _hullKey;
private List<ConvexResult> _hulls;
@@ -87,7 +86,6 @@ public sealed class BSPrim : PhysicsObject
private Vector3 _position;
private Vector3 _rotationalVelocity;
private Vector3 _scale;
private bool _setAlwaysRun;
private ShapeData.PhysicsShapeType _shapeType;
private Vector3 _size;

@@ -202,16 +200,8 @@ public override Vector3 Position
set
{
_position = value;
#if (!ISWIN)
_scene.TaintedObject(delegate()
{
BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation);
// MainConsole.Instance.DebugFormat("{0}: setPosition: id={1}, position={2}", LogHeader, _localID, _position);
});
#else
_scene.TaintedObject(() => BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position,
_orientation));
#endif
}
}

@@ -226,14 +216,7 @@ public override Vector3 Force
set
{
_force = value;
#if (!ISWIN)
_scene.TaintedObject(delegate()
{
BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force);
});
#else
_scene.TaintedObject(() => BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force));
#endif
}
}

@@ -248,14 +231,7 @@ public override Vector3 Velocity
set
{
_velocity = value;
#if (!ISWIN)
_scene.TaintedObject(delegate()
{
BulletSimAPI.SetObjectVelocity(_scene.WorldID, LocalID, _velocity);
});
#else
_scene.TaintedObject(() => BulletSimAPI.SetObjectVelocity(_scene.WorldID, LocalID, _velocity));
#endif
}
}

@@ -283,16 +259,8 @@ public override Quaternion Orientation
{
_orientation = value;
// MainConsole.Instance.DebugFormat("{0}: set orientation: id={1}, ori={2}", LogHeader, LocalID, _orientation);
#if (!ISWIN)
_scene.TaintedObject(delegate()
{
// _position = BulletSimAPI.GetObjectPosition(_scene.WorldID, _localID);
BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position, _orientation);
});
#else
_scene.TaintedObject(() => BulletSimAPI.SetObjectTranslation(_scene.WorldID, _localID, _position,
_orientation));
#endif
}
}

@@ -323,22 +291,6 @@ private bool IsSolid
get { return !IsPhantom && !_isVolumeDetect; }
}

// make gravity work if the object is physical and not selected
// no locking here because only called when it is safe

// prims don't fly
public override bool Flying
{
get { return _flying; }
set { _flying = value; }
}

public override bool SetAlwaysRun
{
get { return _setAlwaysRun; }
set { _setAlwaysRun = value; }
}

public override bool ThrottleUpdates
{
get { return _throttleUpdates; }
@@ -387,15 +339,8 @@ public override Vector3 RotationalVelocity
{
_rotationalVelocity = value;
// MainConsole.Instance.DebugFormat("{0}: RotationalVelocity={1}", LogHeader, _rotationalVelocity);
#if (!ISWIN)
_scene.TaintedObject(delegate()
{
BulletSimAPI.SetObjectAngularVelocity(_scene.WorldID, LocalID, _rotationalVelocity);
});
#else
_scene.TaintedObject(
() => BulletSimAPI.SetObjectAngularVelocity(_scene.WorldID, LocalID, _rotationalVelocity));
#endif
}
}

@@ -411,15 +356,8 @@ public override float Buoyancy
set
{
_buoyancy = value;
#if (!ISWIN)
_scene.TaintedObject(delegate()
{
BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, _localID, 1 - _buoyancy);//Bullet has no change as 0, instead of 1
});
#else
_scene.TaintedObject(
() => BulletSimAPI.SetObjectBuoyancy(_scene.WorldID, _localID, 1 - _buoyancy));
#endif
}
}

@@ -496,14 +434,7 @@ public void Destroy()
// Undo any vehicle properties
_vehicle.ProcessTypeChange(Vehicle.TYPE_NONE);
_scene.RemoveVehiclePrim(this); // just to make sure
#if (!ISWIN)
_scene.TaintedObject(delegate()
{
BulletSimAPI.DestroyObject(_scene.WorldID, _localID);
});
#else
_scene.TaintedObject(() => BulletSimAPI.DestroyObject(_scene.WorldID, _localID));
#endif
}

public override void CrossingFailure()
@@ -641,14 +572,7 @@ public override void AddForce(Vector3 force, bool pushforce)
{
MainConsole.Instance.WarnFormat("{0}: Got a NaN force applied to a Prim", LogHeader);
}
#if (!ISWIN)
_scene.TaintedObject(delegate()
{
BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force);
});
#else
_scene.TaintedObject(() => BulletSimAPI.SetObjectForce(_scene.WorldID, _localID, _force));
#endif
}

public override void AddAngularForce(Vector3 force, bool pushforce)
@@ -735,13 +659,7 @@ private void GenerateHullMesh()
{
convIndices.Add(indices[ii]);
}
#if (!ISWIN)
List<float3> convVertices = new List<float3>();
foreach (Vector3 vv in vertices)
convVertices.Add(new float3(vv.X, vv.Y, vv.Z));
#else
List<float3> convVertices = vertices.Select(vv => new float3(vv.X, vv.Y, vv.Z)).ToList();
#endif

// setup and do convex hull conversion
_hulls = new List<ConvexResult>();
@@ -1413,14 +1331,7 @@ private float CalculateMass()

if (IsRootOfLinkset)
{
#if (!ISWIN)
float sum = 0;
foreach (BSPrim prim in _childrenPrims)
sum += prim.CalculateMass();
returnMass += sum;
#else
returnMass += _childrenPrims.Sum(prim => prim.CalculateMass());
#endif
}

if (returnMass <= 0)
@@ -1,28 +1,28 @@
/* The MIT License
*
* Copyright (c) 2010 Intel Corporation.
* All rights reserved.
*
* Based on the convexdecomposition library from
* <http://codesuppository.googlecode.com> by John W. Ratcliff and Stan Melax.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
/* The MIT License
*
* Copyright (c) 2010 Intel Corporation.
* All rights reserved.
*
* Based on the convexdecomposition library from
* <http://codesuppository.googlecode.com> by John W. Ratcliff and Stan Melax.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

using System;
@@ -406,11 +406,7 @@ public void ConvexDecompResult(ConvexResult result)

public void sortChulls(List<CHull> hulls)
{
#if (!ISWIN)
hulls.Sort(delegate(CHull a, CHull b) { return a.mVolume.CompareTo(b.mVolume); });
#else
hulls.Sort((a, b) => a.mVolume.CompareTo(b.mVolume));
#endif
}
}
}
@@ -463,14 +463,7 @@ public static int PlaneTest(Plane p, float3 v, float planetestepsilon)

public static int SplitTest(ref ConvexH convex, Plane plane, float planetestepsilon)
{
#if (!ISWIN)
int result = 0;
foreach (float3 vertex in convex.vertices)
result = result | PlaneTest(plane, vertex, planetestepsilon);
return result;
#else
return convex.vertices.Aggregate(0, (current, t) => current | PlaneTest(plane, t, planetestepsilon));
#endif
}

public static Quaternion VirtualTrackBall(float3 cop, float3 cor, float3 dir1, float3 dir2)
@@ -1031,13 +1024,7 @@ public static int candidateplane(List<Plane> planes, int planes_count, ConvexH c
int i;
for (i = 0; i < planes_count; i++)
{
#if (!ISWIN)
float d = 0;
foreach (float3 t in convex.vertices)
d = Math.Max(d, float3.dot(t, planes[i].normal) + planes[i].dist);
#else
float d = convex.vertices.Select(t => float3.dot(t, planes[i].normal) + planes[i].dist).Concat(new float[] { 0 }).Max();
#endif
if (i == 0 || d > md)
{
p = i;