diff options
author | UbitUmarov | 2018-02-22 02:49:56 +0000 |
---|---|---|
committer | UbitUmarov | 2018-02-22 02:49:56 +0000 |
commit | 846f35d3655e2f9d61e5b14d76e21909335b5096 (patch) | |
tree | 108a89115e69bab4f700d2d908b218824adb3058 | |
parent | fix a old issue on some tortured prims number of sides, and so textures set (diff) | |
download | opensim-SC-846f35d3655e2f9d61e5b14d76e21909335b5096.zip opensim-SC-846f35d3655e2f9d61e5b14d76e21909335b5096.tar.gz opensim-SC-846f35d3655e2f9d61e5b14d76e21909335b5096.tar.bz2 opensim-SC-846f35d3655e2f9d61e5b14d76e21909335b5096.tar.xz |
a few more changes on tortured prims number of sides/faces
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 121 |
1 files changed, 68 insertions, 53 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index d501939..0533099 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -3892,10 +3892,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3892 | public int GetNumberOfSides() | 3892 | public int GetNumberOfSides() |
3893 | { | 3893 | { |
3894 | int ret = 0; | 3894 | int ret = 0; |
3895 | bool hasCut; | ||
3896 | bool hasHollow; | ||
3897 | bool hasDimple; | ||
3898 | bool hasProfileCut; | ||
3899 | 3895 | ||
3900 | if(Shape.SculptEntry) | 3896 | if(Shape.SculptEntry) |
3901 | { | 3897 | { |
@@ -3909,51 +3905,97 @@ namespace OpenSim.Region.Framework.Scenes | |||
3909 | } | 3905 | } |
3910 | 3906 | ||
3911 | PrimType primType = GetPrimType(true); | 3907 | PrimType primType = GetPrimType(true); |
3912 | HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); | ||
3913 | 3908 | ||
3914 | switch (primType) | 3909 | switch (primType) |
3915 | { | 3910 | { |
3916 | case PrimType.BOX: | 3911 | case PrimType.BOX: |
3917 | ret = 6; | 3912 | ret = 6; |
3918 | if (hasCut) ret += 2; | 3913 | if (Shape.ProfileBegin > 0 || Shape.ProfileEnd > 0) // cut case |
3919 | if (hasHollow) ret += 1; | 3914 | { |
3920 | break; | 3915 | // removed sides |
3921 | case PrimType.CYLINDER: | 3916 | int cut = (Shape.ProfileEnd + Shape.ProfileBegin); |
3922 | ret = 3; | 3917 | if(cut > 50000) |
3923 | if (hasCut) ret += 2; | 3918 | cut = 50000; |
3924 | if (hasHollow) ret += 1; | 3919 | cut /= 12500; |
3920 | ret -= cut; | ||
3921 | ret += 2; // both cut faces | ||
3922 | } | ||
3925 | break; | 3923 | break; |
3926 | case PrimType.PRISM: | 3924 | case PrimType.PRISM: |
3927 | ret = 5; | 3925 | ret = 5; |
3928 | if (hasCut) ret += 2; | 3926 | if (Shape.ProfileBegin > 0 || Shape.ProfileEnd > 0) // cut case |
3929 | if (hasHollow) ret += 1; | 3927 | { |
3928 | // removed faces | ||
3929 | int cut = (Shape.ProfileEnd + Shape.ProfileBegin); | ||
3930 | if(cut >= 16667 ) | ||
3931 | ret--; | ||
3932 | if(cut >= 33333 ) | ||
3933 | ret--; | ||
3934 | ret += 2; // both cut faces | ||
3935 | } | ||
3936 | break; | ||
3937 | case PrimType.CYLINDER: | ||
3938 | ret = 3; | ||
3939 | if (Shape.ProfileBegin > 0 || Shape.ProfileEnd > 0) // cut | ||
3940 | ret += 2; | ||
3930 | break; | 3941 | break; |
3931 | case PrimType.SPHERE: | 3942 | case PrimType.SPHERE: |
3932 | ret = 1; | 3943 | ret = 1; |
3933 | if (hasCut || Shape.PathSkew != 0) ret += 2; | 3944 | // cut faces exist if cut or skew or unequal twist limits |
3934 | if (hasDimple) ret += 2; | 3945 | if (Shape.PathBegin > 0 || Shape.PathEnd > 0 || Shape.PathSkew != 0 || (Shape.PathTwistBegin != Shape.PathTwist)) |
3935 | if (hasHollow) ret += 1; | 3946 | ret += 2; |
3947 | if (Shape.ProfileBegin > 0 || Shape.ProfileEnd > 0 || Shape.ProfileHollow > 0) // dimple also if hollow | ||
3948 | ret += 2; | ||
3936 | break; | 3949 | break; |
3937 | case PrimType.TORUS: | 3950 | case PrimType.TORUS: |
3938 | ret = 1; | 3951 | ret = 1; |
3939 | if (hasCut || Shape.PathSkew != 0) ret += 2; | 3952 | if (Shape.PathBegin > 0 || Shape.PathEnd > 0 || Shape.PathSkew != 0 |
3940 | if (hasProfileCut) ret += 2; | 3953 | || Shape.PathTaperX != 0 || Shape.PathTaperY != 0 || Shape.PathRevolutions > 0 |
3941 | if (hasHollow) ret += 1; | 3954 | || Shape.PathRadiusOffset != 0 || (Shape.PathTwistBegin != Shape.PathTwist)) |
3955 | ret += 2; | ||
3956 | if (Shape.ProfileBegin > 0 || Shape.ProfileEnd > 0) // profile cut | ||
3957 | ret += 2; | ||
3942 | break; | 3958 | break; |
3943 | case PrimType.TUBE: | 3959 | case PrimType.TUBE: |
3944 | ret = 4; | 3960 | ret = 4; |
3945 | if (hasCut || Shape.PathSkew != 0) ret += 2; | 3961 | if (Shape.PathBegin > 0 || Shape.PathEnd > 0 || Shape.PathSkew != 0 |
3946 | if (hasProfileCut) ret += 2; | 3962 | || Shape.PathTaperX != 0 || Shape.PathTaperY != 0 || Shape.PathRevolutions > 0 |
3947 | if (hasHollow) ret += 1; | 3963 | || Shape.PathRadiusOffset != 0 || (Shape.PathTwistBegin != Shape.PathTwist)) |
3964 | ret += 2; | ||
3965 | if (Shape.ProfileBegin > 0 || Shape.ProfileEnd > 0) // profile cut | ||
3966 | { | ||
3967 | // removed sides | ||
3968 | int cut = (Shape.ProfileEnd + Shape.ProfileBegin); | ||
3969 | if(cut > 50000) | ||
3970 | cut = 50000; | ||
3971 | cut /= 12500; | ||
3972 | ret -= cut; | ||
3973 | ret += 2; // both cut faces | ||
3974 | } | ||
3948 | break; | 3975 | break; |
3949 | case PrimType.RING: | 3976 | case PrimType.RING: |
3950 | ret = 3; | 3977 | ret = 3; |
3951 | if (hasCut || Shape.PathSkew != 0) ret += 2; | 3978 | if (Shape.PathBegin > 0 || Shape.PathEnd > 0 || Shape.PathSkew != 0 |
3952 | if (hasProfileCut) ret += 2; | 3979 | || Shape.PathTaperX != 0 || Shape.PathTaperY != 0 || Shape.PathRevolutions > 0 |
3953 | if (hasHollow) ret += 1; | 3980 | || Shape.PathRadiusOffset != 0 || (Shape.PathTwistBegin != Shape.PathTwist)) |
3981 | ret += 2; | ||
3982 | if (Shape.ProfileBegin > 0 || Shape.ProfileEnd > 0) // profile cut | ||
3983 | { | ||
3984 | // removed faces | ||
3985 | int cut = (Shape.ProfileEnd + Shape.ProfileBegin); | ||
3986 | if(cut >= 16667 ) | ||
3987 | ret--; | ||
3988 | if(cut >= 33333 ) | ||
3989 | ret--; | ||
3990 | ret += 2; // both cut faces | ||
3991 | } | ||
3954 | break; | 3992 | break; |
3955 | } | 3993 | } |
3956 | 3994 | ||
3995 | // hollow face commum to all | ||
3996 | if (Shape.ProfileHollow > 0) | ||
3997 | ret += 1; | ||
3998 | |||
3957 | return ret; | 3999 | return ret; |
3958 | } | 4000 | } |
3959 | 4001 | ||
@@ -3998,33 +4040,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3998 | return PrimType.BOX; | 4040 | return PrimType.BOX; |
3999 | } | 4041 | } |
4000 | 4042 | ||
4001 | /// <summary> | ||
4002 | /// Tell us if this object has cut, hollow, dimple, and other factors affecting the number of faces | ||
4003 | /// </summary> | ||
4004 | /// <param name="primType"></param> | ||
4005 | /// <param name="shape"></param> | ||
4006 | /// <param name="hasCut"></param> | ||
4007 | /// <param name="hasHollow"></param> | ||
4008 | /// <param name="hasDimple"></param> | ||
4009 | /// <param name="hasProfileCut"></param> | ||
4010 | protected static void HasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, | ||
4011 | out bool hasDimple, out bool hasProfileCut) | ||
4012 | { | ||
4013 | if (primType == PrimType.BOX | ||
4014 | || | ||
4015 | primType == PrimType.CYLINDER | ||
4016 | || | ||
4017 | primType == PrimType.PRISM) | ||
4018 | |||
4019 | hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); | ||
4020 | else | ||
4021 | hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0); | ||
4022 | |||
4023 | hasHollow = shape.ProfileHollow > 0; | ||
4024 | hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms | ||
4025 | hasProfileCut = hasDimple; // is it the same thing? | ||
4026 | } | ||
4027 | |||
4028 | public void SetGroup(UUID groupID, IClientAPI client) | 4043 | public void SetGroup(UUID groupID, IClientAPI client) |
4029 | { | 4044 | { |
4030 | // Scene.AddNewPrims() calls with client == null so can't use this. | 4045 | // Scene.AddNewPrims() calls with client == null so can't use this. |