diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/Meshing/Extruder.cs | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Extruder.cs b/OpenSim/Region/Physics/Meshing/Extruder.cs index 8a95df9..54ef4ce 100644 --- a/OpenSim/Region/Physics/Meshing/Extruder.cs +++ b/OpenSim/Region/Physics/Meshing/Extruder.cs | |||
@@ -24,6 +24,7 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | //#define SPAM | ||
27 | 28 | ||
28 | using OpenSim.Region.Physics.Manager; | 29 | using OpenSim.Region.Physics.Manager; |
29 | 30 | ||
@@ -246,9 +247,6 @@ namespace OpenSim.Region.Physics.Meshing | |||
246 | 247 | ||
247 | public Mesh ExtrudeCircularPath(Mesh m) | 248 | public Mesh ExtrudeCircularPath(Mesh m) |
248 | { | 249 | { |
249 | //startParameter = float.MinValue; | ||
250 | //stopParameter = float.MaxValue; | ||
251 | // Currently only works for iSteps=1; | ||
252 | Mesh result = new Mesh(); | 250 | Mesh result = new Mesh(); |
253 | 251 | ||
254 | Quaternion tt = new Quaternion(); | 252 | Quaternion tt = new Quaternion(); |
@@ -257,7 +255,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
257 | Mesh newLayer; | 255 | Mesh newLayer; |
258 | Mesh lastLayer = null; | 256 | Mesh lastLayer = null; |
259 | 257 | ||
260 | int start = 0; | 258 | //int start = 0; |
261 | int step; | 259 | int step; |
262 | int steps = 24; | 260 | int steps = 24; |
263 | 261 | ||
@@ -268,39 +266,37 @@ namespace OpenSim.Region.Physics.Meshing | |||
268 | double percentOfPathMultiplier = 1.0 / steps; | 266 | double percentOfPathMultiplier = 1.0 / steps; |
269 | double angleStepMultiplier = System.Math.PI * 2.0 / steps; | 267 | double angleStepMultiplier = System.Math.PI * 2.0 / steps; |
270 | 268 | ||
271 | //System.Console.WriteLine("twistTop: " + twistTop.ToString() + " twistbot: " + twistBot.ToString() + " twisttotal: " + twistTotal.ToString()); | ||
272 | |||
273 | float yPathScale = pathScaleY * 0.5f; | 269 | float yPathScale = pathScaleY * 0.5f; |
274 | float skewStart = -skew; | 270 | float pathLength = pathCutEnd - pathCutBegin; |
275 | float skewOffset = 0.0f; | 271 | float totalSkew = skew * 2.0f * pathLength; |
276 | float totalSkew = skew * 2.0f; | 272 | float skewStart = (-skew) + pathCutBegin * 2.0f * skew; |
277 | 273 | ||
278 | 274 | ||
279 | float startAngle = (float)(System.Math.PI * 2.0 * pathCutBegin * revolutions); | 275 | float startAngle = (float)(System.Math.PI * 2.0 * pathCutBegin * revolutions); |
280 | float endAngle = (float)(System.Math.PI * 2.0 * pathCutEnd * revolutions); | 276 | float endAngle = (float)(System.Math.PI * 2.0 * pathCutEnd * revolutions); |
281 | float stepSize = (float)0.2617993878; // 2*PI / 24 segments | 277 | float stepSize = (float)0.2617993878; // 2*PI / 24 segments per revolution |
282 | step = (int)(startAngle / stepSize); | 278 | step = (int)(startAngle / stepSize); |
283 | float angle = startAngle; | 279 | float angle = startAngle; |
284 | 280 | ||
285 | float xProfileScale = 1.0f; | 281 | float xProfileScale = 1.0f; |
286 | float yProfileScale = 1.0f; | 282 | float yProfileScale = 1.0f; |
287 | 283 | ||
288 | //System.Console.WriteLine("startAngle: " + startAngle.ToString() + " endAngle: " + endAngle.ToString() + " step: " + step.ToString()); | 284 | #if SPAM |
289 | bool done = false; | 285 | System.Console.WriteLine("Extruder: twistTop: " + twistTop.ToString() + " twistbot: " + twistBot.ToString() + " twisttotal: " + twistTotal.ToString()); |
290 | 286 | System.Console.WriteLine("Extruder: startAngle: " + startAngle.ToString() + " endAngle: " + endAngle.ToString() + " step: " + step.ToString()); | |
291 | //System.Console.WriteLine(" PathScaleX: " + pathScaleX.ToString() + " pathScaleY: " + pathScaleY.ToString()); | 287 | System.Console.WriteLine("Extruder: taperBotFactorX: " + taperBotFactorX.ToString() + " taperBotFactorY: " + taperBotFactorY.ToString() |
292 | 288 | + " taperTopFactorX: " + taperTopFactorX.ToString() + " taperTopFactorY: " + taperTopFactorY.ToString()); | |
293 | //System.Console.WriteLine("taperBotFactorX: " + taperBotFactorX.ToString() + " taperBotFactorY: " + taperBotFactorY.ToString() | 289 | System.Console.WriteLine("Extruder: PathScaleX: " + pathScaleX.ToString() + " pathScaleY: " + pathScaleY.ToString()); |
294 | // + " taperTopFactorX: " + taperTopFactorX.ToString() + " taperTopFactorY: " + taperTopFactorY.ToString()); | 290 | #endif |
291 | |||
295 | 292 | ||
293 | bool done = false; | ||
296 | do | 294 | do |
297 | { | 295 | { |
298 | float percentOfPath = 1.0f; | 296 | float percentOfPath = 1.0f; |
299 | 297 | ||
300 | percentOfPath = (angle - startAngle) / (endAngle - startAngle); // endAngle should always be larger than startAngle | 298 | percentOfPath = (angle - startAngle) / (endAngle - startAngle); // endAngle should always be larger than startAngle |
301 | 299 | ||
302 | // System.Console.WriteLine("angle: " + angle.ToString() + " percentOfPath: " + percentOfPath.ToString()); | ||
303 | |||
304 | if (pathTaperX > 0.001f) // can't really compare to 0.0f as the value passed is never exactly zero | 300 | if (pathTaperX > 0.001f) // can't really compare to 0.0f as the value passed is never exactly zero |
305 | xProfileScale = 1.0f - percentOfPath * pathTaperX; | 301 | xProfileScale = 1.0f - percentOfPath * pathTaperX; |
306 | else if (pathTaperX < -0.001f) | 302 | else if (pathTaperX < -0.001f) |
@@ -323,7 +319,10 @@ namespace OpenSim.Region.Physics.Meshing | |||
323 | 319 | ||
324 | //radiusScale = 1.0f; | 320 | //radiusScale = 1.0f; |
325 | 321 | ||
326 | //System.Console.WriteLine("Extruder: radius: " + radius.ToString() + " radiusScale: " + radiusScale.ToString()); | 322 | #if SPAM |
323 | System.Console.WriteLine("Extruder: angle: " + angle.ToString() + " percentOfPath: " + percentOfPath.ToString() | ||
324 | + " radius: " + radius.ToString() + " radiusScale: " + radiusScale.ToString()); | ||
325 | #endif | ||
327 | 326 | ||
328 | float twist = twistBot + (twistTotal * (float)percentOfPath); | 327 | float twist = twistBot + (twistTotal * (float)percentOfPath); |
329 | 328 | ||
@@ -397,8 +396,8 @@ namespace OpenSim.Region.Physics.Meshing | |||
397 | } | 396 | } |
398 | lastLayer = newLayer; | 397 | lastLayer = newLayer; |
399 | 398 | ||
400 | // calc next angle | ||
401 | 399 | ||
400 | // calc the angle for the next interation of the loop | ||
402 | if (angle >= endAngle) | 401 | if (angle >= endAngle) |
403 | done = true; | 402 | done = true; |
404 | else | 403 | else |
@@ -407,6 +406,7 @@ namespace OpenSim.Region.Physics.Meshing | |||
407 | if (angle > endAngle) | 406 | if (angle > endAngle) |
408 | angle = endAngle; | 407 | angle = endAngle; |
409 | } | 408 | } |
409 | |||
410 | } while (!done); | 410 | } while (!done); |
411 | 411 | ||
412 | // scale the mesh to the desired size | 412 | // scale the mesh to the desired size |