using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using TDCG;

namespace TDCG.Proportion
{
    public class Type_Mikuko3 : IProportion
    {
        Dictionary<string, TPONode> nodes;
        public Dictionary<string, TPONode> Nodes { set { nodes = value; }}

        static float DegreeToRadian(float angle)
        {
           return (float)(Math.PI * angle / 180.0);
        }

        public void Execute()
        {
            TPONode node;

            ////ポーズを元に戻す
            //腰は戻さない
            //node = nodes["W_Hips"];
            //node.Move(0F, 0F, 0F);
            //node.RotateX2(DegreeToRadian(-3F));

            //首は戻さない
            //node = nodes["W_Neck"];
            //node.RotateX2(DegreeToRadian(9F));

            node = nodes["W_RightShoulder"];
            node.RotateZ2(DegreeToRadian(-15F));
            node = nodes["W_RightArm"];
            node.RotateZ2(DegreeToRadian(-17F));
            node = nodes["W_RightForeArm"];
            node.RotateZ2(DegreeToRadian(-8F));
            node = nodes["W_RightHand"];
            node.RotateZ2(DegreeToRadian(-5F));

            node = nodes["W_LeftShoulder"];
            node.RotateZ2(DegreeToRadian(15F));
            node = nodes["W_LeftArm"];
            node.RotateZ2(DegreeToRadian(17F));
            node = nodes["W_LeftForeArm"];
            node.RotateZ2(DegreeToRadian(8F));
            node = nodes["W_LeftHand"];
            node.RotateZ2(DegreeToRadian(5F));

            //ハイライトは戻さない
            //node = nodes["Me_Left_HighLight_A"];
            //node.RotateX(DegreeToRadian(-1F));
            //node.RotateY(DegreeToRadian(28F));
            //node = nodes["Me_Left_HighLight_B"];
            //node.RotateY(DegreeToRadian(-45F));

            ////ここからミク子さん体型
            //手を下に回転
            node = nodes["W_RightArm"];
            node.RotateZ2(DegreeToRadian(40F));
            node = nodes["W_LeftArm"];
            node.RotateZ2(DegreeToRadian(-40F));

            //Chichi_Up2(50%)
            node = nodes["Chichi_Right1"];
            node.RotateX2(DegreeToRadian(-10.00F/2));
            node = nodes["Chichi_Right2"];
            node.RotateX2(DegreeToRadian(-5.00F/2));
            node = nodes["Chichi_Left1"];
            node.RotateX2(DegreeToRadian(-10.00F/2));
            node = nodes["Chichi_Left2"];
            node.RotateX2(DegreeToRadian(-5.00F/2));

            //Chichi_Wide(50%)
            node = nodes["Chichi_Right1"];
            node.RotateY(DegreeToRadian(-5.0F/2));
            node = nodes["Chichi_Right2"];
            node.RotateY(DegreeToRadian(-2.5F/2));
            node = nodes["Chichi_Left1"];
            node.RotateY(DegreeToRadian(5.0F/2));
            node = nodes["Chichi_Left2"];
            node.RotateY(DegreeToRadian(2.5F/2));

            //Length_Foot(100%)
            node = nodes["W_LeftFoot"];
            node.Move(0.00F, -0.80F, 0.00F);
            node = nodes["W_RightFoot"];
            node.Move(0.00F, -0.80F, 0.00F);

            //Scale_Foot(10%)
            //node = nodes["W_LeftFoot"];
            //node.Scale(1-0.5F/10, 1-0.5F/10, 1-0.5F/10);
            //node = nodes["W_RightFoot"];
            //node.Scale(1-0.5F/10, 1-0.5F/10, 1-0.5F/10);

            //Rotate_Foot(100%)
            node = nodes["W_LeftFoot"];
            node.RotateX2(DegreeToRadian(30F));
            node = nodes["W_RightFoot"];
            node.RotateX2(DegreeToRadian(30F));

            //Rotate_Toe(100%)
            node = nodes["W_LeftToeBase"];
            node.RotateX2(DegreeToRadian(-15F));
            node = nodes["W_RightToeBase"];
            node.RotateX2(DegreeToRadian(-15F));

            //Scale_Body2(100%)
            node = nodes["W_Hips"];
            node.Scale(0.9F, 0.9F, 0.9F);
        }
    }
}
