Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }