コード例 #1
0
        private void M2ScaleDefault_Click(object sender, RoutedEventArgs e)
        {
            M2SceneNode node = ModelSceneService.Instance.MainM2SceneNode;

            if (node != null)
            {
                float scale = 1.0f;

                M2Move move = node.M2Move;
                if (move != null)
                {
                    move.Scale = new vector3df(scale, scale, scale);
                }
                else
                {
                    matrix4 mat = new matrix4(true);
                    node.GetRelativeTransformation(out mat);

                    matrix4 newMat = new matrix4(true);
                    newMat.RotationRadians = mat.RotationRadians;
                    newMat.Scale           = new vector3df(scale, scale, scale);
                    newMat.Translation     = mat.Translation;
                    node.SetRelativeTransformation(ref newMat);
                }

                node.Update(true);
            }
        }
コード例 #2
0
        private void M2SliderScale_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            M2SceneNode node = ModelSceneService.Instance.MainM2SceneNode;

            if (node != null)
            {
                float scale = (float)e.NewValue;

                M2Move move = node.M2Move;
                if (move != null)
                {
                    move.Scale = new vector3df(scale, scale, scale);
                }
                else
                {
                    matrix4 mat = new matrix4(true);
                    node.GetRelativeTransformation(out mat);

                    matrix4 newMat = new matrix4(true);
                    newMat.RotationRadians = mat.RotationRadians;
                    newMat.Scale           = new vector3df(scale, scale, scale);
                    newMat.Translation     = mat.Translation;
                    node.SetRelativeTransformation(ref newMat);
                }

                node.Update(true);
            }
        }