Ejemplo n.º 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);

            IEnumerable<XElement> entities = doc.Root.Elements("entities");

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