public NUD toNUD() { NUD n = new NUD(); n.hasBones = false; foreach (OBJObject o in objects) { NUD.Mesh m = new NUD.Mesh(); m.Text = o.name; m.singlebind = -1; m.boneflag = 0x08; foreach (OBJGroup g in o.groups) { if (g.v.Count == 0) { continue; } NUD.Polygon p = new NUD.Polygon(); m.Nodes.Add(p); m.Nodes.Add(p); p.setDefaultMaterial(); p.vertSize = 0x06; p.UVSize = 0x10; p.polflag = 0x00; Dictionary <int, int> collected = new Dictionary <int, int>(); for (int i = 0; i < g.v.Count; i++) { p.faces.Add(p.vertices.Count); NUD.Vertex v = new NUD.Vertex(); p.vertices.Add(v); if (g.v.Count > i) { v.pos = this.v[g.v[i]] + Vector3.Zero; } if (g.vn.Count > i) { v.nrm = vn[g.vn[i]] + Vector3.Zero; } if (g.vt.Count > i) { v.uv.Add(vt[g.vt[i]] + Vector2.Zero); } } } if (m.Nodes.Count > 0) { n.Nodes.Add(m); } } n.Optimize(); n.PreRender(); return(n); }