aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Meshing/Extruder.cs
diff options
context:
space:
mode:
authorJeff Ames2007-11-11 09:19:21 +0000
committerJeff Ames2007-11-11 09:19:21 +0000
commitdb174dfa2061ce35b657cd8f119f1176b53c6207 (patch)
tree7ff889f817ab0ebac5a90c6adbecf4a263239a73 /OpenSim/Region/Physics/Meshing/Extruder.cs
parentfixed chatting while sitting (diff)
downloadopensim-SC_OLD-db174dfa2061ce35b657cd8f119f1176b53c6207.zip
opensim-SC_OLD-db174dfa2061ce35b657cd8f119f1176b53c6207.tar.gz
opensim-SC_OLD-db174dfa2061ce35b657cd8f119f1176b53c6207.tar.bz2
opensim-SC_OLD-db174dfa2061ce35b657cd8f119f1176b53c6207.tar.xz
set svn:eol-style
Diffstat (limited to 'OpenSim/Region/Physics/Meshing/Extruder.cs')
-rw-r--r--OpenSim/Region/Physics/Meshing/Extruder.cs166
1 files changed, 83 insertions, 83 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Extruder.cs b/OpenSim/Region/Physics/Meshing/Extruder.cs
index 63d727f..c8fd91b 100644
--- a/OpenSim/Region/Physics/Meshing/Extruder.cs
+++ b/OpenSim/Region/Physics/Meshing/Extruder.cs
@@ -1,83 +1,83 @@
1using System; 1using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using System.Text; 3using System.Text;
4 4
5namespace OpenSim.Region.Physics.Meshing 5namespace OpenSim.Region.Physics.Meshing
6{ 6{
7 class Extruder 7 class Extruder
8 { 8 {
9 public float startParameter; 9 public float startParameter;
10 public float stopParameter; 10 public float stopParameter;
11 public Manager.PhysicsVector size; 11 public Manager.PhysicsVector size;
12 12
13 public Mesh Extrude(Mesh m) 13 public Mesh Extrude(Mesh m)
14 { 14 {
15 // Currently only works for iSteps=1; 15 // Currently only works for iSteps=1;
16 Mesh result = new Mesh(); 16 Mesh result = new Mesh();
17 17
18 Mesh workingPlus = m.Clone(); 18 Mesh workingPlus = m.Clone();
19 Mesh workingMinus = m.Clone(); 19 Mesh workingMinus = m.Clone();
20 20
21 foreach (Vertex v in workingPlus.vertices) 21 foreach (Vertex v in workingPlus.vertices)
22 { 22 {
23 if (v == null) 23 if (v == null)
24 continue; 24 continue;
25 25
26 v.Z = +.5f; 26 v.Z = +.5f;
27 v.X *= size.X; 27 v.X *= size.X;
28 v.Y *= size.Y; 28 v.Y *= size.Y;
29 v.Z *= size.Z; 29 v.Z *= size.Z;
30 } 30 }
31 31
32 foreach (Vertex v in workingMinus.vertices) 32 foreach (Vertex v in workingMinus.vertices)
33 { 33 {
34 if (v == null) 34 if (v == null)
35 continue; 35 continue;
36 36
37 v.Z = -.5f; 37 v.Z = -.5f;
38 v.X *= size.X; 38 v.X *= size.X;
39 v.Y *= size.Y; 39 v.Y *= size.Y;
40 v.Z *= size.Z; 40 v.Z *= size.Z;
41 } 41 }
42 42
43 foreach (Triangle t in workingMinus.triangles) 43 foreach (Triangle t in workingMinus.triangles)
44 { 44 {
45 t.invertNormal(); 45 t.invertNormal();
46 } 46 }
47 47
48 result.Append(workingMinus); 48 result.Append(workingMinus);
49 result.Append(workingPlus); 49 result.Append(workingPlus);
50 50
51 int iLastNull = 0; 51 int iLastNull = 0;
52 for (int i = 0; i < workingPlus.vertices.Count; i++) 52 for (int i = 0; i < workingPlus.vertices.Count; i++)
53 { 53 {
54 int iNext = (i + 1); 54 int iNext = (i + 1);
55 55
56 if (workingPlus.vertices[i] == null) // Can't make a simplex here 56 if (workingPlus.vertices[i] == null) // Can't make a simplex here
57 { 57 {
58 iLastNull = i+1; 58 iLastNull = i+1;
59 continue; 59 continue;
60 } 60 }
61 61
62 if (i == workingPlus.vertices.Count-1) // End of list 62 if (i == workingPlus.vertices.Count-1) // End of list
63 { 63 {
64 iNext = iLastNull; 64 iNext = iLastNull;
65 } 65 }
66 66
67 if (workingPlus.vertices[iNext] == null) // Null means wrap to begin of last segment 67 if (workingPlus.vertices[iNext] == null) // Null means wrap to begin of last segment
68 { 68 {
69 iNext = iLastNull; 69 iNext = iLastNull;
70 } 70 }
71 71
72 Triangle tSide; 72 Triangle tSide;
73 tSide = new Triangle(workingPlus.vertices[i], workingMinus.vertices[i], workingPlus.vertices[iNext]); 73 tSide = new Triangle(workingPlus.vertices[i], workingMinus.vertices[i], workingPlus.vertices[iNext]);
74 result.Add(tSide); 74 result.Add(tSide);
75 75
76 tSide = new Triangle(workingPlus.vertices[iNext], workingMinus.vertices[i], workingMinus.vertices[iNext]); 76 tSide = new Triangle(workingPlus.vertices[iNext], workingMinus.vertices[i], workingMinus.vertices[iNext]);
77 result.Add(tSide); 77 result.Add(tSide);
78 } 78 }
79 79
80 return result; 80 return result;
81 } 81 }
82 } 82 }
83} 83}