From 6ef9d4da901a346c232458317cca6268da888e2e Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 18 Aug 2008 00:39:10 +0000 Subject: Formatting cleanup. --- .../BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 2 +- OpenSim/Region/Physics/Manager/IMesher.cs | 1 - OpenSim/Region/Physics/Manager/PhysicsActor.cs | 2 - OpenSim/Region/Physics/Meshing/Extruder.cs | 26 ++-- OpenSim/Region/Physics/Meshing/HelperTypes.cs | 2 +- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 12 +- OpenSim/Region/Physics/Meshing/SculptMesh.cs | 12 +- OpenSim/Region/Physics/OdePlugin/ODETestClass.cs | 6 +- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 164 ++++++++++----------- 9 files changed, 107 insertions(+), 120 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index 213f1d4..3bf0956 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -70,7 +70,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin public BasicScene() { } - + public override void Initialise(IMesher meshmerizer, IConfigSource config) { // Does nothing right now diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs index 48e4ba6..0042c40 100644 --- a/OpenSim/Region/Physics/Manager/IMesher.cs +++ b/OpenSim/Region/Physics/Manager/IMesher.cs @@ -48,6 +48,5 @@ namespace OpenSim.Region.Physics.Manager int[] getIndexListAsIntLocked(); float[] getVertexListAsFloatLocked(); void releasePinned(); - } } diff --git a/OpenSim/Region/Physics/Manager/PhysicsActor.cs b/OpenSim/Region/Physics/Manager/PhysicsActor.cs index beca4da..d4af271 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsActor.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsActor.cs @@ -209,10 +209,8 @@ namespace OpenSim.Region.Physics.Manager public override bool Stopped { get{ return false; } - } - public override PhysicsVector Position { get { return PhysicsVector.Zero; } diff --git a/OpenSim/Region/Physics/Meshing/Extruder.cs b/OpenSim/Region/Physics/Meshing/Extruder.cs index b14deeb..0c94669 100644 --- a/OpenSim/Region/Physics/Meshing/Extruder.cs +++ b/OpenSim/Region/Physics/Meshing/Extruder.cs @@ -286,7 +286,7 @@ namespace OpenSim.Region.Physics.Meshing // It's not quite clear what pushY (Y top shear) does, but subtracting it from the start and end // angles appears to approximate it's effects on path cut. Likewise, adding it to the angle used // to calculate the sine for generating the path radius appears to approximate it's effects there - // too, but there are some subtle differences in the radius which are noticeable as the prim size + // too, but there are some subtle differences in the radius which are noticeable as the prim size // increases and it may affect megaprims quite a bit. The effect of the Y top shear parameter on // the meshes generated with this technique appear nearly identical in shape to the same prims when // displayed by the viewer. @@ -369,28 +369,26 @@ namespace OpenSim.Region.Physics.Meshing float yOffset; float zOffset; - xOffset = 0.5f * (skewStart + totalSkew * (float)percentOfPath); xOffset += (float) System.Math.Sin(angle) * pushX * 0.45f; yOffset = (float)(System.Math.Cos(angle) * (0.5f - yPathScale)) * radiusScale; zOffset = (float)(System.Math.Sin(angle + pushY * 0.9f) * (0.5f - yPathScale)) * radiusScale; - - // next apply twist rotation to the profile layer - if (twistTotal != 0.0f || twistBot != 0.0f) + // next apply twist rotation to the profile layer + if (twistTotal != 0.0f || twistBot != 0.0f) + { + Quaternion profileRot = new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist); + foreach (Vertex v in newLayer.vertices) { - Quaternion profileRot = new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist); - foreach (Vertex v in newLayer.vertices) + if (v != null) { - if (v != null) - { - vTemp = v * profileRot; - v.X = vTemp.X; - v.Y = vTemp.Y; - v.Z = vTemp.Z; - } + vTemp = v * profileRot; + v.X = vTemp.X; + v.Y = vTemp.Y; + v.Z = vTemp.Z; } } + } // now orient the rotation of the profile layer relative to it's position on the path // adding pushY to the angle used to generate the quat appears to approximate the viewer diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/Physics/Meshing/HelperTypes.cs index 816b6bb..2cb8d04 100644 --- a/OpenSim/Region/Physics/Meshing/HelperTypes.cs +++ b/OpenSim/Region/Physics/Meshing/HelperTypes.cs @@ -118,7 +118,7 @@ public class Vertex : PhysicsVector, IComparable { return new Vertex(Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - Y * v.X); } - + // disable warning: mono compiler moans about overloading // operators hiding base operator but should not according to C# // language spec diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index f041aec..a038dc2 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -941,7 +941,7 @@ namespace OpenSim.Region.Physics.Meshing extr.twistBot = (float)primShape.PathTwistBegin * (float)Math.PI * 0.01f; extr.pathBegin = primShape.PathBegin; extr.pathEnd = primShape.PathEnd; - + //System.Console.WriteLine("[MESH]: twistTop = " + twistTop.ToString() + "|" + extr.twistTop.ToString() + ", twistMid = " + twistMid.ToString() + "|" + extr.twistMid.ToString() + ", twistbot = " + twistBot.ToString() + "|" + extr.twistBot.ToString()); //Mesh result = extr.Extrude(m); Mesh result = extr.ExtrudeLinearPath(m); @@ -1340,7 +1340,7 @@ namespace OpenSim.Region.Physics.Meshing } /// - /// Creates a mesh for prim types torus, ring, tube, and sphere + /// Creates a mesh for prim types torus, ring, tube, and sphere /// /// /// @@ -1655,7 +1655,7 @@ namespace OpenSim.Region.Physics.Meshing // Vertex vTemp = new Vertex(0.0f, 0.0f, 0.0f); - + float skew = primShape.PathSkew * 0.01f; float pathScaleX = (float)(200 - primShape.PathScaleX) * 0.01f; float pathScaleY = (float)(200 - primShape.PathScaleY) * 0.01f; @@ -1700,7 +1700,7 @@ namespace OpenSim.Region.Physics.Meshing //System.Console.WriteLine("primShape.PathTaperX: " + primShape.PathTaperX.ToString()); //System.Console.WriteLine("primShape.PathTaperY: " + primShape.PathTaperY.ToString()); - + //System.Console.WriteLine("primShape.PathRadiusOffset: " + primShape.PathRadiusOffset.ToString()); #endif @@ -1875,7 +1875,7 @@ namespace OpenSim.Region.Physics.Meshing if (primShape.SculptEntry && primShape.SculptType != (byte)0 && primShape.SculptData.Length > 0) { - + SculptMesh smesh = CreateSculptMesh(primName, primShape, size, lod); mesh = (Mesh)smesh; CalcNormals(mesh); @@ -1967,7 +1967,7 @@ namespace OpenSim.Region.Physics.Meshing float pathShearY = primShape.PathShearY < 128 ? (float)primShape.PathShearY * 0.01f : (float)(primShape.PathShearY - 256) * 0.01f; float pathBegin = (float)primShape.PathBegin * 2.0e-5f; float pathEnd = 1.0f - (float)primShape.PathEnd * 2.0e-5f; - + float profileBegin = (float)primShape.ProfileBegin * 2.0e-5f; float profileEnd = 1.0f - (float)primShape.ProfileEnd * 2.0e-5f; diff --git a/OpenSim/Region/Physics/Meshing/SculptMesh.cs b/OpenSim/Region/Physics/Meshing/SculptMesh.cs index 95a244d..1c3153a 100644 --- a/OpenSim/Region/Physics/Meshing/SculptMesh.cs +++ b/OpenSim/Region/Physics/Meshing/SculptMesh.cs @@ -52,7 +52,7 @@ namespace OpenSim.Region.Physics.Meshing { if (_lod == 2f || _lod == 4f || _lod == 8f || _lod == 16f || _lod == 32f || _lod == 64f) lod = (int)_lod; - + try { idata = OpenJPEG.DecodeToImage(jpegData); @@ -81,7 +81,7 @@ namespace OpenSim.Region.Physics.Meshing } } - + } private Vertex ColorToVertex(Color input) { @@ -225,7 +225,7 @@ namespace OpenSim.Region.Physics.Meshing // Create a vertex position from the RGB channels in the current pixel // int ypos = y * bLOD.Width; - + if (y == 0) { v1 = northpole; @@ -291,7 +291,7 @@ namespace OpenSim.Region.Physics.Meshing Add(tri2); } } - + } //Vertex vt31 = sVertices[(y * x_max + x)]; //Vertex vt32 = sVertices[(y * x_max + 0)]; @@ -311,7 +311,7 @@ namespace OpenSim.Region.Physics.Meshing //Add(tri3); // } //} - + //Vertex vt41 = sVertices[(y * x_max + x)]; //Vertex vt42 = sVertices[((y + 1) * x_max + 0)]; //Vertex vt43 = sVertices[((y + 1) * x_max + x)]; @@ -329,7 +329,7 @@ namespace OpenSim.Region.Physics.Meshing //Add(tri4); //} //} - + } } } diff --git a/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs index bc2ad69..074170a 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODETestClass.cs @@ -40,7 +40,7 @@ namespace OpenSim.Region.Physics.OdePlugin private OdePlugin cbt; private PhysicsScene ps; private IMeshingPlugin imp; - + [SetUp] public void Initialize() { @@ -96,11 +96,11 @@ namespace OpenSim.Region.Physics.OdePlugin Assert.That(!oprim.m_taintadd); Console.WriteLine("Prim Position (" + oprim.m_localID + "): " + prim.Position.ToString()); - + // Make sure we're above the ground //Assert.That(prim.Position.Z > 20f); //Console.WriteLine("PrimCollisionScore (" + oprim.m_localID + "): " + oprim.m_collisionscore); - + // Make sure we've got a Body Assert.That(oprim.Body != (IntPtr)0); //Console.WriteLine( diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 3f8aa26..f285911 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -252,7 +252,6 @@ namespace OpenSim.Region.Physics.OdePlugin public int physics_logging_interval = 0; public bool physics_logging_append_existing_logfile = false; - /// /// Initiailizes the scene /// Sets many properties that ODE requires to be stable @@ -352,14 +351,13 @@ namespace OpenSim.Region.Physics.OdePlugin geomDefaultDensity = physicsconfig.GetFloat("geometry_default_density", 10.000006836f); bodyFramesAutoDisable = physicsconfig.GetInt("body_frames_auto_disable", 20); - + bodyPIDD = physicsconfig.GetFloat("body_pid_derivative", 35f); bodyPIDG = physicsconfig.GetFloat("body_pid_gain", 25f); meshSculptedPrim = physicsconfig.GetBoolean("mesh_sculpted_prim", true); meshSculptLOD = physicsconfig.GetFloat("mesh_lod", 32f); MeshSculptphysicalLOD = physicsconfig.GetFloat("mesh_physical_lod", 16f); - if (Environment.OSVersion.Platform == PlatformID.Unix) { @@ -367,7 +365,6 @@ namespace OpenSim.Region.Physics.OdePlugin avPIDP = physicsconfig.GetFloat("av_pid_proportional_linux", 1400.0f); avStandupTensor = physicsconfig.GetFloat("av_capsule_standup_tensor_linux", 2000000f); bodyMotorJointMaxforceTensor = physicsconfig.GetFloat("body_motor_joint_maxforce_tensor_linux", 2f); - } else { @@ -547,7 +544,6 @@ namespace OpenSim.Region.Physics.OdePlugin } catch (AccessViolationException) { - m_log.Warn("[PHYSICS]: Unable to collide test an object"); return; } @@ -603,7 +599,6 @@ namespace OpenSim.Region.Physics.OdePlugin p2.CollidingGround = true; break; } - // we don't want prim or avatar to explode @@ -850,87 +845,87 @@ namespace OpenSim.Region.Physics.OdePlugin case ActorTypes.Agent: cc2 = (OdeCharacter)p2; - // obj1LocalID = cc2.m_localID; - switch ((ActorTypes)p1.PhysicsActorType) - { - case ActorTypes.Agent: - cc1 = (OdeCharacter)p1; - obj2LocalID = cc1.m_localID; - cc1.AddCollisionEvent(cc2.m_localID, collisiondepth); - //ctype = (int)CollisionCategories.Character; - - //if (cc1.CollidingObj) - //cStartStop = (int)StatusIndicators.Generic; - //else - //cStartStop = (int)StatusIndicators.Start; - - //returncollisions = true; - break; - case ActorTypes.Prim: - cp1 = (OdePrim)p1; - obj2LocalID = cp1.m_localID; - cp1.AddCollisionEvent(cc2.m_localID, collisiondepth); - //ctype = (int)CollisionCategories.Geom; - - //if (cp1.CollidingObj) - //cStartStop = (int)StatusIndicators.Generic; - //else - //cStartStop = (int)StatusIndicators.Start; - - //returncollisions = true; - break; - - case ActorTypes.Ground: - case ActorTypes.Unknown: - obj2LocalID = 0; - //ctype = (int)CollisionCategories.Land; - //returncollisions = true; - break; - } + // obj1LocalID = cc2.m_localID; + switch ((ActorTypes)p1.PhysicsActorType) + { + case ActorTypes.Agent: + cc1 = (OdeCharacter)p1; + obj2LocalID = cc1.m_localID; + cc1.AddCollisionEvent(cc2.m_localID, collisiondepth); + //ctype = (int)CollisionCategories.Character; + + //if (cc1.CollidingObj) + //cStartStop = (int)StatusIndicators.Generic; + //else + //cStartStop = (int)StatusIndicators.Start; + + //returncollisions = true; + break; + case ActorTypes.Prim: + cp1 = (OdePrim)p1; + obj2LocalID = cp1.m_localID; + cp1.AddCollisionEvent(cc2.m_localID, collisiondepth); + //ctype = (int)CollisionCategories.Geom; + + //if (cp1.CollidingObj) + //cStartStop = (int)StatusIndicators.Generic; + //else + //cStartStop = (int)StatusIndicators.Start; + + //returncollisions = true; + break; + + case ActorTypes.Ground: + case ActorTypes.Unknown: + obj2LocalID = 0; + //ctype = (int)CollisionCategories.Land; + //returncollisions = true; + break; + } cc2.AddCollisionEvent(obj2LocalID, collisiondepth); break; case ActorTypes.Prim: cp2 = (OdePrim)p2; - // obj1LocalID = cp2.m_localID; - switch ((ActorTypes)p1.PhysicsActorType) - { - case ActorTypes.Agent: - cc1 = (OdeCharacter)p1; - obj2LocalID = cc1.m_localID; - cc1.AddCollisionEvent(cp2.m_localID, collisiondepth); - //ctype = (int)CollisionCategories.Character; - - //if (cc1.CollidingObj) - //cStartStop = (int)StatusIndicators.Generic; - //else - //cStartStop = (int)StatusIndicators.Start; - //returncollisions = true; - - break; - case ActorTypes.Prim: - cp1 = (OdePrim)p1; - obj2LocalID = cp1.m_localID; - cp1.AddCollisionEvent(cp2.m_localID, collisiondepth); - //ctype = (int)CollisionCategories.Geom; - - //if (cp1.CollidingObj) - //cStartStop = (int)StatusIndicators.Generic; - //else - //cStartStop = (int)StatusIndicators.Start; - - //returncollisions = true; - break; - - case ActorTypes.Ground: - case ActorTypes.Unknown: - obj2LocalID = 0; - //ctype = (int)CollisionCategories.Land; - - //returncollisions = true; - break; - } + // obj1LocalID = cp2.m_localID; + switch ((ActorTypes)p1.PhysicsActorType) + { + case ActorTypes.Agent: + cc1 = (OdeCharacter)p1; + obj2LocalID = cc1.m_localID; + cc1.AddCollisionEvent(cp2.m_localID, collisiondepth); + //ctype = (int)CollisionCategories.Character; + + //if (cc1.CollidingObj) + //cStartStop = (int)StatusIndicators.Generic; + //else + //cStartStop = (int)StatusIndicators.Start; + //returncollisions = true; + + break; + case ActorTypes.Prim: + cp1 = (OdePrim)p1; + obj2LocalID = cp1.m_localID; + cp1.AddCollisionEvent(cp2.m_localID, collisiondepth); + //ctype = (int)CollisionCategories.Geom; + + //if (cp1.CollidingObj) + //cStartStop = (int)StatusIndicators.Generic; + //else + //cStartStop = (int)StatusIndicators.Start; + + //returncollisions = true; + break; + + case ActorTypes.Ground: + case ActorTypes.Unknown: + obj2LocalID = 0; + //ctype = (int)CollisionCategories.Land; + + //returncollisions = true; + break; + } cp2.AddCollisionEvent(obj2LocalID, collisiondepth); break; @@ -1015,7 +1010,6 @@ namespace OpenSim.Region.Physics.OdePlugin /// private void collision_optimized(float timeStep) { - foreach (OdeCharacter chr in _characters) { // Reset the collision values to false @@ -1579,7 +1573,7 @@ namespace OpenSim.Region.Physics.OdePlugin // if (pbs.ProfileShape == ProfileShape.EquilateralTriangle) // return true; - + // return false; @@ -1625,7 +1619,6 @@ namespace OpenSim.Region.Physics.OdePlugin //m_log.Info(timeStep.ToString()); step_time += timeStep; - // If We're loaded down by something else, // or debugging with the Visual Studio project on pause // skip a few frames to catch up gracefully. @@ -1739,7 +1732,6 @@ namespace OpenSim.Region.Physics.OdePlugin } d.WorldQuickStep(world, ODE_STEPSIZE); - d.JointGroupEmpty(contactgroup); //ode.dunlock(world); } @@ -2075,7 +2067,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (resultarr2[y, x] <= 0) { returnarr[i] = 0.0000001f; - + } else returnarr[i] = resultarr2[y, x]; -- cgit v1.1