123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using UnityEngine;
- public class BoneMorph_
- {
- public void Init()
- {
- if (this.bones != null)
- {
- for (int i = this.bones.Count - 1; i >= 0; i--)
- {
- BoneMorphLocal boneMorphLocal = this.bones[i];
- if (boneMorphLocal.linkT != null)
- {
- boneMorphLocal.linkT.localPosition = boneMorphLocal.pos;
- }
- }
- }
- this.bones = new List<BoneMorphLocal>();
- }
- public void Uninit()
- {
- this.m_listBoneMorphPos.Clear();
- this.m_listBoneMorphScl.Clear();
- this.m_listBoneMorphRot.Clear();
- }
- public void InitBoneMorphEdit(Transform t, MPN f_mpn, TBody.SlotID f_slot)
- {
- TBodySkin slot = t.GetComponentsInParent<TBody>(true)[0].GetSlot((int)f_slot);
- this.InitBoneMorphEdit(t, f_mpn, f_slot, slot);
- }
- public void InitBoneMorphEdit(Transform t, MPN f_mpn, TBody.SlotID f_slot, TBodySkin tbskin)
- {
- this.m_tbSkin = tbskin;
- Func<string, Transform, BoneMorph_.BoneMorphPos> func = delegate(string propertyName, Transform boneTrans)
- {
- this.m_listBoneMorphPos.RemoveAll((BoneMorph_.BoneMorphPos f) => f.strPropName == propertyName);
- this.m_listBoneMorphPos.Add(new BoneMorph_.BoneMorphPos(propertyName, boneTrans));
- return this.m_listBoneMorphPos[this.m_listBoneMorphPos.Count - 1];
- };
- Func<string, Transform, BoneMorph_.BoneMorphRotatio> func2 = delegate(string propertyName, Transform boneTrans)
- {
- this.m_listBoneMorphRot.RemoveAll((BoneMorph_.BoneMorphRotatio f) => f.strPropName == propertyName);
- this.m_listBoneMorphRot.Add(new BoneMorph_.BoneMorphRotatio(propertyName, boneTrans));
- return this.m_listBoneMorphRot[this.m_listBoneMorphRot.Count - 1];
- };
- Func<string, Transform, BoneMorph_.BoneMorphScl> func3 = delegate(string propertyName, Transform boneTrans)
- {
- this.m_listBoneMorphScl.RemoveAll((BoneMorph_.BoneMorphScl f) => f.strPropName == propertyName);
- this.m_listBoneMorphScl.Add(new BoneMorph_.BoneMorphScl(propertyName, boneTrans));
- return this.m_listBoneMorphScl[this.m_listBoneMorphScl.Count - 1];
- };
- if (f_mpn == MPN.head && f_slot == TBody.SlotID.head)
- {
- Transform transform = CMT.SearchObjName(t, "Ear_L", false);
- bool flag = transform != null;
- if (flag)
- {
- this.m_listBoneMorphPos.RemoveAll((BoneMorph_.BoneMorphPos f) => f.strPropName == "MayuY");
- if (this.m_tbSkin.PartsVersion < 120)
- {
- HashSet<string> gp001AddPropNames = new HashSet<string>(new string[]
- {
- "MayuLongL",
- "MayuLongR"
- });
- this.m_listBoneMorphPos.RemoveAll((BoneMorph_.BoneMorphPos f) => gp001AddPropNames.Contains(f.strPropName));
- this.m_listBoneMorphRot.RemoveAll((BoneMorph_.BoneMorphRotatio f) => gp001AddPropNames.Contains(f.strPropName));
- this.m_listBoneMorphScl.RemoveAll((BoneMorph_.BoneMorphScl f) => gp001AddPropNames.Contains(f.strPropName));
- }
- }
- else
- {
- HashSet<string> gp001AddPropNames = new HashSet<string>(new string[]
- {
- "Earrot_L",
- "Earrot_R",
- "Earscl_L",
- "Earscl_R",
- "Nosepos",
- "Nosescl",
- "Mayupos_L",
- "Mayupos_R",
- "Mayurot_L",
- "Mayurot_R",
- "MayuLongL",
- "MayuLongR"
- });
- this.m_listBoneMorphPos.RemoveAll((BoneMorph_.BoneMorphPos f) => gp001AddPropNames.Contains(f.strPropName));
- this.m_listBoneMorphRot.RemoveAll((BoneMorph_.BoneMorphRotatio f) => gp001AddPropNames.Contains(f.strPropName));
- this.m_listBoneMorphScl.RemoveAll((BoneMorph_.BoneMorphScl f) => gp001AddPropNames.Contains(f.strPropName));
- }
- if (transform != null)
- {
- func2("Earrot_L", transform);
- func3("Earscl_L", transform);
- }
- Transform transform2 = CMT.SearchObjName(t, "Ear_R", false);
- if (transform2 != null)
- {
- func2("Earrot_R", transform2);
- func3("Earscl_R", transform2);
- }
- Transform transform3 = CMT.SearchObjName(t, "Nose", false);
- if (transform3 != null)
- {
- func("Nosepos", transform3);
- func3("Nosescl", transform3);
- }
- Transform transform4 = CMT.SearchObjName(t, "Mayupos", false);
- if (transform4 != null)
- {
- func("MayuY", transform4);
- }
- Transform transform5 = CMT.SearchObjName(t, "Mayupos_L", false);
- if (transform5 != null)
- {
- func("Mayupos_L", transform5);
- func2("Mayurot_L", transform5);
- }
- Transform transform6 = CMT.SearchObjName(t, "Mayupos_R", false);
- if (transform6 != null)
- {
- func("Mayupos_R", transform6);
- func2("Mayurot_R", transform6);
- }
- Transform transform7 = CMT.SearchObjName(t, "Eye_L", false);
- if (transform7 != null)
- {
- func("EyeBallPosXL", transform7);
- BoneMorph_.BoneMorphPos boneMorphPos = func("EyeBallPosYL", transform7);
- boneMorphPos.m_vAddMin += new Vector3(0.00325f, -0.005f, 0f);
- boneMorphPos.m_vAddMax += new Vector3(0f, 0.004f, 0f);
- BoneMorph_.BoneMorphScl boneMorphScl = func3("EyeBallSclXL", transform7);
- boneMorphScl.m_vAddMin += new Vector3(0f, -0.3f, -0.3f);
- boneMorphScl.m_vAddMax += new Vector3(0f, 0.1f, 0.1f);
- boneMorphScl = func3("EyeBallSclYL", transform7);
- boneMorphScl.m_vAddMin += new Vector3(0f, -0.3f, -0.3f);
- boneMorphScl.m_vAddMax += new Vector3(0f, 0.1f, 0.1f);
- }
- Transform transform8 = CMT.SearchObjName(t, "Eye_R", false);
- if (transform8 != null)
- {
- func("EyeBallPosXR", transform8);
- BoneMorph_.BoneMorphPos boneMorphPos2 = func("EyeBallPosYR", transform8);
- boneMorphPos2.m_vAddMin += new Vector3(0.00325f, 0.005f, 0f);
- boneMorphPos2.m_vAddMax += new Vector3(0f, -0.004f, 0f);
- BoneMorph_.BoneMorphScl boneMorphScl2 = func3("EyeBallSclXR", transform8);
- boneMorphScl2.m_vAddMin += new Vector3(0f, -0.3f, -0.3f);
- boneMorphScl2.m_vAddMax += new Vector3(0f, 0.1f, 0.1f);
- boneMorphScl2 = func3("EyeBallSclYR", transform8);
- boneMorphScl2.m_vAddMin += new Vector3(0f, -0.3f, -0.3f);
- boneMorphScl2.m_vAddMax += new Vector3(0f, 0.1f, 0.1f);
- }
- if (120 <= tbskin.PartsVersion)
- {
- Transform transform9 = CMT.SearchObjName(t, "Mayupos_L", false);
- Transform transform10 = CMT.SearchObjName(t, "Mayupos_R", false);
- if (transform9 != null && transform10 != null)
- {
- BoneMorph_.BoneMorphScl boneMorphScl3 = func3("MayuLongL", transform9);
- boneMorphScl3.m_vAddMin += new Vector3(0f, 0f, -0.25f);
- boneMorphScl3.m_vAddMax += new Vector3(0f, 0f, 0.25f);
- BoneMorph_.BoneMorphScl boneMorphScl4 = func3("MayuLongR", transform10);
- boneMorphScl4.m_vAddMin += new Vector3(0f, 0f, -0.25f);
- boneMorphScl4.m_vAddMax += new Vector3(0f, 0f, 0.25f);
- }
- }
- }
- }
- public void DelBoneMorphEdit(MPN f_mpn, TBody.SlotID f_slot)
- {
- if (f_mpn == MPN.head && f_slot == TBody.SlotID.head)
- {
- HashSet<string> removeTargetPropNames = new HashSet<string>(new string[]
- {
- "Earrot_L",
- "Earrot_R",
- "Earscl_L",
- "Earscl_R",
- "Nosepos",
- "Nosescl",
- "MayuY",
- "Mayupos_L",
- "Mayupos_R",
- "Mayurot_L",
- "Mayurot_R",
- "EyeBallPosXL",
- "EyeBallPosYL",
- "EyeBallSclXL",
- "EyeBallSclXR",
- "EyeBallPosXR",
- "EyeBallPosYR",
- "EyeBallSclYL",
- "EyeBallSclYR",
- "MayuLongL",
- "MayuLongR"
- });
- this.m_listBoneMorphPos.RemoveAll((BoneMorph_.BoneMorphPos f) => removeTargetPropNames.Contains(f.strPropName));
- this.m_listBoneMorphRot.RemoveAll((BoneMorph_.BoneMorphRotatio f) => removeTargetPropNames.Contains(f.strPropName));
- this.m_listBoneMorphScl.RemoveAll((BoneMorph_.BoneMorphScl f) => removeTargetPropNames.Contains(f.strPropName));
- }
- }
- private void AddRoot_lp(Transform t, int level = 0, float Kahanshin = 0f)
- {
- string name = t.name;
- if (name.Contains("Thigh"))
- {
- Kahanshin = 1f;
- }
- BoneMorphLocal boneMorphLocal = null;
- List<BoneMorph.BoneProp> list = null;
- if (BoneMorph.dic2.TryGetValue(name, out list))
- {
- for (int i = 0; i < list.Count; i++)
- {
- BoneMorph.BoneProp boneProp = list[i];
- if (boneMorphLocal == null)
- {
- boneMorphLocal = new BoneMorphLocal();
- boneMorphLocal.atr = 0L;
- boneMorphLocal.linkT = t;
- boneMorphLocal.pos = t.localPosition;
- boneMorphLocal.Kahanshin = Kahanshin;
- }
- int nIndex = boneProp.nIndex;
- if (boneProp.bExistM)
- {
- boneMorphLocal.atr |= 1L << nIndex;
- boneMorphLocal.vecs_min[nIndex] = boneProp.vMinM;
- boneMorphLocal.vecs_max[nIndex] = boneProp.vMaxM;
- }
- if (boneProp.bExistP)
- {
- boneMorphLocal.atr |= 1L << nIndex + 32;
- boneMorphLocal.vecs_min[nIndex + 32] = boneProp.vMinP;
- boneMorphLocal.vecs_max[nIndex + 32] = boneProp.vMaxP;
- }
- boneMorphLocal.props.Add(boneProp.strProp);
- }
- }
- if (boneMorphLocal != null)
- {
- this.bones.Add(boneMorphLocal);
- }
- for (int j = 0; j < t.childCount; j++)
- {
- this.AddRoot_lp(t.GetChild(j), level + 1, Kahanshin);
- }
- }
- public void AddRoot(Transform root)
- {
- this.AddRoot_lp(root, 0, 0f);
- }
- public void ChangeMorphPosValue(string strPropName, string f_strBoneName, Vector3 f_fAddMin, Vector3 f_fAddMax)
- {
- BoneMorph_.BoneMorphPos boneMorphPos = this.m_listBoneMorphPos.Find((BoneMorph_.BoneMorphPos f) => f.strPropName == strPropName && f.trBone.name == f_strBoneName);
- if (boneMorphPos != null)
- {
- boneMorphPos.m_vAddMin = boneMorphPos.trBone.localPosition + f_fAddMin;
- boneMorphPos.m_vAddMax = boneMorphPos.trBone.localPosition + f_fAddMax;
- }
- }
- public void ChangeMorphSclValue(string strPropName, string f_strBoneName, Vector3 f_fAddMin, Vector3 f_fAddMax)
- {
- BoneMorph_.BoneMorphScl boneMorphScl = this.m_listBoneMorphScl.Find((BoneMorph_.BoneMorphScl f) => f.strPropName == strPropName && f.trBone.name == f_strBoneName);
- if (boneMorphScl != null)
- {
- boneMorphScl.m_vAddMin = boneMorphScl.trBone.localScale + f_fAddMin;
- boneMorphScl.m_vAddMax = boneMorphScl.trBone.localScale + f_fAddMax;
- }
- }
- public void ChangeMorphRotatioValue(string strPropName, string f_strBoneName, Vector3 f_fAddMin, Vector3 f_fAddMax)
- {
- BoneMorph_.BoneMorphRotatio boneMorphRotatio = this.m_listBoneMorphRot.Find((BoneMorph_.BoneMorphRotatio f) => f.strPropName == strPropName && f.trBone.name == f_strBoneName);
- if (boneMorphRotatio != null)
- {
- boneMorphRotatio.m_vAddMin = boneMorphRotatio.m_vDefRotate * Quaternion.Euler(f_fAddMin);
- boneMorphRotatio.m_vAddMax = boneMorphRotatio.m_vDefRotate * Quaternion.Euler(f_fAddMax);
- }
- }
- public void Blend()
- {
- for (int i = this.bones.Count - 1; i >= 0; i--)
- {
- BoneMorphLocal boneMorphLocal = this.bones[i];
- Vector3 vector = new Vector3(1f, 1f, 1f);
- Vector3 vector2 = boneMorphLocal.pos;
- for (int j = 0; j < BoneMorph.PropNames.Length; j++)
- {
- float num = 1f;
- if (j == 0)
- {
- num = this.SCALE_Kubi;
- }
- if (j == 1)
- {
- num = this.SCALE_Ude;
- }
- if (j == 2)
- {
- num = this.SCALE_EyeX;
- }
- if (j == 3)
- {
- num = this.SCALE_EyeY;
- }
- if (j == 4)
- {
- num = this.Postion_EyeX * (0.5f + this.Postion_EyeY * 0.5f);
- }
- if (j == 5)
- {
- num = this.Postion_EyeY;
- }
- if (j == 6)
- {
- num = this.SCALE_HeadX;
- }
- if (j == 7)
- {
- num = this.SCALE_HeadY;
- }
- if (j == 8)
- {
- num = this.SCALE_DouPer;
- if (boneMorphLocal.Kahanshin == 0f)
- {
- num = 1f - num;
- }
- }
- if (j == 9)
- {
- num = this.SCALE_Sintyou;
- }
- if (j == 10)
- {
- num = this.SCALE_Koshi;
- }
- if (j == 11)
- {
- num = this.SCALE_Kata;
- }
- if (j == 12)
- {
- num = this.SCALE_West;
- }
- if ((boneMorphLocal.atr & 1L << j) != 0L)
- {
- vector = Vector3.Scale(vector, Vector3.Lerp(boneMorphLocal.vecs_min[j], boneMorphLocal.vecs_max[j], num));
- }
- if ((boneMorphLocal.atr & 1L << 32 + j) != 0L)
- {
- vector2 = Vector3.Scale(vector2, Vector3.Lerp(boneMorphLocal.vecs_min[j + 32], boneMorphLocal.vecs_max[j + 32], num));
- }
- }
- if (boneMorphLocal.linkT.name.Contains("Thigh_SCL_"))
- {
- this.SnityouOutScale = Mathf.Pow(vector.x, 0.9f);
- }
- boneMorphLocal.linkT.localPosition = vector2;
- boneMorphLocal.linkT.localScale = vector;
- }
- for (int k = 0; k < this.m_listBoneMorphPos.Count; k++)
- {
- BoneMorph_.BoneMorphPos boneMorphPos = this.m_listBoneMorphPos[k];
- if (boneMorphPos.strPropName == "Nosepos")
- {
- boneMorphPos.trBone.localPosition = boneMorphPos.Lerp(this.POS_Nose);
- }
- else if (boneMorphPos.strPropName == "MayuY")
- {
- boneMorphPos.trBone.localPosition = boneMorphPos.Lerp(this.POS_MayuY);
- }
- else if (boneMorphPos.strPropName == "Mayupos_L" || boneMorphPos.strPropName == "Mayupos_R")
- {
- Vector3 vector3 = boneMorphPos.Lerp(this.POS_MayuY);
- float x = boneMorphPos.m_vAddMin.x;
- boneMorphPos.m_vAddMin = new Vector3(boneMorphPos.m_vAddMax.x, boneMorphPos.m_vAddMin.y, boneMorphPos.m_vAddMin.z);
- boneMorphPos.m_vAddMax = new Vector3(x, boneMorphPos.m_vAddMax.y, boneMorphPos.m_vAddMax.z);
- Vector3 vector4 = boneMorphPos.Lerp(this.POS_MayuX);
- x = boneMorphPos.m_vAddMax.x;
- boneMorphPos.m_vAddMax = new Vector3(boneMorphPos.m_vAddMin.x, boneMorphPos.m_vAddMax.y, boneMorphPos.m_vAddMax.z);
- boneMorphPos.m_vAddMin = new Vector3(x, boneMorphPos.m_vAddMin.y, boneMorphPos.m_vAddMin.z);
- float x2 = vector4.x + vector3.x - boneMorphPos.m_vDefPos.x;
- boneMorphPos.trBone.localPosition = new Vector3(x2, vector3.y, vector4.z);
- }
- else if (boneMorphPos.strPropName == "EyeBallPosYL" || boneMorphPos.strPropName == "EyeBallPosYR")
- {
- boneMorphPos.trBone.localPosition = ((this.EyeBallPosY > 0.5f) ? Vector3.Lerp(boneMorphPos.m_vDefPos, boneMorphPos.m_vAddMax, (this.EyeBallPosY - 0.5f) / 0.5f) : Vector3.Lerp(boneMorphPos.m_vAddMin, boneMorphPos.m_vDefPos, this.EyeBallPosY / 0.5f));
- }
- }
- for (int l = 0; l < this.m_listBoneMorphScl.Count; l++)
- {
- BoneMorph_.BoneMorphScl boneMorphScl = this.m_listBoneMorphScl[l];
- if (boneMorphScl.strPropName == "Earscl_L" || boneMorphScl.strPropName == "Earscl_R")
- {
- boneMorphScl.trBone.localScale = boneMorphScl.Lerp(this.SCALE_Ear);
- }
- else if (boneMorphScl.strPropName == "Nosescl")
- {
- boneMorphScl.trBone.localScale = boneMorphScl.Lerp(this.SCALE_Nose);
- }
- else if (boneMorphScl.strPropName == "EyeBallSclXL" || boneMorphScl.strPropName == "EyeBallSclXR")
- {
- float z = (this.EyeBallSclX >= 0.5f) ? Mathf.Lerp(boneMorphScl.m_vDefScl.z, boneMorphScl.m_vAddMax.z, (this.EyeBallSclX - 0.5f) / 0.5f) : Mathf.Lerp(boneMorphScl.m_vAddMin.z, boneMorphScl.m_vDefScl.z, this.EyeBallSclX / 0.5f);
- Vector3 localScale = boneMorphScl.trBone.localScale;
- localScale.z = z;
- boneMorphScl.trBone.localScale = localScale;
- }
- else if (boneMorphScl.strPropName == "EyeBallSclYL" || boneMorphScl.strPropName == "EyeBallSclYR")
- {
- float y = (this.EyeBallSclY >= 0.5f) ? Mathf.Lerp(boneMorphScl.m_vDefScl.y, boneMorphScl.m_vAddMax.y, (this.EyeBallSclY - 0.5f) / 0.5f) : Mathf.Lerp(boneMorphScl.m_vAddMin.y, boneMorphScl.m_vDefScl.y, this.EyeBallSclY / 0.5f);
- Vector3 localScale2 = boneMorphScl.trBone.localScale;
- localScale2.y = y;
- boneMorphScl.trBone.localScale = localScale2;
- }
- else if (boneMorphScl.strPropName == "MayuLongL" || boneMorphScl.strPropName == "MayuLongR")
- {
- boneMorphScl.trBone.localScale = boneMorphScl.Lerp(this.MayuLong);
- }
- }
- foreach (BoneMorph_.BoneMorphRotatio boneMorphRotatio in this.m_listBoneMorphRot)
- {
- if (boneMorphRotatio.strPropName == "Earrot_L" || boneMorphRotatio.strPropName == "Earrot_R")
- {
- boneMorphRotatio.trBone.localRotation = boneMorphRotatio.Lerp(this.ROT_Ear);
- }
- if (boneMorphRotatio.strPropName == "Mayurot_L" || boneMorphRotatio.strPropName == "Mayurot_R")
- {
- boneMorphRotatio.trBone.localRotation = boneMorphRotatio.Lerp(this.ROT_Mayu);
- }
- }
- if (this.Yorime <= 0.5f)
- {
- this.m_tbSkin.body.m_editYorime = 2f * ((this.Yorime - 0.5f) / 0.5f);
- }
- else
- {
- this.m_tbSkin.body.m_editYorime = 5f * ((this.Yorime - 0.5f) / 0.5f);
- }
- }
- private TextAsset textUserDef1;
- public float SCALE_Sintyou = 1f;
- public float SCALE_Koshi = 1f;
- public float SCALE_DouPer;
- public float SCALE_Kata = 1f;
- public float SCALE_West = 1f;
- public float SCALE_EyeX = 1f;
- public float SCALE_EyeY = 1f;
- public float Postion_EyeX = 1f;
- public float Postion_EyeY = 1f;
- public float EyeBallPosX = 0.5f;
- public float EyeBallPosY = 0.5f;
- public float EyeBallSclX = 0.5f;
- public float EyeBallSclY = 0.5f;
- public float SCALE_Kubi = 1f;
- public float SCALE_Ude = 1f;
- public float SCALE_HeadX = 1f;
- public float SCALE_HeadY = 1f;
- public float POS_Nose = 0.5f;
- public float SCALE_Nose = 0.5f;
- public float ROT_Ear = 0.5f;
- public float SCALE_Ear = 0.5f;
- public float POS_MayuX = 0.5f;
- public float POS_MayuY = 0.5f;
- public float ROT_Mayu = 0.5f;
- public List<BoneMorphLocal> bones;
- public float SnityouOutScale = 1f;
- private bool m_bMayuOffs;
- public float MayuLong = 0.5f;
- public float Yorime = 0.5f;
- private List<BoneMorph_.BoneMorphPos> m_listBoneMorphPos = new List<BoneMorph_.BoneMorphPos>();
- private List<BoneMorph_.BoneMorphScl> m_listBoneMorphScl = new List<BoneMorph_.BoneMorphScl>();
- private List<BoneMorph_.BoneMorphRotatio> m_listBoneMorphRot = new List<BoneMorph_.BoneMorphRotatio>();
- private TBodySkin m_tbSkin;
- private static StringBuilder sbMinM = new StringBuilder(32);
- private static StringBuilder sbMinP = new StringBuilder(32);
- private static StringBuilder sbMaxM = new StringBuilder(32);
- private static StringBuilder sbMaxP = new StringBuilder(32);
- private class BoneMorphPos
- {
- public BoneMorphPos(string f_strPropName, Transform f_trBone)
- {
- this.strPropName = f_strPropName;
- this.trBone = f_trBone;
- this.m_vAddMin = (this.m_vAddMax = (this.m_vDefPos = f_trBone.localPosition));
- }
- public BoneMorphPos(string f_strPropName, Transform f_trBone, Vector3 f_vAddMin, Vector3 f_vAddMax)
- {
- this.strPropName = f_strPropName;
- this.trBone = f_trBone;
- this.m_vDefPos = f_trBone.localPosition;
- this.m_vAddMin = this.m_vDefPos + f_vAddMin;
- this.m_vAddMax = this.m_vDefPos + f_vAddMax;
- }
- public Vector3 Lerp(float t)
- {
- return BoneMorph_.BoneMorphPos.Lerp(this.m_vAddMin, this.m_vDefPos, this.m_vAddMax, t);
- }
- public static Vector3 Lerp(Vector3 min, Vector3 def, Vector3 max, float t)
- {
- float t2 = (t > 0.5f) ? ((t - 0.5f) / 0.5f) : (t / 0.5f);
- return (t > 0.5f) ? Vector3.Lerp(def, max, t2) : Vector3.Lerp(min, def, t2);
- }
- public static float Lerp(float min, float def, float max, float t)
- {
- float t2 = (t > 0.5f) ? ((t - 0.5f) / 0.5f) : (t / 0.5f);
- return (t > 0.5f) ? Mathf.Lerp(def, max, t2) : Mathf.Lerp(min, def, t2);
- }
- public string strPropName;
- public Transform trBone;
- public Vector3 m_vDefPos;
- public Vector3 m_vAddMin;
- public Vector3 m_vAddMax;
- }
- private class BoneMorphScl
- {
- public BoneMorphScl(string f_strPropName, Transform f_trBone)
- {
- this.strPropName = f_strPropName;
- this.trBone = f_trBone;
- this.m_vAddMin = (this.m_vAddMax = (this.m_vDefScl = f_trBone.localScale));
- }
- public BoneMorphScl(string f_strPropName, Transform f_trBone, Vector3 f_vAddMin, Vector3 f_vAddMax)
- {
- this.strPropName = f_strPropName;
- this.trBone = f_trBone;
- this.m_vDefScl = f_trBone.localScale;
- this.m_vAddMin = this.m_vDefScl + f_vAddMin;
- this.m_vAddMax = this.m_vDefScl + f_vAddMax;
- }
- public Vector3 Lerp(float t)
- {
- return BoneMorph_.BoneMorphPos.Lerp(this.m_vAddMin, this.m_vDefScl, this.m_vAddMax, t);
- }
- public string strPropName;
- public Transform trBone;
- public Vector3 m_vDefScl;
- public Vector3 m_vAddMin;
- public Vector3 m_vAddMax;
- }
- private class BoneMorphRotatio
- {
- public BoneMorphRotatio(string f_strPropName, Transform f_trBone)
- {
- this.strPropName = f_strPropName;
- this.trBone = f_trBone;
- this.m_vAddMin = (this.m_vAddMax = (this.m_vDefRotate = f_trBone.localRotation));
- }
- public BoneMorphRotatio(string f_strPropName, Transform f_trBone, Quaternion f_vAddMin, Quaternion f_vAddMax)
- {
- this.strPropName = f_strPropName;
- this.trBone = f_trBone;
- this.m_vDefRotate = f_trBone.localRotation;
- this.m_vAddMin = this.m_vDefRotate * f_vAddMin;
- this.m_vAddMax = this.m_vDefRotate * f_vAddMax;
- }
- public Quaternion Lerp(float t)
- {
- return BoneMorph_.BoneMorphRotatio.Lerp(this.m_vAddMin, this.m_vDefRotate, this.m_vAddMax, t);
- }
- public static Quaternion Lerp(Quaternion min, Quaternion def, Quaternion max, float t)
- {
- float t2 = (t > 0.5f) ? ((t - 0.5f) / 0.5f) : (t / 0.5f);
- return (t > 0.5f) ? Quaternion.Lerp(def, max, t2) : Quaternion.Lerp(min, def, t2);
- }
- public string strPropName;
- public Transform trBone;
- public Quaternion m_vDefRotate;
- public Quaternion m_vAddMin;
- public Quaternion m_vAddMax;
- }
- }
|