Ejemplo n.º 1
0
 public static TDoFBoneType Update(this TDoFBoneType _this, Version version)
 {
     if (!IsIncludeUpperChest(version))
     {
         if (_this >= TDoFBoneType.UpperChest)
         {
             _this++;
         }
     }
     if (!IsIncludeHead(version))
     {
         if (_this >= TDoFBoneType.Head)
         {
             _this++;
         }
     }
     if (!IsIncludeLeftLowerLeg(version))
     {
         if (_this >= TDoFBoneType.LeftLowerLeg)
         {
             _this += 3;
         }
     }
     if (!IsIncludeRightLowerLeg(version))
     {
         if (_this >= TDoFBoneType.RightLowerLeg)
         {
             _this += 3;
         }
     }
     if (!IsIncludeLeftUpperArm(version))
     {
         if (_this >= TDoFBoneType.LeftUpperArm)
         {
             _this += 3;
         }
     }
     if (!IsIncludeRightUpperArm(version))
     {
         if (_this >= TDoFBoneType.RightUpperArm)
         {
             _this += 3;
         }
     }
     return(_this);
 }
Ejemplo n.º 2
0
 public static string ToAttributeString(this HumanoidMuscleType _this)
 {
     if (_this < HumanoidMuscleType.Root)
     {
         int delta = _this - HumanoidMuscleType.Motion;
         return(nameof(HumanoidMuscleType.Motion) + GetTransformPostfix(delta % 7));
     }
     if (_this < HumanoidMuscleType.Limbs)
     {
         int delta = _this - HumanoidMuscleType.Root;
         return(nameof(HumanoidMuscleType.Root) + GetTransformPostfix(delta % 7));
     }
     if (_this < HumanoidMuscleType.Muscles)
     {
         int      delta = _this - HumanoidMuscleType.Limbs;
         LimbType limb  = (LimbType)(delta / 7);
         return(limb.ToBoneType().ToAttributeString() + GetTransformPostfix(delta % 7));
     }
     if (_this < HumanoidMuscleType.Fingers)
     {
         int        delta  = _this - HumanoidMuscleType.Muscles;
         MuscleType muscle = (MuscleType)delta;
         return(muscle.ToAttributeString());
     }
     if (_this < HumanoidMuscleType.TDoFBones)
     {
         const int armSize = (int)FingerType.Last * (int)FingerDoFType.Last;
         const int dofSize = (int)FingerDoFType.Last;
         int       delta   = _this - HumanoidMuscleType.Fingers;
         ArmType   arm     = (ArmType)(delta / armSize);
         delta = delta % armSize;
         FingerType finger = (FingerType)(delta / dofSize);
         delta = delta % dofSize;
         FingerDoFType dof = (FingerDoFType)delta;
         return($"{arm.ToBoneType().ToAttributeString()}.{finger.ToAttributeString()}.{dof.ToAttributeString()}");
     }
     if (_this < HumanoidMuscleType.Last)
     {
         const int    TDoFSize = (int)TDoFBoneType.Last;
         int          delta    = _this - HumanoidMuscleType.TDoFBones;
         TDoFBoneType tdof     = (TDoFBoneType)(delta / TDoFSize);
         return($"{tdof.ToBoneType().ToAttributeString()}{GetTDoFTransformPostfix(delta % TDoFSize)}");
     }
     throw new ArgumentException(_this.ToString());
 }
Ejemplo n.º 3
0
        public static HumanoidMuscleType Update(this HumanoidMuscleType _this, Version version)
        {
            if (_this < HumanoidMuscleType.Muscles)
            {
                return(_this);
            }

            MuscleType muscle      = (MuscleType)(_this - HumanoidMuscleType.Muscles);
            MuscleType fixedMuscle = muscle.Update(version);

            _this = HumanoidMuscleType.Muscles + (int)fixedMuscle;
            if (_this < HumanoidMuscleType.TDoFBones)
            {
                return(_this);
            }

            TDoFBoneType tdof      = (TDoFBoneType)(_this - HumanoidMuscleType.TDoFBones);
            TDoFBoneType fixedTdof = tdof.Update(version);

            _this = HumanoidMuscleType.TDoFBones + (int)fixedTdof;
            return(_this);
        }
Ejemplo n.º 4
0
        public static BoneType ToBoneType(this TDoFBoneType _this)
        {
            switch (_this)
            {
            case TDoFBoneType.Spine:
                return(BoneType.Spine);

            case TDoFBoneType.Chest:
                return(BoneType.Chest);

            case TDoFBoneType.UpperChest:
                return(BoneType.UpperChest);

            case TDoFBoneType.Neck:
                return(BoneType.Neck);

            case TDoFBoneType.Head:
                return(BoneType.Head);

            case TDoFBoneType.LeftUpperLeg:
                return(BoneType.LeftUpperLeg);

            case TDoFBoneType.LeftLowerLeg:
                return(BoneType.LeftLowerLeg);

            case TDoFBoneType.LeftFoot:
                return(BoneType.LeftFoot);

            case TDoFBoneType.LeftToes:
                return(BoneType.LeftToes);

            case TDoFBoneType.RightUpperLeg:
                return(BoneType.RightUpperLeg);

            case TDoFBoneType.RightLowerLeg:
                return(BoneType.RightLowerLeg);

            case TDoFBoneType.RightFoot:
                return(BoneType.RightFoot);

            case TDoFBoneType.RightToes:
                return(BoneType.RightToes);

            case TDoFBoneType.LeftShoulder:
                return(BoneType.LeftShoulder);

            case TDoFBoneType.LeftUpperArm:
                return(BoneType.LeftUpperArm);

            case TDoFBoneType.LeftLowerArm:
                return(BoneType.LeftLowerArm);

            case TDoFBoneType.LeftHand:
                return(BoneType.LeftHand);

            case TDoFBoneType.RightShoulder:
                return(BoneType.RightShoulder);

            case TDoFBoneType.RightUpperArm:
                return(BoneType.RightUpperArm);

            case TDoFBoneType.RightLowerArm:
                return(BoneType.RightLowerArm);

            case TDoFBoneType.RightHand:
                return(BoneType.RightHand);

            default:
                throw new ArgumentException(_this.ToString());
            }
        }