/**
         * @inheritDoc
         */

        //private Vector3 vector = new Vector3 ();
        //private float angle;
        public void UpdateTransform(Com.Viperstudio.Geom.Matrix matrix, DBTransform transform)
        {
            if (_display != null)
            {
                (_display as UnityBoneDisplay).Update(matrix);
            }
        }
 public static void TransformToMatrix(DBTransform transform, Com.Viperstudio.Geom.Matrix matrix)
 {
     matrix.A  = transform.ScaleX * (float)Math.Cos(transform.SkewY);
     matrix.B  = transform.ScaleX * (float)Math.Sin(transform.SkewY);
     matrix.C  = -transform.ScaleY * (float)Math.Sin(transform.SkewX);
     matrix.D  = transform.ScaleY * (float)Math.Cos(transform.SkewX);
     matrix.Tx = transform.X;
     matrix.Ty = transform.Y;
 }
 /**
  * Cleans up any resources used by this DBObject instance.
  */
 public virtual void Dispose()
 {
     UserData = null;
     _parent = null;
     _armature = null;
     _global = null;
     _origin = null;
     _offset = null;
     _tween = null;
     _globalTransformMatrix = null;
 }
        public DBObject()
        {
            _global = new DBTransform();
            _origin = new DBTransform();
            _offset = new DBTransform();
            _tween = new DBTransform();
            _tween.ScaleX = _tween.ScaleY = 0;

            _globalTransformMatrix = new Com.Viperstudio.Geom.Matrix();

            _visible = true;
        }
        /** @private */
        public virtual void update()
        {
            _global.ScaleX = (_origin.ScaleX + _tween.ScaleX) * _offset.ScaleX;
            _global.ScaleY = (_origin.ScaleY + _tween.ScaleY) * _offset.ScaleY;

            if(_parent!=null)
            {
                float x = _origin.X + _offset.X + _tween.X;
                float y = _origin.Y + _offset.Y + _tween.Y;

                Com.Viperstudio.Geom.Matrix parentMatrix = _parent._globalTransformMatrix;

                _globalTransformMatrix.Tx =  _global.X =  parentMatrix.A * x + parentMatrix.C * y + parentMatrix.Tx;

                _globalTransformMatrix.Ty = _global.Y =   parentMatrix.D * y + parentMatrix.B * x + parentMatrix.Ty;

                if(FixedRotation)
                {
                    _global.SkewX = _origin.SkewX + _offset.SkewX + _tween.SkewX;
                    _global.SkewY = _origin.SkewY + _offset.SkewY + _tween.SkewY;
                }
                else
                {
                    _global.SkewX = _origin.SkewX + _offset.SkewX + _tween.SkewX + _parent._global.SkewX;
                    _global.SkewY = _origin.SkewY + _offset.SkewY + _tween.SkewY + _parent._global.SkewY;

                }

                if(_parent.ScaleMode >= _scaleType)
                {
                    _global.ScaleX *= _parent._global.ScaleX;
                    _global.ScaleY *= _parent._global.ScaleY;
                }

            }
            else
            {

                _globalTransformMatrix.Tx = _global.X = _origin.X + _offset.X + _tween.X;
                _globalTransformMatrix.Ty = _global.Y = _origin.Y + _offset.Y + _tween.Y;
                //Logger.Log(this.Name + "  " +"  "  + _globalTransformMatrix.Tx + "  " +  _globalTransformMatrix.Ty);
                _global.SkewX = _origin.SkewX + _offset.SkewX + _tween.SkewX;
                _global.SkewY = _origin.SkewY + _offset.SkewY + _tween.SkewY;

            }

            _globalTransformMatrix.A = _global.ScaleX * (float)Math.Cos(_global.SkewY);
            _globalTransformMatrix.B = _global.ScaleX * (float)Math.Sin(_global.SkewY);
            _globalTransformMatrix.C = -_global.ScaleY * (float)Math.Sin(_global.SkewX);
            _globalTransformMatrix.D = _global.ScaleY * (float)Math.Cos(_global.SkewX);
        }
Esempio n. 6
0
        /** @private */
        override public void update()
        {
            base.update();

            if (_isDisplayOnStage)
            {
                float pivotX = _parent._tweenPivot.X;
                float pivotY = _parent._tweenPivot.Y;



                if (pivotX != float.NaN || pivotY != float.NaN)
                {
                    Com.Viperstudio.Geom.Matrix parentMatrix = _parent._globalTransformMatrix;
                    this._globalTransformMatrix.Tx += (parentMatrix.A * pivotX + parentMatrix.C * pivotY);
                    this._globalTransformMatrix.Ty += (parentMatrix.B * pivotX + parentMatrix.D * pivotY);
                }

                _displayBridge.UpdateTransform(this._globalTransformMatrix, this._global);
            }
        }
Esempio n. 7
0
		/**
		 * Cleans up any resources used by this DBObject instance.
		 */
		public virtual void Dispose()
		{
			UserData = null;
			_parent = null;
			_armature = null;
			_global = null;
			_origin = null;
			_offset = null;
			_tween = null;
			_globalTransformMatrix = null;
		}
Esempio n. 8
0
		public DBObject()
		{
			_global = new DBTransform();
			_origin = new DBTransform();
			_offset = new DBTransform();
			_tween = new DBTransform();
			_tween.ScaleX = _tween.ScaleY = 0;
			
			_globalTransformMatrix = new Com.Viperstudio.Geom.Matrix();
			
			_visible = true;
		}