#region File Description
//-----------------------------------------------------------------------------
// TypeReaders.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
#endregion
#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
#endregion
namespace SkinnedModel
{
///
/// Loads SkinningData objects from compiled XNB format.
///
public class SkinningDataReader : ContentTypeReader
{
protected override SkinningData Read(ContentReader input,
SkinningData existingInstance)
{
IDictionary animationClips;
IList bindPose, inverseBindPose;
IList skeletonHierarchy;
animationClips = input.ReadObject>();
bindPose = input.ReadObject>();
inverseBindPose = input.ReadObject>();
skeletonHierarchy = input.ReadObject>();
return new SkinningData(animationClips, bindPose,
inverseBindPose, skeletonHierarchy);
}
}
///
/// Loads AnimationClip objects from compiled XNB format.
///
public class AnimationClipReader : ContentTypeReader
{
protected override AnimationClip Read(ContentReader input,
AnimationClip existingInstance)
{
TimeSpan duration = input.ReadObject();
IList keyframes = input.ReadObject < IList>();
return new AnimationClip(duration, keyframes);
}
}
///
/// Loads Keyframe objects from compiled XNB format.
///
public class KeyframeReader : ContentTypeReader
{
protected override Keyframe Read(ContentReader input,
Keyframe existingInstance)
{
int bone = input.ReadObject();
TimeSpan time = input.ReadObject();
Matrix transform = input.ReadObject();
return new Keyframe(bone, time, transform);
}
}
}