public bool RotateClipboard(float pAngle)
        {
            if (mClipboard == null)
            {
                return(false);
            }

            AffineTransform transform = new AffineTransform();

            pAngle    = (float)(Math.PI * MathUtil.NormalizeAngle0to360(pAngle) / 180.0);
            transform = transform.RotateY(pAngle);

            for (int i = 0; i < mClipboard.Count; i++)
            {
                var block = mClipboard[i].Clone();
                block.Position = transform.Apply(block.Position);
                mClipboard[i]  = block;
            }

            return(true);
        }
Пример #2
0
        protected override void Execute(WorldRange selection)
        {
            AffineTransform transform = new AffineTransform();
            float           radians   = Mathf.DegToRad(this.angleDegrees);

            transform = transform.RotateY(radians);

            List <WorldEditBlock> blocks = new List <WorldEditBlock>();

            blocks.AddRange(this.UserSession.Clipboard.GetBlocks());
            blocks.AddRange(this.UserSession.Clipboard.GetPlants());
            blocks.AddRange(this.UserSession.Clipboard.GetWorldObjects());

            for (int i = 0; i < blocks.Count; i++)
            {
                WorldEditBlock block = blocks[i];
                block.RotateBlock(transform, this.angleDegrees, radians);
                blocks[i] = block;
            }

            this.UserSession.Clipboard.Clear();
            this.UserSession.Clipboard.Parse(blocks);
        }
Пример #3
0
        public void Rotate(float degrees)
        {
            AffineTransform transform = new AffineTransform();
            float           radians   = Mathf.DegToRad(degrees);

            transform = transform.RotateY(radians);

            List <WorldEditBlock> blocks = new List <WorldEditBlock>();

            blocks.AddRange(this.GetBlocks());
            blocks.AddRange(this.GetPlants());
            blocks.AddRange(this.GetWorldObjects());

            for (int i = 0; i < blocks.Count; i++)
            {
                WorldEditBlock block = blocks[i];
                block.RotateBlock(transform, degrees, radians);
                blocks[i] = block;
            }

            this.Clear();
            this.Parse(blocks);
        }