public void Execute() { if (directionalLight == null) { directionalLight = new DirectionalLight(app, parent, new Vector3(0f,0f,0f), diffuse, specular); } parent.Add(directionalLight); for (int i = app.SelectedObject.Count - 1; i >= 0; i--) { app.SelectedObject[i].Node.UnSelect(); } if (directionalLight.Node != null) { directionalLight.Node.Select(); } }
public void Clone(IWorldContainer copyParent) { DirectionalLight clone = new DirectionalLight(app, copyParent as Boundary, lightDirection, diffuse, specular); clone.Azimuth = azimuth; clone.Zenith = zenith; copyParent.Add(clone); }
protected void FromXml(XmlReader r) { // first parse the attributes for (int i = 0; i < r.AttributeCount; i++) { r.MoveToAttribute(i); // set the field in this object based on the element we just read switch (r.Name) { case "Name": this.name = r.Value; break; case "Priority": this.priority = int.Parse(r.Value); break; } } r.MoveToElement(); //Moves the reader back to the element node. while (r.Read()) { if (r.NodeType == XmlNodeType.EndElement) { break; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "PointCollection": if (!r.IsEmptyElement) { this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial,MPPointType.Boundary, r); Add(points); points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler); } break; case "NameValuePairs": this.nameValuePairs = new NameValueObject(r); break; case "Forest": Forest forest = new Forest(r, this, app); Add(forest); break; case "Fog": Fog fog = new Fog(r, this, app); Add(fog); break; case "Water": Water water = new Water(r, this, app); Add(water); break; case "Sound": Sound sound = new Sound(r, (IWorldContainer)this, app); Add(sound); break; case "Grass": Grass grass = new Grass(r, this, app); Add(grass); break; case "SpawnGen": SpawnGen mob = new SpawnGen(r, app, this); Add(mob); break; case "AmbientLight": AmbientLight ambientLight = new AmbientLight(app, this, r); Add(ambientLight); break; case "DirectionalLight": DirectionalLight directionalLight = new DirectionalLight(app, this, r); Add(directionalLight); break; } } } if (points == null) { this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial, MPPointType.Boundary); Add(points); points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler); } }
protected void FromXml(XmlReader r) { // first parse the attributes for (int i = 0; i < r.AttributeCount; i++) { r.MoveToAttribute(i); // set the field in this object based on the element we just read switch (r.Name) { case "Name": this.name = r.Value; break; case "Priority": this.priority = int.Parse(r.Value); break; } } r.MoveToElement(); //Moves the reader back to the element node. while (r.Read()) { if (r.NodeType == XmlNodeType.EndElement) { break; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "PointCollection": if (!r.IsEmptyElement) { this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial, MPPointType.Boundary, r); Add(points); points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler); } break; case "NameValuePairs": this.nameValuePairs = new NameValueObject(r); break; case "Forest": Forest forest = new Forest(r, this, app); Add(forest); break; case "Fog": Fog fog = new Fog(r, this, app); Add(fog); break; case "Water": Water water = new Water(r, this, app); Add(water); break; case "Sound": Sound sound = new Sound(r, (IWorldContainer)this, app); Add(sound); break; case "Grass": Grass grass = new Grass(r, this, app); Add(grass); break; case "SpawnGen": SpawnGen mob = new SpawnGen(r, app, this); Add(mob); break; case "AmbientLight": AmbientLight ambientLight = new AmbientLight(app, this, r); Add(ambientLight); break; case "DirectionalLight": DirectionalLight directionalLight = new DirectionalLight(app, this, r); Add(directionalLight); break; } } } if (points == null) { this.points = new PointCollection(this, app, true, app.Config.DisplayRegionPoints, this.app.Config.RegionPointMeshName, this.app.Config.RegionPointMaterial, MPPointType.Boundary); Add(points); points.PointsChanged += new PointsChangedEventHandler(PointsChangedHandler); } }