fixed some ugliness in the conversion from the new mesher format to the old that should speed up region startup a little and maybe even use less memory if the GC decides to play friendly with the other kids.
parent
10b2a4597a
commit
35ad484b6b
|
@ -179,13 +179,14 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Coord c = primMesh.coords[i];
|
||||
int resultIndex = 3 * i;
|
||||
result[resultIndex++] = c.X;
|
||||
result[resultIndex++] = c.Y;
|
||||
result[resultIndex] = c.Z;
|
||||
{
|
||||
int resultIndex = 3 * i;
|
||||
result[resultIndex] = c.X;
|
||||
result[resultIndex + 1] = c.Y;
|
||||
result[resultIndex + 2] = c.Z;
|
||||
}
|
||||
|
||||
}
|
||||
//primMesh.coords = null;
|
||||
pinnedVirtexes = GCHandle.Alloc(result, GCHandleType.Pinned);
|
||||
}
|
||||
return result;
|
||||
|
@ -213,12 +214,15 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
for (int i = 0; i < numFaces; i++)
|
||||
{
|
||||
Face f = primMesh.faces[i];
|
||||
Coord c1 = primMesh.coords[f.v1];
|
||||
Coord c2 = primMesh.coords[f.v2];
|
||||
Coord c3 = primMesh.coords[f.v3];
|
||||
|
||||
int resultIndex = i * 3;
|
||||
result[resultIndex++] = f.v1;
|
||||
result[resultIndex++] = f.v2;
|
||||
result[resultIndex] = f.v3;
|
||||
result[resultIndex] = f.v1;
|
||||
result[resultIndex + 1] = f.v2;
|
||||
result[resultIndex + 2] = f.v3;
|
||||
}
|
||||
//primMesh.faces = null;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1971,21 +1971,39 @@ namespace OpenSim.Region.Physics.Meshing
|
|||
|
||||
primMesh.Scale(size.X, size.Y, size.Z);
|
||||
|
||||
int numCoords = primMesh.coords.Count;
|
||||
int numFaces = primMesh.faces.Count;
|
||||
|
||||
List<Coord> coords = primMesh.coords;
|
||||
for (int i = 0; i < numCoords; i++)
|
||||
{
|
||||
Coord c = coords[i];
|
||||
mesh.vertices.Add(new Vertex(c.X, c.Y, c.Z));
|
||||
}
|
||||
|
||||
List<Face> faces = primMesh.faces;
|
||||
List<Vertex> vertices = mesh.vertices;
|
||||
|
||||
for (int i = 0; i < numFaces; i++)
|
||||
{
|
||||
Face f = primMesh.faces[i];
|
||||
Coord vert = primMesh.coords[f.v1];
|
||||
Vertex v1 = new Vertex(vert.X, vert.Y, vert.Z);
|
||||
mesh.vertices.Add(v1);
|
||||
vert = primMesh.coords[f.v2];
|
||||
Vertex v2 = new Vertex(vert.X, vert.Y, vert.Z);
|
||||
mesh.vertices.Add(v2);
|
||||
vert = primMesh.coords[f.v3];
|
||||
Vertex v3 = new Vertex(vert.X, vert.Y, vert.Z);
|
||||
mesh.vertices.Add(v3);
|
||||
mesh.triangles.Add(new Triangle(v1, v2, v3));
|
||||
Face f = faces[i];
|
||||
mesh.triangles.Add(new Triangle(vertices[f.v1], vertices[f.v2], vertices[f.v3]));
|
||||
}
|
||||
|
||||
//for (int i = 0; i < numFaces; i++)
|
||||
//{
|
||||
// Face f = primMesh.faces[i];
|
||||
// Coord vert = primMesh.coords[f.v1];
|
||||
// Vertex v1 = new Vertex(vert.X, vert.Y, vert.Z);
|
||||
// mesh.vertices.Add(v1);
|
||||
// vert = primMesh.coords[f.v2];
|
||||
// Vertex v2 = new Vertex(vert.X, vert.Y, vert.Z);
|
||||
// mesh.vertices.Add(v2);
|
||||
// vert = primMesh.coords[f.v3];
|
||||
// Vertex v3 = new Vertex(vert.X, vert.Y, vert.Z);
|
||||
// mesh.vertices.Add(v3);
|
||||
// mesh.triangles.Add(new Triangle(v1, v2, v3));
|
||||
//}
|
||||
|
||||
//mesh.DumpRaw(baseDir, primName, "Mesh");
|
||||
|
||||
|
|
Loading…
Reference in New Issue