Example #1
0
        public void ConvertToEular()
        {
            if (RotationType == BoneRotationType.Euler)
            {
                return;
            }

            RotationType = STBone.BoneRotationType.Euler;

            ApplyTransforms();

            //Update matrices
            skeletonParent.reset();
            skeletonParent.update();
        }
Example #2
0
        public void ConvertToQuaternion()
        {
            if (RotationType == BoneRotationType.Quaternion)
            {
                return;
            }

            RotationType = STBone.BoneRotationType.Quaternion;

            ApplyTransforms();

            //Update matrices
            skeletonParent.reset();
            skeletonParent.update();
        }
Example #3
0
        public JPBone ReadBone(Bone bn, bool SetParent = true)
        {
            if (boneU == null)
            {
                boneU = new Bone();
            }
            boneU             = bn;
            flagVisible       = bn.Flags.HasFlag(BoneFlags.Visible);
            name              = bn.Name;
            rigidMatrixIndex  = bn.RigidMatrixIndex;
            smoothMatrixIndex = bn.SmoothMatrixIndex;
            billboardIndex    = bn.BillboardIndex;
            useRigidMatrix    = bn.RigidMatrixIndex != -1;
            useSmoothMatrix   = bn.SmoothMatrixIndex != -1;

            if (SetParent)
            {
                parentIndex = (short)bn.ParentIndex;
            }
            scale    = new float[3];
            rotation = new float[4];
            position = new float[3];
            if (bn.FlagsRotation == BoneFlagsRotation.Quaternion)
            {
                rotationType = BoneRotationType.Quaternion;
            }
            else
            {
                rotationType = BoneRotationType.Euler;
            }
            scale[0]    = bn.Scale.X;
            scale[1]    = bn.Scale.Y;
            scale[2]    = bn.Scale.Z;
            rotation[0] = bn.Rotation.X;
            rotation[1] = bn.Rotation.Y;
            rotation[2] = bn.Rotation.Z;
            rotation[3] = bn.Rotation.W;
            position[0] = bn.Position.X;
            position[1] = bn.Position.Y;
            position[2] = bn.Position.Z;
            return(this);
        }