public CubeRenderer(GraphicsDeviceControl parentControl, CameraController cameraController) { parentControl.MouseDown += (sender, e) => { if (IsWithinCameraCube(parentControl, e.Location)) { cameraController.MouseDown(ToXnaPoint(e.Location)); _isCubeActive = true; parentControl.Invalidate(); } }; parentControl.MouseMove += (sender, e) => { bool isCubeActive = _isCubeActive; _isCubeActive = IsWithinCameraCube(parentControl, e.Location) || cameraController.IsMouseButtonDown; if (cameraController.MouseMove(ToXnaPoint(e.Location)) || isCubeActive != _isCubeActive) parentControl.Invalidate(); }; parentControl.MouseUp += (sender, e) => { if (!IsWithinCameraCube(parentControl, e.Location)) { _isCubeActive = false; parentControl.Invalidate(); } cameraController.MouseUp(ToXnaPoint(e.Location)); }; _size = 100; // TODO: Make this a configurable setting. }
public CubeRenderer(GraphicsDeviceControl parentControl, CameraController cameraController) { parentControl.MouseDown += (sender, e) => { if (IsWithinCameraCube(parentControl, e.Location)) { cameraController.MouseDown(ToXnaPoint(e.Location)); _isCubeActive = true; parentControl.Invalidate(); } }; parentControl.MouseMove += (sender, e) => { bool isCubeActive = _isCubeActive; _isCubeActive = IsWithinCameraCube(parentControl, e.Location) || cameraController.IsMouseButtonDown; if (cameraController.MouseMove(ToXnaPoint(e.Location)) || isCubeActive != _isCubeActive) { parentControl.Invalidate(); } }; parentControl.MouseUp += (sender, e) => { if (!IsWithinCameraCube(parentControl, e.Location)) { _isCubeActive = false; parentControl.Invalidate(); } cameraController.MouseUp(ToXnaPoint(e.Location)); }; _size = 100; // TODO: Make this a configurable setting. }
public override void Initialize(IServiceProvider serviceProvider, GraphicsDevice graphicsDevice) { _serviceProvider = serviceProvider; _optionsService = (IOptionsService)serviceProvider.GetService(typeof(IOptionsService)); _optionsService.OptionsChanged += (sender, e) => { SetOptions(); _parentControl.Invalidate(); }; SetOptions(); foreach (ModelRendererWidget widget in _widgets) { widget.Initialize(serviceProvider, graphicsDevice); } }
public override void Initialize(IServiceProvider serviceProvider, GraphicsDevice graphicsDevice) { IOptionsService optionsService = (IOptionsService)serviceProvider.GetService(typeof(IOptionsService)); optionsService.OptionsChanged += (sender, e) => { RecreateGrid(graphicsDevice, optionsService); _parentControl.Invalidate(); }; _lineEffect = new BasicEffect(graphicsDevice); ((BasicEffect)_lineEffect).VertexColorEnabled = true; ((BasicEffect)_lineEffect).LightingEnabled = false; ((BasicEffect)_lineEffect).TextureEnabled = false; RecreateGrid(graphicsDevice, optionsService); }
public ModelRenderer(GraphicsDeviceControl parentControl) { _parentControl = parentControl; _ballController = new CameraController(); parentControl.MouseWheelWpf += (sender, e) => { _cameraPosition += _viewDirection * e.Delta * _modelRadius * 0.001f; parentControl.Invalidate(); }; _widgets = new ModelRendererWidget[4]; _widgets[0] = new GridRenderer(parentControl); _widgets[1] = new CubeRenderer(parentControl, _ballController); _normalsRenderer = new NormalsRenderer(parentControl, this); _widgets[2] = _normalsRenderer; _bboxRenderer = new BoundingBoxRenderer(parentControl, this); _widgets[3] = _bboxRenderer; }
public ModelRenderer(GraphicsDeviceControl parentControl) { _parentControl = parentControl; _ballController = new CameraController(); parentControl.MouseWheelWpf += (sender, e) => { _cameraPosition += _viewDirection * e.Delta * _modelRadius * 0.001f; parentControl.Invalidate(); }; _widgets = new ModelRendererWidget[4]; _widgets[0] = new GridRenderer(parentControl); _widgets[1] = new CubeRenderer(parentControl, _ballController); _normalsRenderer = new NormalsRenderer(parentControl, this); _widgets[2] = _normalsRenderer; _bboxRenderer = new BoundingBoxRenderer(parentControl, this); _widgets[3] = _bboxRenderer; }