diff --git a/src/main.cpp b/src/main.cpp index b2bb176..1bcc534 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -193,9 +193,10 @@ void L3D::MainLoop(void) { HyperspaceTo(&s); /* Linked list eh... Put player at planet f. */ + const float zpos = EARTH_RADIUS * 7; Frame* pframe = *(++(++(++(++(Space::rootFrame->m_children.begin()))))); player->SetFrame(pframe); - player->SetPosition(vector3d(0, 100000, 10000000.0)); + player->SetPosition(vector3d(0, zpos*0.1, zpos)); for(int i = 0; i < 4; i++) { Ship* body = new Ship(ShipType::SLEEK/*LADYBIRD*/); @@ -203,7 +204,7 @@ void L3D::MainLoop(void) { snprintf(buf, sizeof(buf), "X%c-0%02d", "A"+i, i); body->SetLabel(buf); body->SetFrame(pframe); - body->SetPosition(vector3d(i*2000, 100000, 10001000)); + body->SetPosition(vector3d(i*2000, zpos*0.1, zpos+1000)); Space::AddBody(body); } @@ -211,7 +212,7 @@ void L3D::MainLoop(void) { SpaceStation* body = new SpaceStation(); body->SetLabel("Poemi-chan's Folly"); body->SetFrame(pframe); - body->SetPosition(vector3d(5000, 100000, 9990000.0)); + body->SetPosition(vector3d(5000, zpos*0.1, zpos-10000)); Space::AddBody(body); } diff --git a/src/planet.cpp b/src/planet.cpp index bdf2164..0038f85 100644 --- a/src/planet.cpp +++ b/src/planet.cpp @@ -5,9 +5,8 @@ #include "world_view.h" Planet::Planet(StarSystem::SBody* sbody) : Body() { - radius = 6378135.0; pos = vector3d(0, 0, 0); - geom = dCreateSphere(0, radius); + geom = dCreateSphere(0, sbody->radius); dGeomSetData(geom, static_cast
(this)); this->sbody = *sbody; this->sbody.children.clear(); @@ -29,8 +28,8 @@ void Planet::SetPosition(vector3d p) { } void Planet::SetRadius(double radius) { - this->radius = radius; - dGeomSphereSetRadius(geom, radius); + assert(0); + //dGeomSpehereSetRadius(geom, radius); } static void subdivide(vector3d& v1, vector3d& v2, vector3d& v3, vector3d& v4, int depth) { @@ -551,7 +550,7 @@ void Planet::DrawGasGiant(void) { void Planet::Render(const Frame* a_camFrame) { glPushMatrix(); - double rad = radius; + double rad = sbody.radius; vector3d fpos = GetPositionRelTo(a_camFrame); double apparent_size = rad / fpos.Length(); diff --git a/src/planet.h b/src/planet.h index 05778cb..a66fc28 100644 --- a/src/planet.h +++ b/src/planet.h @@ -10,7 +10,7 @@ public: virtual void SetPosition(vector3d p); virtual vector3d GetPosition(void); void SetRadius(double radius); - double GetRadius(void) { return radius; } + double GetRadius(void) { return sbody.radius; } virtual void Render(const Frame* camFrame); virtual void SetFrame(Frame* f); virtual bool OnCollision(Body* b, Uint32 flags) { return true; } @@ -19,7 +19,6 @@ private: void DrawGasGiant(void); vector3d pos; - double radius; dGeomID geom; StarSystem::SBody sbody; GLuint crudDList; diff --git a/src/star_system.cpp b/src/star_system.cpp index c5c9559..8883ce7 100644 --- a/src/star_system.cpp +++ b/src/star_system.cpp @@ -16,7 +16,7 @@ float StarSystem::starColors[7][3] = { static const struct SBodySubTypeInfo { float mass; - float radius; + float radius; /* Sol radii for stars, earth radii for planets. */ const char *description; const char *icon; float tempMin, tempMax; @@ -61,59 +61,59 @@ static const struct SBodySubTypeInfo { "icons/object_brown_dwarf.png" }, { - 0, 0, "Small gas giant", + 0, 3.9, "Small gas giant", "icons/object_planet_small_gas_giant.png" }, { - 0, 0, "Medium gas giant", + 0, 9.5, "Medium gas giant", "icons/object_planet_medium_gas_giant.png" }, { - 0, 0, "Large gas giant", + 0, 11.1, "Large gas giant", "icons/object_planet_large_gas_giant.png" }, { - 0, 0, "Very large gas giant", + 0, 15.0, "Very large gas giant", "icons/object_planet_large_gas_giant.png" }, { - 0, 0, "Small, rocky dwarf planet", + 0, 0.26, "Small, rocky dwarf planet", "icons/object_planet_dwarf.png" }, { - 0, 0, "Small, rocky planet with a thin atmosphere", + 0, 0.52, "Small, rocky planet with a thin atmosphere", "icons/object_planet_small.png" }, { - 0, 0, "Rocky planet with liquid water and a nitrogen atmosphere", + 0, 1.0, "Rocky planet with liquid water and a nitrogen atmosphere", "icons/object_planet_small.png" }, { - 0, 0, "Rocky planet with a carbon dioxide atmosphere", + 0, 1.0, "Rocky planet with a carbon dioxide atmosphere", "icons/object_planet_small.png" }, { - 0, 0, "Rocky planet with a methane atmosphere", + 0, 1.0, "Rocky planet with a methane atmosphere", "icons/object_planet_small.png" }, { - 0, 0, "Rocky planet with running water and a thick nitrogen atmosphere", + 0, 1.0, "Rocky planet with running water and a thick nitrogen atmosphere", "icons/object_planet_small.png" }, { - 0, 0, "Rocky planet with a thick carbon dioxide atmosphere", + 0, 1.0, "Rocky planet with a thick carbon dioxide atmosphere", "icons/object_planet_small.png" }, { - 0, 0, "Rocky planet with a thick methane atmosphere", + 0, 1.0, "Rocky planet with a thick methane atmosphere", "icons/object_planet_small.png" }, { - 0, 0, "Highly volcanic world", + 0, 1.0, "Highly volcanic world", "icons/object_planet_small.png" }, { - 0, 0, "World with indigenous life and an oxygen atmosphere", + 0, 1.0, "World with indigenous life and an oxygen atmosphere", "icons/object_planet_life.png" } }; @@ -270,7 +270,7 @@ StarSystem::StarSystem(int sector_x, int sector_y, int system_idx) { planet->seed = rand.Int32(); planet->temp = 0; planet->parent = primary; - planet->radius = EARTH_RADIUS; + //planet->radius = EARTH_RADIUS*bodyTypeInfo[type].radius; planet->mass = mass * EARTH_MASS; planet->orbit.eccentricity = rand.pdrand(3); planet->orbit.semiMajorAxis = ((i+1)*0.1)*AU; @@ -395,6 +395,7 @@ void StarSystem::SBody::PickPlanetType(SBody* star, double distToPrimary, MTRand /* Kinda crappy. */ if((emass > 0.8) && (!rand(0,15))) type = TYPE_PLANET_HIGHLY_VOLCANIC; } + radius = EARTH_RADIUS*bodyTypeInfo[type].radius; /* Generate moons. */ if(genMoons) { std::vector