Exemplo n.º 1
0
        /// <summary>
        /// フレームLinear補完
        /// </summary>
        /// <param name="rate">重み</param>
        /// <param name="Index1">対象1</param>
        /// <param name="Index2">対象2</param>
        /// <returns></returns>
        public FRAME FrameCompLinier(int Index1, int Index2, float rate)
        {
            //座標差分を取る?
            FRAME ret = gmTimeLine[Index1].Clone();

            for (int cnt = 0; cnt < gmTimeLine[Index1].ElementsCount; cnt++)
            {
                ELEMENTS ele1 = gmTimeLine[Index1].GetElement(cnt);
                ELEMENTS ele2 = gmTimeLine[Index2].GetElement(cnt);
                ELEMENTS rest = ret.GetElement(cnt);
                rest.Atr.Position = Vector3.Linear(ele1.Atr.Position, ele2.Atr.Position, rate);
            }
            return(ret);
        }
Exemplo n.º 2
0
        private void DrawParts(object sender, Graphics g)
        {
            //なんだか遅いなぁ・・ちらつくなぁ・・
            //表示の仕方も悩む 親もマーク表示するか 等
            //StageInfomation
            float zoom = HScrollBar_ZoomLevel.Value / mParZOOM;

            if (zoom < 0.2)
            {
                zoom = 0.2f;
            }
            int vcx = mScreenScroll.X + panel_PreView.Width / 2;  //ViewCenter X
            int vcy = mScreenScroll.Y + panel_PreView.Height / 2; //ViewCenter Y

            FRAME frm = TimeLine.EditFrame;

            for (int cnt = 0; cnt < frm.ElementsCount; cnt++)
            {
                ELEMENTS      e      = frm.GetElement(cnt);
                AttributeBase atr    = e.Atr;
                Matrix        Back   = g.Transform;
                Matrix        MatObj = new Matrix();

                float vsx = atr.Width * atr.Scale.X;  //* zoom;//SizeX
                float vsy = atr.Height * atr.Scale.Y; // * zoom;//SizeY

                CELL c = ImageMan.GetCellFromHash(atr.CellID);
                if (c == null)
                {
                    Console.WriteLine("Image:null"); return;
                }

                //原点を部品中心に
                //g.TranslateTransform(   vcx + (atr.Position.X + atr.Width/2)  * atr.Scale.X *zoom,
                //                        vcy + (atr.Position.Y + atr.Height/2) * atr.Scale.Y *zoom);//部品中心座標か?


                //平行移動
                g.TranslateTransform(vcx + (atr.Position.X * atr.Scale.X), vcy + (atr.Position.Y * atr.Scale.Y));
                //回転角指定
                g.RotateTransform(atr.Radius.X);
                //スケーリング調
                g.ScaleTransform(atr.Scale.X, atr.Scale.X);
                //g.TranslateTransform(vcx + (atr.Position.X * atr.Scale.X), vcy + (atr.Position.Y * atr.Scale.Y));

                //MatObj.Translate(-(vcx + atr.Position.X +(atr.Width /2))*atr.Scale.X,-(vcy + atr.Position.Y +(atr.Height/2))*atr.Scale.Y,MatrixOrder.Append);
                //MatObj.Translate(0, 0);
                //MatObj.Scale(atr.Scale.X,atr.Scale.Y,MatrixOrder.Append);
                //MatObj.Rotate(atr.Radius.X,MatrixOrder.Append);
                //MatObj.Translate((vcx + atr.Position.X + (atr.Width / 2)) * atr.Scale.Y, (vcy + atr.Position.Y + (atr.Height / 2)) * atr.Scale.Y,MatrixOrder.Append);

                //g.TranslateTransform(vcx, vcy);
                //描画

                /*
                 * g.DrawImage(c.Img,
                 *  -(atr.Width  * atr.Scale.X * zoom )/2,
                 *  -(atr.Height * atr.Scale.Y * zoom )/2,
                 *  vsx,vsy);*/
                //g.DrawImage(c.Img,vcx+ (now.Position.X*zoom)-(vsx/2),vcy+ (now.Position.Y*zoom)-(vsy/2),vsx,vsy);
                //g.Transform = MatObj;

                //Draw
                g.DrawImage(c.Img, -(atr.Width * atr.Scale.X) / 2, -(atr.Height * atr.Scale.Y) / 2, vsx, vsy);

                //Selected DrawBounds
                if (e.Select)
                {
                    g.DrawRectangle(Pens.DarkCyan, -(atr.Width * atr.Scale.X) / 2, -(atr.Height * atr.Scale.Y) / 2, vsx - 1, vsy - 1);
                }

                //test Hit範囲をボックス描画

                /*
                 * g.DrawRectangle(Pens.Aqua,  (-(atr.Width *atr.Scale.X)/2 * atr.Scale.X),
                 *                          (-(atr.Height *atr.Scale.Y)/2 * atr.Scale.Y),
                 *                          vsx - 1, vsy - 1);
                 */

                g.Transform = Back;//restore Matrix

                //Cuurent Draw Grip
            }
        }