using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using MikuMikuDance.XNA.Model.ModelData;
//using BulletX;
//using BulletX.Dynamics;

namespace MikuMikuDance.XNA.Model
{
    /// <summary>
    /// 剛体クラス
    /// </summary>
    abstract class MMDPhisicsObject
    {
    //    public RigidBody body { get; protected set; }
    //    public CollisionShape collision { get; protected set; }
    //    public MMDRigid Rigid { get; protected set; }
    //    protected MMDModel Model;
    //    protected UInt16 RelatedBone;
        
    //    protected Vector3 defaultPos = Vector3.Zero;
    //    protected Quaternion defaultRotate = Quaternion.Identity;
        
    //    public MMDPhisicsObject(MMDRigid rigid, MMDModel model)
    //    {
    //        Model = model;
    //        Rigid = rigid;
    //    }
    //    public static MMDPhisicsObject PhisicsObjectFactory(MMDRigid rigid, MMDModel model, DynamicsWorld world)
    //    {
    //        switch (rigid.ShapeType)
    //        {
    //            case 0://球
    //                return new MMDPhisicsSphere(rigid, model, world);
    //            case 1://箱
    //                return new MMDPhisicsBox(rigid, model, world);
    //            case 2://カプセル
    //                return new MMDPhisicsCapsule(rigid, model, world);
    //            default:
    //                throw new ApplicationException("Undefined Rigid Shape Type");
    //        }
    //    }

    //    /// <summary>
    //    /// 剛体→ボーンへの適応
    //    /// </summary>
    //    internal virtual void ApplyRigitToBone() { }
    //    /// <summary>
    //    /// ボーン→剛体への適応
    //    /// </summary>
    //    internal virtual void ApplyBoneToRigit() { }
        

    //    protected Matrix CreateOrientation(MMDRigid rigid)
    //    {
    //        return Matrix.CreateFromYawPitchRoll(rigid.Rotation[1],rigid.Rotation[0],rigid.Rotation[2])
    //            * Matrix.CreateTranslation(rigid.Position[0], rigid.Position[1], rigid.Position[2]);
    //    }
    //    /*protected MaterialProperties CreateMaterialProperty(MMDRigid rigid)
    //    {
    //        return new MaterialProperties(rigid.Restitution, rigid.Friction, rigid.Friction * 0.9f);
    //    }

    //    public void Draw()
    //    {
    //        if (Model.mmdXNA.debugDrawer.Enabled)
    //        {
               
    //           wf = collision.GetLocalSkinWireframe();

    //            // if the collision skin was also added to the body
    //            // we have to transform the skin wireframe to the body space
    //            if (body.CollisionSkin != null)
    //            {
    //                body.TransformWireframe(wf);
    //            }
    //            Model.mmdXNA.debugDrawer.DrawShape(wf);
    //        }
    //    }
    //    VertexPositionColor[] wf;*/

        
    }
    //class MMDPhisicsSorter : IComparer<MMDPhisicsObject>
    //{
    //    public int Compare(MMDPhisicsObject o1, MMDPhisicsObject o2)
    //    {
    //        return o1.Rigid.RelatedBoneIndex - o2.Rigid.RelatedBoneIndex;
    //    }
    //}
}
