Merge commit '68c8633ba18f0a11cfc0ed04d1d0c7c59e6cec76'
commit
527c2cdb1e
|
@ -259,12 +259,12 @@ public override BulletShape CreateHullShape(BulletWorld world, int hullCount, fl
|
|||
BSPhysicsShapeType.SHAPE_HULL);
|
||||
}
|
||||
|
||||
public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape)
|
||||
public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape, HACDParams parms)
|
||||
{
|
||||
BulletWorldUnman worldu = world as BulletWorldUnman;
|
||||
BulletShapeUnman shapeu = meshShape as BulletShapeUnman;
|
||||
return new BulletShapeUnman(
|
||||
BSAPICPP.BuildHullShapeFromMesh2(worldu.ptr, shapeu.ptr),
|
||||
BSAPICPP.BuildHullShapeFromMesh2(worldu.ptr, shapeu.ptr, parms),
|
||||
BSPhysicsShapeType.SHAPE_HULL);
|
||||
}
|
||||
|
||||
|
@ -1411,7 +1411,7 @@ public static extern IntPtr CreateHullShape2(IntPtr world,
|
|||
int hullCount, [MarshalAs(UnmanagedType.LPArray)] float[] hulls);
|
||||
|
||||
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape);
|
||||
public static extern IntPtr BuildHullShapeFromMesh2(IntPtr world, IntPtr meshShape, HACDParams parms);
|
||||
|
||||
[DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity]
|
||||
public static extern IntPtr BuildNativeShape2(IntPtr world, ShapeData shapeData);
|
||||
|
|
|
@ -1773,10 +1773,9 @@ private sealed class BulletConstraintXNA : BulletConstraint
|
|||
return new BulletShapeXNA(compoundshape, BSPhysicsShapeType.SHAPE_HULL);
|
||||
}
|
||||
|
||||
public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape)
|
||||
public override BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape, HACDParams parms)
|
||||
{
|
||||
/* TODO */ return null;
|
||||
|
||||
}
|
||||
|
||||
public override BulletShape CreateMeshShape(BulletWorld pWorld, int pIndicesCount, int[] indices, int pVerticesCount, float[] verticesAsFloats)
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
|||
{
|
||||
public class BSActorLockAxis : BSActor
|
||||
{
|
||||
bool TryExperimentalLockAxisCode = false;
|
||||
bool TryExperimentalLockAxisCode = true;
|
||||
BSConstraint LockAxisConstraint = null;
|
||||
|
||||
public BSActorLockAxis(BSScene physicsScene, BSPhysObject pObj, string actorName)
|
||||
|
@ -117,9 +117,7 @@ public class BSActorLockAxis : BSActor
|
|||
RemoveAxisLockConstraint();
|
||||
|
||||
BSConstraint6Dof axisConstrainer = new BSConstraint6Dof(m_physicsScene.World, m_controllingPrim.PhysBody,
|
||||
// OMV.Vector3.Zero, OMV.Quaternion.Identity,
|
||||
OMV.Vector3.Zero, OMV.Quaternion.Inverse(m_controllingPrim.RawOrientation),
|
||||
// OMV.Vector3.Zero, m_controllingPrim.RawOrientation,
|
||||
OMV.Vector3.Zero, OMV.Quaternion.Identity,
|
||||
false /* useLinearReferenceFrameB */, true /* disableCollisionsBetweenLinkedBodies */);
|
||||
LockAxisConstraint = axisConstrainer;
|
||||
m_physicsScene.Constraints.AddConstraint(LockAxisConstraint);
|
||||
|
|
|
@ -191,6 +191,21 @@ public struct ConfigurationParameters
|
|||
public const float numericFalse = 0f;
|
||||
}
|
||||
|
||||
// Parameters passed for the conversion of a mesh to a hull using Bullet's HACD library.
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct HACDParams
|
||||
{
|
||||
// usual default values
|
||||
public float maxVerticesPerHull; // 100
|
||||
public float minClusters; // 2
|
||||
public float compacityWeight; // 0.1
|
||||
public float volumeWeight; // 0.0
|
||||
public float concavity; // 100
|
||||
public float addExtraDistPoints; // false
|
||||
public float addNeighboursDistPoints; // false
|
||||
public float addFacesPoints; // false
|
||||
public float shouldAdjustCollisionMargin; // false
|
||||
}
|
||||
|
||||
// The states a bullet collision object can have
|
||||
public enum ActivationState : uint
|
||||
|
@ -308,7 +323,7 @@ public abstract BulletShape CreateMeshShape(BulletWorld world,
|
|||
public abstract BulletShape CreateHullShape(BulletWorld world,
|
||||
int hullCount, float[] hulls);
|
||||
|
||||
public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape);
|
||||
public abstract BulletShape BuildHullShapeFromMesh(BulletWorld world, BulletShape meshShape, HACDParams parms);
|
||||
|
||||
public abstract BulletShape BuildNativeShape(BulletWorld world, ShapeData shapeData);
|
||||
|
||||
|
|
|
@ -199,15 +199,8 @@ public sealed class BSTerrainManager : IDisposable
|
|||
if (MegaRegionParentPhysicsScene is BSScene)
|
||||
{
|
||||
DetailLog("{0},SetTerrain.ToParent,offset={1},worldMax={2}", BSScene.DetailLogZero, m_worldOffset, m_worldMax);
|
||||
// This looks really odd but this region is passing its terrain to its mega-region root region
|
||||
// and the creation of the terrain must happen on the root region's taint thread and not
|
||||
// my taint thread.
|
||||
((BSScene)MegaRegionParentPhysicsScene).PostTaintObject("TerrainManager.SetTerrain.Mega-" + m_worldOffset.ToString(), 0, delegate()
|
||||
{
|
||||
((BSScene)MegaRegionParentPhysicsScene).TerrainManager.UpdateTerrain(
|
||||
BSScene.CHILDTERRAIN_ID, localHeightMap,
|
||||
m_worldOffset, m_worldOffset + DefaultRegionSize, true /* inTaintTime */);
|
||||
});
|
||||
((BSScene)MegaRegionParentPhysicsScene).TerrainManager.AddMegaRegionChildTerrain(
|
||||
BSScene.CHILDTERRAIN_ID, localHeightMap, m_worldOffset, m_worldOffset + DefaultRegionSize);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -215,12 +208,23 @@ public sealed class BSTerrainManager : IDisposable
|
|||
// If not doing the mega-prim thing, just change the terrain
|
||||
DetailLog("{0},SetTerrain.Existing", BSScene.DetailLogZero);
|
||||
|
||||
UpdateTerrain(BSScene.TERRAIN_ID, localHeightMap,
|
||||
m_worldOffset, m_worldOffset + DefaultRegionSize, true /* inTaintTime */);
|
||||
UpdateTerrain(BSScene.TERRAIN_ID, localHeightMap, m_worldOffset, m_worldOffset + DefaultRegionSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Another region is calling this region passing a terrain.
|
||||
// A region that is not the mega-region root will pass its terrain to the root region so the root region
|
||||
// physics engine will have all the terrains.
|
||||
private void AddMegaRegionChildTerrain(uint id, float[] heightMap, Vector3 minCoords, Vector3 maxCoords)
|
||||
{
|
||||
// Since we are called by another region's thread, the action must be rescheduled onto our processing thread.
|
||||
PhysicsScene.PostTaintObject("TerrainManager.AddMegaRegionChild" + m_worldOffset.ToString(), 0, delegate()
|
||||
{
|
||||
UpdateTerrain(id, heightMap, minCoords, maxCoords);
|
||||
});
|
||||
}
|
||||
|
||||
// If called for terrain has has not been previously allocated, a new terrain will be built
|
||||
// based on the passed information. The 'id' should be either the terrain id or
|
||||
// BSScene.CHILDTERRAIN_ID. If the latter, a new child terrain ID will be allocated and used.
|
||||
|
@ -230,11 +234,10 @@ public sealed class BSTerrainManager : IDisposable
|
|||
// This call is most often used to update the heightMap and parameters of the terrain.
|
||||
// (The above does suggest that some simplification/refactoring is in order.)
|
||||
// Called during taint-time.
|
||||
private void UpdateTerrain(uint id, float[] heightMap,
|
||||
Vector3 minCoords, Vector3 maxCoords, bool inTaintTime)
|
||||
private void UpdateTerrain(uint id, float[] heightMap, Vector3 minCoords, Vector3 maxCoords)
|
||||
{
|
||||
DetailLog("{0},BSTerrainManager.UpdateTerrain,call,id={1},minC={2},maxC={3},inTaintTime={4}",
|
||||
BSScene.DetailLogZero, id, minCoords, maxCoords, inTaintTime);
|
||||
DetailLog("{0},BSTerrainManager.UpdateTerrain,call,id={1},minC={2},maxC={3}",
|
||||
BSScene.DetailLogZero, id, minCoords, maxCoords);
|
||||
|
||||
// Find high and low points of passed heightmap.
|
||||
// The min and max passed in is usually the area objects can be in (maximum
|
||||
|
|
|
@ -609,7 +609,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene))
|
||||
return;
|
||||
|
||||
MainConsole.Instance.OutputFormat(GetStatusReport());
|
||||
MainConsole.Instance.Output(GetStatusReport());
|
||||
}
|
||||
|
||||
public string GetStatusReport()
|
||||
|
@ -708,7 +708,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
sb.AppendFormat("Containing part UUID: {0}\n", instance.ObjectID);
|
||||
sb.AppendFormat("Position : {0}\n", sop.AbsolutePosition);
|
||||
|
||||
MainConsole.Instance.OutputFormat(sb.ToString());
|
||||
MainConsole.Instance.Output(sb.ToString());
|
||||
}
|
||||
|
||||
private void HandleSuspendScript(IScriptInstance instance)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue