* Instead of referencing mesh stuff in the physics plugin.. change the IMesh Interface. (blame prebuild)

0.6.5-rc1
Teravus Ovares 2009-04-11 00:11:54 +00:00
parent daac8ad2db
commit 53026affb3
5 changed files with 37 additions and 26 deletions

View File

@ -927,10 +927,10 @@ namespace OpenSim.Region.Framework.Scenes
{ {
throw; throw;
} }
catch (AccessViolationException e) //catch (AccessViolationException e)
{ //{
m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); // m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
} //}
//catch (NullReferenceException e) //catch (NullReferenceException e)
//{ //{
// m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); // 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); m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
} }
catch (Exception e) //catch (Exception e)
{ //{
m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); // m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
} //}
finally finally
{ {
//updateLock.ReleaseMutex(); //updateLock.ReleaseMutex();

View File

@ -35,7 +35,7 @@ using OpenMetaverse;
using BulletDotNET; using BulletDotNET;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using OpenSim.Region.Physics.Meshing;
namespace OpenSim.Region.Physics.BulletDotNETPlugin 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); IMesh mesh = _parent_scene.mesher.CreateMesh(SOPName, _pbs, _size, meshlod, IsPhysical);
if (!positionOffset.IsIdentical(PhysicsVector.Zero,0.001f) || orientation != Quaternion.Identity) if (!positionOffset.IsIdentical(PhysicsVector.Zero,0.001f) || orientation != Quaternion.Identity)
{ {
if (mesh is Mesh)
{
float[] xyz = new float[3]; float[] xyz = new float[3];
xyz[0] = positionOffset.X; xyz[0] = positionOffset.X;
xyz[1] = positionOffset.Y; xyz[1] = positionOffset.Y;
@ -1033,10 +1032,10 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
matrix[2, 1] = m4.M32; matrix[2, 1] = m4.M32;
matrix[2, 2] = m4.M33; matrix[2, 2] = m4.M33;
Mesh mesh2 = (Mesh) mesh;
mesh2.TransformLinear(matrix, xyz); mesh.TransformLinear(matrix, xyz);
mesh = (IMesh)mesh2;
}
} }
@ -2120,7 +2119,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity); ProcessGeomCreationAsTriMesh(PhysicsVector.Zero, Quaternion.Identity);
// createmesh returns null when it doesn't mesh. // createmesh returns null when it doesn't mesh.
/*
if (_mesh is 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"); m_log.Warn("[PHYSICS]: Can't link a OpenSim.Region.Physics.Meshing.Mesh object");
return; return;
} }
Mesh pMesh = (Mesh) _mesh; */
foreach (BulletDotNETPrim chld in childrenPrim) foreach (BulletDotNETPrim chld in childrenPrim)
{ {
@ -2141,13 +2142,12 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin
//pos *= Orientation; //pos *= Orientation;
offset.setValues(pos.X, pos.Y, pos.Z); offset.setValues(pos.X, pos.Y, pos.Z);
chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation); chld.ProcessGeomCreationAsTriMesh(offset, chld.Orientation);
if (chld._mesh is Mesh)
{ _mesh.Append(chld._mesh);
pMesh.Append((Mesh)chld._mesh);
}
} }
setMesh(_parent_scene, pMesh); setMesh(_parent_scene, _mesh);
//} //}

View File

@ -49,5 +49,7 @@ namespace OpenSim.Region.Physics.Manager
float[] getVertexListAsFloatLocked(); float[] getVertexListAsFloatLocked();
void releaseSourceMeshData(); void releaseSourceMeshData();
void releasePinned(); void releasePinned();
void Append(IMesh newMesh);
void TransformLinear(float[,] matrix, float[] offset);
} }
} }

View File

@ -296,12 +296,22 @@ namespace OpenSim.Region.Physics.Meshing
primMesh = null; 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); vertices.Add(v);
foreach (Triangle t in newMesh.triangles) foreach (Triangle t in newMesh2.triangles)
Add(t); Add(t);
} }

View File

@ -556,7 +556,6 @@
<Reference name="BulletDotNET.dll" /> <Reference name="BulletDotNET.dll" />
<Reference name="nunit.framework.dll" /> <Reference name="nunit.framework.dll" />
<Reference name="log4net.dll"/> <Reference name="log4net.dll"/>
<Reference name="./Physics/OpenSim.Region.Physics.Meshing"/>
<Files> <Files>
<Match pattern="*.cs" recurse="true"/> <Match pattern="*.cs" recurse="true"/>