/// <summary> /// Loads the specified Nyx XML. /// </summary> /// <param name="filename">The filename.</param> /// <returns>A <see cref="Scene" /> instance.</returns> public Scene Load(string filename) { XDocument doc = XDocument.Load(filename); var entities = doc.Root.Elements("entities").First(); Scene scene = new Scene(); foreach (var node in entities.Elements("directional-light")) { scene.AttachSceneNodeToRoot(this.ParseDirectionalLight(node)); } foreach (var node in entities.Elements("point-light")) { scene.AttachSceneNodeToRoot(this.ParsePointLight(node)); } foreach (var node in entities.Elements("spot-light")) { scene.AttachSceneNodeToRoot(this.ParseSpotLight(node)); } foreach (var node in entities.Elements("object")) { scene.AttachSceneNodeToRoot(this.ParseObject(node)); } return scene; }
/// <summary> /// Initializes this instance. /// </summary> public virtual void Initialize() { this.scene = new Scene(); this.InitializeEmptyScene(); }
/// <summary> /// Loads a scene. /// </summary> /// <param name="filename">The filename of the scene to load.</param> public void LoadScene(string filename) { var sceneLoader = new SceneLoader(); this.scene = sceneLoader.Load(filename); this.scene.Initialize(this.engine); }