Beispiel #1
0
        public virtual SceneObject BuildPolyTubeSO(FScene scene, TypedAttribSet attributes)
        {
            PolyTubeSO so = new PolyTubeSO();

            so.Create(scene.DefaultSOMaterial);
            safe_set_property_s(attributes, IOStrings.ASOName, (s) => { so.Name = s; });
            RestoreTransform(so, attributes);
            RestoreMaterial(so, attributes);

            if (check_key_or_debug_print(attributes, IOStrings.APolyCurve3))
            {
                VectorArray3d v = attributes[IOStrings.APolyCurve3] as VectorArray3d;
                so.Curve.SetVertices(v);
            }
            if (check_key_or_debug_print(attributes, IOStrings.APolyCurveClosed))
            {
                so.Curve.Closed = (bool)attributes[IOStrings.APolyCurveClosed];
            }
            if (check_key_or_debug_print(attributes, IOStrings.APolygon2))
            {
                VectorArray2d v = attributes[IOStrings.APolygon2] as VectorArray2d;
                so.Polygon = new Polygon2d(v);
            }

            return(so);
        }
 public static void EmitPolyTubeSO(SceneSerializer s, IOutputStream o, PolyTubeSO so)
 {
     o.AddAttribute(IOStrings.ASOName, so.Name);
     o.AddAttribute(IOStrings.ASOUuid, so.UUID);
     s.EmitTransform(o, so);
     s.EmitMaterial(o, so.GetAssignedSOMaterial());
     o.AddAttribute(IOStrings.APolyCurve3, so.Curve.Vertices);
     o.AddAttribute(IOStrings.APolyCurveClosed, so.Curve.Closed);
     o.AddAttribute(IOStrings.APolygon2, so.Polygon.Vertices);
 }
Beispiel #3
0
        public override SceneObject Duplicate()
        {
            PolyTubeSO copy = new PolyTubeSO();

            copy.Curve   = new DCurve3(this.curve);
            copy.Polygon = new Polygon2d(this.polygon);
            copy.Create(this.GetAssignedSOMaterial());
            copy.SetLocalFrame(
                this.GetLocalFrame(CoordSpace.ObjectCoords), CoordSpace.ObjectCoords);
            copy.SetLocalScale(this.GetLocalScale());
            return(copy);
        }
 public static void Emit(this SceneSerializer s, IOutputStream o, PolyTubeSO so)
 {
     o.AddAttribute(IOStrings.ASOType, IOStrings.TypePolyTube);
     EmitPolyTubeSO(s, o, so);
 }