From 53026affb315816280ef8649e0f9694e81280540 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 11 Apr 2009 00:11:54 +0000 Subject: * Instead of referencing mesh stuff in the physics plugin.. change the IMesh Interface. (blame prebuild) --- OpenSim/Region/Framework/Scenes/Scene.cs | 16 ++++++------- .../Physics/BulletDotNETPlugin/BulletDotNETPrim.cs | 28 +++++++++++----------- OpenSim/Region/Physics/Manager/IMesher.cs | 2 ++ OpenSim/Region/Physics/Meshing/Mesh.cs | 16 ++++++++++--- 4 files changed, 37 insertions(+), 25 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 54c420d..b79918a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -927,10 +927,10 @@ namespace OpenSim.Region.Framework.Scenes { throw; } - catch (AccessViolationException e) - { - m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); - } + //catch (AccessViolationException e) + //{ + // m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); + //} //catch (NullReferenceException e) //{ // m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); @@ -939,10 +939,10 @@ namespace OpenSim.Region.Framework.Scenes { m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); } - catch (Exception e) - { - m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); - } + //catch (Exception e) + //{ + // m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); + //} finally { //updateLock.ReleaseMutex(); diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs index 0f54a9f..9f68f02 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs @@ -35,7 +35,7 @@ using OpenMetaverse; using BulletDotNET; using OpenSim.Framework; using OpenSim.Region.Physics.Manager; -using OpenSim.Region.Physics.Meshing; + namespace OpenSim.Region.Physics.BulletDotNETPlugin { @@ -1012,8 +1012,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical); if (!positionOffset.IsIdentical(PhysicsVector.Zero,0.001f) || orientation != Quaternion.Identity) { - if (mesh is Mesh) - { + float[] xyz = new float[3]; xyz[0] = positionOffset.X; xyz[1] = positionOffset.Y; @@ -1033,10 +1032,10 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin matrix[2, 1] = m4.M32; matrix[2, 2] = m4.M33; - Mesh mesh2 = (Mesh) mesh; - mesh2.TransformLinear(matrix, xyz); - mesh = (IMesh)mesh2; - } + + mesh.TransformLinear(matrix, xyz); + + } @@ -2120,7 +2119,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity); // createmesh returns null when it doesn't mesh. - + /* if (_mesh is Mesh) { } @@ -2129,7 +2128,9 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin m_log.Warn("[PHYSICS]: Can't link a OpenSim.Region.Physics.Meshing.Mesh object"); return; } - Mesh pMesh = (Mesh) _mesh; + */ + + foreach (BulletDotNETPrim chld in childrenPrim) { @@ -2141,13 +2142,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin //pos *= Orientation; offset.setValues(pos.X, pos.Y, pos.Z); chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation); - if (chld._mesh is Mesh) - { - pMesh.Append((Mesh)chld._mesh); - } + + _mesh.Append(chld._mesh); + } - setMesh(_parent_scene, pMesh); + setMesh(_parent_scene, _mesh); //} diff --git a/OpenSim/Region/Physics/Manager/IMesher.cs b/OpenSim/Region/Physics/Manager/IMesher.cs index fa13787..29f58f3 100644 --- a/OpenSim/Region/Physics/Manager/IMesher.cs +++ b/OpenSim/Region/Physics/Manager/IMesher.cs @@ -49,5 +49,7 @@ namespace OpenSim.Region.Physics.Manager float[] getVertexListAsFloatLocked(); void releaseSourceMeshData(); void releasePinned(); + void Append(IMesh newMesh); + void TransformLinear(float[,] matrix, float[] offset); } } diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs index 5a565ff..719e364 100644 --- a/OpenSim/Region/Physics/Meshing/Mesh.cs +++ b/OpenSim/Region/Physics/Meshing/Mesh.cs @@ -296,12 +296,22 @@ namespace OpenSim.Region.Physics.Meshing primMesh = null; } - public void Append(Mesh newMesh) + public void Append(IMesh newMesh) { - foreach (Vertex v in newMesh.vertices) + Mesh newMesh2; + if (newMesh is Mesh) + { + newMesh2 = (Mesh)newMesh; + } + else + { + return; + } + + foreach (Vertex v in newMesh2.vertices) vertices.Add(v); - foreach (Triangle t in newMesh.triangles) + foreach (Triangle t in newMesh2.triangles) Add(t); } -- cgit v1.1