public Model(FLVER flver) { Submeshes = new List <FlverSubmeshRenderer>(); var subBoundsPoints = new List <Vector3>(); foreach (var submesh in flver.Meshes) { var smm = new FlverSubmeshRenderer(flver, submesh); Submeshes.Add(smm); subBoundsPoints.Add(smm.Bounds.Min); subBoundsPoints.Add(smm.Bounds.Max); } //DEBUG// //Console.WriteLine($"{flver.Meshes[0].DefaultBoneIndex}"); //Console.WriteLine(); //Console.WriteLine(); //foreach (var mat in flver.Materials) //{ // Console.WriteLine($"{mat.Name}: {mat.MTD}"); //} ///////// if (Submeshes.Count == 0) { Bounds = new BoundingBox(); IsVisible = false; } else { Bounds = BoundingBox.CreateFromPoints(subBoundsPoints); } }
public Model(FLVERD flver) { Type = ModelType.ModelTypeFlver; Submeshes = new List <FlverSubmeshRenderer>(); var subBoundsPoints = new List <Vector3>(); foreach (var submesh in flver.Meshes) { // Blacklist some materials that don't have good shaders and just make the viewer look like a mess var mtd = InterrootLoader.GetMTD(Path.GetFileName(flver.Materials[submesh.MaterialIndex].MTD)); if (mtd != null) { if (mtd.ShaderPath.Contains("FRPG_Water_Env")) { continue; } if (mtd.ShaderPath.Contains("FRPG_Water_Reflect.spx")) { continue; } } if (submesh.ToTriangleList().Length > 0) { var smm = new FlverSubmeshRenderer(this, flver, submesh); Submeshes.Add(smm); subBoundsPoints.Add(smm.Bounds.Min); subBoundsPoints.Add(smm.Bounds.Max); } } //DEBUG// //Console.WriteLine($"{flver.Meshes[0].DefaultBoneIndex}"); //Console.WriteLine(); //Console.WriteLine(); //foreach (var mat in flver.Materials) //{ // Console.WriteLine($"{mat.Name}: {mat.MTD}"); //} ///////// if (Submeshes.Count == 0) { Bounds = new BoundingBox(); IsVisible = false; } else { Bounds = BoundingBox.CreateFromPoints(subBoundsPoints); } }
public Model(HKX hkx) { Type = ModelType.ModelTypeCollision; Submeshes = new List <FlverSubmeshRenderer>(); var subBoundsPoints = new List <Vector3>(); foreach (var col in hkx.DataSection.Objects) { if (col is HKX.FSNPCustomParamCompressedMeshShape) { var smm = new FlverSubmeshRenderer(this, hkx, (HKX.FSNPCustomParamCompressedMeshShape)col); Submeshes.Add(smm); subBoundsPoints.Add(smm.Bounds.Min); subBoundsPoints.Add(smm.Bounds.Max); } if (col is HKX.HKPStorageExtendedMeshShapeMeshSubpartStorage) { var smm = new FlverSubmeshRenderer(this, hkx, (HKX.HKPStorageExtendedMeshShapeMeshSubpartStorage)col); Submeshes.Add(smm); subBoundsPoints.Add(smm.Bounds.Min); subBoundsPoints.Add(smm.Bounds.Max); } } if (Submeshes.Count == 0) { Bounds = new BoundingBox(); IsVisible = false; } else { Bounds = BoundingBox.CreateFromPoints(subBoundsPoints); } }