Exemplo n.º 1
0
 public void VisitPrimTypeConstraint(PrimType primType)
 {
     sb.Append("primtype-");
     sb.Append(primType.ToString().ToLowerInvariant());
 }
Exemplo n.º 2
0
        /// <summary>
        /// Setup construction data for a basic primitive shape
        /// </summary>
        /// <param name="type">Primitive shape to construct</param>
        /// <returns>Construction data that can be plugged into a <seealso cref="Primitive"/></returns>
        public static Primitive.ConstructionData BuildBasicShape(PrimType type)
        {
            Primitive.ConstructionData prim = new Primitive.ConstructionData();
            prim.PCode = PCode.Prim;
            prim.Material = Material.Wood;

            switch (type)
            {
                case PrimType.Box:
                    prim.ProfileCurve = ProfileCurve.Square;
                    prim.PathCurve = PathCurve.Line;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 1f;
                    prim.PathScaleY = 1f;
                    prim.PathRevolutions = 1f;
                    break;
                case PrimType.Cylinder:
                    prim.ProfileCurve = ProfileCurve.Circle;
                    prim.PathCurve = PathCurve.Line;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 1f;
                    prim.PathScaleY = 1f;
                    prim.PathRevolutions = 1f;
                    break;
                case PrimType.Prism:
                    prim.ProfileCurve = ProfileCurve.Square;
                    prim.PathCurve = PathCurve.Line;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 0f;
                    prim.PathScaleY = 0f;
                    prim.PathRevolutions = 1f;
                    break;
                case PrimType.Ring:
                    prim.ProfileCurve = ProfileCurve.EqualTriangle;
                    prim.PathCurve = PathCurve.Circle;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 1f;
                    prim.PathScaleY = 0.25f;
                    prim.PathRevolutions = 1f;
                    break;
                case PrimType.Sphere:
                    prim.ProfileCurve = ProfileCurve.HalfCircle;
                    prim.PathCurve = PathCurve.Circle;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 1f;
                    prim.PathScaleY = 1f;
                    prim.PathRevolutions = 1f;
                    break;
                case PrimType.Torus:
                    prim.ProfileCurve = ProfileCurve.Circle;
                    prim.PathCurve = PathCurve.Circle;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 1f;
                    prim.PathScaleY = 0.25f;
                    prim.PathRevolutions = 1f;
                    break;
                case PrimType.Tube:
                    prim.ProfileCurve = ProfileCurve.Square;
                    prim.PathCurve = PathCurve.Circle;
                    prim.ProfileEnd = 1f;
                    prim.PathEnd = 1f;
                    prim.PathScaleX = 1f;
                    prim.PathScaleY = 0.25f;
                    prim.PathRevolutions = 1f;
                    break;
                default:
                    throw new NotSupportedException("Unsupported shape: " + type.ToString());
            }

            return prim;
        }
Exemplo n.º 3
0
 public void VisitPrimTypeConstraint(PrimType primType)
 {
     result = new JObject {
         ["constraint"] = "primtype", ["primype"] = primType.ToString()
     };
 }