コード例 #1
0
        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;
        }
コード例 #2
0
ファイル: PointManipulator.cs プロジェクト: Arnyev/MG
 public PointManipulator(ObjectsController controller, float fov, PictureBox box, Camera camera)
 {
     _controller     = controller;
     _camera         = camera;
     box.MouseClick += _box_MouseClick;
     box.MouseDown  += Box_MouseDown;
     box.MouseUp    += Box_MouseUp;
 }
コード例 #3
0
ファイル: Pipeline.cs プロジェクト: Arnyev/MG
 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;
 }