diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Mesh.cs | 22 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 40 |
2 files changed, 42 insertions, 20 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Mesh.cs b/OpenSim/Region/Physics/Meshing/Mesh.cs index 4630d98..16ac453 100644 --- a/OpenSim/Region/Physics/Meshing/Mesh.cs +++ b/OpenSim/Region/Physics/Meshing/Mesh.cs | |||
@@ -179,13 +179,14 @@ namespace OpenSim.Region.Physics.Meshing | |||
179 | for (int i = 0; i < count; i++) | 179 | for (int i = 0; i < count; i++) |
180 | { | 180 | { |
181 | Coord c = primMesh.coords[i]; | 181 | Coord c = primMesh.coords[i]; |
182 | int resultIndex = 3 * i; | 182 | { |
183 | result[resultIndex++] = c.X; | 183 | int resultIndex = 3 * i; |
184 | result[resultIndex++] = c.Y; | 184 | result[resultIndex] = c.X; |
185 | result[resultIndex] = c.Z; | 185 | result[resultIndex + 1] = c.Y; |
186 | result[resultIndex + 2] = c.Z; | ||
187 | } | ||
186 | 188 | ||
187 | } | 189 | } |
188 | //primMesh.coords = null; | ||
189 | pinnedVirtexes = GCHandle.Alloc(result, GCHandleType.Pinned); | 190 | pinnedVirtexes = GCHandle.Alloc(result, GCHandleType.Pinned); |
190 | } | 191 | } |
191 | return result; | 192 | return result; |
@@ -213,12 +214,15 @@ namespace OpenSim.Region.Physics.Meshing | |||
213 | for (int i = 0; i < numFaces; i++) | 214 | for (int i = 0; i < numFaces; i++) |
214 | { | 215 | { |
215 | Face f = primMesh.faces[i]; | 216 | Face f = primMesh.faces[i]; |
217 | Coord c1 = primMesh.coords[f.v1]; | ||
218 | Coord c2 = primMesh.coords[f.v2]; | ||
219 | Coord c3 = primMesh.coords[f.v3]; | ||
220 | |||
216 | int resultIndex = i * 3; | 221 | int resultIndex = i * 3; |
217 | result[resultIndex++] = f.v1; | 222 | result[resultIndex] = f.v1; |
218 | result[resultIndex++] = f.v2; | 223 | result[resultIndex + 1] = f.v2; |
219 | result[resultIndex] = f.v3; | 224 | result[resultIndex + 2] = f.v3; |
220 | } | 225 | } |
221 | //primMesh.faces = null; | ||
222 | } | 226 | } |
223 | return result; | 227 | return result; |
224 | } | 228 | } |
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 7cf8b76..ecde92a 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -1971,21 +1971,39 @@ namespace OpenSim.Region.Physics.Meshing | |||
1971 | 1971 | ||
1972 | primMesh.Scale(size.X, size.Y, size.Z); | 1972 | primMesh.Scale(size.X, size.Y, size.Z); |
1973 | 1973 | ||
1974 | int numCoords = primMesh.coords.Count; | ||
1974 | int numFaces = primMesh.faces.Count; | 1975 | int numFaces = primMesh.faces.Count; |
1976 | |||
1977 | List<Coord> coords = primMesh.coords; | ||
1978 | for (int i = 0; i < numCoords; i++) | ||
1979 | { | ||
1980 | Coord c = coords[i]; | ||
1981 | mesh.vertices.Add(new Vertex(c.X, c.Y, c.Z)); | ||
1982 | } | ||
1983 | |||
1984 | List<Face> faces = primMesh.faces; | ||
1985 | List<Vertex> vertices = mesh.vertices; | ||
1986 | |||
1975 | for (int i = 0; i < numFaces; i++) | 1987 | for (int i = 0; i < numFaces; i++) |
1976 | { | 1988 | { |
1977 | Face f = primMesh.faces[i]; | 1989 | Face f = faces[i]; |
1978 | Coord vert = primMesh.coords[f.v1]; | 1990 | mesh.triangles.Add(new Triangle(vertices[f.v1], vertices[f.v2], vertices[f.v3])); |
1979 | Vertex v1 = new Vertex(vert.X, vert.Y, vert.Z); | ||
1980 | mesh.vertices.Add(v1); | ||
1981 | vert = primMesh.coords[f.v2]; | ||
1982 | Vertex v2 = new Vertex(vert.X, vert.Y, vert.Z); | ||
1983 | mesh.vertices.Add(v2); | ||
1984 | vert = primMesh.coords[f.v3]; | ||
1985 | Vertex v3 = new Vertex(vert.X, vert.Y, vert.Z); | ||
1986 | mesh.vertices.Add(v3); | ||
1987 | mesh.triangles.Add(new Triangle(v1, v2, v3)); | ||
1988 | } | 1991 | } |
1992 | |||
1993 | //for (int i = 0; i < numFaces; i++) | ||
1994 | //{ | ||
1995 | // Face f = primMesh.faces[i]; | ||
1996 | // Coord vert = primMesh.coords[f.v1]; | ||
1997 | // Vertex v1 = new Vertex(vert.X, vert.Y, vert.Z); | ||
1998 | // mesh.vertices.Add(v1); | ||
1999 | // vert = primMesh.coords[f.v2]; | ||
2000 | // Vertex v2 = new Vertex(vert.X, vert.Y, vert.Z); | ||
2001 | // mesh.vertices.Add(v2); | ||
2002 | // vert = primMesh.coords[f.v3]; | ||
2003 | // Vertex v3 = new Vertex(vert.X, vert.Y, vert.Z); | ||
2004 | // mesh.vertices.Add(v3); | ||
2005 | // mesh.triangles.Add(new Triangle(v1, v2, v3)); | ||
2006 | //} | ||
1989 | 2007 | ||
1990 | //mesh.DumpRaw(baseDir, primName, "Mesh"); | 2008 | //mesh.DumpRaw(baseDir, primName, "Mesh"); |
1991 | 2009 | ||