aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs')
-rw-r--r--OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs64
1 files changed, 39 insertions, 25 deletions
diff --git a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
index 00cbfbd..c131c6f 100644
--- a/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
+++ b/OpenSim/Region/Physics/UbitMeshing/Meshmerizer.cs
@@ -816,15 +816,31 @@ namespace OpenSim.Region.Physics.Meshing
816 816
817 float profileBegin = (float)primShape.ProfileBegin * 2.0e-5f; 817 float profileBegin = (float)primShape.ProfileBegin * 2.0e-5f;
818 float profileEnd = 1.0f - (float)primShape.ProfileEnd * 2.0e-5f; 818 float profileEnd = 1.0f - (float)primShape.ProfileEnd * 2.0e-5f;
819
820 if (profileBegin < 0.0f)
821 profileBegin = 0.0f;
822
823 if (profileEnd < 0.02f)
824 profileEnd = 0.02f;
825 else if (profileEnd > 1.0f)
826 profileEnd = 1.0f;
827
828 if (profileBegin >= profileEnd)
829 profileBegin = profileEnd - 0.02f;
830
819 float profileHollow = (float)primShape.ProfileHollow * 2.0e-5f; 831 float profileHollow = (float)primShape.ProfileHollow * 2.0e-5f;
820 if (profileHollow > 0.95f) 832 if (profileHollow > 0.95f)
821 profileHollow = 0.95f; 833 profileHollow = 0.95f;
822 834
823 int sides = 4; 835 int sides = 4;
824 LevelOfDetail iLOD = (LevelOfDetail)lod; 836 LevelOfDetail iLOD = (LevelOfDetail)lod;
825 if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) 837 byte profshape = (byte)(primShape.ProfileCurve & 0x07);
838
839 if (profshape == (byte)ProfileShape.EquilateralTriangle
840 || profshape == (byte)ProfileShape.IsometricTriangle
841 || profshape == (byte)ProfileShape.RightTriangle)
826 sides = 3; 842 sides = 3;
827 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) 843 else if (profshape == (byte)ProfileShape.Circle)
828 { 844 {
829 switch (iLOD) 845 switch (iLOD)
830 { 846 {
@@ -835,7 +851,7 @@ namespace OpenSim.Region.Physics.Meshing
835 default: sides = 24; break; 851 default: sides = 24; break;
836 } 852 }
837 } 853 }
838 else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) 854 else if (profshape == (byte)ProfileShape.HalfCircle)
839 { // half circle, prim is a sphere 855 { // half circle, prim is a sphere
840 switch (iLOD) 856 switch (iLOD)
841 { 857 {
@@ -865,10 +881,15 @@ namespace OpenSim.Region.Physics.Meshing
865 else if (primShape.HollowShape == HollowShape.Square) 881 else if (primShape.HollowShape == HollowShape.Square)
866 hollowSides = 4; 882 hollowSides = 4;
867 else if (primShape.HollowShape == HollowShape.Triangle) 883 else if (primShape.HollowShape == HollowShape.Triangle)
868 hollowSides = 3; 884 {
885 if (profshape == (byte)ProfileShape.HalfCircle)
886 hollowSides = 6;
887 else
888 hollowSides = 3;
889 }
869 890
870 primMesh = new PrimMesh(sides, profileBegin, profileEnd, profileHollow, hollowSides); 891 primMesh = new PrimMesh(sides, profileBegin, profileEnd, profileHollow, hollowSides);
871 892
872 if (primMesh.errorMessage != null) 893 if (primMesh.errorMessage != null)
873 if (primMesh.errorMessage.Length > 0) 894 if (primMesh.errorMessage.Length > 0)
874 m_log.Error("[ERROR] " + primMesh.errorMessage); 895 m_log.Error("[ERROR] " + primMesh.errorMessage);
@@ -880,17 +901,11 @@ namespace OpenSim.Region.Physics.Meshing
880 901
881 if (primShape.PathCurve == (byte)Extrusion.Straight || primShape.PathCurve == (byte) Extrusion.Flexible) 902 if (primShape.PathCurve == (byte)Extrusion.Straight || primShape.PathCurve == (byte) Extrusion.Flexible)
882 { 903 {
883 primMesh.twistBegin = primShape.PathTwistBegin * 18 / 10; 904 primMesh.twistBegin = (primShape.PathTwistBegin * 18) / 10;
884 primMesh.twistEnd = primShape.PathTwist * 18 / 10; 905 primMesh.twistEnd = (primShape.PathTwist * 18) / 10;
885 primMesh.taperX = pathScaleX; 906 primMesh.taperX = pathScaleX;
886 primMesh.taperY = pathScaleY; 907 primMesh.taperY = pathScaleY;
887 908
888 if (profileBegin < 0.0f || profileBegin >= profileEnd || profileEnd > 1.0f)
889 {
890 ReportPrimError("*** CORRUPT PRIM!! ***", primName, primMesh);
891 if (profileBegin < 0.0f) profileBegin = 0.0f;
892 if (profileEnd > 1.0f) profileEnd = 1.0f;
893 }
894#if SPAM 909#if SPAM
895 m_log.Debug("****** PrimMesh Parameters (Linear) ******\n" + primMesh.ParamsToDisplayString()); 910 m_log.Debug("****** PrimMesh Parameters (Linear) ******\n" + primMesh.ParamsToDisplayString());
896#endif 911#endif
@@ -911,17 +926,11 @@ namespace OpenSim.Region.Physics.Meshing
911 primMesh.radius = 0.01f * primShape.PathRadiusOffset; 926 primMesh.radius = 0.01f * primShape.PathRadiusOffset;
912 primMesh.revolutions = 1.0f + 0.015f * primShape.PathRevolutions; 927 primMesh.revolutions = 1.0f + 0.015f * primShape.PathRevolutions;
913 primMesh.skew = 0.01f * primShape.PathSkew; 928 primMesh.skew = 0.01f * primShape.PathSkew;
914 primMesh.twistBegin = primShape.PathTwistBegin * 36 / 10; 929 primMesh.twistBegin = (primShape.PathTwistBegin * 36) / 10;
915 primMesh.twistEnd = primShape.PathTwist * 36 / 10; 930 primMesh.twistEnd = (primShape.PathTwist * 36) / 10;
916 primMesh.taperX = primShape.PathTaperX * 0.01f; 931 primMesh.taperX = primShape.PathTaperX * 0.01f;
917 primMesh.taperY = primShape.PathTaperY * 0.01f; 932 primMesh.taperY = primShape.PathTaperY * 0.01f;
918 933
919 if (profileBegin < 0.0f || profileBegin >= profileEnd || profileEnd > 1.0f)
920 {
921 ReportPrimError("*** CORRUPT PRIM!! ***", primName, primMesh);
922 if (profileBegin < 0.0f) profileBegin = 0.0f;
923 if (profileEnd > 1.0f) profileEnd = 1.0f;
924 }
925#if SPAM 934#if SPAM
926 m_log.Debug("****** PrimMesh Parameters (Circular) ******\n" + primMesh.ParamsToDisplayString()); 935 m_log.Debug("****** PrimMesh Parameters (Circular) ******\n" + primMesh.ParamsToDisplayString());
927#endif 936#endif
@@ -1031,14 +1040,19 @@ namespace OpenSim.Region.Physics.Meshing
1031 1040
1032 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod) 1041 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod)
1033 { 1042 {
1034 return CreateMesh(primName, primShape, size, lod, false,false,false,false); 1043 return CreateMesh(primName, primShape, size, lod, false,false,false);
1035 } 1044 }
1036 1045
1037 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical) 1046 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical)
1038 { 1047 {
1039 return CreateMesh(primName, primShape, size, lod, false,false,false,false); 1048 return CreateMesh(primName, primShape, size, lod, false,false,false);
1040 } 1049 }
1041 1050
1051 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache, bool convex, bool forOde)
1052 {
1053 return CreateMesh(primName, primShape, size, lod, false, false, false);
1054 }
1055
1042 public IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex) 1056 public IMesh GetMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex)
1043 { 1057 {
1044 Mesh mesh = null; 1058 Mesh mesh = null;
@@ -1080,7 +1094,7 @@ namespace OpenSim.Region.Physics.Meshing
1080 1094
1081 private static Vector3 m_MeshUnitSize = new Vector3(1.0f, 1.0f, 1.0f); 1095 private static Vector3 m_MeshUnitSize = new Vector3(1.0f, 1.0f, 1.0f);
1082 1096
1083 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool shouldCache, bool convex, bool forOde) 1097 public IMesh CreateMesh(String primName, PrimitiveBaseShape primShape, Vector3 size, float lod, bool isPhysical, bool convex, bool forOde)
1084 { 1098 {
1085#if SPAM 1099#if SPAM
1086 m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName); 1100 m_log.DebugFormat("[MESH]: Creating mesh for {0}", primName);