//Construct an updated model with the movement calculated public AnimatiedPlayer(SkinningDataStorage skinningData) { if (skinningData == null) throw new ArgumentNullException("skinningData"); skinningDataValue = skinningData; boneTransforms = new Matrix[skinningData.BindPose.Count]; worldTransforms = new Matrix[skinningData.BindPose.Count]; skinTransforms = new Matrix[skinningData.BindPose.Count]; }
public void LoadObject(GraphicsDevice graphicsDevice) { this.skinningData = this.model.Tag as SkinningDataStorage; this.originalBoneMatrix = new Matrix[skinningData.BindPose.Count]; int currentBone = 0; while (currentBone < skinningData.BindPose.Count) { this.originalBoneMatrix[currentBone] = skinningData.BindPose[currentBone]; currentBone++; } if (skinningData == null) { throw new InvalidOperationException ("This model does not contain a skinning data tag."); } boundingSpheres = new BoundingSphere[skinnedSpheres.Length]; updatedModel = new AnimatiedPlayer(skinningData); skinningData.BindPose.CopyTo(updatedModel.boneTransforms, 0); mySpherePrimitive = new SpherePrimitive(graphicsDevice, 1, 12); UpdateBoundingSpheres(); boundingSphereAndNamesArray = new BoundingSphereAndNames[skinnedSpheres.Length]; UpdateStructArray(); }