2 #include "app/Application.hpp"
3 #include "app/Assets.hpp"
4 #include "app/init.hpp"
5 #include "app/MasterState.hpp"
6 #include "world/Planet.hpp"
7 #include "world/Simulation.hpp"
8 #include "world/Sun.hpp"
9 #include "world/TileSet.hpp"
10 #include "world/TileType.hpp"
16 using namespace blobs;
18 int main(int argc, char *argv[]) {
19 app::Init init(true, 8);
23 tiles.Add({ "ice", "Ice", 0, 0 });
24 tiles.Add({ "black", "Black", 0, 1 });
25 tiles.Add({ "red", "Red", 0, 2 });
26 tiles.Add({ "grass", "Grass", 0, 3 });
27 tiles.Add({ "water", "Water", 0, 4 });
28 tiles.Add({ "sand", "Sand", 0, 5 });
29 tiles.Add({ "tundra", "Tundra", 0, 6 });
30 tiles.Add({ "magenta", "Magenta", 0, 7 });
31 tiles.Add({ "rock", "Rock", 0, 8 });
36 sun.SurfaceTilt(glm::dvec2(PI * 0.25, PI * 0.25));
37 sun.AngularMomentum(1.0e13);
39 world::Planet planet(11);
40 planet.SetParent(sun);
42 planet.GetOrbit().SemiMajorAxis(941.7);
43 planet.SurfaceTilt(glm::dvec2(PI * 0.25, PI * 0.25));
44 planet.AxialTilt(glm::dvec2(PI * 0.127, 0.0));
45 planet.AngularMomentum(1.25e9);
47 world::Planet moon(3);
48 moon.SetParent(planet);
50 moon.GetOrbit().SemiMajorAxis(25.0);
51 moon.Rotation(PI * 0.25);
52 moon.AngularMomentum(1.0e4);
54 world::Planet second_planet(9);
55 second_planet.SetParent(sun);
56 second_planet.Mass(1.0e9);
57 second_planet.GetOrbit().SemiMajorAxis(350.0);
58 second_planet.SurfaceTilt(glm::dvec2(PI * 0.125, PI * 0.25));
59 second_planet.AxialTilt(glm::dvec2(PI * 0.95, 0.0));
60 second_planet.AngularMomentum(1.0e8);
62 world::Simulation sim(sun);
64 sim.AddPlanet(planet);
65 sim.AddPlanet(second_planet);
68 world::GenerateEarthlike(tiles, planet);
69 world::GenerateTest(tiles, moon);
70 world::GenerateTest(tiles, second_planet);
72 std::cout << "length of year: " << planet.OrbitalPeriod() << "s" << std::endl;
73 std::cout << "length of moon cycle: " << moon.OrbitalPeriod() << "s" << std::endl;
74 std::cout << "length of day: " << planet.RotationalPeriod() << "s" << std::endl;
75 std::cout << "days per year: " << (planet.OrbitalPeriod() / planet.RotationalPeriod()) << std::endl;
76 std::cout << "moon cycle in days: " << (moon.OrbitalPeriod() / planet.RotationalPeriod()) << std::endl;
77 std::cout << "moon cycles per year: " << (planet.OrbitalPeriod() / moon.OrbitalPeriod()) << std::endl;
79 app::MasterState state(assets, sim);
83 //.FirstPerson(0, glm::vec3(0.0f, 0.0f, 0.1f), glm::vec3(1.0f, -0.75f, 0.1f))
85 //.FirstPerson(3, glm::vec3(0.0f, 0.0f, 0.1f), glm::vec3(1.0f, -0.75f, 0.1f))
87 //.MapView(0, glm::vec3(0.0f, 0.0f, 25.0f), 0.0f)
88 // from afar, rotating
89 .Orbital(glm::vec3(-25.0f, 0.0f, 0.0f))
94 // .Orbital(glm::vec3(-500.0f, 500.0f, 500.0f))
97 app::Application app(init.window, init.viewport);
98 app.PushState(&state);