aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/Meshing
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/Meshing')
-rw-r--r--OpenSim/Region/Physics/Meshing/Extruder.cs26
-rw-r--r--OpenSim/Region/Physics/Meshing/HelperTypes.cs2
-rw-r--r--OpenSim/Region/Physics/Meshing/Meshmerizer.cs12
-rw-r--r--OpenSim/Region/Physics/Meshing/SculptMesh.cs12
4 files changed, 25 insertions, 27 deletions
diff --git a/OpenSim/Region/Physics/Meshing/Extruder.cs b/OpenSim/Region/Physics/Meshing/Extruder.cs
index b14deeb..0c94669 100644
--- a/OpenSim/Region/Physics/Meshing/Extruder.cs
+++ b/OpenSim/Region/Physics/Meshing/Extruder.cs
@@ -286,7 +286,7 @@ namespace OpenSim.Region.Physics.Meshing
286 // It's not quite clear what pushY (Y top shear) does, but subtracting it from the start and end 286 // It's not quite clear what pushY (Y top shear) does, but subtracting it from the start and end
287 // angles appears to approximate it's effects on path cut. Likewise, adding it to the angle used 287 // angles appears to approximate it's effects on path cut. Likewise, adding it to the angle used
288 // to calculate the sine for generating the path radius appears to approximate it's effects there 288 // to calculate the sine for generating the path radius appears to approximate it's effects there
289 // too, but there are some subtle differences in the radius which are noticeable as the prim size 289 // too, but there are some subtle differences in the radius which are noticeable as the prim size
290 // increases and it may affect megaprims quite a bit. The effect of the Y top shear parameter on 290 // increases and it may affect megaprims quite a bit. The effect of the Y top shear parameter on
291 // the meshes generated with this technique appear nearly identical in shape to the same prims when 291 // the meshes generated with this technique appear nearly identical in shape to the same prims when
292 // displayed by the viewer. 292 // displayed by the viewer.
@@ -369,28 +369,26 @@ namespace OpenSim.Region.Physics.Meshing
369 float yOffset; 369 float yOffset;
370 float zOffset; 370 float zOffset;
371 371
372
373 xOffset = 0.5f * (skewStart + totalSkew * (float)percentOfPath); 372 xOffset = 0.5f * (skewStart + totalSkew * (float)percentOfPath);
374 xOffset += (float) System.Math.Sin(angle) * pushX * 0.45f; 373 xOffset += (float) System.Math.Sin(angle) * pushX * 0.45f;
375 yOffset = (float)(System.Math.Cos(angle) * (0.5f - yPathScale)) * radiusScale; 374 yOffset = (float)(System.Math.Cos(angle) * (0.5f - yPathScale)) * radiusScale;
376 zOffset = (float)(System.Math.Sin(angle + pushY * 0.9f) * (0.5f - yPathScale)) * radiusScale; 375 zOffset = (float)(System.Math.Sin(angle + pushY * 0.9f) * (0.5f - yPathScale)) * radiusScale;
377 376
378 377 // next apply twist rotation to the profile layer
379 // next apply twist rotation to the profile layer 378 if (twistTotal != 0.0f || twistBot != 0.0f)
380 if (twistTotal != 0.0f || twistBot != 0.0f) 379 {
380 Quaternion profileRot = new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist);
381 foreach (Vertex v in newLayer.vertices)
381 { 382 {
382 Quaternion profileRot = new Quaternion(new Vertex(0.0f, 0.0f, 1.0f), twist); 383 if (v != null)
383 foreach (Vertex v in newLayer.vertices)
384 { 384 {
385 if (v != null) 385 vTemp = v * profileRot;
386 { 386 v.X = vTemp.X;
387 vTemp = v * profileRot; 387 v.Y = vTemp.Y;
388 v.X = vTemp.X; 388 v.Z = vTemp.Z;
389 v.Y = vTemp.Y;
390 v.Z = vTemp.Z;
391 }
392 } 389 }
393 } 390 }
391 }
394 392
395 // now orient the rotation of the profile layer relative to it's position on the path 393 // now orient the rotation of the profile layer relative to it's position on the path
396 // adding pushY to the angle used to generate the quat appears to approximate the viewer 394 // adding pushY to the angle used to generate the quat appears to approximate the viewer
diff --git a/OpenSim/Region/Physics/Meshing/HelperTypes.cs b/OpenSim/Region/Physics/Meshing/HelperTypes.cs
index 816b6bb..2cb8d04 100644
--- a/OpenSim/Region/Physics/Meshing/HelperTypes.cs
+++ b/OpenSim/Region/Physics/Meshing/HelperTypes.cs
@@ -118,7 +118,7 @@ public class Vertex : PhysicsVector, IComparable<Vertex>
118 { 118 {
119 return new Vertex(Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - Y * v.X); 119 return new Vertex(Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - Y * v.X);
120 } 120 }
121 121
122 // disable warning: mono compiler moans about overloading 122 // disable warning: mono compiler moans about overloading
123 // operators hiding base operator but should not according to C# 123 // operators hiding base operator but should not according to C#
124 // language spec 124 // language spec
diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
index f041aec..a038dc2 100644
--- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs
@@ -941,7 +941,7 @@ namespace OpenSim.Region.Physics.Meshing
941 extr.twistBot = (float)primShape.PathTwistBegin * (float)Math.PI * 0.01f; 941 extr.twistBot = (float)primShape.PathTwistBegin * (float)Math.PI * 0.01f;
942 extr.pathBegin = primShape.PathBegin; 942 extr.pathBegin = primShape.PathBegin;
943 extr.pathEnd = primShape.PathEnd; 943 extr.pathEnd = primShape.PathEnd;
944 944
945 //System.Console.WriteLine("[MESH]: twistTop = " + twistTop.ToString() + "|" + extr.twistTop.ToString() + ", twistMid = " + twistMid.ToString() + "|" + extr.twistMid.ToString() + ", twistbot = " + twistBot.ToString() + "|" + extr.twistBot.ToString()); 945 //System.Console.WriteLine("[MESH]: twistTop = " + twistTop.ToString() + "|" + extr.twistTop.ToString() + ", twistMid = " + twistMid.ToString() + "|" + extr.twistMid.ToString() + ", twistbot = " + twistBot.ToString() + "|" + extr.twistBot.ToString());
946 //Mesh result = extr.Extrude(m); 946 //Mesh result = extr.Extrude(m);
947 Mesh result = extr.ExtrudeLinearPath(m); 947 Mesh result = extr.ExtrudeLinearPath(m);
@@ -1340,7 +1340,7 @@ namespace OpenSim.Region.Physics.Meshing
1340 } 1340 }
1341 1341
1342 /// <summary> 1342 /// <summary>
1343 /// Creates a mesh for prim types torus, ring, tube, and sphere 1343 /// Creates a mesh for prim types torus, ring, tube, and sphere
1344 /// </summary> 1344 /// </summary>
1345 /// <param name="primName"></param> 1345 /// <param name="primName"></param>
1346 /// <param name="primShape"></param> 1346 /// <param name="primShape"></param>
@@ -1655,7 +1655,7 @@ namespace OpenSim.Region.Physics.Meshing
1655 1655
1656 // Vertex vTemp = new Vertex(0.0f, 0.0f, 0.0f); 1656 // Vertex vTemp = new Vertex(0.0f, 0.0f, 0.0f);
1657 1657
1658 1658
1659 float skew = primShape.PathSkew * 0.01f; 1659 float skew = primShape.PathSkew * 0.01f;
1660 float pathScaleX = (float)(200 - primShape.PathScaleX) * 0.01f; 1660 float pathScaleX = (float)(200 - primShape.PathScaleX) * 0.01f;
1661 float pathScaleY = (float)(200 - primShape.PathScaleY) * 0.01f; 1661 float pathScaleY = (float)(200 - primShape.PathScaleY) * 0.01f;
@@ -1700,7 +1700,7 @@ namespace OpenSim.Region.Physics.Meshing
1700 //System.Console.WriteLine("primShape.PathTaperX: " + primShape.PathTaperX.ToString()); 1700 //System.Console.WriteLine("primShape.PathTaperX: " + primShape.PathTaperX.ToString());
1701 //System.Console.WriteLine("primShape.PathTaperY: " + primShape.PathTaperY.ToString()); 1701 //System.Console.WriteLine("primShape.PathTaperY: " + primShape.PathTaperY.ToString());
1702 1702
1703 1703
1704 //System.Console.WriteLine("primShape.PathRadiusOffset: " + primShape.PathRadiusOffset.ToString()); 1704 //System.Console.WriteLine("primShape.PathRadiusOffset: " + primShape.PathRadiusOffset.ToString());
1705#endif 1705#endif
1706 1706
@@ -1875,7 +1875,7 @@ namespace OpenSim.Region.Physics.Meshing
1875 1875
1876 if (primShape.SculptEntry && primShape.SculptType != (byte)0 && primShape.SculptData.Length > 0) 1876 if (primShape.SculptEntry && primShape.SculptType != (byte)0 && primShape.SculptData.Length > 0)
1877 { 1877 {
1878 1878
1879 SculptMesh smesh = CreateSculptMesh(primName, primShape, size, lod); 1879 SculptMesh smesh = CreateSculptMesh(primName, primShape, size, lod);
1880 mesh = (Mesh)smesh; 1880 mesh = (Mesh)smesh;
1881 CalcNormals(mesh); 1881 CalcNormals(mesh);
@@ -1967,7 +1967,7 @@ namespace OpenSim.Region.Physics.Meshing
1967 float pathShearY = primShape.PathShearY < 128 ? (float)primShape.PathShearY * 0.01f : (float)(primShape.PathShearY - 256) * 0.01f; 1967 float pathShearY = primShape.PathShearY < 128 ? (float)primShape.PathShearY * 0.01f : (float)(primShape.PathShearY - 256) * 0.01f;
1968 float pathBegin = (float)primShape.PathBegin * 2.0e-5f; 1968 float pathBegin = (float)primShape.PathBegin * 2.0e-5f;
1969 float pathEnd = 1.0f - (float)primShape.PathEnd * 2.0e-5f; 1969 float pathEnd = 1.0f - (float)primShape.PathEnd * 2.0e-5f;
1970 1970
1971 float profileBegin = (float)primShape.ProfileBegin * 2.0e-5f; 1971 float profileBegin = (float)primShape.ProfileBegin * 2.0e-5f;
1972 float profileEnd = 1.0f - (float)primShape.ProfileEnd * 2.0e-5f; 1972 float profileEnd = 1.0f - (float)primShape.ProfileEnd * 2.0e-5f;
1973 1973
diff --git a/OpenSim/Region/Physics/Meshing/SculptMesh.cs b/OpenSim/Region/Physics/Meshing/SculptMesh.cs
index 95a244d..1c3153a 100644
--- a/OpenSim/Region/Physics/Meshing/SculptMesh.cs
+++ b/OpenSim/Region/Physics/Meshing/SculptMesh.cs
@@ -52,7 +52,7 @@ namespace OpenSim.Region.Physics.Meshing
52 { 52 {
53 if (_lod == 2f || _lod == 4f || _lod == 8f || _lod == 16f || _lod == 32f || _lod == 64f) 53 if (_lod == 2f || _lod == 4f || _lod == 8f || _lod == 16f || _lod == 32f || _lod == 64f)
54 lod = (int)_lod; 54 lod = (int)_lod;
55 55
56 try 56 try
57 { 57 {
58 idata = OpenJPEG.DecodeToImage(jpegData); 58 idata = OpenJPEG.DecodeToImage(jpegData);
@@ -81,7 +81,7 @@ namespace OpenSim.Region.Physics.Meshing
81 } 81 }
82 } 82 }
83 83
84 84
85 } 85 }
86 private Vertex ColorToVertex(Color input) 86 private Vertex ColorToVertex(Color input)
87 { 87 {
@@ -225,7 +225,7 @@ namespace OpenSim.Region.Physics.Meshing
225 // Create a vertex position from the RGB channels in the current pixel 225 // Create a vertex position from the RGB channels in the current pixel
226 // int ypos = y * bLOD.Width; 226 // int ypos = y * bLOD.Width;
227 227
228 228
229 if (y == 0) 229 if (y == 0)
230 { 230 {
231 v1 = northpole; 231 v1 = northpole;
@@ -291,7 +291,7 @@ namespace OpenSim.Region.Physics.Meshing
291 Add(tri2); 291 Add(tri2);
292 } 292 }
293 } 293 }
294 294
295 } 295 }
296 //Vertex vt31 = sVertices[(y * x_max + x)]; 296 //Vertex vt31 = sVertices[(y * x_max + x)];
297 //Vertex vt32 = sVertices[(y * x_max + 0)]; 297 //Vertex vt32 = sVertices[(y * x_max + 0)];
@@ -311,7 +311,7 @@ namespace OpenSim.Region.Physics.Meshing
311 //Add(tri3); 311 //Add(tri3);
312 // } 312 // }
313 //} 313 //}
314 314
315 //Vertex vt41 = sVertices[(y * x_max + x)]; 315 //Vertex vt41 = sVertices[(y * x_max + x)];
316 //Vertex vt42 = sVertices[((y + 1) * x_max + 0)]; 316 //Vertex vt42 = sVertices[((y + 1) * x_max + 0)];
317 //Vertex vt43 = sVertices[((y + 1) * x_max + x)]; 317 //Vertex vt43 = sVertices[((y + 1) * x_max + x)];
@@ -329,7 +329,7 @@ namespace OpenSim.Region.Physics.Meshing
329 //Add(tri4); 329 //Add(tri4);
330 //} 330 //}
331 //} 331 //}
332 332
333 } 333 }
334 } 334 }
335 } 335 }