public ViewSettingDialog(Graphics.DocumentViews docviews, ViewSetting setting) { InitializeComponent(); _docviews = docviews; _setting = setting; propertyGrid1.SelectedObject = _setting; viewControl.BackColor = _setting.BackgroundColor; viewControl.SceneGraph.WorldScenes.Add(new WorldSphere()); viewControl.SceneGraph.WorldScenes.Add( delegate(Graphics.ISceneContext context) { using (var scope = context.Push()) { scope.Color = this.ActiveLight.Enabled ? _setting.Color : Color.LightGray; Graphics.Util.DrawSolidSphere( new Geom.Sphere3d(Geom.Point3d.Zero, 1.0)); } } ); viewControl.SceneGraph.CameraScenes.Add( delegate(Graphics.ISceneContext context) { if (!this.ActiveLight.Enabled) { return; } Geom.HmCod3d p = this.ActiveLight.Position; Geom.Vector3d d = new Geom.Vector3d(p.X, p.Y, p.Z).Normalize(); Geom.CodSys3d sys = new Geom.CodSys3d(d, new Geom.Point3d(d.x, d.y, d.z)); Geom.Point3d top = Geom.Point3d.Zero; Geom.Point3d end = new Geom.Point3d(0, 0, 2); Geom.Point3d px1 = new Geom.Point3d(0.3, 0, 0.8); Geom.Point3d px2 = new Geom.Point3d(-0.3, 0, 0.8); Geom.Point3d py1 = new Geom.Point3d(0, 0.3, 0.8); Geom.Point3d py2 = new Geom.Point3d(0, -0.3, 0.8); top = sys.Globalize(top); end = sys.Globalize(end); px1 = sys.Globalize(px1); px2 = sys.Globalize(px2); py1 = sys.Globalize(py1); py2 = sys.Globalize(py2); using (var scope = context.Push()) { scope.Color = Color.White; context.DrawLineStrip(gl => gl.Vertices(end, top, px1, px2, top, py1, py2, top)); } } ); this.ActiveLightChanged(null, EventArgs.Empty); viewControl.Fit(); }
public ViewSettingDialog( Graphics.DocumentViews docviews, ViewSetting setting ) { InitializeComponent(); _docviews = docviews; _setting = setting; propertyGrid1.SelectedObject = _setting; viewControl.BackColor = _setting.BackgroundColor; viewControl.SceneGraph.WorldScenes.Add( new WorldSphere() ); viewControl.SceneGraph.WorldScenes.Add( delegate( Graphics.ISceneContext context ) { using ( var scope = context.Push() ) { scope.Color = this.ActiveLight.Enabled ? _setting.Color : Color.LightGray; Graphics.Util.DrawSolidSphere( new Geom.Sphere3d( Geom.Point3d.Zero, 1.0 ) ); } } ); viewControl.SceneGraph.CameraScenes.Add( delegate( Graphics.ISceneContext context ) { if ( !this.ActiveLight.Enabled ) return; Geom.HmCod3d p = this.ActiveLight.Position; Geom.Vector3d d = new Geom.Vector3d( p.X, p.Y, p.Z ).Normalize(); Geom.CodSys3d sys = new Geom.CodSys3d( d, new Geom.Point3d( d.x, d.y, d.z ) ); Geom.Point3d top = Geom.Point3d.Zero; Geom.Point3d end = new Geom.Point3d( 0, 0, 2 ); Geom.Point3d px1 = new Geom.Point3d( 0.3, 0, 0.8 ); Geom.Point3d px2 = new Geom.Point3d( -0.3, 0, 0.8 ); Geom.Point3d py1 = new Geom.Point3d( 0, 0.3, 0.8 ); Geom.Point3d py2 = new Geom.Point3d( 0, -0.3, 0.8 ); top = sys.Globalize( top ); end = sys.Globalize( end ); px1 = sys.Globalize( px1 ); px2 = sys.Globalize( px2 ); py1 = sys.Globalize( py1 ); py2 = sys.Globalize( py2 ); using ( var scope = context.Push() ) { scope.Color = Color.White; context.DrawLineStrip( gl => gl.Vertices( end, top, px1, px2, top, py1, py2, top ) ); } } ); this.ActiveLightChanged( null, EventArgs.Empty ); viewControl.Fit(); }