public GeometryModel3D[] render() { Model3DGroup modelGroup = new Model3DGroup(); Viewport3D visualisation = new Viewport3D(); ModelVisual3D modelsVisual = new ModelVisual3D(); int depthPoint = 0; //Setup viewport environment init = new ViewportCalibrator(this.cp); visualisation = init.setupViewport(init.setupCamera(), this.cp.ActualHeight, this.cp.ActualWidth); //Create triangle mesh for (int y = 0; y < 480; y += pos) { for (int x = 0; x < 640; x += pos) { pts[depthPoint] = Triangle(x, y, pos); pts[depthPoint].Transform = new TranslateTransform3D(0, 0, 0); modelGroup.Children.Add(pts[depthPoint]); depthPoint++; } } //Add mesh to visualisation and viewport/canvas modelGroup.Children.Add(init.setupDirectionalLights(Colors.White)); modelsVisual.Content = modelGroup; visualisation.Children.Add(modelsVisual); cp.Children.Add(visualisation); Canvas.SetTop(visualisation, 0); Canvas.SetLeft(visualisation, 0); return pts; }
public GeometryModel3D[] render() { Model3DGroup modelGroup = new Model3DGroup(); Viewport3D visualisation = new Viewport3D(); ModelVisual3D modelsVisual = new ModelVisual3D(); int depthPoint = 0; //Setup viewport environment init = new ViewportCalibrator(this.cp); visualisation = init.setupViewport(init.setupCamera(), this.cp.ActualHeight, this.cp.ActualWidth); //Create triangle mesh for (int y = 0; y < 480; y += pos) { for (int x = 0; x < 640; x += pos) { pts[depthPoint] = Triangle(x, y, pos); pts[depthPoint].Transform = new TranslateTransform3D(0, 0, 0); modelGroup.Children.Add(pts[depthPoint]); depthPoint++; } } //Add mesh to visualisation and viewport/canvas modelGroup.Children.Add(init.setupDirectionalLights(Colors.White)); modelsVisual.Content = modelGroup; visualisation.Children.Add(modelsVisual); cp.Children.Add(visualisation); Canvas.SetTop(visualisation, 0); Canvas.SetLeft(visualisation, 0); return(pts); }