/// <summary> /// Updates the positions /// </summary> /// <param name="x">The X direction acceleration</param> /// <param name="y">The Y direction acceleration</param> /// <param name="z">The Z direction acceleration</param> public void UpdateDisplay(double x, double y, double z) { mainViewport.Children.Clear(); CubeBuilder cubeBuilder = new CubeBuilder(Color.FromRgb(0, 0, 255)); mainViewport.Children.Add(cubeBuilder.Create(CubeBuilder.Direction.X, x * 3)); cubeBuilder.CubeColor = Color.FromRgb(0, 255, 0); mainViewport.Children.Add(cubeBuilder.Create(CubeBuilder.Direction.Y, y * 3)); cubeBuilder.CubeColor = Color.FromRgb(255, 0, 0); mainViewport.Children.Add(cubeBuilder.Create(CubeBuilder.Direction.Z, z * 3)); ModelVisual3D lightSource = new ModelVisual3D(); AmbientLight light = new AmbientLight(Color.FromRgb(255,255,255)); lightSource.Content = light; mainViewport.Children.Add(lightSource); }
/// <summary> /// Performs the initial rendering /// </summary> private void Render() { CubeBuilder cubeBuilder = new CubeBuilder(Color.FromRgb(0,0,255)); mainViewport.Children.Add(cubeBuilder.Create(CubeBuilder.Direction.X, 6)); cubeBuilder.CubeColor = Color.FromRgb(0,255,0); mainViewport.Children.Add(cubeBuilder.Create(CubeBuilder.Direction.Y, 6)); cubeBuilder.CubeColor = Color.FromRgb(255,0,0); mainViewport.Children.Add(cubeBuilder.Create(CubeBuilder.Direction.Z, 6)); }