OpenSim.Region.Framework.Scenes.SceneObjectPart.GetNumberOfSides C# (CSharp) Method

GetNumberOfSides() public method

Get the number of sides that this part has.
public GetNumberOfSides ( ) : int
return int
        public int GetNumberOfSides()
        {
            int ret = 0;
            bool hasCut;
            bool hasHollow;
            bool hasDimple;
            bool hasProfileCut;

            PrimType primType = GetPrimType();
            HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);

            switch (primType)
            {
                case PrimType.BOX:
                    ret = 6;
                    if (hasCut) ret += 2;
                    if (hasHollow) ret += 1;
                    break;
                case PrimType.CYLINDER:
                    ret = 3;
                    if (hasCut) ret += 2;
                    if (hasHollow) ret += 1;
                    break;
                case PrimType.PRISM:
                    ret = 5;
                    if (hasCut) ret += 2;
                    if (hasHollow) ret += 1;
                    break;
                case PrimType.SPHERE:
                    ret = 1;
                    if (hasCut) ret += 2;
                    if (hasDimple) ret += 2;
                    if (hasHollow) ret += 1;
                    break;
                case PrimType.TORUS:
                    ret = 1;
                    if (hasCut) ret += 2;
                    if (hasProfileCut) ret += 2;
                    if (hasHollow) ret += 1;
                    break;
                case PrimType.TUBE:
                    ret = 4;
                    if (hasCut) ret += 2;
                    if (hasProfileCut) ret += 2;
                    if (hasHollow) ret += 1;
                    break;
                case PrimType.RING:
                    ret = 3;
                    if (hasCut) ret += 2;
                    if (hasProfileCut) ret += 2;
                    if (hasHollow) ret += 1;
                    break;
                case PrimType.SCULPT:
                    ret = 1;
                    break;
            }
            return ret;
        }

Usage Example

Beispiel #1
0
 /// <summary>
 /// Check that the face number is valid for the given prim.
 /// </summary>
 /// <param name="part"></param>
 /// <param name="face"></param>
 protected void CheckFaceParam(SceneObjectPart part, int face)
 {
     if (face < 0)
         throw new ArgumentException("Face cannot be less than zero");
                        
     int maxFaces = part.GetNumberOfSides() - 1;
     if (face > maxFaces)
         throw new ArgumentException(
             string.Format("Face argument was {0} but max is {1}", face, maxFaces));
 }
All Usage Examples Of OpenSim.Region.Framework.Scenes.SceneObjectPart::GetNumberOfSides
SceneObjectPart