public STBone CreateGenericBone(SELib.SEModel seModel, SELib.SEModelBone seBone) { STBone bone = new STBone(skeleton); bone.Text = seBone.BoneName; bone.parentIndex = seBone.BoneParent; bone.RotationType = STBone.BoneRotationType.Euler; Vector3 rotEular = ToEular(seBone.LocalRotation); bone.position = new float[] { (float)seBone.LocalPosition.X, (float)seBone.LocalPosition.Y, (float)seBone.LocalPosition.Z }; bone.scale = new float[] { (float)seBone.Scale.X, (float)seBone.Scale.Y, (float)seBone.Scale.Z }; bone.rotation = new float[] { rotEular.X, rotEular.Y, rotEular.Z, 0 }; return(bone); }
/// <summary> /// Adds a new bone to the model with the given information /// </summary> /// <param name="Name">The tag name of this bone</param> /// <param name="ParentIndex">The parent index of this bone, -1 for a root bone</param> /// <param name="GlobalPosition">The global space position of this bone</param> /// <param name="GlobalRotation">The global space rotation of this bone</param> /// <param name="LocalPosition">The local parent space position of this bone</param> /// <param name="LocalRotation">The local parent space rotation of this bone</param> /// <param name="Scale">The scale of this bone, 1.0 is default</param> public void AddBone(string Name, int ParentIndex, Vector3 GlobalPosition, Quaternion GlobalRotation, Vector3 LocalPosition, Quaternion LocalRotation, Vector3 Scale) { var Bone = new SEModelBone() { BoneName = Name, BoneParent = ParentIndex }; // Set matricies Bone.GlobalPosition = GlobalPosition; Bone.GlobalRotation = GlobalRotation; Bone.LocalPosition = LocalPosition; Bone.LocalRotation = LocalRotation; // Set scale Bone.Scale = Scale; // Add Bones.Add(Bone); }
public STBone CreateGenericBone(SELib.SEModel seModel, SELib.SEModelBone seBone) { STBone bone = new STBone(skeleton); bone.Text = seBone.BoneName; bone.parentIndex = seBone.BoneParent; bone.RotationType = STBone.BoneRotationType.Euler; bone.Position = new Vector3( (float)seBone.LocalPosition.X, (float)seBone.LocalPosition.Y, (float)seBone.LocalPosition.Z); bone.Scale = new Vector3( (float)seBone.Scale.X, (float)seBone.Scale.Y, (float)seBone.Scale.Z); bone.Rotation = new Quaternion( (float)seBone.LocalRotation.X, (float)seBone.LocalRotation.Y, (float)seBone.LocalRotation.Z, (float)seBone.LocalRotation.W); return(bone); }
private static SELib.SEModelBone SaveBone(STBone bone) { var seBone = new SELib.SEModelBone(); return(seBone); }