public HavokAnimationData_InterleavedUncompressed(string name, HKX.HKASkeleton skeleton, HKX.HKADefaultAnimatedReferenceFrame refFrame, HKX.HKAAnimationBinding binding, HKX.HKAInterleavedUncompressedAnimation anim) : base(name, skeleton, refFrame, binding) { Duration = anim.Duration;// Math.Max(anim.Duration, anim.FrameDuration * anim.FrameCount); TransformTrackCount = anim.TransformTrackCount; FrameCount = (int)anim.Transforms.Capacity / anim.TransformTrackCount; FrameDuration = Duration / FrameCount; HkxBoneIndexToTransformTrackMap = new int[skeleton.Bones.Size]; TransformTrackIndexToHkxBoneMap = new int[binding.TransformTrackToBoneIndices.Size]; for (int i = 0; i < binding.TransformTrackToBoneIndices.Size; i++) { TransformTrackIndexToHkxBoneMap[i] = -1; } for (int i = 0; i < skeleton.Bones.Size; i++) { HkxBoneIndexToTransformTrackMap[i] = -1; } for (int i = 0; i < binding.TransformTrackToBoneIndices.Size; i++) { short boneIndex = binding.TransformTrackToBoneIndices[i].data; if (boneIndex >= 0) { HkxBoneIndexToTransformTrackMap[boneIndex] = i; } TransformTrackIndexToHkxBoneMap[i] = boneIndex; } Transforms = new List <NewBlendableTransform>((int)anim.Transforms.Capacity); foreach (var t in anim.Transforms.GetArrayData().Elements) { Transforms.Add(new NewBlendableTransform() { Translation = new Vector3(t.Position.Vector.X, t.Position.Vector.Y, t.Position.Vector.Z), Scale = new Vector3(t.Scale.Vector.X, t.Scale.Vector.Y, t.Scale.Vector.Z), Rotation = new Quaternion(t.Rotation.Vector.X, t.Rotation.Vector.Y, t.Rotation.Vector.Z, t.Rotation.Vector.W) }); } }
public HavokAnimationData_SplineCompressed(string name, HKX.HKASkeleton skeleton, HKX.HKADefaultAnimatedReferenceFrame refFrame, HKX.HKAAnimationBinding binding, HKX.HKASplineCompressedAnimation anim) : base(name, skeleton, refFrame, binding) { Duration = anim.Duration;// Math.Max(anim.Duration, anim.FrameDuration * anim.FrameCount); FrameCount = anim.FrameCount; FrameDuration = anim.FrameDuration; BlockCount = anim.BlockCount; NumFramesPerBlock = anim.FramesPerBlock; HkxBoneIndexToTransformTrackMap = new int[skeleton.Bones.Size]; TransformTrackIndexToHkxBoneMap = new int[binding.TransformTrackToBoneIndices.Size]; for (int i = 0; i < binding.TransformTrackToBoneIndices.Size; i++) { TransformTrackIndexToHkxBoneMap[i] = -1; } for (int i = 0; i < skeleton.Bones.Size; i++) { HkxBoneIndexToTransformTrackMap[i] = -1; } for (int i = 0; i < binding.TransformTrackToBoneIndices.Size; i++) { short boneIndex = binding.TransformTrackToBoneIndices[i].data; if (boneIndex >= 0) { HkxBoneIndexToTransformTrackMap[boneIndex] = i; } TransformTrackIndexToHkxBoneMap[i] = boneIndex; } Tracks = SplineCompressedAnimation.ReadSplineCompressedAnimByteBlock( isBigEndian: false, anim.GetData(), anim.TransformTrackCount, anim.BlockCount); }
public HavokAnimationData(string Name, HKX.HKASkeleton skeleton, HKX.HKADefaultAnimatedReferenceFrame refFrame, HKX.HKAAnimationBinding binding) { this.Name = Name; hkaSkeleton = skeleton; if (refFrame != null) { RootMotion = new RootMotionData(refFrame); } BlendHint = binding?.BlendHint ?? HKX.AnimationBlendHint.NORMAL; }