diff options
author | Teravus Ovares | 2008-02-08 23:28:38 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-02-08 23:28:38 +0000 |
commit | fadf5b479fea038f129cf85e1fb02857d19ac38f (patch) | |
tree | 11ccf094156ee3a166239a75bb1ba97ffb656cea /OpenSim/Region/Physics | |
parent | Still chasing logout memory leak. Putting in small changes and temporary lig... (diff) | |
download | opensim-SC_OLD-fadf5b479fea038f129cf85e1fb02857d19ac38f.zip opensim-SC_OLD-fadf5b479fea038f129cf85e1fb02857d19ac38f.tar.gz opensim-SC_OLD-fadf5b479fea038f129cf85e1fb02857d19ac38f.tar.bz2 opensim-SC_OLD-fadf5b479fea038f129cf85e1fb02857d19ac38f.tar.xz |
* Added Taper support to the Meshmerizer for Cube and Cylinder.
* Removed the hull verbosity
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Extruder.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 68 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Meshing/SimpleHull.cs | 16 |
3 files changed, 83 insertions, 14 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Extruder.cs b/OpenSim/Region/Physics/Meshing/Extruder.cs index 7ef5b5b..5886c9e 100644 --- a/OpenSim/Region/Physics/Meshing/Extruder.cs +++ b/OpenSim/Region/Physics/Meshing/Extruder.cs | |||
@@ -36,6 +36,11 @@ namespace OpenSim.Region.Physics.Meshing | |||
36 | public float stopParameter; | 36 | public float stopParameter; |
37 | public PhysicsVector size; | 37 | public PhysicsVector size; |
38 | 38 | ||
39 | public float taperTopFactorX = 1f; | ||
40 | public float taperTopFactorY = 1f; | ||
41 | public float taperBotFactorX = 1f; | ||
42 | public float taperBotFactorY = 1f; | ||
43 | |||
39 | public Mesh Extrude(Mesh m) | 44 | public Mesh Extrude(Mesh m) |
40 | { | 45 | { |
41 | // Currently only works for iSteps=1; | 46 | // Currently only works for iSteps=1; |
@@ -50,8 +55,8 @@ namespace OpenSim.Region.Physics.Meshing | |||
50 | continue; | 55 | continue; |
51 | 56 | ||
52 | v.Z = +.5f; | 57 | v.Z = +.5f; |
53 | v.X *= size.X; | 58 | v.X *= (size.X * taperTopFactorX); |
54 | v.Y *= size.Y; | 59 | v.Y *= (size.Y * taperTopFactorY); |
55 | v.Z *= size.Z; | 60 | v.Z *= size.Z; |
56 | } | 61 | } |
57 | 62 | ||
@@ -61,8 +66,8 @@ namespace OpenSim.Region.Physics.Meshing | |||
61 | continue; | 66 | continue; |
62 | 67 | ||
63 | v.Z = -.5f; | 68 | v.Z = -.5f; |
64 | v.X *= size.X; | 69 | v.X *= (size.X * taperBotFactorX); |
65 | v.Y *= size.Y; | 70 | v.Y *= (size.Y * taperBotFactorY); |
66 | v.Z *= size.Z; | 71 | v.Z *= size.Z; |
67 | } | 72 | } |
68 | 73 | ||
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 2d80287..a2bbd3a 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
58 | // Setting baseDir to a path will enable the dumping of raw files | 58 | // Setting baseDir to a path will enable the dumping of raw files |
59 | // raw files can be imported by blender so a visual inspection of the results can be done | 59 | // raw files can be imported by blender so a visual inspection of the results can be done |
60 | // const string baseDir = "rawFiles"; | 60 | // const string baseDir = "rawFiles"; |
61 | private const string baseDir = null; | 61 | private const string baseDir = null; //"rawFiles"; |
62 | 62 | ||
63 | private static void IntersectionParameterPD(PhysicsVector p1, PhysicsVector r1, PhysicsVector p2, | 63 | private static void IntersectionParameterPD(PhysicsVector p1, PhysicsVector r1, PhysicsVector p2, |
64 | PhysicsVector r2, ref float lambda, ref float mu) | 64 | PhysicsVector r2, ref float lambda, ref float mu) |
@@ -181,7 +181,13 @@ namespace OpenSim.Region.Physics.Meshing | |||
181 | UInt16 hollowFactor = primShape.ProfileHollow; | 181 | UInt16 hollowFactor = primShape.ProfileHollow; |
182 | UInt16 profileBegin = primShape.ProfileBegin; | 182 | UInt16 profileBegin = primShape.ProfileBegin; |
183 | UInt16 profileEnd = primShape.ProfileEnd; | 183 | UInt16 profileEnd = primShape.ProfileEnd; |
184 | UInt16 taperX = primShape.PathScaleX; | ||
185 | UInt16 taperY = primShape.PathScaleY; | ||
184 | 186 | ||
187 | //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString()); | ||
188 | //m_log.Error("pathTaper:" + primShape.PathTaperX.ToString() + "," + primShape.PathTaperY.ToString()); | ||
189 | //m_log.Error("ProfileBegin:" + primShape.ProfileBegin.ToString() + "," + primShape.ProfileBegin.ToString()); | ||
190 | //m_log.Error("PathScale:" + primShape.PathScaleX.ToString() + "," + primShape.PathScaleY.ToString()); | ||
185 | // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface | 191 | // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface |
186 | // of a block are basically the same | 192 | // of a block are basically the same |
187 | // They may be warped differently but the shape is identical | 193 | // They may be warped differently but the shape is identical |
@@ -299,6 +305,35 @@ namespace OpenSim.Region.Physics.Meshing | |||
299 | 305 | ||
300 | extr.size = size; | 306 | extr.size = size; |
301 | 307 | ||
308 | if (taperX != 100) | ||
309 | { | ||
310 | if (taperX > 100) | ||
311 | { | ||
312 | extr.taperTopFactorX = 1.0f - ((float)taperX / 200); | ||
313 | //m_log.Warn("taperTopFactorX: " + extr.taperTopFactorX.ToString()); | ||
314 | } | ||
315 | else | ||
316 | { | ||
317 | extr.taperBotFactorX = 1.0f - ((100 - (float)taperX) / 100); | ||
318 | //m_log.Warn("taperBotFactorX: " + extr.taperBotFactorX.ToString()); | ||
319 | } | ||
320 | |||
321 | } | ||
322 | |||
323 | if (taperY != 100) | ||
324 | { | ||
325 | if (taperY > 100) | ||
326 | { | ||
327 | extr.taperTopFactorY = 1.0f - ((float)taperY / 200); | ||
328 | //m_log.Warn("taperTopFactorY: " + extr.taperTopFactorY.ToString()); | ||
329 | } | ||
330 | else | ||
331 | { | ||
332 | extr.taperBotFactorY = 1.0f - ((100 - (float)taperY) / 100); | ||
333 | //m_log.Warn("taperBotFactorY: " + extr.taperBotFactorY.ToString()); | ||
334 | } | ||
335 | } | ||
336 | |||
302 | Mesh result = extr.Extrude(m); | 337 | Mesh result = extr.Extrude(m); |
303 | result.DumpRaw(baseDir, primName, "Z extruded"); | 338 | result.DumpRaw(baseDir, primName, "Z extruded"); |
304 | return result; | 339 | return result; |
@@ -309,7 +344,8 @@ namespace OpenSim.Region.Physics.Meshing | |||
309 | UInt16 hollowFactor = primShape.ProfileHollow; | 344 | UInt16 hollowFactor = primShape.ProfileHollow; |
310 | UInt16 profileBegin = primShape.ProfileBegin; | 345 | UInt16 profileBegin = primShape.ProfileBegin; |
311 | UInt16 profileEnd = primShape.ProfileEnd; | 346 | UInt16 profileEnd = primShape.ProfileEnd; |
312 | 347 | UInt16 taperX = primShape.PathScaleX; | |
348 | UInt16 taperY = primShape.PathScaleY; | ||
313 | // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface | 349 | // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface |
314 | // of a block are basically the same | 350 | // of a block are basically the same |
315 | // They may be warped differently but the shape is identical | 351 | // They may be warped differently but the shape is identical |
@@ -589,7 +625,35 @@ namespace OpenSim.Region.Physics.Meshing | |||
589 | Extruder extr = new Extruder(); | 625 | Extruder extr = new Extruder(); |
590 | 626 | ||
591 | extr.size = size; | 627 | extr.size = size; |
628 | if (taperX != 100) | ||
629 | { | ||
630 | if (taperX > 100) | ||
631 | { | ||
632 | extr.taperTopFactorX = 1.0f - ((float)taperX / 200); | ||
633 | //m_log.Warn("taperTopFactorX: " + extr.taperTopFactorX.ToString()); | ||
634 | } | ||
635 | else | ||
636 | { | ||
637 | extr.taperBotFactorX = 1.0f - ((100 - (float)taperX) / 100); | ||
638 | //m_log.Warn("taperBotFactorX: " + extr.taperBotFactorX.ToString()); | ||
639 | } | ||
640 | |||
641 | } | ||
592 | 642 | ||
643 | if (taperY != 100) | ||
644 | { | ||
645 | if (taperY > 100) | ||
646 | { | ||
647 | extr.taperTopFactorY = 1.0f - ((float)taperY / 200); | ||
648 | //m_log.Warn("taperTopFactorY: " + extr.taperTopFactorY.ToString()); | ||
649 | } | ||
650 | else | ||
651 | { | ||
652 | extr.taperBotFactorY = 1.0f - ((100 - (float)taperY) / 100); | ||
653 | //m_log.Warn("taperBotFactorY: " + extr.taperBotFactorY.ToString()); | ||
654 | } | ||
655 | } | ||
656 | |||
593 | Mesh result = extr.Extrude(m); | 657 | Mesh result = extr.Extrude(m); |
594 | result.DumpRaw(baseDir, primName, "Z extruded"); | 658 | result.DumpRaw(baseDir, primName, "Z extruded"); |
595 | return result; | 659 | return result; |
diff --git a/OpenSim/Region/Physics/Meshing/SimpleHull.cs b/OpenSim/Region/Physics/Meshing/SimpleHull.cs index 9209860..e9cce3b 100644 --- a/OpenSim/Region/Physics/Meshing/SimpleHull.cs +++ b/OpenSim/Region/Physics/Meshing/SimpleHull.cs | |||
@@ -245,9 +245,9 @@ namespace OpenSim.Region.Physics.Meshing | |||
245 | SimpleHull otherHullClone = otherHull.Clone(); | 245 | SimpleHull otherHullClone = otherHull.Clone(); |
246 | bool intersects = false; | 246 | bool intersects = false; |
247 | 247 | ||
248 | m_log.Debug("State before intersection detection"); | 248 | //m_log.Debug("State before intersection detection"); |
249 | m_log.Debug(String.Format("The baseHull is:\n{1}", 0, baseHullClone.ToString())); | 249 | //m_log.Debug(String.Format("The baseHull is:\n{1}", 0, baseHullClone.ToString())); |
250 | m_log.Debug(String.Format("The otherHull is:\n{1}", 0, otherHullClone.ToString())); | 250 | //m_log.Debug(String.Format("The otherHull is:\n{1}", 0, otherHullClone.ToString())); |
251 | 251 | ||
252 | { | 252 | { |
253 | int iBase, iOther; | 253 | int iBase, iOther; |
@@ -276,8 +276,8 @@ namespace OpenSim.Region.Physics.Meshing | |||
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
279 | m_log.Debug("State after intersection detection for the base hull"); | 279 | //m_log.Debug("State after intersection detection for the base hull"); |
280 | m_log.Debug(String.Format("The baseHull is:\n{1}", 0, baseHullClone.ToString())); | 280 | //m_log.Debug(String.Format("The baseHull is:\n{1}", 0, baseHullClone.ToString())); |
281 | 281 | ||
282 | { | 282 | { |
283 | int iOther, iBase; | 283 | int iOther, iBase; |
@@ -305,8 +305,8 @@ namespace OpenSim.Region.Physics.Meshing | |||
305 | } | 305 | } |
306 | } | 306 | } |
307 | 307 | ||
308 | m_log.Debug("State after intersection detection for the base hull"); | 308 | //m_log.Debug("State after intersection detection for the base hull"); |
309 | m_log.Debug(String.Format("The otherHull is:\n{1}", 0, otherHullClone.ToString())); | 309 | //m_log.Debug(String.Format("The otherHull is:\n{1}", 0, otherHullClone.ToString())); |
310 | 310 | ||
311 | 311 | ||
312 | bool otherIsInBase = baseHullClone.containsPointsFrom(otherHullClone); | 312 | bool otherIsInBase = baseHullClone.containsPointsFrom(otherHullClone); |
@@ -389,7 +389,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
389 | done = true; | 389 | done = true; |
390 | } | 390 | } |
391 | 391 | ||
392 | m_log.Debug(String.Format("The resulting Hull is:\n{1}", 0, result.ToString())); | 392 | //m_log.Debug(String.Format("The resulting Hull is:\n{1}", 0, result.ToString())); |
393 | 393 | ||
394 | return result; | 394 | return result; |
395 | } | 395 | } |