From 203588e3c0374505a6aa564d8f7a655d968653d7 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 29 Dec 2012 18:34:46 -0800 Subject: BulletSim: change physical data structures to classes. Add default instantiations for PhysBody and PhysShape when BSPhysObject is created to account for them being classes and not structures. Update TODO list. --- .../Region/Physics/BulletSPlugin/BSLinksetConstraints.cs | 15 +++++++++------ OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | 5 +++++ OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 5 +---- OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs | 15 ++++++++++----- OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | 4 ++++ 5 files changed, 29 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs index 6b592e7..86c29c7 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetConstraints.cs @@ -48,12 +48,15 @@ public sealed class BSLinksetConstraints : BSLinkset { base.Refresh(requestor); - // Queue to happen after all the other taint processing - PhysicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate() - { - if (HasAnyChildren && IsRoot(requestor)) - RecomputeLinksetConstraints(); - }); + if (HasAnyChildren && IsRoot(requestor)) + { + // Queue to happen after all the other taint processing + PhysicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate() + { + if (HasAnyChildren && IsRoot(requestor)) + RecomputeLinksetConstraints(); + }); + } } // The object is going dynamic (physical). Do any setup necessary diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index 73b5764..b093890 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs @@ -67,6 +67,11 @@ public abstract class BSPhysObject : PhysicsActor PhysObjectName = name; TypeName = typeName; + // We don't have any physical representation yet. + PhysBody = new BulletBody(localID); + PhysShape = new BulletShape(); + + // A linkset of just me Linkset = BSLinkset.Factory(PhysicsScene, this); LastAssetBuildFailed = false; diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 5f3f0d1..2de4717 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -111,10 +111,7 @@ public sealed class BSPrim : BSPhysObject _mass = CalculateMass(); - // No body or shape yet - PhysBody = new BulletBody(LocalID); - PhysShape = new BulletShape(); - + // Cause linkset variables to be initialized (like mass) Linkset.Refresh(this); DetailLog("{0},BSPrim.constructor,call", LocalID); diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs index 5ad6746..cd5d170 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimData.cs @@ -35,7 +35,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin // These hold pointers to allocated objects in the unmanaged space. // The physics engine controller class created at initialization -public struct BulletWorld +public class BulletWorld { public BulletWorld(uint worldId, BSScene bss, IntPtr xx) { @@ -50,7 +50,7 @@ public struct BulletWorld } // An allocated Bullet btRigidBody -public struct BulletBody +public class BulletBody { public BulletBody(uint id) : this(id, IntPtr.Zero) { @@ -96,9 +96,14 @@ public struct BulletBody } } -public struct BulletShape +public class BulletShape { - public BulletShape(IntPtr xx) : this(xx, BSPhysicsShapeType.SHAPE_UNKNOWN) + public BulletShape() + : this(IntPtr.Zero, BSPhysicsShapeType.SHAPE_UNKNOWN) + { + } + public BulletShape(IntPtr xx) + : this(xx, BSPhysicsShapeType.SHAPE_UNKNOWN) { } public BulletShape(IntPtr xx, BSPhysicsShapeType typ) @@ -136,7 +141,7 @@ public struct BulletShape } // An allocated Bullet btConstraint -public struct BulletConstraint +public class BulletConstraint { public BulletConstraint(IntPtr xx) { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index f805836..8ec9871 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt @@ -97,6 +97,9 @@ Selecting and deselecting physical objects causes CPU processing time to jump Re-implement buoyancy as a separate force on the object rather than diddling gravity. Register a pre-step event to add the force. More efficient memory usage when passing hull information from BSPrim to BulletSim +Avatar movement motor check for zero or small movement. Somehow suppress small movements + when avatar has stopped and is just standing. Simple test for near zero has + the problem of preventing starting up (increase from zero) especially when falling. LINKSETS ====================================================== @@ -195,6 +198,7 @@ Should taints check for existance or activeness of target? keeps the object from being freed, but that is just an accident. Possibly have and 'active' flag that is checked by the taint processor? Parameters for physics logging should be moved from BSScene to BSParam (at least boolean ones) +Can some of the physical wrapper classes (BulletBody, BulletWorld, BulletShape) be 'sealed'? THREADING ================================================= -- cgit v1.1