Ejemplo n.º 1
0
        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.
        }
Ejemplo n.º 2
0
		public AssetHandlers(ContentManager contentManager, GraphicsDeviceControl graphicsDeviceControl)
		{
			_graphicsDeviceControl = graphicsDeviceControl;
			_modelHandler = new ModelHandler(contentManager, graphicsDeviceControl);
			_effectHandler = new EffectHandler(contentManager, graphicsDeviceControl);
			_textureHandler = new TextureHandler(contentManager, graphicsDeviceControl);
		}
Ejemplo n.º 3
0
		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.
		}
Ejemplo n.º 4
0
		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;
		}
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
		public EffectHandler(ContentManager contentManager, GraphicsDeviceControl graphicsDeviceControl)
			: base(contentManager, graphicsDeviceControl)
		{
			_modelRenderer = new EffectRenderer(graphicsDeviceControl);
		}
Ejemplo n.º 7
0
		public BoundingBoxRenderer(GraphicsDeviceControl parentControl, ModelRenderer renderer)
		{
			_parentControl = parentControl;
			renderer.ModelChanged += OnRendererModelChanged;
		}
Ejemplo n.º 8
0
		protected AssetHandler(ContentManager contentManager, GraphicsDeviceControl graphicsDeviceControl)
		{
			ContentManager = contentManager;
			GraphicsDeviceControl = graphicsDeviceControl;
		}
Ejemplo n.º 9
0
		public EffectRenderer(GraphicsDeviceControl parentControl)
			: base(parentControl)
		{
		}
Ejemplo n.º 10
0
 public NormalsRenderer(GraphicsDeviceControl parentControl, ModelRenderer renderer)
 {
     _parentControl         = parentControl;
     renderer.ModelChanged += OnRendererModelChanged;
 }
Ejemplo n.º 11
0
		private bool IsWithinCameraCube(GraphicsDeviceControl parentControl, System.Drawing.Point p)
		{
			return (p.X > parentControl.ClientSize.Width - _size)
				&& p.Y < _size;
		}
Ejemplo n.º 12
0
 public EffectRenderer(GraphicsDeviceControl parentControl)
     : base(parentControl)
 {
 }
Ejemplo n.º 13
0
 private bool IsWithinCameraCube(GraphicsDeviceControl parentControl, System.Drawing.Point p)
 {
     return((p.X > parentControl.ClientSize.Width - _size) &&
            p.Y < _size);
 }
Ejemplo n.º 14
0
 public GridRenderer(GraphicsDeviceControl parentControl)
 {
     _parentControl = parentControl;
 }
Ejemplo n.º 15
0
		public GridRenderer(GraphicsDeviceControl parentControl)
		{
			_parentControl = parentControl;
		}
Ejemplo n.º 16
0
 public BoundingBoxRenderer(GraphicsDeviceControl parentControl, ModelRenderer renderer)
 {
     _parentControl         = parentControl;
     renderer.ModelChanged += OnRendererModelChanged;
 }
Ejemplo n.º 17
0
		public NormalsRenderer(GraphicsDeviceControl parentControl, ModelRenderer renderer)
		{
			_parentControl = parentControl;
			renderer.ModelChanged += OnRendererModelChanged;
		}
Ejemplo n.º 18
0
		public TextureHandler(ContentManager contentManager, GraphicsDeviceControl graphicsDeviceControl)
			: base(contentManager, graphicsDeviceControl)
		{
			_textureRenderer = new TextureRenderer(graphicsDeviceControl, graphicsDeviceControl.GraphicsDevice);
		}