public MainPageViewModel() { EffectsManager = new DefaultEffectsManager(new Logger()); Camera = new PerspectiveCamera() { Position = new Vector3(40, 10, 100), LookDirection = new Vector3(0, -10, -100), UpDirection = UpDirection, FarPlaneDistance = 500, NearPlaneDistance = 0.1 }; Camera1 = new OrthographicCamera() { Position = new Vector3(60, 10, 100), LookDirection = new Vector3(0, -10, -100), UpDirection = upDirection, Width = 30, FarPlaneDistance = 2000, NearPlaneDistance = 20 }; var builder = new MeshBuilder(true, true, true); builder.AddBox(new SharpDX.Vector3(0, 0, 0), 2, 2, 2); builder.AddSphere(new Vector3(0, 2, 0), 1.5); Geometry = builder.ToMesh(); Geometry.UpdateOctree(); builder = new MeshBuilder(); builder.AddSphere(new Vector3(0, 2, 0), 2); Sphere = builder.ToMesh(); Sphere.UpdateOctree(); Material = new PhongMaterial() { AmbientColor = Color.Gray, DiffuseColor = new Color4(0.75f, 0.75f, 0.75f, 1.0f), SpecularColor = Color.White, SpecularShininess = 10f, ReflectiveColor = new Color4(0.2f, 0.2f, 0.2f, 0.5f), RenderEnvironmentMap = true }; Material.DiffuseMap = LoadTexture("TextureCheckerboard2.jpg"); Material.NormalMap = LoadTexture("TextureCheckerboard2_dot3.jpg"); Material1 = Material.CloneMaterial(); Material1.ReflectiveColor = Color.Silver; Material1.RenderDiffuseMap = false; Material1.RenderNormalMap = false; Material1.RenderEnvironmentMap = true; Material1.RenderShadowMap = true; var lineBuilder = new LineBuilder(); lineBuilder.AddLine(Vector3.Zero, new Vector3(5, 0, 0)); lineBuilder.AddLine(Vector3.Zero, new Vector3(0, 5, 0)); lineBuilder.AddLine(Vector3.Zero, new Vector3(0, 0, 5)); LineGeometry = lineBuilder.ToLineGeometry3D(); LineGeometry.Colors = new Color4Collection() { Color.Red, Color.Red, Color.Green, Color.Green, Color.Blue, Color.Blue }; builder = new MeshBuilder(); builder.AddSphere(new Vector3(), 3); var mesh = builder.ToMesh(); mesh.UpdateOctree(); PointGeometry = new PointGeometry3D() { Positions = mesh.Positions }; AxisLabelGeometry = new BillboardText3D(); AxisLabelGeometry.TextInfo.Add(new TextInfo("X", new Vector3(5.5f, 0, 0)) { Foreground = Color.Red }); AxisLabelGeometry.TextInfo.Add(new TextInfo("Y", new Vector3(0, 5.5f, 0)) { Foreground = Color.Green }); AxisLabelGeometry.TextInfo.Add(new TextInfo("Z", new Vector3(0, 0, 5.5f)) { Foreground = Color.Blue }); builder = new MeshBuilder(); builder.AddBox(new Vector3(0, -6, 0), 30, 0.5, 30); FloorModel = builder.ToMesh(); FloorMaterial = PhongMaterials.Obsidian; FloorMaterial.ReflectiveColor = Color.Silver; FloorMaterial.RenderShadowMap = true; EnvironmentMap = LoadTexture("Cubemap_Grandcanyon.dds"); UpDirXCommand = new RelayCommand(() => { UpDirection = Vector3.UnitX; }, () => { return(UpDirection != Vector3.UnitX); }); UpDirYCommand = new RelayCommand(() => { UpDirection = Vector3.UnitY; }, () => { return(UpDirection != Vector3.UnitY); }); UpDirZCommand = new RelayCommand(() => { UpDirection = Vector3.UnitZ; }, () => { return(UpDirection != Vector3.UnitZ); }); timer = new DispatcherTimer(); timer.Tick += Timer_Tick; timer.Interval = new TimeSpan(0, 0, 0, 0, 16); timer.Start(); }