//lattice_deform_vertsから呼ばれる,notested done void init_latt_deform() { MMDModel ob = null; Matrix4x4 latmat; Matrix4x4 imat; if (ob == null) { //デフォームスペースの行列 latmat = latma.Inverted(); //デフォーム配列に戻す imat = latmat.Inverted(); } //今のところここに入るパターンが無い else { imat = latma.Inverted( ); //latmat = imat * myself; latmat = Matrix4x4.Identity; //imat = latmat.inverse; } //BPoint bp;//頂点だけ参照している、lattice int id = 0; var ffu = fu; var ffv = fv; var ffw = fw; List <Vertex> vertices = new List <Vertex>( ); for (int w = 0; w < UVW[2]; w++, fw += dw) { for (int v = 0; v < UVW[1]; v++, fv += dv) { for (int u = 0; u < UVW[0]; u++, //bp++, co += 3, fp += 3, fu += du) { //coはlattice座標 fpは初期fu,fv,fwで引かれて0になる Vertex value = LatticeData[id].Value; #if true value.Position = (mul_mat3_m4_v3(imat, value.Position)); vertices.Add(value); #else Vector3 pos = value.Position - new Vector3(fu, fv, fw); //latmatをかけて行列を戻す value.Position = (mul_mat3_m4_v3(imat, pos)); vertices.Add(value); // ちゃんと変更 RelativeLattice[id] = new LatticeType(value); // 常に相対になりたい // 0 0 0 -> -1 -1 -1 //RelativeLattice[ id ].ToReactivePropertyAsSynchronized( x => x.Value , // convert :x => x + value ,convertBack: x => x - value ); #endif id++; } fu = ffu; } fv = ffv; } fw = ffw; RelativeLattice = LatticeData.Select( (lat, i) => lat.Select( // x => x.Value , convert: x => LatticeData[i].Value - vertices[i] //, convertBack: x => vertices[ i ] - LatticeData[i].Value) ).ToReactiveProperty()).ToArray(); latma = latmat; }