예제 #1
0
        public void SetFrame(int timecode)
        {
            SimPe.Geometry.Vector3f           v     = this.frames[timecode];
            Ambertation.Scenes.Transformation trans = new Ambertation.Scenes.Transformation();
            if (afb.TransformationType == FrameType.Translation)
            {
                if (timecode != 0)
                {
                    trans.Translation.X = v.X;
                    trans.Translation.Y = v.Y;
                    trans.Translation.Z = v.Z;
                }
                //else nb.Transform = mt;
            }
            else
            {
                if (timecode != 0)
                {
                    trans.Rotation.X = v.X;
                    trans.Rotation.Y = v.Y;
                    trans.Rotation.Z = v.Z;
                }
            }

            //mb.Transform = Microsoft.DirectX.Matrix.Multiply(mb.Transform, Ambertation.Scenes.Converter.ToDx(trans));
            mb.Transform = Ambertation.Scenes.Converter.ToDx(trans);
        }
예제 #2
0
        void AddJoint(ListedMeshBlocks lmb, SimPe.Interfaces.Scenegraph.ICresChildren bl, Ambertation.Graphics.MeshList parent, System.Windows.Forms.TreeNodeCollection nodes)
        {
            SimPe.Plugin.TransformNode tn = bl.StoredTransformNode;


            if (tn != null)
            {
                Ambertation.Graphics.MeshBox mb = new Ambertation.Graphics.MeshBox(
                    Microsoft.DirectX.Direct3D.Mesh.Sphere(dx.Device, 0.02f, 12, 24),
                    1,
                    Ambertation.Graphics.DirectXPanel.GetMaterial(Color.Wheat)
                    );
                mb.Wire = false;

                Ambertation.Scenes.Transformation trans = new Ambertation.Scenes.Transformation();
                trans.Rotation.X = tn.Rotation.GetEulerAngles().X;
                trans.Rotation.Y = tn.Rotation.GetEulerAngles().Y;
                trans.Rotation.Z = tn.Rotation.GetEulerAngles().Z;

                trans.Translation.X = tn.TransformX;
                trans.Translation.Y = tn.TransformY;
                trans.Translation.Z = tn.TransformZ;

                mb.Transform = Ambertation.Scenes.Converter.ToDx(trans);

                TreeNode tnode = new TreeNode(tn.ToString());
                tnode.Tag = mb;
                nodes.Add(tnode);
                jointmap[bl.GetName()] = mb;

                parent.Add(mb);

                foreach (SimPe.Interfaces.Scenegraph.ICresChildren cld in bl)
                {
                    AddJoint(lmb, cld, mb, tnode.Nodes);
                }
            }
            else
            {
                foreach (SimPe.Interfaces.Scenegraph.ICresChildren cld in bl)
                {
                    AddJoint(lmb, cld, parent, nodes);
                }
            }
        }