bool AnimParse(BinaryReader br, string cid) { MegaShape ms = (MegaShape)target; switch (cid) { case "V": int v = br.ReadInt32(); ma = new MegaKnotAnim(); int s = ms.GetSpline(v, ref ma); //.s, ref ma.p, ref ma.t); if (ms.splines[s].animations == null) { ms.splines[s].animations = new List <MegaKnotAnim>(); } ms.splines[s].animations.Add(ma); break; case "Anim": //ma.con = MegaBezVector3KeyControl.LoadBezVector3KeyControl(br); ma.con = MegaParseBezVector3Control.LoadBezVector3KeyControl(br); break; } return(true); }
public bool ParseAnimMesh(BinaryReader br, string id) { switch (id) { case "Size": Vector3 sz = MegaParse.ReadP3(br); Vector3 min1, max1; Vector3 ex1 = Extents(mods.verts, out min1, out max1); int largest = 0; if (sz.x > sz.y) { if (sz.x > sz.z) { largest = 0; } else { largest = 2; } } else { if (sz.y > sz.z) { largest = 1; } else { largest = 2; } } scl = ex1[largest] / sz[largest]; break; case "V": Vector3 p = MegaParse.ReadP3(br) * scl; // Find all matching verts currentVert = new MegaAnimatedVert(); currentVert.startVert = p; currentVert.indices = FindVerts(p); if (currentVert.indices == null) { Debug.Log("Error! No match found"); } Verts.Add(currentVert); break; case "Anim": //currentVert.con = MegaBezVector3KeyControl.LoadBezVector3KeyControl(br); currentVert.con = MegaParseBezVector3Control.LoadBezVector3KeyControl(br); currentVert.con.Scale(scl); break; default: return(false); } return(true); }