public ObjectsController(PropertyGrid propertyGrid, ListBox listBox, ListBox listBox2, FlowLayoutPanel panel, Cursor3D cursor) { _propertyGrid = propertyGrid; _listBox = listBox; _listBox2 = listBox2; _cursor = cursor; //_listBox.Items.Add(RaycastingParameters); //_selectableObjects.Add(RaycastingParameters); _listBox.SelectedIndexChanged += _listBox_SelectedIndexChanged; _listBox.DisplayMember = "Name"; _listBox.Items.Add(cursor); _listBox2.DisplayMember = "Name"; _listBox2.SelectedIndexChanged += _listBox2_SelectedIndexChanged; //_listBox.Items.Add(new FrenetCurve()); panel.Controls.Add(GetButton("Add torus", AddTorus)); panel.Controls.Add(GetButton("Add point", AddPoint)); panel.Controls.Add(GetButton("Add Bezier curve", AddBezierCurve)); panel.Controls.Add(GetButton("Add spline curve", AddSplineCurve)); panel.Controls.Add(GetButton("Add interpolating curve", AddBSplineInterpolateCurve)); panel.Controls.Add(GetButton("Add surface", AddSurface)); panel.Controls.Add(GetButton("Add BSpline surface", AddBsplineSurface)); panel.Controls.Add(GetButton("Match points", MatchPoints)); panel.Controls.Add(GetButton("Insert patch", InsertPatch)); panel.Controls.Add(GetButton("Add Intersecting Curve", AddIntersectingCurve)); panel.Controls.Add(GetButton("Draw Curve Params", DrawCurveParams)); panel.Controls.Add(GetButton("Trim", Trim)); panel.Controls.Add(GetButton("Inverse trimming", InverseTrimming)); panel.Controls.Add(GetButton("Serialize", Serialize)); panel.Controls.Add(GetButton("Deserialize", Deserialize)); panel.Controls.Add(GetButton("Delete object", DeleteObject)); }
public MainForm() { InitializeComponent(); KeyPreview = true; KeyDown += MainForm_KeyDown; CenterToScreen(); _bitmap = new DirectBitmap(pictureBox1.Width, pictureBox1.Height); pictureBox1.Image = _bitmap.Bitmap; _graphics = Graphics.FromImage(_bitmap.Bitmap); _camera = new Camera(pictureBox1, this); _cursor = new Cursor3D(_camera, pictureBox1, (float)Near, (float)Far); _controller = new ObjectsController(propertyGrid1, listBox1, listBox2, flowLayoutPanel1, _cursor); _pipeline = new Pipeline(_camera, Fov, Near, Far, _controller, _bitmap, _cursor); _manipulator = new PointManipulator(_controller, (float)Fov, pictureBox1, _camera); var timer = new Timer { Interval = 10 }; timer.Tick += Timer_Tick; timer.Start(); pictureBox1.SizeChanged += PictureBox1_Resize; }
public Pipeline(Camera camera, double fov, double near, double far, ObjectsController objectsController, DirectBitmap bitmap, Cursor3D cursor) { _camera = camera; _fov = (float)fov; _near = (float)near; _far = (float)far; _objectsController = objectsController; _bitmap = bitmap; _aspectRatio = (float)_bitmap.Width / _bitmap.Height; _cursor = cursor; }