using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using TDCG;
//css_reference Microsoft.DirectX.dll;
//css_reference Microsoft.DirectX.Direct3D.dll;
//css_reference Microsoft.DirectX.Direct3DX.dll;

namespace TDCG.Proportion
{
    public class Type_Mikuko6B_Uni : 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;

            //■Tスタンスの適用が前提

            node = nodes["W_Neck"];
            node.RotateX2(DegreeToRadian(9F));

            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));		//手を下に回転(TスタンスからAスタンスへ)
            node = nodes["W_LeftArm"];			//腕
            node.RotateZ2(DegreeToRadian(-40F));	//手を下に回転(TスタンスからAスタンスへ)

            //■全体調整
            node = nodes["W_Hips"];			//全体
            node.RotateX(DegreeToRadian(-3.00F));	//後に仰け反り
            node.Move(0.00F, 0.00F, 1.50F);		//前に移動(センター位置調整)
            node.Scale(0.92F, 0.92F, 0.92F);		//大きさを小さく

            //■手
            node = nodes["W_RightShoulder_Dummy"];	//肩ダミー
            node.Scale1(0.895F, 1.00F, 1.00F);		//肩幅を狭く

            node = nodes["W_RightShoulder"];
            node.Scale1(0.79F, 1.00F, 1.00F);		//肩を狭く

            node = nodes["W_RightArmRoll"];		//腕捩
            node.Scale1(1.21F, 1.00F, 1.00F);		//上腕を長く

            node = nodes["W_RightForeArm"];		//腕
            node.Scale1(1.00F, 0.79F, 1.00F);		//上腕を長く、上下に薄く

            node = nodes["W_RightForeArmRoll"];		//ひじ捩
            node.Scale1(1.21F, 0.79F, 1.00F);		//下腕を長く、上下に薄く

            node = nodes["W_RightHand"];		//手首
            node.Scale(0.895F, 0.895F, 0.895F);		//掌を小さく

            node = nodes["W_LeftShoulder_Dummy"];	//肩ダミー
            node.Scale1(0.895F, 1.00F, 1.00F);		//肩幅を狭く

            node = nodes["W_LeftShoulder"];
            node.Scale1(0.79F, 1.00F, 1.00F);		//肩を狭く

            node = nodes["W_LeftArmRoll"];		//腕捩
            node.Scale1(1.21F, 1.00F, 1.00F);		//上腕を長く

            node = nodes["W_LeftForeArm"];		//腕
            node.Scale1(1.00F, 0.79F, 1.00F);		//上腕を長く、上下に薄く

            node = nodes["W_LeftForeArmRoll"];		//ひじ捩
            node.Scale1(1.21F, 0.79F, 1.00F);		//下腕を長く、上下に薄く

            node = nodes["W_LeftHand"];			//手首
            node.Scale(0.895F, 0.895F, 0.895F);		//掌を小さく

            //■足
            node = nodes["W_LeftHips_Dummy"];		//足ダミー
            node.RotateX(DegreeToRadian(2.00F));	//後に回転
            node.Move(0.10F, -0.20F, -0.10F);		//股関節を外側、下、後に移動

            node = nodes["W_LeftUpLegRoll"];		//足(捩り位置)
            node.Scale1(0.895F, 1.00F, 0.895F);		//腿の下側を細く
            node.Move(0.10F, 0.00F, 0.00F);		//外側に移動

            node = nodes["W_LeftLeg"];			//ひざ
            node.Scale1(1.00F, 1.21F, 1.00F);		//脛(上)を長く
            node.RotateZ(DegreeToRadian(-1.00F));	//内側に回転(X脚をまっすぐに)

            node = nodes["W_LeftLegRoll"];		//ひざ(捩り位置)
            node.Scale1(1.00F, 1.42F, 1.00F);		//脛(下)を長く

            node = nodes["W_LeftFoot"];			//足首
            node.Scale(0.895F, 0.895F, 0.895F);		//足首を小さく
            node.RotateX(DegreeToRadian(6.00F));	//足首を下に回転
            node.RotateZ(DegreeToRadian(1.00F));	//足首を外側に回転(ひざの打ち消し用)

            node = nodes["W_RightHips_Dummy"];		//足ダミー
            node.RotateX(DegreeToRadian(2.00F));	//後に回転
            node.Move(-0.10F, -0.20F, -0.10F);		//股関節を外側、下、後に移動

            node = nodes["W_RightUpLegRoll"];		//足(捩り位置)
            node.Scale1(0.895F, 1.00F, 0.895F);		//腿の下側を細く
            node.Move(-0.10F, 0.00F, 0.00F);		//外側に移動

            node = nodes["W_RightLeg"];			//ひざ
            node.Scale1(1.00F, 1.21F, 1.00F);		//脛(上)を長く
            node.RotateZ(DegreeToRadian(1.00F));	//内側に回転(X脚をまっすぐに)

            node = nodes["W_RightLegRoll"];		//ひざ(捩り位置)
            node.Scale1(1.00F, 1.42F, 1.00F);		//脛(下)を長く

            node = nodes["W_RightFoot"];		//足首
            node.Scale(0.895F, 0.895F, 0.895F);		//足首を小さく
            node.RotateX(DegreeToRadian(6.00F));	//足首を下に回転
            node.RotateZ(DegreeToRadian(-1.00F));	//足首を外側に回転(ひざの打ち消し用)

            //■体幹
            node = nodes["face_oya"];
            node.Move(0.00F, -0.10F, 0.00F);		//首を短く

            node = nodes["W_Neck"];
            node.RotateX2(DegreeToRadian(-9F));		//首を後に回転

            node = nodes["W_Spine_Dummy"];
            node.Move(0.00F, 0.00F, -0.10F);		//腰を前後に薄く

            node = nodes["W_Spine1"];
            node.Scale1(0.895F, 1.00F, 1.00F);		//上半身の横幅を狭く

            node = nodes["W_Spine2"];
            node.Scale1(0.895F, 1.00F, 1.00F);		//上半身2の横幅を狭く

            node = nodes["W_Spine3"];
            node.Scale1(0.895F, 1.00F, 1.00F);		//上半身3の横幅を狭く

            //■目ハイライト
            node = nodes["Me_Left_HighLight_A"];
            node.Move(-0.25F, -0.10F, 0.08F);

            node = nodes["Me_Left_HighLight_B"];
            node.Scale(1.50F, 1.50F, 1.50F);
            node.Move(0.10F, 0.02F, 0.00F);

            node = nodes["Me_Left_RighLight_A"];
            node.RotateX(DegreeToRadian(-1.00F));
            node.Move(0.00F, -0.10F, 0.00F);

            node = nodes["Me_Left_RighLight_B"];
            node.Scale(1.50F, 1.50F, 1.50F);
            node.Move(-0.15F, 0.02F, 0.00F);

            //■乳　Chichi_Up3_Uni:100%と同様
            node = nodes["Chichi_Right1"];
            node.Scale(1.05F, 0.90F, 0.95F);
            node.RotateX(DegreeToRadian(-7.11F));
            node.RotateY(DegreeToRadian(-2.52F));
            node.RotateZ(DegreeToRadian(-0.39F));

            node = nodes["Chichi_Right2"];
            node.Scale(1.07F, 1.25F, 1.18F);

            node = nodes["Chichi_Right3"];
            node.Scale(0.89F, 0.89F, 0.89F);

            node = nodes["Chichi_Left1"];
            node.Scale(1.05F, 0.90F, 0.95F);
            node.RotateX(DegreeToRadian(-7.11F));
            node.RotateY(DegreeToRadian(2.52F));
            node.RotateZ(DegreeToRadian(-0.39F));

            node = nodes["Chichi_Left2"];
            node.Scale(1.07F, 1.25F, 1.18F);

            node = nodes["Chichi_Left3"];
            node.Scale(0.89F, 0.89F, 0.89F);
        }
    }
}
