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); } }
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); } }
private void menuModelScale_SubmenuOpened(object sender, RoutedEventArgs e) { M2SceneNode node = ModelSceneService.Instance.MainM2SceneNode; if (node != null) { matrix4 mat = new matrix4(true); node.GetRelativeTransformation(out mat); m2SliderScale.Value = mat.Scale.X; } }