예제 #1
0
        private bool GenerateAnimation()
        {
            if (lvStep.Items.Count == 0)
            {
                return(false);
            }

            vizcore3d.View.EnableAutoFit = false;                                       /* 자동 화면맞춤 비활성 */
            //vizcore3d.View.Projection = VIZCore3D.NET.Data.Projections.Perspective;   /* 원근 뷰 설정 */
            vizcore3d.Animation.UseEffect = false;                                      /* 기본 효과 사용안함 설정 */

            vizcore3d.Animation.Clear();
            vizcore3d.Animation.Add("Animation");

            int count = 0;

            vizcore3d.BeginUpdate();

            for (int i = 0; i < lvStep.Items.Count; i++)
            {
                ListViewItem lvi = lvStep.Items[i];

                AnimationItem ani = (AnimationItem)lvi.Tag;

                if (ani.TransformKind == ENUM_TRANSFORM_KIND.NONE)
                {
                    continue;
                }

                if (ani.TransformKind == ENUM_TRANSFORM_KIND.TRANSLATION)
                {
                    vizcore3d.Object3D.Transform.Move(ani.Nodes, ani.TX, ani.TY, ani.TZ, false);
                }
                else
                {
                    vizcore3d.Object3D.Transform.Rotate(ani.Nodes, ani.RX, ani.RY, ani.RZ, false, false);
                }

                AddKey(true, false, TimeInterval);
                count++;
            }

            vizcore3d.Object3D.Transform.RestoreTransformAll();

            vizcore3d.EndUpdate();

            return(count > 0 ? true : false);
        }
예제 #2
0
        private void btnAddStep_Click(object sender, EventArgs e)
        {
            string name = txtNodeName.Text;
            string itx  = txtTX.Text;
            string ity  = txtTY.Text;
            string itz  = txtTZ.Text;
            string irx  = txtRX.Text;
            string iry  = txtRY.Text;
            string irz  = txtRZ.Text;

            if (String.IsNullOrEmpty(name) == true)
            {
                return;
            }
            if (String.IsNullOrEmpty(itx) == true)
            {
                return;
            }
            if (String.IsNullOrEmpty(ity) == true)
            {
                return;
            }
            if (String.IsNullOrEmpty(itz) == true)
            {
                return;
            }
            if (String.IsNullOrEmpty(irx) == true)
            {
                return;
            }
            if (String.IsNullOrEmpty(iry) == true)
            {
                return;
            }
            if (String.IsNullOrEmpty(irz) == true)
            {
                return;
            }

            int ntx = Convert.ToInt32(itx);
            int nty = Convert.ToInt32(ity);
            int ntz = Convert.ToInt32(itz);
            int nrx = Convert.ToInt32(irx);
            int nry = Convert.ToInt32(iry);
            int nrz = Convert.ToInt32(irz);

            if (ntx == 0 && nty == 0 && ntz == 0 && nrx == 0 && nry == 0 && nrz == 0)
            {
                return;
            }

            float tx = Convert.ToSingle(itx);
            float ty = Convert.ToSingle(ity);
            float tz = Convert.ToSingle(itz);
            float rx = Convert.ToSingle(irx);
            float ry = Convert.ToSingle(iry);
            float rz = Convert.ToSingle(irz);

            List <VIZCore3D.NET.Data.Node> nodes = vizcore3d.Object3D.Find.QuickSearch(new List <string>()
            {
                name
            }, false, true, false, false, true, false);

            if (nodes.Count == 0)
            {
                return;
            }

            AnimationItem animation = new AnimationItem(name, nodes, tx, ty, tz, rx, ry, rz);

            ListViewItem lvi = new ListViewItem(
                new string[]
            {
                name
                , itx
                , ity
                , itz
                , irx
                , iry
                , irz
            }
                );

            lvi.Tag = animation;
            lvStep.Items.Add(lvi);
        }