public Game1() { Graphics = new GraphicsDeviceManager(this); Graphics.PreferredBackBufferWidth = 1366; Graphics.PreferredBackBufferHeight = 768; Graphics.PreferMultiSampling = true; Graphics.SynchronizeWithVerticalRetrace = true; Graphics.ApplyChanges(); Content.RootDirectory = "Content"; Instance = this; Setting = new Setting(); Camera = new Camera(); Children = new List<GameEntity>(); }
protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); cam = new Camera(GraphicsDevice.Viewport.AspectRatio) { Position = Vector3.Backward * 15, }; Texture2D tex=Content.Load<Texture2D>("Textures\\Default\\TEX_Default"); planet1 = new Planet(GraphicsDevice, 10) { Diameter = 50f, }; planet1.Orbit.Radius = 500f; planet1.Orbit.OriginPosition = Vector3.Zero; sun = new Star(GraphicsDevice); sun.Diameter = 500f; }
public void Draw(Camera camera) { mesh.Draw(Matrix.Identity * Matrix.CreateScale(diameter * .5f) * Matrix.CreateTranslation(Position), camera.View, camera.Projection, Color); }
private void loadContent(PlanetParameters planetParams, Dictionary<Enums.MeshVBOs, MeshVBOs> VBOs, Dictionary<Enums.Textures, Texture> textures) { this.planets = new List<Planet>();; this.rings = new List<PlanetRing>();; this.stars = new Mesh(VBOs[Enums.MeshVBOs.planet], textures[Enums.Textures.starsT], defaultShader); stars.Scale = 4500f; MeshVBOs planetVBOs = VBOs[Enums.MeshVBOs.planet]; sun = new Sun("sun", planetParams, null, planetVBOs, textures[Enums.Textures.sunT], sunShader, lineShader); Planet mercury = new Planet("mercury", planetParams, sun, planetVBOs, textures[Enums.Textures.mercury], defaultShader, lineShader); Planet venus = new Planet("venus", planetParams, sun, planetVBOs, textures[Enums.Textures.venusT], defaultShader, lineShader); Earth earth = new Earth("earth", planetParams, sun, planetVBOs, textures[Enums.Textures.earthT], textures[Enums.Textures.earth_SpecT], textures[Enums.Textures.earth_NightT], textures[Enums.Textures.earth_NormalT], textures[Enums.Textures.earty_CloudsT], earthShader, lineShader); Planet moon = new Planet("moon", planetParams, earth, planetVBOs, textures[Enums.Textures.moonT], defaultShader, lineShader); Planet mars = new Planet("mars", planetParams, sun, planetVBOs, textures[Enums.Textures.marsT], defaultShader, lineShader); Planet jupiter = new Planet("jupiter", planetParams, sun, planetVBOs, textures[Enums.Textures.jupiterT], defaultShader, lineShader); Planet saturn = new Planet("saturn", planetParams, sun, planetVBOs, textures[Enums.Textures.saturnT], defaultShader, lineShader); Planet uranus = new Planet("uranus", planetParams, sun, planetVBOs, textures[Enums.Textures.uranusT], defaultShader, lineShader); Planet neptune = new Planet("neptune", planetParams, sun, planetVBOs, textures[Enums.Textures.neptuneT], defaultShader, lineShader); Planet pluto = new Planet("pluto", planetParams, sun, planetVBOs, textures[Enums.Textures.plutoT], defaultShader, lineShader); PlanetRing saturnRings = new PlanetRing(VBOs[Enums.MeshVBOs.saturnRings], textures[Enums.Textures.saturn_RingsT], saturn); PlanetRing uranusRings = new PlanetRing(VBOs[Enums.MeshVBOs.uranusRings], textures[Enums.Textures.uranus_RingsT], uranus); planets.Add(sun); planets.Add(mercury); planets.Add(venus); planets.Add(earth); planets.Add(moon); planets.Add(mars); planets.Add(jupiter); planets.Add(saturn); planets.Add(uranus); planets.Add(neptune); planets.Add(pluto); rings.Add(saturnRings); rings.Add(uranusRings); cam = new Camera(); cam.setFocus(sun); foreach (Planet p in planets) { p.DrawOrbit = true; p.DrawAxisTilt = true; } }
protected override void Initialize() { Setting = new Setting(); Camera = new Camera(); Children = new List<GameEntity>(); Skybox = new Skybox(); Sound = new Sound(); Sun = new Sun(0, 0, 0); Earth = new Earth(); Moon = new Moon(); Children.Add(Sound); Children.Add(Sun); Children.Add(Earth); Children.Add(Moon); Children.Add(new SatelliteManager()); Children.Add(new Monitor()); base.Initialize(); }