public bool Init() { if (Initialized) { return true; } if (Model == null) { return false; } SkinningData = Model.Tag as SkinningData; if (SkinningData == null) throw new InvalidOperationException ("このモデルのTagにはSkinningDataが設定されていません。\n" + "プロセッサにSkinnedModelProcessorを指定してください"); if (SkinningData.AnimationClips.Count == 0) throw new InvalidOperationException ("このモデルにはAnimationClipが存在しません。"); AnimationPlayer = new AnimationPlayer(SkinningData); MotionNames.AddRange(SkinningData.AnimationClips.Keys); // 適当に最初のモーションを再生 foreach (var clip in SkinningData.AnimationClips) { AnimationPlayer.StartClip(clip.Value); CurrentMotionName = clip.Key; break; } BoneTransforms = new QuatTransform[SkinningData.BindPose.Count]; int width = AnimationPlayer.GetSkinRotations().Length; int height = 1; RotationTexture = new FlipTexture2D(GraphicsDevice, width, height, false, SurfaceFormat.Vector4); TranslationTexture = new FlipTexture2D(GraphicsDevice, width, height, false, SurfaceFormat.Vector4); Initialized = true; return true; }