Exemple #1
0
        public static PmxConstraint Parse(BinaryReader br, PmxDocument doc)
        {
            var rt = new PmxSpringSixDegreesOfFreedomConstraint
            {
                Name        = doc.ReadString(br),
                EnglishName = doc.ReadString(br),
            };
            var kind = (PmxConstraintKind)br.ReadByte();

            rt.Read(br, doc);

            switch (kind)
            {
            case PmxConstraintKind.SpringSixDegreesOfFreedom:
                return(rt);

            case PmxConstraintKind.SixDegreesOfFreedom:
                return((PmxSixDegreesOfFreedomConstraint)rt);

            case PmxConstraintKind.PointToPoint:
                return((PmxPointToPointConstraint)rt);

            case PmxConstraintKind.ConeTwist:
                return((PmxConeTwistConstraint)rt);

            case PmxConstraintKind.Slider:
                return((PmxSliderConstraint)rt);

            case PmxConstraintKind.Hinge:
                return((PmxHingeConstraint)rt);

            default:
                throw new NotSupportedException();
            }
        }
Exemple #2
0
        public static PmxConstraint Parse(BinaryReader br, PmxDocument doc)
        {
            var rt = new PmxSpringSixDegreesOfFreedomConstraint
            {
                Name = doc.ReadString(br),
                EnglishName = doc.ReadString(br),
            };
            var kind = (PmxConstraintKind)br.ReadByte();

            rt.Read(br, doc);

            switch (kind)
            {
                case PmxConstraintKind.SpringSixDegreesOfFreedom:
                    return rt;
                case PmxConstraintKind.SixDegreesOfFreedom:
                    return (PmxSixDegreesOfFreedomConstraint)rt;
                case PmxConstraintKind.PointToPoint:
                    return (PmxPointToPointConstraint)rt;
                case PmxConstraintKind.ConeTwist:
                    return (PmxConeTwistConstraint)rt;
                case PmxConstraintKind.Slider:
                    return (PmxSliderConstraint)rt;
                case PmxConstraintKind.Hinge:
                    return (PmxHingeConstraint)rt;
                default:
                    throw new NotSupportedException();
            }
        }