public void LoadCourseInfo(System.Collections.IEnumerable by, string FilePath) { string CourseFolder = System.IO.Path.GetDirectoryName(FilePath); scene = new CourseMuuntScene(by); if (File.Exists($"{CourseFolder}/course_model.szs")) { // scene.AddRenderableBfres($"{CourseFolder}/course_model.szs"); scene.AddRenderableKcl($"{CourseFolder}/course.kcl"); foreach (var kcl in scene.KclObjects) { viewport.AddDrawable(kcl.Renderer); kcl.Renderer.UpdateVertexData(); } /* foreach (var bfres in scene.BfresObjects) * { * viewport.AddDrawable(bfres.BFRESRender); * * bfres.BFRESRender.UpdateVertexData(); * bfres.BFRESRender.UpdateTextureMaps(); * }*/ viewport.LoadObjects(); } objectCB.Items.Add("Scene"); objectCB.SelectedIndex = 0; }
public void Load(dynamic byml) { var courseMuunt = new CourseMuuntScene(byml); Groups = new List <ObjectGroup>(); Groups.Add(new ObjectGroup("Scene Properties", new PropertyObject() { Name = "", Prop = (Dictionary <string, dynamic>)byml, })); var pathGroup = new ObjectGroup("Scene Objects"); Groups.Add(pathGroup); PathDoublePointDrawableContainer lapPaths = new PathDoublePointDrawableContainer("Lap Paths", Color.Blue); PathDrawableContainer enemyPaths = new PathDrawableContainer("Enemy Paths", Color.Red); PathDrawableContainer glidePaths = new PathDrawableContainer("Glide Paths", Color.Orange); PathDrawableContainer itemPaths = new PathDrawableContainer("Item Paths", Color.Green); PathDrawableContainer steerAssitPaths = new PathDrawableContainer("Steer Assist Paths", Color.Cyan); PathDrawableContainer gravityPaths = new PathDrawableContainer("Gravity Paths", Color.Purple); PathDrawableContainer pullPaths = new PathDrawableContainer("Pull Paths", Color.DarkSlateGray); PathDrawableContainer paths = new PathDrawableContainer("Paths", Color.Black); PathDrawableContainer objPaths = new PathDrawableContainer("Object Paths", Color.Brown); PathDrawableContainer jugemPaths = new PathDrawableContainer("Latiku Paths", Color.Pink); PathDrawableContainer introCameras = new PathDrawableContainer("Intro Camera", Color.Yellow); pathGroup.Objects.Add(lapPaths); pathGroup.Objects.Add(enemyPaths); pathGroup.Objects.Add(glidePaths); pathGroup.Objects.Add(itemPaths); pathGroup.Objects.Add(steerAssitPaths); pathGroup.Objects.Add(gravityPaths); pathGroup.Objects.Add(pullPaths); pathGroup.Objects.Add(paths); pathGroup.Objects.Add(objPaths); pathGroup.Objects.Add(jugemPaths); pathGroup.Objects.Add(introCameras); for (int i = 0; i < courseMuunt.LapPaths.Count; i++) { courseMuunt.LapPaths[i].Name = $"Group [{i}]"; lapPaths.SubObjects.Add(courseMuunt.LapPaths[i]); } for (int i = 0; i < courseMuunt.EnemyPaths.Count; i++) { courseMuunt.EnemyPaths[i].Name = $"Group [{i}]"; enemyPaths.SubObjects.Add(courseMuunt.EnemyPaths[i]); } }
public void LoadCourseInfo(System.Collections.IEnumerable by, string FilePath) { CourseFolder = System.IO.Path.GetDirectoryName(FilePath); scene = new CourseMuuntScene(by); //Add collsion (switch) if (File.Exists($"{CourseFolder}/course_kcl.szs")) { scene.AddRenderableKcl($"{CourseFolder}/course_kcl.szs"); } //Add collsion (wii u) if (File.Exists($"{CourseFolder}/course.kcl")) { scene.AddRenderableKcl($"{CourseFolder}/course.kcl"); } //Add probe lighting config (wii u) if (File.Exists($"{CourseFolder}/course.bglpbd")) { scene.AddParameterArchive($"{CourseFolder}/course.bglpbd"); } //Add probe lighting config (switch) if (File.Exists($"{CourseFolder}/course_bglpbd.szs")) { scene.AddParameterArchive($"{CourseFolder}/course_bglpbd.szs"); } //Add course model if (File.Exists($"{CourseFolder}/course_model.szs")) { scene.AddRenderableBfres($"{CourseFolder}/course_model.szs"); } //Add camera mini map parameters if (File.Exists($"{CourseFolder}/course_mapcamera.bin")) { scene.MapCamera = STFileLoader.OpenFileFormat($"{CourseFolder}/course_mapcamera.bin"); } if (scene.MapCamera != null) { var cam = (Course_MapCamera_bin)scene.MapCamera; var wrapper = new MapCameraWrapper(); wrapper.Text = "course_mapcamera.bin"; wrapper.CameraFile = cam; var pointConnection = new RenderableConnectedMapPoints(Color.Blue); Vector4 PositionColor = new Vector4(1, 0, 0, 1); Vector4 TargetColor = new Vector4(0, 1, 0, 1); Vector3 BoundingScale = new Vector3(cam.cameraData.BoundingWidth, 1, cam.cameraData.BoundingHeight); Vector3 CamTranslate = new Vector3(cam.cameraData.PositionX, cam.cameraData.PositionY, cam.cameraData.PositionZ); Vector3 CamTargetTranslate = new Vector3(cam.cameraData.TargetX, cam.cameraData.TargetY, cam.cameraData.TargetZ); wrapper.MapCameraPosition = new RenderablePathPoint(PositionColor, CamTranslate, new Vector3(0), new Vector3(100), cam); wrapper.MapCameraTarget = new RenderablePathPoint(TargetColor, CamTargetTranslate, new Vector3(0), BoundingScale, cam); pointConnection.AddRenderable(wrapper.MapCameraPosition); pointConnection.AddRenderable(wrapper.MapCameraTarget); viewport.AddDrawable(pointConnection); viewport.AddDrawable(wrapper.MapCameraPosition); viewport.AddDrawable(wrapper.MapCameraTarget); treeView1.Nodes.Add(wrapper); } foreach (AAMP aamp in scene.ParameterArchives) { if (aamp.aampFileV1 != null) { LoadParameters(aamp.aampFileV1); } else if (aamp.aampFileV2 != null) { LoadParameters(aamp.aampFileV2); } else { throw new Exception("Failed to load parameter file " + aamp.FileName); } } viewport.AddDrawable(new GL_EditorFramework.EditorDrawables.SingleObject(new OpenTK.Vector3(0))); viewport.LoadObjects(); treeView1.Nodes.Add("Scene"); foreach (var bfres in scene.BfresObjects) { viewport.AddDrawable(bfres.BFRESRender); treeView1.Nodes.Add(bfres); bfres.Checked = true; } if (scene.LapPaths.Count > 0) { AddPathDrawable("Lap Path", scene.LapPaths, Color.Blue); } if (scene.GravityPaths.Count > 0) { AddPathDrawable("Gravity Path", scene.GravityPaths, Color.Purple); } if (scene.EnemyPaths.Count > 0) { AddPathDrawable("Enemy Path", scene.EnemyPaths, Color.Red); } if (scene.GlidePaths.Count > 0) { AddPathDrawable("Glide Path", scene.GlidePaths, Color.Orange); } if (scene.ItemPaths.Count > 0) { AddPathDrawable("Item Path", scene.ItemPaths, Color.Yellow); } if (scene.PullPaths.Count > 0) { AddPathDrawable("Pull Path", scene.PullPaths, Color.GreenYellow); } if (scene.SteerAssistPaths.Count > 0) { AddPathDrawable("Steer Assist Path", scene.SteerAssistPaths, Color.Green); } if (scene.Paths.Count > 0) { AddPathDrawable("Path", scene.Paths, Color.Black); } if (scene.ObjPaths.Count > 0) { // AddPathDrawable("Object Path", scene.ObjPaths, Color.DarkSeaGreen); } if (scene.JugemPaths.Count > 0) { AddPathDrawable("Jugem Path", scene.JugemPaths, Color.DarkSeaGreen); } if (scene.IntroCameras.Count > 0) { AddPathDrawable("IntroCamera", scene.IntroCameras, Color.Pink); } foreach (var kcl in scene.KclObjects) { // viewport.AddDrawable(kcl.Renderer); // treeView1.Nodes.Add(kcl); // kcl.Checked = true; } IsLoaded = true; }