예제 #1
0
        /// <summary/>
        public ArcHandles()
        {
            _cframe    = CFrame.Identity;
            _spheres   = new ShapeAdornment[6];
            _testers   = new BoundingBox[6];
            _scales    = new float[6];
            _cylinders = new ShapeAdornment[_segments * 3];

            var colours = new[]
            {
                Colour.Red,
                Colour.Green,
                Colour.Blue,
                Colour.Red,
                Colour.Green,
                Colour.Blue
            };

            for (int i = 0; i < 6; i++)
            {
                _spheres[i] = new ShapeAdornment(Shape.Sphere)
                {
                    Colour = colours[i]
                };
                _testers[i] = new BoundingBox();
            }

            for (int i = 0; i < _segments * 3; i++)
            {
                Colour colour;
                if (i < _segments)
                {
                    colour = Colour.Red;
                }
                else if (i < _segments * 2)
                {
                    colour = Colour.Blue;
                }
                else
                {
                    colour = Colour.Green;
                }

                _cylinders[i] = new ShapeAdornment(Shape.Cylinder)
                {
                    Colour = colour
                };
            }

            LeftMouseButtonDown = new Signal <Axis>(this);
            RightMouseButtonUp  = new Signal <Axis>(this);
            MouseDrag           = new Signal <Axis, float, float>(this);
            MouseEnter          = new Signal <Axis>(this);
            MouseLeave          = new Signal <Axis>(this);
        }
예제 #2
0
        /// <inheritdoc />
        public AxisHandles()
        {
            _cframe = CFrame.Identity;

            _cones      = new ShapeAdornment[6];
            _spheres    = new ShapeAdornment[6];
            _cylinders  = new ShapeAdornment[6];
            _hitTesters = new OrientedBoundingBox[6];

            var colours = new[]
            {
                Colour.Red,
                Colour.Green,
                Colour.Blue,
                Colour.Red,
                Colour.Green,
                Colour.Blue
            };

            for (int i = 0; i < 6; i++)
            {
                var nid = (NormalId)i;
                _cones[i] = new ShapeAdornment(this, (Shape)5, nid)
                {
                    Colour = colours[i]
                };
                _spheres[i] = new ShapeAdornment(this, Shape.Sphere, nid)
                {
                    Colour = colours[i]
                };
                _cylinders[i] = new ShapeAdornment(this, Shape.Cylinder, nid)
                {
                    Colour = colours[i]
                };
                _hitTesters[i] = new OrientedBoundingBox(new SharpDX.Vector3(-0.5f, -0.5f, -0.5f),
                                                         new SharpDX.Vector3(.5f, .5f, .5f));
            }

            MouseButton1Down = new Signal <NormalId>(this);
            MouseButton1Up   = new Signal <NormalId>(this);
            MouseDrag        = new Signal <NormalId, float>(this);
            MouseEnter       = new Signal <NormalId>(this);
            MouseLeave       = new Signal <NormalId>(this);

            InputService.Service.InputBegan.Event   += OnInputBegan;
            InputService.Service.InputChanged.Event += OnInputChanged;
            InputService.Service.InputEnded.Event   += OnInputEnded;
        }