diff options
author | Teravus Ovares | 2008-04-10 00:31:44 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-10 00:31:44 +0000 |
commit | b85624db1832c54ea2a8b3d53d93b8ca60a18a38 (patch) | |
tree | c6f831b8aa53c2a9c1b5dfbbc95dffa6e5c4607d /OpenSim/Region | |
parent | Update svn properties. (diff) | |
download | opensim-SC_OLD-b85624db1832c54ea2a8b3d53d93b8ca60a18a38.zip opensim-SC_OLD-b85624db1832c54ea2a8b3d53d93b8ca60a18a38.tar.gz opensim-SC_OLD-b85624db1832c54ea2a8b3d53d93b8ca60a18a38.tar.bz2 opensim-SC_OLD-b85624db1832c54ea2a8b3d53d93b8ca60a18a38.tar.xz |
* Adds twist support for Cubes, Cylinders, and Prisms in the Meshmerizer
* A tweak of the SimStatsReporter so it would report the prim capacity to be 45000.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Extruder.cs | 116 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Meshing/HelperTypes.cs | 136 | ||||
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 119 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 3 |
5 files changed, 365 insertions, 11 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index 68140f4..ef741d4 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs | |||
@@ -152,7 +152,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
152 | { | 152 | { |
153 | statpack.Region.RegionFlags = (uint) 0; | 153 | statpack.Region.RegionFlags = (uint) 0; |
154 | } | 154 | } |
155 | statpack.Region.ObjectCapacity = (uint) 15000; | 155 | statpack.Region.ObjectCapacity = (uint) 45000; |
156 | 156 | ||
157 | #region various statistic googly moogly | 157 | #region various statistic googly moogly |
158 | 158 | ||
diff --git a/OpenSim/Region/Physics/Meshing/Extruder.cs b/OpenSim/Region/Physics/Meshing/Extruder.cs index 4d2ed4b..c7dcf33 100644 --- a/OpenSim/Region/Physics/Meshing/Extruder.cs +++ b/OpenSim/Region/Physics/Meshing/Extruder.cs | |||
@@ -39,9 +39,15 @@ namespace OpenSim.Region.Physics.Meshing | |||
39 | public float taperTopFactorY = 1f; | 39 | public float taperTopFactorY = 1f; |
40 | public float taperBotFactorX = 1f; | 40 | public float taperBotFactorX = 1f; |
41 | public float taperBotFactorY = 1f; | 41 | public float taperBotFactorY = 1f; |
42 | |||
42 | public float pushX = 0f; | 43 | public float pushX = 0f; |
43 | public float pushY = 0f; | 44 | public float pushY = 0f; |
44 | 45 | ||
46 | // twist amount in radians. NOT DEGREES. | ||
47 | public float twistTop = 0; | ||
48 | public float twistBot = 0; | ||
49 | public float twistMid = 0; | ||
50 | |||
45 | public Mesh Extrude(Mesh m) | 51 | public Mesh Extrude(Mesh m) |
46 | { | 52 | { |
47 | startParameter = float.MinValue; | 53 | startParameter = float.MinValue; |
@@ -50,8 +56,12 @@ namespace OpenSim.Region.Physics.Meshing | |||
50 | Mesh result = new Mesh(); | 56 | Mesh result = new Mesh(); |
51 | 57 | ||
52 | Mesh workingPlus = m.Clone(); | 58 | Mesh workingPlus = m.Clone(); |
59 | Mesh workingMiddle = m.Clone(); | ||
53 | Mesh workingMinus = m.Clone(); | 60 | Mesh workingMinus = m.Clone(); |
54 | 61 | ||
62 | Quaternion tt = new Quaternion(); | ||
63 | Vertex v2 = new Vertex(0, 0, 0); | ||
64 | |||
55 | foreach (Vertex v in workingPlus.vertices) | 65 | foreach (Vertex v in workingPlus.vertices) |
56 | { | 66 | { |
57 | if (v == null) | 67 | if (v == null) |
@@ -68,8 +78,44 @@ namespace OpenSim.Region.Physics.Meshing | |||
68 | //Push the top of the object over by the Top Shear amount | 78 | //Push the top of the object over by the Top Shear amount |
69 | v.X += pushX * size.X; | 79 | v.X += pushX * size.X; |
70 | v.Y += pushY * size.X; | 80 | v.Y += pushY * size.X; |
81 | |||
82 | if (twistTop != 0) | ||
83 | { | ||
84 | // twist and shout | ||
85 | tt = new Quaternion(new Vertex(0, 0, 1), twistTop); | ||
86 | v2 = v * tt; | ||
87 | v.X = v2.X; | ||
88 | v.Y = v2.Y; | ||
89 | v.Z = v2.Z; | ||
90 | } | ||
71 | } | 91 | } |
72 | 92 | ||
93 | foreach (Vertex v in workingMiddle.vertices) | ||
94 | { | ||
95 | if (v == null) | ||
96 | continue; | ||
97 | |||
98 | // This is the top | ||
99 | // Set the Z + .5 to match the rest of the scale of the mesh | ||
100 | // Scale it by Size, and Taper the scaling | ||
101 | v.Z *= size.Z; | ||
102 | v.X *= (size.X * ((taperTopFactorX + taperBotFactorX) /2)); | ||
103 | v.Y *= (size.Y * ((taperTopFactorY + taperBotFactorY) / 2)); | ||
104 | |||
105 | v.X += (pushX / 2) * size.X; | ||
106 | v.Y += (pushY / 2) * size.X; | ||
107 | //Push the top of the object over by the Top Shear amount | ||
108 | if (twistMid != 0) | ||
109 | { | ||
110 | // twist and shout | ||
111 | tt = new Quaternion(new Vertex(0, 0, 1), twistMid); | ||
112 | v2 = v * tt; | ||
113 | v.X = v2.X; | ||
114 | v.Y = v2.Y; | ||
115 | v.Z = v2.Z; | ||
116 | } | ||
117 | |||
118 | } | ||
73 | foreach (Vertex v in workingMinus.vertices) | 119 | foreach (Vertex v in workingMinus.vertices) |
74 | { | 120 | { |
75 | if (v == null) | 121 | if (v == null) |
@@ -80,6 +126,16 @@ namespace OpenSim.Region.Physics.Meshing | |||
80 | v.X *= (size.X * taperBotFactorX); | 126 | v.X *= (size.X * taperBotFactorX); |
81 | v.Y *= (size.Y * taperBotFactorY); | 127 | v.Y *= (size.Y * taperBotFactorY); |
82 | v.Z *= size.Z; | 128 | v.Z *= size.Z; |
129 | |||
130 | if (twistBot != 0) | ||
131 | { | ||
132 | // twist and shout | ||
133 | tt = new Quaternion(new Vertex(0, 0, 1), twistBot); | ||
134 | v2 = v * tt; | ||
135 | v.X = v2.X; | ||
136 | v.Y = v2.Y; | ||
137 | v.Z = v2.Z; | ||
138 | } | ||
83 | } | 139 | } |
84 | 140 | ||
85 | foreach (Triangle t in workingMinus.triangles) | 141 | foreach (Triangle t in workingMinus.triangles) |
@@ -88,9 +144,47 @@ namespace OpenSim.Region.Physics.Meshing | |||
88 | } | 144 | } |
89 | 145 | ||
90 | result.Append(workingMinus); | 146 | result.Append(workingMinus); |
91 | result.Append(workingPlus); | 147 | |
148 | result.Append(workingMiddle); | ||
149 | |||
92 | 150 | ||
93 | int iLastNull = 0; | 151 | int iLastNull = 0; |
152 | |||
153 | for (int i = 0; i < workingMiddle.vertices.Count; i++) | ||
154 | { | ||
155 | int iNext = (i + 1); | ||
156 | |||
157 | if (workingMiddle.vertices[i] == null) // Can't make a simplex here | ||
158 | { | ||
159 | iLastNull = i + 1; | ||
160 | continue; | ||
161 | } | ||
162 | |||
163 | if (i == workingMiddle.vertices.Count - 1) // End of list | ||
164 | { | ||
165 | iNext = iLastNull; | ||
166 | } | ||
167 | |||
168 | if (workingMiddle.vertices[iNext] == null) // Null means wrap to begin of last segment | ||
169 | { | ||
170 | iNext = iLastNull; | ||
171 | } | ||
172 | |||
173 | Triangle tSide; | ||
174 | tSide = new Triangle(workingMiddle.vertices[i], workingMinus.vertices[i], workingMiddle.vertices[iNext]); | ||
175 | result.Add(tSide); | ||
176 | |||
177 | tSide = | ||
178 | new Triangle(workingMiddle.vertices[iNext], workingMinus.vertices[i], workingMinus.vertices[iNext]); | ||
179 | result.Add(tSide); | ||
180 | } | ||
181 | //foreach (Triangle t in workingPlus.triangles) | ||
182 | //{ | ||
183 | //t.invertNormal(); | ||
184 | // } | ||
185 | result.Append(workingPlus); | ||
186 | |||
187 | iLastNull = 0; | ||
94 | for (int i = 0; i < workingPlus.vertices.Count; i++) | 188 | for (int i = 0; i < workingPlus.vertices.Count; i++) |
95 | { | 189 | { |
96 | int iNext = (i + 1); | 190 | int iNext = (i + 1); |
@@ -112,14 +206,28 @@ namespace OpenSim.Region.Physics.Meshing | |||
112 | } | 206 | } |
113 | 207 | ||
114 | Triangle tSide; | 208 | Triangle tSide; |
115 | tSide = new Triangle(workingPlus.vertices[i], workingMinus.vertices[i], workingPlus.vertices[iNext]); | 209 | tSide = new Triangle(workingPlus.vertices[i], workingMiddle.vertices[i], workingPlus.vertices[iNext]); |
116 | result.Add(tSide); | 210 | result.Add(tSide); |
117 | 211 | ||
118 | tSide = | 212 | tSide = |
119 | new Triangle(workingPlus.vertices[iNext], workingMinus.vertices[i], workingMinus.vertices[iNext]); | 213 | new Triangle(workingPlus.vertices[iNext], workingMiddle.vertices[i], workingMiddle.vertices[iNext]); |
120 | result.Add(tSide); | 214 | result.Add(tSide); |
121 | } | 215 | } |
122 | 216 | if (twistMid != 0) | |
217 | { | ||
218 | foreach (Vertex v in result.vertices) | ||
219 | { | ||
220 | // twist and shout | ||
221 | if (v != null) | ||
222 | { | ||
223 | tt = new Quaternion(new Vertex(0, 0, -1), twistMid*2); | ||
224 | v2 = v * tt; | ||
225 | v.X = v2.X; | ||
226 | v.Y = v2.Y; | ||
227 | v.Z = v2.Z; | ||
228 | } | ||
229 | } | ||
230 | } | ||
123 | return result; | 231 | return result; |
124 | } | 232 | } |
125 | } | 233 | } |
diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/Physics/Meshing/HelperTypes.cs index 7b17a3f..efc5968 100644 --- a/OpenSim/Region/Physics/Meshing/HelperTypes.cs +++ b/OpenSim/Region/Physics/Meshing/HelperTypes.cs | |||
@@ -32,16 +32,136 @@ using System.Globalization; | |||
32 | using OpenSim.Region.Physics.Manager; | 32 | using OpenSim.Region.Physics.Manager; |
33 | using OpenSim.Region.Physics.Meshing; | 33 | using OpenSim.Region.Physics.Meshing; |
34 | 34 | ||
35 | public class Vertex : PhysicsVector, IComparable<Vertex> | 35 | public class Quaternion |
36 | { | 36 | { |
37 | public Vertex(float x, float y, float z) | 37 | public float x = 0; |
38 | : base(x, y, z) | 38 | public float y = 0; |
39 | public float z = 0; | ||
40 | public float w = 1; | ||
41 | |||
42 | public Quaternion() | ||
39 | { | 43 | { |
40 | } | ||
41 | 44 | ||
45 | } | ||
46 | public Quaternion(float x1, float y1, float z1, float w1) | ||
47 | { | ||
48 | x = x1; y = y1; z = z1; w = w1; | ||
49 | } | ||
50 | public Quaternion(Vertex axis, float angle) | ||
51 | { | ||
52 | // using (* 0.5) instead of (/2) | ||
53 | w = (float)Math.Cos(angle * 0.5f); | ||
54 | x = axis.X * (float)Math.Sin(angle * 0.5f); | ||
55 | y = axis.Y * (float)Math.Sin(angle * 0.5f); | ||
56 | z = axis.Z * (float)Math.Sin(angle * 0.5f); | ||
57 | normalize(); | ||
58 | } | ||
59 | public static Quaternion operator *(Quaternion a, Quaternion b) | ||
60 | { | ||
61 | Quaternion c = new Quaternion(); | ||
62 | c.x = a.w * b.x + a.x * b.w + a.y * b.z - a.z * b.y; | ||
63 | c.y = a.w * b.y + a.y * b.w + a.z * b.x - a.x * b.z; | ||
64 | c.z = a.w * b.z + a.z * b.w + a.x * b.y - a.y * b.x; | ||
65 | c.w = a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z; | ||
66 | return c; | ||
67 | } | ||
68 | |||
69 | |||
70 | public Matrix4 computeMatrix() | ||
71 | { | ||
72 | return new Matrix4(this); | ||
73 | } | ||
74 | public void normalize() | ||
75 | { | ||
76 | float mag = length(); | ||
77 | |||
78 | w /= mag; | ||
79 | x /= mag; | ||
80 | y /= mag; | ||
81 | z /= mag; | ||
82 | } | ||
42 | public float length() | 83 | public float length() |
43 | { | 84 | { |
44 | return (float)Math.Sqrt(X * X + Y * Y + Z * Z); | 85 | return (float)Math.Sqrt(w * w + x * x + y * y + z * z); |
86 | } | ||
87 | } | ||
88 | public class Matrix4 | ||
89 | { | ||
90 | public float m00 = 0; | ||
91 | public float m01 = 0; | ||
92 | public float m02 = 0; | ||
93 | public float m03 = 0; | ||
94 | public float m10 = 0; | ||
95 | public float m11 = 0; | ||
96 | public float m12 = 0; | ||
97 | public float m13 = 0; | ||
98 | public float m20 = 0; | ||
99 | public float m21 = 0; | ||
100 | public float m22 = 0; | ||
101 | public float m23 = 0; | ||
102 | public float m30 = 0; | ||
103 | public float m31 = 0; | ||
104 | public float m32 = 0; | ||
105 | public float m33 = 1; | ||
106 | |||
107 | public Matrix4(float m001, float m011, float m021, float m031, float m101, float m111, float m121, float m131, float m201, float m211, float m221, float m231, float m301, float m311, float m321, float m331) | ||
108 | { | ||
109 | m00 = m001; | ||
110 | m01 = m011; | ||
111 | m02 = m021; | ||
112 | m03 = m031; | ||
113 | m10 = m101; | ||
114 | m11 = m111; | ||
115 | m12 = m121; | ||
116 | m13 = m131; | ||
117 | m20 = m201; | ||
118 | m21 = m211; | ||
119 | m22 = m221; | ||
120 | m23 = m231; | ||
121 | m30 = m301; | ||
122 | m31 = m311; | ||
123 | m32 = m321; | ||
124 | m33 = m331; | ||
125 | } | ||
126 | public Matrix4() | ||
127 | { | ||
128 | } | ||
129 | public Matrix4(Quaternion r) | ||
130 | { | ||
131 | m00 = 1 - (2 * (r.y * r.y)) - (2 * (r.z * r.z)); | ||
132 | m01 = (r.x * r.y * 2) - (r.w * r.z * 2); | ||
133 | m02 = (r.x * r.z * 2) + (r.w * r.y * 2); | ||
134 | m03 = 0f; | ||
135 | m10 = (r.x * r.y * 2) + (r.w * r.z * 2); | ||
136 | m11 = 1 - (2 * (r.x * r.x)) - (2 * (r.z * r.z)); | ||
137 | m12 = (r.y * r.z * 2) - (r.w * r.x * 2); | ||
138 | m13 = 0f; | ||
139 | m20 = (r.x * r.z * 2) - (r.w * r.y * 2); | ||
140 | m21 = (r.y * r.z * 2) - (r.w * r.x * 2); | ||
141 | m22 = 1 - (2 * (r.x * r.x)) - (2 * (r.y * r.y)); | ||
142 | m23 = 0f; | ||
143 | m30 = 0f; | ||
144 | m31 = 0f; | ||
145 | m32 = 0f; | ||
146 | m33 = 1f; | ||
147 | } | ||
148 | public Vertex transform(Vertex o) | ||
149 | { | ||
150 | Vertex r = new Vertex(0,0,0); | ||
151 | // w value implicitly 1 therefore the last + m3x actually represents (m3x * o.W) = m3x | ||
152 | // in calculating the dot product. | ||
153 | r.X = (m00 * o.X) + (m10 * o.Y) + (m20 * o.Z) + m30; | ||
154 | r.Y = (m01 * o.X) + (m11 * o.Y) + (m21 * o.Z) + m31; | ||
155 | r.Z = (m02 * o.X) + (m12 * o.Y) + (m22 * o.Z) + m32; | ||
156 | return r; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | public class Vertex : PhysicsVector, IComparable<Vertex> | ||
161 | { | ||
162 | public Vertex(float x, float y, float z) | ||
163 | : base(x, y, z) | ||
164 | { | ||
45 | } | 165 | } |
46 | 166 | ||
47 | public Vertex normalize() | 167 | public Vertex normalize() |
@@ -62,6 +182,12 @@ public class Vertex : PhysicsVector, IComparable<Vertex> | |||
62 | return new Vertex(Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - Y * v.X); | 182 | return new Vertex(Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - Y * v.X); |
63 | } | 183 | } |
64 | 184 | ||
185 | public static Vertex operator *(Vertex v, Quaternion q) | ||
186 | { | ||
187 | Matrix4 tm = q.computeMatrix(); | ||
188 | return tm.transform(v); | ||
189 | } | ||
190 | |||
65 | public static Vertex operator +(Vertex v1, Vertex v2) | 191 | public static Vertex operator +(Vertex v1, Vertex v2) |
66 | { | 192 | { |
67 | return new Vertex(v1.X + v2.X, v1.Y + v2.Y, v1.Z + v2.Z); | 193 | return new Vertex(v1.X + v2.X, v1.Y + v2.Y, v1.Z + v2.Z); |
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 80f5bd1..d4b6a50 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs | |||
@@ -58,6 +58,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
58 | // raw files can be imported by blender so a visual inspection of the results can be done | 58 | // raw files can be imported by blender so a visual inspection of the results can be done |
59 | // const string baseDir = "rawFiles"; | 59 | // const string baseDir = "rawFiles"; |
60 | private const string baseDir = null; //"rawFiles"; | 60 | private const string baseDir = null; //"rawFiles"; |
61 | private const float DEG_TO_RAD = 0.01745329238f; | ||
61 | 62 | ||
62 | // TODO: unused | 63 | // TODO: unused |
63 | // private static void IntersectionParameterPD(PhysicsVector p1, PhysicsVector r1, PhysicsVector p2, | 64 | // private static void IntersectionParameterPD(PhysicsVector p1, PhysicsVector r1, PhysicsVector p2, |
@@ -195,6 +196,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
195 | 196 | ||
196 | break; | 197 | break; |
197 | 198 | ||
199 | case ProfileShape.HalfCircle: | ||
198 | case ProfileShape.Circle: | 200 | case ProfileShape.Circle: |
199 | if (pbs.PathCurve == (byte)Extrusion.Straight) | 201 | if (pbs.PathCurve == (byte)Extrusion.Straight) |
200 | { | 202 | { |
@@ -359,6 +361,8 @@ namespace OpenSim.Region.Physics.Meshing | |||
359 | UInt16 taperY = primShape.PathScaleY; | 361 | UInt16 taperY = primShape.PathScaleY; |
360 | UInt16 pathShearX = primShape.PathShearX; | 362 | UInt16 pathShearX = primShape.PathShearX; |
361 | UInt16 pathShearY = primShape.PathShearY; | 363 | UInt16 pathShearY = primShape.PathShearY; |
364 | Int16 twistTop = primShape.PathTwistBegin; | ||
365 | Int16 twistBot = primShape.PathTwist; | ||
362 | 366 | ||
363 | 367 | ||
364 | //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString()); | 368 | //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString()); |
@@ -531,7 +535,42 @@ namespace OpenSim.Region.Physics.Meshing | |||
531 | //m_log.Warn("pushY: " + extr.pushY); | 535 | //m_log.Warn("pushY: " + extr.pushY); |
532 | } | 536 | } |
533 | } | 537 | } |
534 | 538 | ||
539 | if (twistTop != 0) | ||
540 | { | ||
541 | extr.twistTop = 180 * ((float)twistTop / 100); | ||
542 | if (extr.twistTop > 0) | ||
543 | { | ||
544 | extr.twistTop = 360 - (-1 * extr.twistTop); | ||
545 | |||
546 | } | ||
547 | |||
548 | |||
549 | extr.twistTop = (float)(extr.twistTop * DEG_TO_RAD); | ||
550 | } | ||
551 | |||
552 | float twistMid = ((twistTop + twistBot) * 0.5f); | ||
553 | |||
554 | if (twistMid != 0) | ||
555 | { | ||
556 | extr.twistMid = 180 * ((float)twistMid / 100); | ||
557 | if (extr.twistMid > 0) | ||
558 | { | ||
559 | extr.twistMid = 360 - (-1 * extr.twistMid); | ||
560 | } | ||
561 | extr.twistMid = (float)(extr.twistMid * DEG_TO_RAD); | ||
562 | } | ||
563 | |||
564 | if (twistBot != 0) | ||
565 | { | ||
566 | extr.twistBot = 180 * ((float)twistBot / 100); | ||
567 | if (extr.twistBot > 0) | ||
568 | { | ||
569 | extr.twistBot = 360 - (-1 * extr.twistBot); | ||
570 | } | ||
571 | extr.twistBot = (float)(extr.twistBot * DEG_TO_RAD); | ||
572 | } | ||
573 | |||
535 | Mesh result = extr.Extrude(m); | 574 | Mesh result = extr.Extrude(m); |
536 | result.DumpRaw(baseDir, primName, "Z extruded"); | 575 | result.DumpRaw(baseDir, primName, "Z extruded"); |
537 | return result; | 576 | return result; |
@@ -540,6 +579,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
540 | private static Mesh CreateCyllinderMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size) | 579 | private static Mesh CreateCyllinderMesh(String primName, PrimitiveBaseShape primShape, PhysicsVector size) |
541 | // Builds the z (+ and -) surfaces of a box shaped prim | 580 | // Builds the z (+ and -) surfaces of a box shaped prim |
542 | { | 581 | { |
582 | |||
543 | UInt16 hollowFactor = primShape.ProfileHollow; | 583 | UInt16 hollowFactor = primShape.ProfileHollow; |
544 | UInt16 profileBegin = primShape.ProfileBegin; | 584 | UInt16 profileBegin = primShape.ProfileBegin; |
545 | UInt16 profileEnd = primShape.ProfileEnd; | 585 | UInt16 profileEnd = primShape.ProfileEnd; |
@@ -547,6 +587,9 @@ namespace OpenSim.Region.Physics.Meshing | |||
547 | UInt16 taperY = primShape.PathScaleY; | 587 | UInt16 taperY = primShape.PathScaleY; |
548 | UInt16 pathShearX = primShape.PathShearX; | 588 | UInt16 pathShearX = primShape.PathShearX; |
549 | UInt16 pathShearY = primShape.PathShearY; | 589 | UInt16 pathShearY = primShape.PathShearY; |
590 | Int16 twistBot = primShape.PathTwist; | ||
591 | Int16 twistTop = primShape.PathTwistBegin; | ||
592 | |||
550 | 593 | ||
551 | // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface | 594 | // Procedure: This is based on the fact that the upper (plus) and lower (minus) Z-surface |
552 | // of a block are basically the same | 595 | // of a block are basically the same |
@@ -797,8 +840,45 @@ namespace OpenSim.Region.Physics.Meshing | |||
797 | extr.pushY = (float)pathShearY / 100; | 840 | extr.pushY = (float)pathShearY / 100; |
798 | //m_log.Warn("pushY: " + extr.pushY); | 841 | //m_log.Warn("pushY: " + extr.pushY); |
799 | } | 842 | } |
843 | |||
844 | } | ||
845 | |||
846 | if (twistTop != 0) | ||
847 | { | ||
848 | extr.twistTop = 180 * ((float)twistTop / 100); | ||
849 | if (extr.twistTop > 0) | ||
850 | { | ||
851 | extr.twistTop = 360 - (-1 * extr.twistTop); | ||
852 | |||
853 | } | ||
854 | |||
855 | |||
856 | extr.twistTop = (float)(extr.twistTop * DEG_TO_RAD); | ||
857 | } | ||
858 | |||
859 | float twistMid = ((twistTop + twistBot) * 0.5f); | ||
860 | |||
861 | if (twistMid != 0) | ||
862 | { | ||
863 | extr.twistMid = 180 * ((float)twistMid / 100); | ||
864 | if (extr.twistMid > 0) | ||
865 | { | ||
866 | extr.twistMid = 360 - (-1 * extr.twistMid); | ||
867 | } | ||
868 | extr.twistMid = (float)(extr.twistMid * DEG_TO_RAD); | ||
869 | } | ||
870 | |||
871 | if (twistBot != 0) | ||
872 | { | ||
873 | extr.twistBot = 180 * ((float)twistBot / 100); | ||
874 | if (extr.twistBot > 0) | ||
875 | { | ||
876 | extr.twistBot = 360 - (-1 * extr.twistBot); | ||
877 | } | ||
878 | extr.twistBot = (float)(extr.twistBot * DEG_TO_RAD); | ||
800 | } | 879 | } |
801 | 880 | ||
881 | //System.Console.WriteLine("[MESH]: twistTop = " + twistTop.ToString() + "|" + extr.twistTop.ToString() + ", twistMid = " + twistMid.ToString() + "|" + extr.twistMid.ToString() + ", twistbot = " + twistBot.ToString() + "|" + extr.twistBot.ToString()); | ||
802 | Mesh result = extr.Extrude(m); | 882 | Mesh result = extr.Extrude(m); |
803 | result.DumpRaw(baseDir, primName, "Z extruded"); | 883 | result.DumpRaw(baseDir, primName, "Z extruded"); |
804 | return result; | 884 | return result; |
@@ -815,6 +895,8 @@ namespace OpenSim.Region.Physics.Meshing | |||
815 | UInt16 pathShearX = primShape.PathShearX; | 895 | UInt16 pathShearX = primShape.PathShearX; |
816 | UInt16 pathShearY = primShape.PathShearY; | 896 | UInt16 pathShearY = primShape.PathShearY; |
817 | 897 | ||
898 | Int16 twistTop = primShape.PathTwistBegin; | ||
899 | Int16 twistBot = primShape.PathTwist; | ||
818 | //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString()); | 900 | //m_log.Error("pathShear:" + primShape.PathShearX.ToString() + "," + primShape.PathShearY.ToString()); |
819 | //m_log.Error("pathTaper:" + primShape.PathTaperX.ToString() + "," + primShape.PathTaperY.ToString()); | 901 | //m_log.Error("pathTaper:" + primShape.PathTaperX.ToString() + "," + primShape.PathTaperY.ToString()); |
820 | //m_log.Error("ProfileBegin:" + primShape.ProfileBegin.ToString() + "," + primShape.ProfileBegin.ToString()); | 902 | //m_log.Error("ProfileBegin:" + primShape.ProfileBegin.ToString() + "," + primShape.ProfileBegin.ToString()); |
@@ -984,6 +1066,41 @@ namespace OpenSim.Region.Physics.Meshing | |||
984 | } | 1066 | } |
985 | } | 1067 | } |
986 | 1068 | ||
1069 | if (twistTop != 0) | ||
1070 | { | ||
1071 | extr.twistTop = 180 * ((float)twistTop / 100); | ||
1072 | if (extr.twistTop > 0) | ||
1073 | { | ||
1074 | extr.twistTop = 360 - (-1 * extr.twistTop); | ||
1075 | |||
1076 | } | ||
1077 | |||
1078 | |||
1079 | extr.twistTop = (float)(extr.twistTop * DEG_TO_RAD); | ||
1080 | } | ||
1081 | |||
1082 | float twistMid = ((twistTop + twistBot) * 0.5f); | ||
1083 | |||
1084 | if (twistMid != 0) | ||
1085 | { | ||
1086 | extr.twistMid = 180 * ((float)twistMid / 100); | ||
1087 | if (extr.twistMid > 0) | ||
1088 | { | ||
1089 | extr.twistMid = 360 - (-1 * extr.twistMid); | ||
1090 | } | ||
1091 | extr.twistMid = (float)(extr.twistMid * DEG_TO_RAD); | ||
1092 | } | ||
1093 | |||
1094 | if (twistBot != 0) | ||
1095 | { | ||
1096 | extr.twistBot = 180 * ((float)twistBot / 100); | ||
1097 | if (extr.twistBot > 0) | ||
1098 | { | ||
1099 | extr.twistBot = 360 - (-1 * extr.twistBot); | ||
1100 | } | ||
1101 | extr.twistBot = (float)(extr.twistBot * DEG_TO_RAD); | ||
1102 | } | ||
1103 | |||
987 | Mesh result = extr.Extrude(m); | 1104 | Mesh result = extr.Extrude(m); |
988 | result.DumpRaw(baseDir, primName, "Z extruded"); | 1105 | result.DumpRaw(baseDir, primName, "Z extruded"); |
989 | return result; | 1106 | return result; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 9b8f4af..fa128de 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -1438,6 +1438,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1438 | if (pbs.ProfileHollow != 0) | 1438 | if (pbs.ProfileHollow != 0) |
1439 | return true; | 1439 | return true; |
1440 | 1440 | ||
1441 | if (((Int16)pbs.PathTwistBegin != 0) || ((Int16)pbs.PathTwist != 0)) | ||
1442 | return true; | ||
1443 | |||
1441 | if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0) | 1444 | if ((pbs.ProfileBegin != 0) || pbs.ProfileEnd != 0) |
1442 | return true; | 1445 | return true; |
1443 | 1446 | ||