示例#1
0
        /// <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;
        }
示例#2
0
 /// <summary>
 /// Initializes this instance.
 /// </summary>
 public virtual void Initialize()
 {
     this.scene = new Scene();
     this.InitializeEmptyScene();
 }
示例#3
0
 /// <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);
 }