aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
diff options
context:
space:
mode:
authorRobert Adams2014-10-02 18:45:36 -0700
committerRobert Adams2014-11-30 19:52:58 -0800
commitcf85ade81e38e692fe99c71386ab2c306ab77319 (patch)
treeba8dd76e62a4a989ae46f02dfe028ef0ee3d37fd /OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
parentA little more cleaning of config files. (diff)
downloadopensim-SC-cf85ade81e38e692fe99c71386ab2c306ab77319.zip
opensim-SC-cf85ade81e38e692fe99c71386ab2c306ab77319.tar.gz
opensim-SC-cf85ade81e38e692fe99c71386ab2c306ab77319.tar.bz2
opensim-SC-cf85ade81e38e692fe99c71386ab2c306ab77319.tar.xz
BulletSim: add shape and linkset rebuild scheduled flags. Add BSPrim.Incomplete flag based on rebuild flags to say when an object is being rebuilt.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs42
1 files changed, 39 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
index 27ee5ac..c88a5c2 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -141,6 +141,18 @@ public class BSPrim : BSPhysObject
141 public override bool Stopped { 141 public override bool Stopped {
142 get { return false; } 142 get { return false; }
143 } 143 }
144
145 public override bool IsIncomplete {
146 get {
147 return ShapeRebuildScheduled;
148 }
149 }
150
151 // 'true' if this object's shape is in need of a rebuild and a rebuild has been queued.
152 // The prim is still available but its underlying shape will change soon.
153 // This is protected by a 'lock(this)'.
154 public bool ShapeRebuildScheduled { get; protected set; }
155
144 public override OMV.Vector3 Size { 156 public override OMV.Vector3 Size {
145 get { return _size; } 157 get { return _size; }
146 set { 158 set {
@@ -159,13 +171,37 @@ public class BSPrim : BSPhysObject
159 ForceBodyShapeRebuild(false); 171 ForceBodyShapeRebuild(false);
160 } 172 }
161 } 173 }
174 // Cause the body and shape of the prim to be rebuilt if necessary.
175 // If there are no changes required, this is quick and does not make changes to the prim.
176 // If rebuilding is necessary (like changing from static to physical), that will happen.
177 // The 'ShapeRebuildScheduled' tells any checker that the body/shape may change shortly.
178 // The return parameter is not used by anyone.
162 public override bool ForceBodyShapeRebuild(bool inTaintTime) 179 public override bool ForceBodyShapeRebuild(bool inTaintTime)
163 { 180 {
164 PhysScene.TaintedObject(inTaintTime, LocalID, "BSPrim.ForceBodyShapeRebuild", delegate() 181 if (inTaintTime)
165 { 182 {
183 // If called in taint time, do the operation immediately
166 _mass = CalculateMass(); // changing the shape changes the mass 184 _mass = CalculateMass(); // changing the shape changes the mass
167 CreateGeomAndObject(true); 185 CreateGeomAndObject(true);
168 }); 186 }
187 else
188 {
189 lock (this)
190 {
191 // If a rebuild is not already in the queue
192 if (!ShapeRebuildScheduled)
193 {
194 // Remember that a rebuild is queued -- this is used to flag an incomplete object
195 ShapeRebuildScheduled = true;
196 PhysScene.TaintedObject(LocalID, "BSPrim.ForceBodyShapeRebuild", delegate()
197 {
198 _mass = CalculateMass(); // changing the shape changes the mass
199 CreateGeomAndObject(true);
200 ShapeRebuildScheduled = false;
201 });
202 }
203 }
204 }
169 return true; 205 return true;
170 } 206 }
171 public override bool Grabbed { 207 public override bool Grabbed {