aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-04-22 19:51:51 +0100
committerJustin Clark-Casey (justincc)2012-04-22 19:51:51 +0100
commit8205fe79ceaeebd31509a044005bf27d226dbe07 (patch)
treeef0c0111f800e61b3365048431ed8689b922423f /OpenSim/Region
parentComment out spurious Body != IntPtr.Zero code after disableBody(), since disa... (diff)
downloadopensim-SC_OLD-8205fe79ceaeebd31509a044005bf27d226dbe07.zip
opensim-SC_OLD-8205fe79ceaeebd31509a044005bf27d226dbe07.tar.gz
opensim-SC_OLD-8205fe79ceaeebd31509a044005bf27d226dbe07.tar.bz2
opensim-SC_OLD-8205fe79ceaeebd31509a044005bf27d226dbe07.tar.xz
Fix bug where setting phantom on a prim would result in a server log message rather than setting phantom.
This was an oversight when removing some race conditions from PhysicsActor setting recently. Regression tests extended to probe this code path. Extending regression tests required implementation of a BasicPhysicsPrim (there was none before). However, BasicPhysics plugin is still of no current practical use other than to fill in as a component for other parts of regression testing.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs2
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs344
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs41
6 files changed, 382 insertions, 32 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 63f1363..e05e8f6 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -102,9 +102,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
102 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); 102 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
103 Vector3 groupPosition = new Vector3(10, 20, 30); 103 Vector3 groupPosition = new Vector3(10, 20, 30);
104 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); 104 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
105 Vector3 offsetPosition = new Vector3(5, 10, 15); 105// Vector3 offsetPosition = new Vector3(5, 10, 15);
106 106
107 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; 107 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, Vector3.Zero) { Name = partName };
108 } 108 }
109 109
110 protected SceneObjectPart CreateSceneObjectPart2() 110 protected SceneObjectPart CreateSceneObjectPart2()
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e488fe1..a87dfb7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -684,8 +684,8 @@ namespace OpenSim.Region.Framework.Scenes
684 //Animation states 684 //Animation states
685 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); 685 m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false);
686 686
687 PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); 687 PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims);
688 CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); 688 CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims);
689 689
690 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); 690 m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys);
691 if (RegionInfo.NonphysPrimMax > 0) 691 if (RegionInfo.NonphysPrimMax > 0)
@@ -800,13 +800,11 @@ namespace OpenSim.Region.Framework.Scenes
800 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; 800 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
801 } 801 }
802 802
803 /// <summary>
804 /// Mock constructor for scene group persistency unit tests.
805 /// SceneObjectGroup RegionId property is delegated to Scene.
806 /// </summary>
807 /// <param name="regInfo"></param>
808 public Scene(RegionInfo regInfo) 803 public Scene(RegionInfo regInfo)
809 { 804 {
805 PhysicalPrims = true;
806 CollidablePrims = true;
807
810 BordersLocked = true; 808 BordersLocked = true;
811 Border northBorder = new Border(); 809 Border northBorder = new Border();
812 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<--- 810 northBorder.BorderLine = new Vector3(float.MinValue, float.MaxValue, (int)Constants.RegionSize); //<---
@@ -833,8 +831,6 @@ namespace OpenSim.Region.Framework.Scenes
833 m_eventManager = new EventManager(); 831 m_eventManager = new EventManager();
834 832
835 m_permissions = new ScenePermissions(this); 833 m_permissions = new ScenePermissions(this);
836
837// m_lastUpdate = Util.EnvironmentTickCount();
838 } 834 }
839 835
840 #endregion 836 #endregion
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 1592131..4bec2d4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4290,7 +4290,10 @@ namespace OpenSim.Region.Framework.Scenes
4290 AddFlag(PrimFlags.Phantom); 4290 AddFlag(PrimFlags.Phantom);
4291 4291
4292 if (PhysActor != null) 4292 if (PhysActor != null)
4293 {
4293 RemoveFromPhysics(); 4294 RemoveFromPhysics();
4295 pa = null;
4296 }
4294 } 4297 }
4295 else // Not phantom 4298 else // Not phantom
4296 { 4299 {
@@ -4356,7 +4359,7 @@ namespace OpenSim.Region.Framework.Scenes
4356 { 4359 {
4357 pa.SetVolumeDetect(1); 4360 pa.SetVolumeDetect(1);
4358 AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active 4361 AddFlag(PrimFlags.Phantom); // We set this flag also if VD is active
4359 this.VolumeDetectActive = true; 4362 VolumeDetectActive = true;
4360 } 4363 }
4361 } 4364 }
4362 else 4365 else
@@ -4364,9 +4367,9 @@ namespace OpenSim.Region.Framework.Scenes
4364 // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like 4367 // Remove VolumeDetect in any case. Note, it's safe to call SetVolumeDetect as often as you like
4365 // (mumbles, well, at least if you have infinte CPU powers :-)) 4368 // (mumbles, well, at least if you have infinte CPU powers :-))
4366 if (pa != null) 4369 if (pa != null)
4367 PhysActor.SetVolumeDetect(0); 4370 pa.SetVolumeDetect(0);
4368 4371
4369 this.VolumeDetectActive = false; 4372 VolumeDetectActive = false;
4370 } 4373 }
4371 4374
4372 if (SetTemporary) 4375 if (SetTemporary)
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 882031c..51751ef 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -62,6 +62,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
62 { 62 {
63 TestHelpers.InMethod(); 63 TestHelpers.InMethod();
64 64
65 m_scene.AddSceneObject(m_so1);
66
65 SceneObjectPart rootPart = m_so1.RootPart; 67 SceneObjectPart rootPart = m_so1.RootPart;
66 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None)); 68 Assert.That(rootPart.Flags, Is.EqualTo(PrimFlags.None));
67 69
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs
new file mode 100644
index 0000000..ba7fe1e
--- /dev/null
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPrim.cs
@@ -0,0 +1,344 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using Nini.Config;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Region.Physics.Manager;
34
35namespace OpenSim.Region.Physics.BasicPhysicsPlugin
36{
37 public class BasicPhysicsPrim : PhysicsActor
38 {
39 private Vector3 _position;
40 private Vector3 _velocity;
41 private Vector3 _acceleration;
42 private Vector3 _size;
43 private PrimitiveBaseShape _shape;
44 private Vector3 m_rotationalVelocity;
45 private bool flying;
46 private bool iscolliding;
47
48 public BasicPhysicsPrim(
49 string name, uint localId, Vector3 position, Vector3 size, Quaternion orientation, PrimitiveBaseShape shape)
50 {
51 Name = name;
52 LocalID = localId;
53 Position = position;
54 Size = size;
55 Orientation = orientation;
56 Shape = shape;
57 }
58
59 public override int PhysicsActorType
60 {
61 get { return (int) ActorTypes.Agent; }
62 set { return; }
63 }
64
65 public override Vector3 RotationalVelocity
66 {
67 get { return m_rotationalVelocity; }
68 set { m_rotationalVelocity = value; }
69 }
70
71 public override bool SetAlwaysRun
72 {
73 get { return false; }
74 set { return; }
75 }
76
77 public override uint LocalID
78 {
79 set { return; }
80 }
81
82 public override bool Grabbed
83 {
84 set { return; }
85 }
86
87 public override bool Selected
88 {
89 set { return; }
90 }
91
92 public override float Buoyancy
93 {
94 get { return 0f; }
95 set { return; }
96 }
97
98 public override bool FloatOnWater
99 {
100 set { return; }
101 }
102
103 public override bool IsPhysical
104 {
105 get { return false; }
106 set { return; }
107 }
108
109 public override bool ThrottleUpdates
110 {
111 get { return false; }
112 set { return; }
113 }
114
115 public override bool Flying
116 {
117 get { return flying; }
118 set { flying = value; }
119 }
120
121 public override bool IsColliding
122 {
123 get { return iscolliding; }
124 set { iscolliding = value; }
125 }
126
127 public override bool CollidingGround
128 {
129 get { return false; }
130 set { return; }
131 }
132
133 public override bool CollidingObj
134 {
135 get { return false; }
136 set { return; }
137 }
138
139 public override bool Stopped
140 {
141 get { return false; }
142 }
143
144 public override Vector3 Position
145 {
146 get { return _position; }
147 set { _position = value; }
148 }
149
150 public override Vector3 Size
151 {
152 get { return _size; }
153 set {
154 _size = value;
155 _size.Z = _size.Z / 2.0f;
156 }
157 }
158
159 public override PrimitiveBaseShape Shape
160 {
161 set { _shape = value; }
162 }
163
164 public override float Mass
165 {
166 get { return 0f; }
167 }
168
169 public override Vector3 Force
170 {
171 get { return Vector3.Zero; }
172 set { return; }
173 }
174
175 public override int VehicleType
176 {
177 get { return 0; }
178 set { return; }
179 }
180
181 public override void VehicleFloatParam(int param, float value)
182 {
183
184 }
185
186 public override void VehicleVectorParam(int param, Vector3 value)
187 {
188
189 }
190
191 public override void VehicleRotationParam(int param, Quaternion rotation)
192 {
193
194 }
195
196 public override void VehicleFlags(int param, bool remove)
197 {
198
199 }
200
201 public override void SetVolumeDetect(int param)
202 {
203
204 }
205
206 public override Vector3 CenterOfMass
207 {
208 get { return Vector3.Zero; }
209 }
210
211 public override Vector3 GeometricCenter
212 {
213 get { return Vector3.Zero; }
214 }
215
216 public override Vector3 Velocity
217 {
218 get { return _velocity; }
219 set { _velocity = value; }
220 }
221
222 public override Vector3 Torque
223 {
224 get { return Vector3.Zero; }
225 set { return; }
226 }
227
228 public override float CollisionScore
229 {
230 get { return 0f; }
231 set { }
232 }
233
234 public override Quaternion Orientation { get; set; }
235
236 public override Vector3 Acceleration
237 {
238 get { return _acceleration; }
239 set { _acceleration = value; }
240 }
241
242 public override bool Kinematic
243 {
244 get { return true; }
245 set { }
246 }
247
248 public override void link(PhysicsActor obj)
249 {
250 }
251
252 public override void delink()
253 {
254 }
255
256 public override void LockAngularMotion(Vector3 axis)
257 {
258 }
259
260 public override void AddForce(Vector3 force, bool pushforce)
261 {
262 }
263
264 public override void AddAngularForce(Vector3 force, bool pushforce)
265 {
266 }
267
268 public override void SetMomentum(Vector3 momentum)
269 {
270 }
271
272 public override void CrossingFailure()
273 {
274 }
275
276 public override Vector3 PIDTarget
277 {
278 set { return; }
279 }
280
281 public override bool PIDActive
282 {
283 set { return; }
284 }
285
286 public override float PIDTau
287 {
288 set { return; }
289 }
290
291 public override float PIDHoverHeight
292 {
293 set { return; }
294 }
295
296 public override bool PIDHoverActive
297 {
298 set { return; }
299 }
300
301 public override PIDHoverType PIDHoverType
302 {
303 set { return; }
304 }
305
306 public override float PIDHoverTau
307 {
308 set { return; }
309 }
310
311 public override Quaternion APIDTarget
312 {
313 set { return; }
314 }
315
316 public override bool APIDActive
317 {
318 set { return; }
319 }
320
321 public override float APIDStrength
322 {
323 set { return; }
324 }
325
326 public override float APIDDamping
327 {
328 set { return; }
329 }
330
331 public override void SubscribeEvents(int ms)
332 {
333 }
334
335 public override void UnSubscribeEvents()
336 {
337 }
338
339 public override bool SubscribedEvents()
340 {
341 return false;
342 }
343 }
344}
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
index 2e14216..f5826ed 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsScene.cs
@@ -34,9 +34,17 @@ using OpenSim.Region.Physics.Manager;
34 34
35namespace OpenSim.Region.Physics.BasicPhysicsPlugin 35namespace OpenSim.Region.Physics.BasicPhysicsPlugin
36{ 36{
37 /// <summary>
38 /// This is an incomplete extremely basic physics implementation
39 /// </summary>
40 /// <remarks>
41 /// Not useful for anything at the moment apart from some regression testing in other components where some form
42 /// of physics plugin is needed.
43 /// </remarks>
37 public class BasicScene : PhysicsScene 44 public class BasicScene : PhysicsScene
38 { 45 {
39 private List<BasicActor> _actors = new List<BasicActor>(); 46 private List<BasicActor> _actors = new List<BasicActor>();
47 private List<BasicPhysicsPrim> _prims = new List<BasicPhysicsPrim>();
40 private float[] _heightMap; 48 private float[] _heightMap;
41 49
42 //protected internal string sceneIdentifier; 50 //protected internal string sceneIdentifier;
@@ -50,10 +58,19 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
50 { 58 {
51 } 59 }
52 60
53 public override void Dispose() 61 public override void Dispose() {}
62
63 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
64 Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
54 { 65 {
66 BasicPhysicsPrim prim = new BasicPhysicsPrim(primName, localid, position, size, rotation, pbs);
67 prim.IsPhysical = isPhysical;
68
69 _prims.Add(prim);
55 70
71 return prim;
56 } 72 }
73
57 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) 74 public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
58 { 75 {
59 BasicActor act = new BasicActor(size); 76 BasicActor act = new BasicActor(size);
@@ -63,30 +80,18 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
63 return act; 80 return act;
64 } 81 }
65 82
66 public override void RemovePrim(PhysicsActor prim) 83 public override void RemovePrim(PhysicsActor actor)
67 { 84 {
85 BasicPhysicsPrim prim = (BasicPhysicsPrim)actor;
86 if (_prims.Contains(prim))
87 _prims.Remove(prim);
68 } 88 }
69 89
70 public override void RemoveAvatar(PhysicsActor actor) 90 public override void RemoveAvatar(PhysicsActor actor)
71 { 91 {
72 BasicActor act = (BasicActor) actor; 92 BasicActor act = (BasicActor)actor;
73 if (_actors.Contains(act)) 93 if (_actors.Contains(act))
74 {
75 _actors.Remove(act); 94 _actors.Remove(act);
76 }
77 }
78
79/*
80 public override PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation)
81 {
82 return null;
83 }
84*/
85
86 public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position,
87 Vector3 size, Quaternion rotation, bool isPhysical, uint localid)
88 {
89 return null;
90 } 95 }
91 96
92 public override void AddPhysicsActorTaint(PhysicsActor prim) 97 public override void AddPhysicsActorTaint(PhysicsActor prim)