/*! * @param url URL of 3D scene file to load. * Load a 3D content file (Havok or Vixen format) * and handle a SceneLoadEvent when load is complete. * @see LoadAnimation */ public void LoadScene(string url) { try { Viewer3D viewer = Viewer as Viewer3D; Scene scene = SharedWorld.MainScene; Engine simroot = scene.Engines; SharedWorld.DoAsyncLoad = true; string ext = Path.GetExtension(url).ToLower(); if (ext == ".obj") { ObjIO.Import objload = new ObjIO.Import(); Scene newscene = objload.LoadFile(url); if (OBJLoaded != null) { OBJLoaded(newscene, url); } else { Viewer.SetScene(newscene); } } /* * else if (ext == ".xml") * { * ModImport.ModImport import = new ModImport.ModImport(); * * import.Load(url); * Scene newscene = import.ParseScene(); * Viewer.SetScene(newscene); * } * */ else if (ext == ".vix") { viewer.LoadAsync(url, scene); } else if (ext == ".hkt") { Physics physics = null; if (simroot != null) { physics = simroot.Find(".physics", Group.FIND_END | Group.FIND_CHILD) as Physics; } if (physics == null) { physics = new Physics(); physics.Name = "viewer.physics"; physics.Active = false; if (simroot != null) { simroot.Append(physics); } else { scene.Engines = physics; } } physics.Active = false; viewer.LoadAsync(url, scene); } else { throw new System.ArgumentException("invalid extension", ext); } } catch (Exception ex) { throw new System.IO.FileNotFoundException(ex.Message + ", Cannot open vixen file", url); } }