private void Game_Update(Game game) { var frame1 = _frameNumber; if (_rainCounter-- <= 0) { _rainCounter = 50; var x = Math.Abs(rnd.Next((int)HeightMap.LengthSegments - 2) + 1); var z = Math.Abs(rnd.Next((int)HeightMap.HeightSegments - 2) + 1); //x = HeightMap.LengthSegments/2; //z = HeightMap.HeightSegments / 2; _waveMap[frame1, x, z] = -10; } if( HeightMap.GeometryContext.FaceCount > 0 && HeightMap.GeometryContext.VertexCount > 0 ) { GeometryHelper.CalculateFaceNormals(HeightMap.GeometryContext); GeometryHelper.CalculateVertexNormals(HeightMap.GeometryContext); } _frameNumber ^= 1; }
private void HandleGame(Game game, bool reload) { if( reload ) { } else { game.Unload(); } }
private void Game_Initialize(Game game) { game.ContentManager.AssetsRoot = "Samples/Programatic/Materials/Assets"; var light = new OmniLight { Ambient = Colors.Black, Diffuse = Colors.Black, Specular = Colors.White, Position = new Coordinate(0, 400, 0) }; game.Scene.AddNode(light); game.Camera.Position.Set(0,80,-150); game.Camera.Target.Set(0,10,0); }
private void Game_LoadContent(Game game) { _container = new Geometry(); game.Scene.AddNode(_container); _teapot = game.ContentManager.Load<Mesh>("teapot.ASE"); _container.Children.Add(_teapot); _teapot.IsVisible = false; _box = new Box {Dimension = new Coordinate(40, 40, 40)}; _box.Position.Set(0,10,0); _container.Children.Add(_box); _cylinder = new Cylinder {Segments = 16, Size = 20, TopRadius = 20, BottomRadius = 40}; _cylinder.Position.Set(0, 10, 0); _container.Children.Add(_cylinder); _ring = new Ring {Segments = 16, Size = 20, InnerRadius = 20, OuterRadius = 40}; _ring.Position.Set(0, 10, 0); _container.Children.Add(_ring); _reflectionMapTexture = LoadTexture("/Balder.Silverlight.SampleBrowser;component/Samples/Programatic/Materials/Assets/ReflectionMap.jpg"); _visualStudioTexture = LoadTexture("/Balder.Silverlight.SampleBrowser;component/Samples/Programatic/Materials/Assets/VisualStudio.png"); _balderLogoTexture = LoadTexture("/Balder.Silverlight.SampleBrowser;component/Samples/Programatic/Materials/Assets/BalderLogo.png"); _flatMaterial = new Material { Diffuse = Colors.Red, Shade = MaterialShade.Flat }; _gouraudMaterial = new Material { Diffuse = Colors.Red, Shade = MaterialShade.Gouraud }; _texturedMaterial = new Material { DiffuseMap = _reflectionMapTexture, Shade = MaterialShade.Flat, }; _reflectionMaterial = new Material { ReflectionMap = _reflectionMapTexture, Shade = MaterialShade.Flat }; }
private void GameUpdate(Game game) { CameraInfo.Text = string.Format("Position : {0}, Target : {1}", Game.Camera.Position, Game.Camera.Target); }
private void Game_Update(Game game) { if( !_initialized) { HandleSelection(); } _container.Rotation.Y += 1; }