// Token: 0x06000031 RID: 49 RVA: 0x000028B8 File Offset: 0x00000AB8 private static void ApplySelectedPointsAndFaces(MLOD_LOD dstLod, Dictionary <string, List <Conversion.PointWeight> > nsPoints, Dictionary <string, List <int> > nsFaces) { foreach (Tagg tagg in dstLod.taggs) { if (tagg is NamedSelectionTagg) { NamedSelectionTagg namedSelectionTagg = tagg as NamedSelectionTagg; List <Conversion.PointWeight> list; if (nsPoints != null && nsPoints.TryGetValue(namedSelectionTagg.Name, out list)) { foreach (Conversion.PointWeight pointWeight in list) { byte b = -pointWeight.weight; if (b != 0) { namedSelectionTagg.points[pointWeight.pointIndex] = b; } } } List <int> list2; if (nsFaces != null && nsFaces.TryGetValue(namedSelectionTagg.Name, out list2)) { foreach (int num in list2) { namedSelectionTagg.faces[num] = 1; } } } } }
// Token: 0x0600002F RID: 47 RVA: 0x00002730 File Offset: 0x00000930 public static MLOD ODOL2MLOD(ODOL odol) { P3D_LOD[] lods = odol.LODs; int num = lods.Length; MLOD_LOD[] array = new MLOD_LOD[num]; for (int i = 0; i < num; i++) { array[i] = Conversion.OdolLod2MLOD(odol, (LOD)lods[i]); } return(new MLOD(array)); }
// Token: 0x06000032 RID: 50 RVA: 0x000029DC File Offset: 0x00000BDC private static void ConvertPoints(ODOL odol, MLOD_LOD dstLod, LOD srcLod) { Vector3P boundingCenter = odol.modelInfo.boundingCenter; Vector3P bboxMinVisual = odol.modelInfo.bboxMinVisual; Vector3P bboxMaxVisual = odol.modelInfo.bboxMaxVisual; int num = srcLod.Vertices.Length; dstLod.points = new Point[num]; for (int i = 0; i < num; i++) { Vector3P pos = srcLod.Vertices[i] + boundingCenter; dstLod.points[i] = new Point(pos, Conversion.clipFlagsToPointFlags(srcLod.ClipFlags[i])); } }
// Token: 0x06000030 RID: 48 RVA: 0x00002774 File Offset: 0x00000974 private static MLOD_LOD OdolLod2MLOD(ODOL odol, LOD src) { MLOD_LOD mlod_LOD = new MLOD_LOD(src.Resolution); int vertexCount = src.VertexCount; Conversion.ConvertPoints(odol, mlod_LOD, src); mlod_LOD.normals = src.Normals; Conversion.ConvertFaces(odol, mlod_LOD, src); float mass = odol.modelInfo.mass; Skeleton skeleton = odol.Skeleton; mlod_LOD.taggs = new List <Tagg>(); if (src.Resolution == 1E+13f) { MassTagg item = Conversion.createMassTagg(vertexCount, mass); mlod_LOD.taggs.Add(item); } IEnumerable <UVSetTagg> collection = Conversion.createUVSetTaggs(src); mlod_LOD.taggs.AddRange(collection); IEnumerable <PropertyTagg> collection2 = Conversion.createPropertyTaggs(src); mlod_LOD.taggs.AddRange(collection2); IEnumerable <NamedSelectionTagg> collection3 = Conversion.createNamedSelectionTaggs(src); mlod_LOD.taggs.AddRange(collection3); IEnumerable <AnimationTagg> collection4 = Conversion.createAnimTaggs(src); mlod_LOD.taggs.AddRange(collection4); if (Resolution.KeepsNamedSelections(src.Resolution)) { return(mlod_LOD); } Dictionary <string, List <Conversion.PointWeight> > nsPoints = new Dictionary <string, List <Conversion.PointWeight> >(); Dictionary <string, List <int> > nsFaces = new Dictionary <string, List <int> >(); Conversion.ReconstructNamedSelectionBySections(src, out nsPoints, out nsFaces); Dictionary <string, List <Conversion.PointWeight> > nsPoints2 = new Dictionary <string, List <Conversion.PointWeight> >(); Dictionary <string, List <int> > nsFaces2 = new Dictionary <string, List <int> >(); Conversion.ReconstructProxies(src, out nsPoints2, out nsFaces2); Dictionary <string, List <Conversion.PointWeight> > nsPoints3 = new Dictionary <string, List <Conversion.PointWeight> >(); Conversion.ReconstructNamedSelectionsByBones(src, odol.Skeleton, out nsPoints3); Conversion.ApplySelectedPointsAndFaces(mlod_LOD, nsPoints, nsFaces); Conversion.ApplySelectedPointsAndFaces(mlod_LOD, nsPoints2, nsFaces2); Conversion.ApplySelectedPointsAndFaces(mlod_LOD, nsPoints3, null); return(mlod_LOD); }
// Token: 0x06000033 RID: 51 RVA: 0x00002A58 File Offset: 0x00000C58 private static void ConvertFaces(ODOL odol, MLOD_LOD dstLod, LOD srcLOD) { List <Face> list = new List <Face>(srcLOD.VertexCount * 2); foreach (Section section in srcLOD.Sections) { float[] uvdata = srcLOD.UVSets[0].UVData; foreach (uint num in section.getFaceIndexes(srcLOD.Faces)) { int num2 = srcLOD.Faces[(int)num].VertexIndices.Length; Vertex[] array = new Vertex[num2]; for (int k = 0; k < num2; k++) { int num3 = srcLOD.Faces[(int)num].VertexIndices[num2 - 1 - k]; array[k] = new Vertex(num3, num3, uvdata[num3 * 2], uvdata[num3 * 2 + 1]); } string texture = (section.textureIndex == -1) ? "" : srcLOD.Textures[(int)section.textureIndex]; string material = (section.materialIndex == -1) ? "" : srcLOD.Materials[section.materialIndex].materialName; Face item = new Face(num2, array, FaceFlags.DEFAULT, texture, material); list.Add(item); } } dstLod.faces = list.ToArray(); }