2 #include "app/Application.hpp"
3 #include "app/Assets.hpp"
4 #include "app/init.hpp"
5 #include "app/MasterState.hpp"
6 #include "world/Creature.hpp"
7 #include "world/Planet.hpp"
8 #include "world/Simulation.hpp"
9 #include "world/Sun.hpp"
10 #include "world/TileSet.hpp"
11 #include "world/TileType.hpp"
17 using namespace blobs;
19 int main(int argc, char *argv[]) {
20 app::Init init(true, 8);
24 tiles.Add({ "ice", "Ice", 0, 0 });
25 tiles.Add({ "black", "Black", 0, 1 });
26 tiles.Add({ "red", "Red", 0, 2 });
27 tiles.Add({ "grass", "Grass", 0, 3 });
28 tiles.Add({ "water", "Water", 0, 4 });
29 tiles.Add({ "sand", "Sand", 0, 5 });
30 tiles.Add({ "tundra", "Tundra", 0, 6 });
31 tiles.Add({ "magenta", "Magenta", 0, 7 });
32 tiles.Add({ "rock", "Rock", 0, 8 });
37 sun.SurfaceTilt(glm::dvec2(PI * 0.25, PI * 0.25));
38 sun.AngularMomentum(1.0e13);
40 world::Planet planet(11);
41 planet.SetParent(sun);
43 planet.GetOrbit().SemiMajorAxis(941.7);
44 planet.SurfaceTilt(glm::dvec2(PI * 0.25, PI * 0.25));
45 planet.AxialTilt(glm::dvec2(PI * 0.127, 0.0));
46 planet.AngularMomentum(1.25e9);
48 world::Planet moon(3);
49 moon.SetParent(planet);
51 moon.GetOrbit().SemiMajorAxis(25.0);
52 moon.Rotation(PI * 0.25);
53 moon.AngularMomentum(1.0e4);
55 world::Planet second_planet(9);
56 second_planet.SetParent(sun);
57 second_planet.Mass(1.0e9);
58 second_planet.GetOrbit().SemiMajorAxis(350.0);
59 second_planet.SurfaceTilt(glm::dvec2(PI * 0.125, PI * 0.25));
60 second_planet.AxialTilt(glm::dvec2(PI * 0.95, 0.0));
61 second_planet.AngularMomentum(1.0e8);
63 world::Simulation sim(sun);
65 sim.AddPlanet(planet);
66 sim.AddPlanet(second_planet);
69 world::GenerateEarthlike(tiles, planet);
70 world::GenerateTest(tiles, moon);
71 world::GenerateTest(tiles, second_planet);
73 std::cout << "length of year: " << planet.OrbitalPeriod() << "s" << std::endl;
74 std::cout << "length of moon cycle: " << moon.OrbitalPeriod() << "s" << std::endl;
75 std::cout << "length of day: " << planet.RotationalPeriod() << "s" << std::endl;
76 std::cout << "days per year: " << (planet.OrbitalPeriod() / planet.RotationalPeriod()) << std::endl;
77 std::cout << "moon cycle in days: " << (moon.OrbitalPeriod() / planet.RotationalPeriod()) << std::endl;
78 std::cout << "moon cycles per year: " << (planet.OrbitalPeriod() / moon.OrbitalPeriod()) << std::endl;
80 auto blob = new world::Creature;
82 planet.AddCreature(blob);
84 blob->Position(glm::dvec3(0.0, 0.0, 0.0));
86 app::MasterState state(assets, sim);
90 //.FirstPerson(0, glm::vec3(0.0f, 0.0f, 0.1f), glm::vec3(1.0f, -0.75f, 0.1f))
92 //.FirstPerson(3, glm::vec3(0.0f, 0.0f, 0.1f), glm::vec3(1.0f, -0.75f, 0.1f))
94 //.MapView(0, glm::vec3(0.0f, 0.0f, 25.0f), 0.0f)
95 // from afar, rotating
96 .Orbital(glm::vec3(-25.0f, 0.0f, 0.0f))
101 // .Orbital(glm::vec3(-500.0f, 500.0f, 500.0f))
104 app::Application app(init.window, init.viewport);
105 app.PushState(&state);