diff options
author | Robert Adams | 2012-12-29 18:34:46 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-31 19:57:21 -0800 |
commit | 203588e3c0374505a6aa564d8f7a655d968653d7 (patch) | |
tree | 8c4baba73e84f42bbedaca64d5e2ba33bb4e8aa9 | |
parent | Resolve Mantis 6480 (http://opensimulator.org/mantis/view.php?id=6480) (diff) | |
download | opensim-SC-203588e3c0374505a6aa564d8f7a655d968653d7.zip opensim-SC-203588e3c0374505a6aa564d8f7a655d968653d7.tar.gz opensim-SC-203588e3c0374505a6aa564d8f7a655d968653d7.tar.bz2 opensim-SC-203588e3c0374505a6aa564d8f7a655d968653d7.tar.xz |
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.
5 files changed, 29 insertions, 15 deletions
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 | |||
48 | { | 48 | { |
49 | base.Refresh(requestor); | 49 | base.Refresh(requestor); |
50 | 50 | ||
51 | // Queue to happen after all the other taint processing | 51 | if (HasAnyChildren && IsRoot(requestor)) |
52 | PhysicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate() | 52 | { |
53 | { | 53 | // Queue to happen after all the other taint processing |
54 | if (HasAnyChildren && IsRoot(requestor)) | 54 | PhysicsScene.PostTaintObject("BSLinksetContraints.Refresh", requestor.LocalID, delegate() |
55 | RecomputeLinksetConstraints(); | 55 | { |
56 | }); | 56 | if (HasAnyChildren && IsRoot(requestor)) |
57 | RecomputeLinksetConstraints(); | ||
58 | }); | ||
59 | } | ||
57 | } | 60 | } |
58 | 61 | ||
59 | // The object is going dynamic (physical). Do any setup necessary | 62 | // 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 | |||
67 | PhysObjectName = name; | 67 | PhysObjectName = name; |
68 | TypeName = typeName; | 68 | TypeName = typeName; |
69 | 69 | ||
70 | // We don't have any physical representation yet. | ||
71 | PhysBody = new BulletBody(localID); | ||
72 | PhysShape = new BulletShape(); | ||
73 | |||
74 | // A linkset of just me | ||
70 | Linkset = BSLinkset.Factory(PhysicsScene, this); | 75 | Linkset = BSLinkset.Factory(PhysicsScene, this); |
71 | LastAssetBuildFailed = false; | 76 | LastAssetBuildFailed = false; |
72 | 77 | ||
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 | |||
111 | 111 | ||
112 | _mass = CalculateMass(); | 112 | _mass = CalculateMass(); |
113 | 113 | ||
114 | // No body or shape yet | 114 | // Cause linkset variables to be initialized (like mass) |
115 | PhysBody = new BulletBody(LocalID); | ||
116 | PhysShape = new BulletShape(); | ||
117 | |||
118 | Linkset.Refresh(this); | 115 | Linkset.Refresh(this); |
119 | 116 | ||
120 | DetailLog("{0},BSPrim.constructor,call", LocalID); | 117 | 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 | |||
35 | // These hold pointers to allocated objects in the unmanaged space. | 35 | // These hold pointers to allocated objects in the unmanaged space. |
36 | 36 | ||
37 | // The physics engine controller class created at initialization | 37 | // The physics engine controller class created at initialization |
38 | public struct BulletWorld | 38 | public class BulletWorld |
39 | { | 39 | { |
40 | public BulletWorld(uint worldId, BSScene bss, IntPtr xx) | 40 | public BulletWorld(uint worldId, BSScene bss, IntPtr xx) |
41 | { | 41 | { |
@@ -50,7 +50,7 @@ public struct BulletWorld | |||
50 | } | 50 | } |
51 | 51 | ||
52 | // An allocated Bullet btRigidBody | 52 | // An allocated Bullet btRigidBody |
53 | public struct BulletBody | 53 | public class BulletBody |
54 | { | 54 | { |
55 | public BulletBody(uint id) : this(id, IntPtr.Zero) | 55 | public BulletBody(uint id) : this(id, IntPtr.Zero) |
56 | { | 56 | { |
@@ -96,9 +96,14 @@ public struct BulletBody | |||
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 | ||
99 | public struct BulletShape | 99 | public class BulletShape |
100 | { | 100 | { |
101 | public BulletShape(IntPtr xx) : this(xx, BSPhysicsShapeType.SHAPE_UNKNOWN) | 101 | public BulletShape() |
102 | : this(IntPtr.Zero, BSPhysicsShapeType.SHAPE_UNKNOWN) | ||
103 | { | ||
104 | } | ||
105 | public BulletShape(IntPtr xx) | ||
106 | : this(xx, BSPhysicsShapeType.SHAPE_UNKNOWN) | ||
102 | { | 107 | { |
103 | } | 108 | } |
104 | public BulletShape(IntPtr xx, BSPhysicsShapeType typ) | 109 | public BulletShape(IntPtr xx, BSPhysicsShapeType typ) |
@@ -136,7 +141,7 @@ public struct BulletShape | |||
136 | } | 141 | } |
137 | 142 | ||
138 | // An allocated Bullet btConstraint | 143 | // An allocated Bullet btConstraint |
139 | public struct BulletConstraint | 144 | public class BulletConstraint |
140 | { | 145 | { |
141 | public BulletConstraint(IntPtr xx) | 146 | public BulletConstraint(IntPtr xx) |
142 | { | 147 | { |
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 | |||
97 | Re-implement buoyancy as a separate force on the object rather than diddling gravity. | 97 | Re-implement buoyancy as a separate force on the object rather than diddling gravity. |
98 | Register a pre-step event to add the force. | 98 | Register a pre-step event to add the force. |
99 | More efficient memory usage when passing hull information from BSPrim to BulletSim | 99 | More efficient memory usage when passing hull information from BSPrim to BulletSim |
100 | Avatar movement motor check for zero or small movement. Somehow suppress small movements | ||
101 | when avatar has stopped and is just standing. Simple test for near zero has | ||
102 | the problem of preventing starting up (increase from zero) especially when falling. | ||
100 | 103 | ||
101 | LINKSETS | 104 | LINKSETS |
102 | ====================================================== | 105 | ====================================================== |
@@ -195,6 +198,7 @@ Should taints check for existance or activeness of target? | |||
195 | keeps the object from being freed, but that is just an accident. | 198 | keeps the object from being freed, but that is just an accident. |
196 | Possibly have and 'active' flag that is checked by the taint processor? | 199 | Possibly have and 'active' flag that is checked by the taint processor? |
197 | Parameters for physics logging should be moved from BSScene to BSParam (at least boolean ones) | 200 | Parameters for physics logging should be moved from BSScene to BSParam (at least boolean ones) |
201 | Can some of the physical wrapper classes (BulletBody, BulletWorld, BulletShape) be 'sealed'? | ||
198 | 202 | ||
199 | THREADING | 203 | THREADING |
200 | ================================================= | 204 | ================================================= |