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({ "algae", "Algae", 0, 0 });
25 tiles.Add({ "desert", "Desert", 0, 1 });
26 tiles.Add({ "forest", "Forest", 0, 2 });
27 tiles.Add({ "grass", "Grass", 0, 3 });
28 tiles.Add({ "ice", "Ice", 0, 4 });
29 tiles.Add({ "jungle", "Jungle", 0, 5 });
30 tiles.Add({ "mountain", "Mountain", 0, 6 });
31 tiles.Add({ "ocean", "Ocean", 0, 7 });
32 tiles.Add({ "rock", "Rock", 0, 8 });
33 tiles.Add({ "sand", "Sand", 0, 9 });
34 tiles.Add({ "taiga", "Taiga", 0, 10 });
35 tiles.Add({ "tundra", "Tundra", 0, 11 });
36 tiles.Add({ "water", "Water", 0, 12 });
37 tiles.Add({ "wheat", "Wheat", 0, 13 });
42 sun.SurfaceTilt(glm::dvec2(PI * 0.25, PI * 0.25));
43 sun.AngularMomentum(1.0e13);
45 world::Planet planet(25);
46 planet.SetParent(sun);
48 planet.GetOrbit().SemiMajorAxis(941.7);
49 planet.SurfaceTilt(glm::dvec2(PI * 0.25, PI * 0.25));
50 planet.AxialTilt(glm::dvec2(PI * 0.127, 0.0));
51 planet.AngularMomentum(6.0e10);
53 world::Planet moon(3);
54 moon.SetParent(planet);
56 moon.GetOrbit().SemiMajorAxis(37.0);
57 moon.Rotation(PI * 0.25);
58 moon.AngularMomentum(1.0e4);
60 world::Planet second_planet(9);
61 second_planet.SetParent(sun);
62 second_planet.Mass(1.0e9);
63 second_planet.GetOrbit().SemiMajorAxis(350.0);
64 second_planet.SurfaceTilt(glm::dvec2(PI * 0.125, PI * 0.25));
65 second_planet.AxialTilt(glm::dvec2(PI * 0.95, 0.0));
66 second_planet.AngularMomentum(1.0e8);
68 world::Simulation sim(sun);
70 sim.AddPlanet(planet);
71 sim.AddPlanet(second_planet);
74 world::GenerateEarthlike(tiles, planet);
75 world::GenerateTest(tiles, moon);
76 world::GenerateTest(tiles, second_planet);
78 std::cout << "length of year: " << planet.OrbitalPeriod() << "s" << std::endl;
79 std::cout << "length of moon cycle: " << moon.OrbitalPeriod() << "s" << std::endl;
80 std::cout << "length of day: " << planet.RotationalPeriod() << "s" << std::endl;
81 std::cout << "days per year: " << (planet.OrbitalPeriod() / planet.RotationalPeriod()) << std::endl;
82 std::cout << "moon cycle in days: " << (moon.OrbitalPeriod() / planet.RotationalPeriod()) << std::endl;
83 std::cout << "moon cycles per year: " << (planet.OrbitalPeriod() / moon.OrbitalPeriod()) << std::endl;
85 auto blob = new world::Creature;
87 planet.AddCreature(blob);
89 blob->Position(glm::dvec3(0.0, 0.0, 0.0));
91 app::MasterState state(assets, sim);
95 //.FirstPerson(0, glm::vec3(0.0f, 0.0f, 0.1f), glm::vec3(1.0f, -0.75f, 0.1f))
97 //.FirstPerson(3, glm::vec3(0.0f, 0.0f, 0.1f), glm::vec3(1.0f, -0.75f, 0.1f))
99 //.MapView(0, glm::vec3(0.0f, 0.0f, 60.0f), 0.0f)
100 // from afar, rotating
101 .Orbital(glm::vec3(-60.0f, 0.0f, 0.0f))
106 // .Orbital(glm::vec3(-500.0f, 500.0f, 500.0f))
109 app::Application app(init.window, init.viewport);
110 app.PushState(&state);