public void OpenModel() { mDialog.ShowDialog(); Model = new FileModelVisual3D { Source = mDialog.FileName }; }
void LoadPathsAndWalls(MainGameViewModel context) { foreach (var path in context.Maze.Paths) { FileModelVisual3D fmv3D = new FileModelVisual3D(); fmv3D.Source = context.AssemblyPath + ViewConstants.GiftModelPath; var transformGroup = new Transform3DGroup(); Binding binding = new Binding(); binding.Path = new PropertyPath(ViewConstants.PropertyPathHaveGift); binding.Source = path; binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; binding.Converter = FindResource(ViewConstants.ResourceNameConverterBoolToVisibility) as BooleanToVisibilityConverter; BindingOperations.SetBinding(fmv3D, FileModelVisual3D.VisibilityProperty, binding); Vector3D vector = new Vector3D(path.Row * ViewConstants.OneTailSize, ViewConstants.GiftsYPos, path.Cell * -ViewConstants.OneTailSize); transformGroup.Children.Add(new TranslateTransform3D(vector)); transformGroup.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1.0, 0.0, 0.0), 90))); transformGroup.Children.Add(new ScaleTransform3D(ViewConstants.ScaleAll, ViewConstants.ScaleAll, ViewConstants.ScaleAll)); fmv3D.Transform = transformGroup; Viewport.Children.Add(fmv3D); } foreach (var wall in context.ListBricks) { FileModelVisual3D fmv3D = new FileModelVisual3D(); fmv3D.Source = context.AssemblyPath + ViewConstants.WallModelPath; var transformGroup = new Transform3DGroup(); Vector3D vector = new Vector3D(wall.X * ViewConstants.OneTailSize, 0.0, wall.Y * -ViewConstants.OneTailSize); transformGroup.Children.Add(new TranslateTransform3D(vector)); transformGroup.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1.0, 0.0, 0.0), 90))); transformGroup.Children.Add(new ScaleTransform3D(ViewConstants.ScaleAll, ViewConstants.ScaleAll, ViewConstants.ScaleAll)); fmv3D.Transform = transformGroup; Viewport.Children.Add(fmv3D); } }
FileModelVisual3D LoadModelPath(MainGameViewModel context, string path) { FileModelVisual3D fmv3D = new FileModelVisual3D(); fmv3D.Source = context.AssemblyPath + path; return(fmv3D); }
public MainWindow() { InitializeComponent(); //<h:FileModelVisual3D Source="C:\Users\USER\Downloads\wk07\pikachu.obj"> for (int x = 0; x < 5; x++) { for (int y = 0; y < 5; y++) { for (int z = 0; z < 5; z++) { //Teapot B = new Teapot(); FileModelVisual3D B = new FileModelVisual3D(); B.Source = @"C:\Users\User\Downloads\wk08\pikachu.obj"; //B.Location = new Point(i*100, y); B.Transform = new TranslateTransform3D(x * 4 - 10, y * 4 - 10, z * 4 - 10); G.Children.Add(B); //this.Controls.Add(B); } } } }