aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMic Bowman2013-02-06 17:32:57 -0800
committerMic Bowman2013-02-06 17:32:57 -0800
commit274d376c82c8cfd6fa8ef5873f77567446c8b64d (patch)
tree06eb4ade64b736762ffbfbd1364fb4942bfbe1e4
parentEnables script access to the per object dynamic attributes through the JsonStore (diff)
parentMerge branch 'master' of git://opensimulator.org/git/opensim (diff)
downloadopensim-SC-274d376c82c8cfd6fa8ef5873f77567446c8b64d.zip
opensim-SC-274d376c82c8cfd6fa8ef5873f77567446c8b64d.tar.gz
opensim-SC-274d376c82c8cfd6fa8ef5873f77567446c8b64d.tar.bz2
opensim-SC-274d376c82c8cfd6fa8ef5873f77567446c8b64d.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
-rw-r--r--OpenSim/Framework/DAMap.cs7
-rw-r--r--OpenSim/Framework/Util.cs16
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs2
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs1
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs28
-rw-r--r--OpenSim/Region/UserStatistics/WebStatsModule.cs2
6 files changed, 43 insertions, 13 deletions
diff --git a/OpenSim/Framework/DAMap.cs b/OpenSim/Framework/DAMap.cs
index 7d7738a..64cea77 100644
--- a/OpenSim/Framework/DAMap.cs
+++ b/OpenSim/Framework/DAMap.cs
@@ -176,6 +176,10 @@ namespace OpenSim.Framework
176 } 176 }
177 } 177 }
178 178
179 /// <summary>
180 /// Validate the key used for storing separate data stores.
181 /// </summary>
182 /// <param name='key'></param>
179 private static void ValidateKey(string key) 183 private static void ValidateKey(string key)
180 { 184 {
181 if (key.Length < MIN_STORE_NAME_LENGTH) 185 if (key.Length < MIN_STORE_NAME_LENGTH)
@@ -196,7 +200,8 @@ namespace OpenSim.Framework
196 } 200 }
197 201
198 public void Add(KeyValuePair<string, OSDMap> kvp) 202 public void Add(KeyValuePair<string, OSDMap> kvp)
199 { 203 {
204 ValidateKey(kvp.Key);
200 lock (this) 205 lock (this)
201 m_map.Add(kvp.Key, kvp.Value); 206 m_map.Add(kvp.Key, kvp.Value);
202 } 207 }
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 9b1e97d..d9148fb 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -45,6 +45,7 @@ using System.Text.RegularExpressions;
45using System.Xml; 45using System.Xml;
46using System.Threading; 46using System.Threading;
47using log4net; 47using log4net;
48using log4net.Appender;
48using Nini.Config; 49using Nini.Config;
49using Nwc.XmlRpc; 50using Nwc.XmlRpc;
50using OpenMetaverse; 51using OpenMetaverse;
@@ -816,9 +817,22 @@ namespace OpenSim.Framework
816 return "."; 817 return ".";
817 } 818 }
818 819
820 public static string logFile()
821 {
822 foreach (IAppender appender in LogManager.GetRepository().GetAppenders())
823 {
824 if (appender is FileAppender)
825 {
826 return ((FileAppender)appender).File;
827 }
828 }
829
830 return "./OpenSim.log";
831 }
832
819 public static string logDir() 833 public static string logDir()
820 { 834 {
821 return "."; 835 return Path.GetDirectoryName(logFile());
822 } 836 }
823 837
824 // From: http://coercedcode.blogspot.com/2008/03/c-generate-unique-filenames-within.html 838 // From: http://coercedcode.blogspot.com/2008/03/c-generate-unique-filenames-within.html
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index 306928a..965c382 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -220,7 +220,7 @@ public static class BSParam
220 (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); }, 220 (s) => { return BSParam.NumericBool(ShouldUseHullsForPhysicalObjects); },
221 (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ), 221 (s,p,l,v) => { ShouldUseHullsForPhysicalObjects = BSParam.BoolNumeric(v); } ),
222 new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes", 222 new ParameterDefn("ShouldRemoveZeroWidthTriangles", "If true, remove degenerate triangles from meshes",
223 ConfigurationParameters.numericFalse, 223 ConfigurationParameters.numericTrue,
224 (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); }, 224 (s,cf,p,v) => { ShouldRemoveZeroWidthTriangles = cf.GetBoolean(p, BSParam.BoolNumeric(v)); },
225 (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); }, 225 (s) => { return BSParam.NumericBool(ShouldRemoveZeroWidthTriangles); },
226 (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ), 226 (s,p,l,v) => { ShouldRemoveZeroWidthTriangles = BSParam.BoolNumeric(v); } ),
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
index 823402b..ec25aa9 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs
@@ -75,6 +75,7 @@ public abstract class BSPhysObject : PhysicsActor
75 PhysicsScene = parentScene; 75 PhysicsScene = parentScene;
76 LocalID = localID; 76 LocalID = localID;
77 PhysObjectName = name; 77 PhysObjectName = name;
78 Name = name; // PhysicsActor also has the name of the object. Someday consolidate.
78 TypeName = typeName; 79 TypeName = typeName;
79 80
80 // We don't have any physical representation yet. 81 // We don't have any physical representation yet.
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
index fe0f984..15747c9 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSShapeCollection.cs
@@ -608,7 +608,7 @@ public sealed class BSShapeCollection : IDisposable
608 // Since we're recreating new, get rid of the reference to the previous shape 608 // Since we're recreating new, get rid of the reference to the previous shape
609 DereferenceShape(prim.PhysShape, shapeCallback); 609 DereferenceShape(prim.PhysShape, shapeCallback);
610 610
611 newShape = CreatePhysicalMesh(prim.PhysObjectName, newMeshKey, prim.BaseShape, prim.Size, lod); 611 newShape = CreatePhysicalMesh(prim, newMeshKey, prim.BaseShape, prim.Size, lod);
612 // Take evasive action if the mesh was not constructed. 612 // Take evasive action if the mesh was not constructed.
613 newShape = VerifyMeshCreated(newShape, prim); 613 newShape = VerifyMeshCreated(newShape, prim);
614 614
@@ -619,7 +619,7 @@ public sealed class BSShapeCollection : IDisposable
619 return true; // 'true' means a new shape has been added to this prim 619 return true; // 'true' means a new shape has been added to this prim
620 } 620 }
621 621
622 private BulletShape CreatePhysicalMesh(string objName, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod) 622 private BulletShape CreatePhysicalMesh(BSPhysObject prim, System.UInt64 newMeshKey, PrimitiveBaseShape pbs, OMV.Vector3 size, float lod)
623 { 623 {
624 BulletShape newShape = new BulletShape(); 624 BulletShape newShape = new BulletShape();
625 625
@@ -631,7 +631,7 @@ public sealed class BSShapeCollection : IDisposable
631 } 631 }
632 else 632 else
633 { 633 {
634 IMesh meshData = PhysicsScene.mesher.CreateMesh(objName, pbs, size, lod, 634 IMesh meshData = PhysicsScene.mesher.CreateMesh(prim.PhysObjectName, pbs, size, lod,
635 false, // say it is not physical so a bounding box is not built 635 false, // say it is not physical so a bounding box is not built
636 false // do not cache the mesh and do not use previously built versions 636 false // do not cache the mesh and do not use previously built versions
637 ); 637 );
@@ -651,18 +651,20 @@ public sealed class BSShapeCollection : IDisposable
651 realIndicesIndex = 0; 651 realIndicesIndex = 0;
652 for (int tri = 0; tri < indices.Length; tri += 3) 652 for (int tri = 0; tri < indices.Length; tri += 3)
653 { 653 {
654 // Compute displacements into vertex array for each vertex of the triangle
654 int v1 = indices[tri + 0] * 3; 655 int v1 = indices[tri + 0] * 3;
655 int v2 = indices[tri + 1] * 3; 656 int v2 = indices[tri + 1] * 3;
656 int v3 = indices[tri + 2] * 3; 657 int v3 = indices[tri + 2] * 3;
657 if (!((verticesAsFloats[v1 + 0] == verticesAsFloats[v2 + 0] 658 // Check to see if any two of the vertices are the same
659 if (!( ( verticesAsFloats[v1 + 0] == verticesAsFloats[v2 + 0]
658 && verticesAsFloats[v1 + 1] == verticesAsFloats[v2 + 1] 660 && verticesAsFloats[v1 + 1] == verticesAsFloats[v2 + 1]
659 && verticesAsFloats[v1 + 2] == verticesAsFloats[v2 + 2]) 661 && verticesAsFloats[v1 + 2] == verticesAsFloats[v2 + 2])
660 || (verticesAsFloats[v2 + 0] == verticesAsFloats[v3 + 0] 662 || ( verticesAsFloats[v2 + 0] == verticesAsFloats[v3 + 0]
661 && verticesAsFloats[v2 + 1] == verticesAsFloats[v3 + 1] 663 && verticesAsFloats[v2 + 1] == verticesAsFloats[v3 + 1]
662 && verticesAsFloats[v2 + 2] == verticesAsFloats[v3 + 2]) 664 && verticesAsFloats[v2 + 2] == verticesAsFloats[v3 + 2])
663 || (verticesAsFloats[v1 + 0] == verticesAsFloats[v3 + 0] 665 || ( verticesAsFloats[v1 + 0] == verticesAsFloats[v3 + 0]
664 && verticesAsFloats[v1 + 1] == verticesAsFloats[v3 + 1] 666 && verticesAsFloats[v1 + 1] == verticesAsFloats[v3 + 1]
665 && verticesAsFloats[v1 + 2] == verticesAsFloats[v3 + 2])) 667 && verticesAsFloats[v1 + 2] == verticesAsFloats[v3 + 2]) )
666 ) 668 )
667 { 669 {
668 // None of the vertices of the triangles are the same. This is a good triangle; 670 // None of the vertices of the triangles are the same. This is a good triangle;
@@ -676,8 +678,16 @@ public sealed class BSShapeCollection : IDisposable
676 DetailLog("{0},BSShapeCollection.CreatePhysicalMesh,origTri={1},realTri={2},numVerts={3}", 678 DetailLog("{0},BSShapeCollection.CreatePhysicalMesh,origTri={1},realTri={2},numVerts={3}",
677 BSScene.DetailLogZero, indices.Length / 3, realIndicesIndex / 3, verticesAsFloats.Length / 3); 679 BSScene.DetailLogZero, indices.Length / 3, realIndicesIndex / 3, verticesAsFloats.Length / 3);
678 680
679 newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World, 681 if (realIndicesIndex != 0)
680 realIndicesIndex, indices, verticesAsFloats.Length/3, verticesAsFloats); 682 {
683 newShape = PhysicsScene.PE.CreateMeshShape(PhysicsScene.World,
684 realIndicesIndex, indices, verticesAsFloats.Length / 3, verticesAsFloats);
685 }
686 else
687 {
688 PhysicsScene.Logger.ErrorFormat("{0} All mesh triangles degenerate. Prim {1} at {2} in {3}",
689 LogHeader, prim.PhysObjectName, prim.RawPosition, PhysicsScene.Name);
690 }
681 } 691 }
682 } 692 }
683 newShape.shapeKey = newMeshKey; 693 newShape.shapeKey = newMeshKey;
diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs
index 438ef48..b98b762 100644
--- a/OpenSim/Region/UserStatistics/WebStatsModule.cs
+++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs
@@ -420,7 +420,7 @@ namespace OpenSim.Region.UserStatistics
420 Encoding encoding = Encoding.ASCII; 420 Encoding encoding = Encoding.ASCII;
421 int sizeOfChar = encoding.GetByteCount("\n"); 421 int sizeOfChar = encoding.GetByteCount("\n");
422 byte[] buffer = encoding.GetBytes("\n"); 422 byte[] buffer = encoding.GetBytes("\n");
423 string logfile = Util.logDir() + "/" + "OpenSim.log"; 423 string logfile = Util.logFile();
424 FileStream fs = new FileStream(logfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); 424 FileStream fs = new FileStream(logfile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
425 Int64 tokenCount = 0; 425 Int64 tokenCount = 0;
426 Int64 endPosition = fs.Length / sizeOfChar; 426 Int64 endPosition = fs.Length / sizeOfChar;