[Change] A bunch more planet work.

[Change] Start player in system 0, 0, 0
This commit is contained in:
Allanis 2017-11-23 21:25:46 +00:00
parent 4f4996d44b
commit 1a8689d0fe
12 changed files with 276 additions and 148 deletions

View File

@ -185,57 +185,36 @@ void L3D::HandleEvents(void) {
}
void L3D::MainLoop(void) {
Frame* earth_frame = new Frame(Space::GetRootFrame(), "Earth");
earth_frame->SetPosition(vector3d(149598000000.0, 0, 0));
earth_frame->SetRadius(2*380000000); /* 2 moon orbital radii. */
player = new Player(ShipType::SLEEK);
player->SetLabel("Me");
player->SetFrame(earth_frame);
player->SetPosition(vector3d(0, 0, 8000000.0));
Space::AddBody(player);
StarSystem s(0, 0, 0);
HyperspaceTo(&s);
/* Linked list eh... Put player at planet f. */
Frame* pframe = *++(++(++(++(Space::rootFrame->m_children.begin()))));
player->SetFrame(pframe);
player->SetPosition(vector3d(0, 100000, 10000000.0));
for(int i = 0; i < 4; i++) {
Ship* body = new Ship(ShipType::SLEEK/*LADYBIRD*/);
char buf[64];
snprintf(buf, sizeof(buf), "X%c-0%02d", "A"+i, i);
body->SetLabel(buf);
body->SetFrame(earth_frame);
body->SetPosition(vector3d(i*2000, 0, 8000400));
body->SetFrame(pframe);
body->SetPosition(vector3d(i*2000, 100000, 10001000));
Space::AddBody(body);
}
{
SpaceStation* body = new SpaceStation();
body->SetLabel("Poemi-chan's Folly");
body->SetFrame(earth_frame);
body->SetPosition(vector3d(0, 0, 7998000));
body->SetFrame(pframe);
body->SetPosition(vector3d(5000, 100000, 9990000.0));
Space::AddBody(body);
}
Planet* planet = new Planet(StarSystem::SBody::SUBTYPE_PLANET_INDIGENOUS_LIFE);
planet->SetLabel("Earth");
planet->SetPosition(vector3d(0, 0, 0));
planet->SetFrame(earth_frame);
Space::AddBody(planet);
Frame* moon_frame = new Frame(earth_frame, "Moon");
moon_frame->SetPosition(vector3d(0, -380000000.0, 0));
moon_frame->SetRadius(10*1738140.0); /* 10 moon radii. */
Planet* moon = new Planet(StarSystem::SBody::SUBTYPE_PLANET_DWARF);
moon->SetLabel("Moon");
moon->SetPosition(vector3d(0, 0, 0));
moon->SetRadius(1738140.0);
moon->SetFrame(moon_frame);
Space::AddBody(moon);
Star* sol = new Star(StarSystem::SBody::SUBTYPE_STAR_G);
sol->SetLabel("Sol");
sol->SetRadius(6.955e8);
sol->SetPosition(vector3d(0, 0, 0));
sol->SetFrame(Space::GetRootFrame());
Space::AddBody(sol);
Gui::Init(scrWidth, scrHeight, 640, 480);
cpan = new ShipCpanel();

View File

@ -84,6 +84,10 @@ public:
return max*static_cast<double>(rand_int32()) * (1./4294967296.);
}
unsigned int In32(int min, int max) {
return (rand_int32()%(1+max-min))+min;
}
unsigned int Int32(void) { return rand_int32(); }
private:
/* Copy and assignment operators not defined. */
MTRand(const MTRand&);

View File

@ -4,33 +4,35 @@
#include "l3d.h"
#include "world_view.h"
Planet::Planet(StarSystem::SBody::SubType subtype) : Body() {
m_radius = 6378135.0;
m_pos = vector3d(0, 0, 0);
m_geom = dCreateSphere(0, m_radius);
dGeomSetData(m_geom, static_cast<Body*>(this));
m_subtype = subtype;
Planet::Planet(StarSystem::SBody* sbody) : Body() {
radius = 6378135.0;
pos = vector3d(0, 0, 0);
geom = dCreateSphere(0, radius);
dGeomSetData(geom, static_cast<Body*>(this));
this->sbody = *sbody;
this->sbody.children.clear();
this->sbody.parent = 0;
}
Planet::~Planet(void) {
dGeomDestroy(m_geom);
dGeomDestroy(geom);
}
vector3d Planet::GetPosition(void) {
return m_pos;
return pos;
}
void Planet::SetPosition(vector3d p) {
m_pos = p;
dGeomSetPosition(m_geom, p.x, p.y, p.z);
pos = p;
dGeomSetPosition(geom, p.x, p.y, p.z);
}
void Planet::SetRadius(double radius) {
m_radius = radius;
dGeomSphereSetRadius(m_geom, radius);
radius = radius;
dGeomSphereSetRadius(geom, radius);
}
void subdivide(vector3d& v1, vector3d& v2, vector3d& v3, vector3d& v4, int depth) {
static void subdivide(vector3d& v1, vector3d& v2, vector3d& v3, vector3d& v4, int depth) {
if(depth) {
depth--;
vector3d v5 = v1+v2;
@ -80,7 +82,7 @@ void subdivide(vector3d& v1, vector3d& v2, vector3d& v3, vector3d& v4, int depth
}
}
void DrawLovelyRoundCube(double radius) {
static void DrawLovelyRoundCube(double radius) {
vector3d p1(1, 1, 1);
vector3d p2(-1, 1, 1);
vector3d p3(-1, -1, 1);
@ -363,8 +365,6 @@ static GasGiantDef_t ggdefs[] = {
},
};
static GasGiantDef_t &ggdef = ggdefs[0];
#define PLANET_AMBIENT 0.1
static void SetMaterialColor(const float col[4]) {
@ -377,10 +377,134 @@ static void SetMaterialColor(const float col[4]) {
glMaterialfv(GL_FRONT, GL_DIFFUSE, col);
}
static void DrawGasGiant(void) {
MTRand rng((int)L3D::GetGameTime());
/* 1980's graphics. ^.^ */
#define GEOSPLIT 4
#define GEOROUGHNESS 0.7
static const float _yes[] = { 1.0, 0.5, 0.25, 0.126, 0.0625, 0.03125 };
static void SubdivideTriangularContinent2(std::vector<vector3d>& verts,
int sidx, int eidx, int depth, MTRand& rng) {
vector3d& v1 = verts[sidx];
vector3d& v2 = verts[eidx];
if(depth > 0) {
int midx = (sidx+eidx)>>1;
vector3d c = vector3d::Normalize(vector3d::Cross(v2-v1, v1));
c *= rng(1.0);
verts[midx] = vector3d::Normalize(v1+v2+0.7*_yes[GEOSPLIT-depth]*c);
SubdivideTriangularContinent2(verts, sidx, midx, depth-1, rng);
SubdivideTriangularContinent2(verts, midx, eidx, depth-1, rng);
}
}
static void SubdivideVeryLongTri(vector3d& tip, vector3d& v1, vector3d& v2, int bits) {
vector3d v;
vector3d tip2v1 = v1-tip;
vector3d tip2v2 = v2-tip;
tip2v1 *= 1.0/bits;
tip2v2 *= 1.0/bits;
/* Tip triangle. */
glBegin(GL_TRIANGLES);
glNormal3dv(&tip.x);
glVertex3dv(&tip.x);
v = vector3d::Normalize(tip+tip2v1);
glNormal3dv(&v.x);
glVertex3dv(&v.x);
v = vector3d::Normalize(tip+tip2v2);
glNormal3dv(&v.x);
glVertex3dv(&v.x);
glEnd();
glBegin(GL_QUADS);
for(int i = 1; i < bits; i++) {
v = vector3d::Normalize(tip+(tip2v1*i));
glNormal3dv(&v.x);
glVertex3dv(&v.x);
v = vector3d::Normalize(tip+(tip2v1*(i+1)));
glNormal3dv(&v.x);
glVertex3dv(&v.x);
v = vector3d::Normalize(tip+(tip2v2*(i+1)));
glNormal3dv(&v.x);
glVertex3dv(&v.x);
v = vector3d::Normalize(tip+(tip2v2*i));
glNormal3dv(&v.x);
glVertex3dv(&v.x);
}
glEnd();
}
static void MakeContinent(matrix4x4d& rot, float scale, MTRand& rng) {
const int nvps = exp2(GEOSPLIT);
const int numVertices = nvps*3 + 1;
/*
* This is a continent centered on the north pole, of size roughly 45
* degrees in each direction (although it is based on a triangle, so
* the actual shape will be a load of rubbish.
*/
vector3d v1(0, 1, scale*1);
vector3d v2(scale*sin(2*M_PI/3.0), 1, scale*cos(2*M_PI/3.0));
vector3d v3(-scale*sin(2*M_PI/3.0), 1, scale*cos(2*M_PI/3.0));
v1 = rot*v1;
v2 = rot*v2;
v3 = rot*v3;
v1.Normalize();
v2.Normalize();
v3.Normalize();
std::vector<vector3d> edgeVerts(numVertices);
edgeVerts[0] = v1;
edgeVerts[nvps] = v2;
edgeVerts[2*nvps] = v3;
edgeVerts[3*nvps] = v1;
SubdivideTriangularContinent2(edgeVerts, 0, nvps, GEOSPLIT, rng);
SubdivideTriangularContinent2(edgeVerts, nvps, 2*nvps, GEOSPLIT, rng);
SubdivideTriangularContinent2(edgeVerts, 2*nvps, 3*nvps, GEOSPLIT, rng);
vector3d center = vector3d::Normalize(v1+v2+v3);
for(unsigned int i = 0; i < edgeVerts.size()-1; i++) {
SubdivideVeryLongTri(center, edgeVerts[i], edgeVerts[i+1], 16);
}
}
void Planet::DrawRockyPlanet(void) {
//MTRand rng((int)L3D::GetGameTime());
MTRand rng(sbody.seed);
float blue[4] = { .2, .2, 1, 1 };
float green[4] = { .2, .8, .2, 1 };
float white[4] = { 1, 1, 1, 1 };
SetMaterialColor(blue);
DrawLovelyRoundCube(1.0f);
glDisable(GL_DEPTH_TEST);
glEnable(GL_NORMALIZE);
matrix4x4d rot;
int n = rng(3, 10);
while(n--) {
SetMaterialColor(green);
rot = matrix4x4d::RotateXMatrix(-M_PI/2+rng.drange(-M_PI/3, M_PI/3));
rot.RotateZ(rng(M_PI*2));
MakeContinent(rot, rng.drange(0.1, 0.5), rng);
}
/* Poles. */
SetMaterialColor(white);
rot = matrix4x4d::Identity();
MakeContinent(rot, 0.25, rng);
rot = matrix4x4d::RotateXMatrix(M_PI);
MakeContinent(rot, 0.25, rng);
glEnable(GL_DEPTH_TEST);
glDisable(GL_NORMALIZE);
}
void Planet::DrawGasGiant(void) {
//MTRand rng((int)L3D::GetGameTime());
MTRand rng(sbody.seed+9);
float col[4];
/* Just use a random gas giant flavour for the moment. */
GasGiantDef_t& ggdef = ggdefs[rng(0,3)];
ggdef.bodyCol.GenCol(col, rng);
SetMaterialColor(col);
DrawLovelyRoundCube(1.0f);
@ -426,7 +550,7 @@ static void DrawGasGiant(void) {
void Planet::Render(const Frame* a_camFrame) {
glPushMatrix();
double rad = m_radius;
double rad = radius;
vector3d fpos = GetPositionRelTo(a_camFrame);
double apparent_size = rad / fpos.Length();
@ -450,15 +574,20 @@ void Planet::Render(const Frame* a_camFrame) {
glEnable(GL_LIGHTING);
} else {
glScalef(rad, rad, rad);
/* This is a rather brittle test.. */
if(sbody.type < StarSystem::TYPE_PLANET_DWARF) {
DrawGasGiant();
} else {
DrawRockyPlanet();
}
glClear(GL_DEPTH_BUFFER_BIT);
}
glPopMatrix();
}
void Planet::SetFrame(Frame* f) {
if(GetFrame()) GetFrame()->RemoveGeom(m_geom);
if(GetFrame()) GetFrame()->RemoveGeom(geom);
Body::SetFrame(f);
if(f) f->AddGeom(m_geom);
if(f) f->AddGeom(geom);
}

View File

@ -5,19 +5,22 @@
class Frame;
class Planet : public Body {
public:
Planet(StarSystem::SBody::SubType);
Planet(StarSystem::SBody*);
virtual ~Planet(void);
virtual void SetPosition(vector3d p);
virtual vector3d GetPosition(void);
void SetRadius(double radius);
double GetRadius(void) { return m_radius; }
double GetRadius(void) { return radius; }
virtual void Render(const Frame* camFrame);
virtual void SetFrame(Frame* f);
virtual bool OnCollision(Body* b, Uint32 flags) { return true; }
private:
vector3d m_pos;
double m_radius;
dGeomID m_geom;
StarSystem::SBody::SubType m_subtype;
void DrawRockyPlanet(void);
void DrawGasGiant(void);
vector3d pos;
double radius;
dGeomID geom;
StarSystem::SBody sbody;
};

View File

@ -23,19 +23,19 @@ Sector::Sector(int x, int y) {
float spec = rand(1.0);
/* Frequences are from our friends over at wikipedia. ^.^ */
if(spec < 0.0000003) {
s.primaryStarClass = StarSystem::SBody::SUBTYPE_STAR_O;
s.primaryStarClass = StarSystem::TYPE_STAR_O;
} else if(spec < 0.0013) {
s.primaryStarClass = StarSystem::SBody::SUBTYPE_STAR_B;
s.primaryStarClass = StarSystem::TYPE_STAR_B;
} else if(spec < 0.0073) {
s.primaryStarClass = StarSystem::SBody::SUBTYPE_STAR_A;
s.primaryStarClass = StarSystem::TYPE_STAR_A;
} else if(spec < 0.0373) {
s.primaryStarClass = StarSystem::SBody::SUBTYPE_STAR_F;
s.primaryStarClass = StarSystem::TYPE_STAR_F;
} else if(spec < 0.1133) {
s.primaryStarClass = StarSystem::SBody::SUBTYPE_STAR_G;
s.primaryStarClass = StarSystem::TYPE_STAR_G;
} else if(spec < 0.2343) {
s.primaryStarClass = StarSystem::SBody::SUBTYPE_STAR_K;
s.primaryStarClass = StarSystem::TYPE_STAR_K;
} else {
s.primaryStarClass = StarSystem::SBody::SUBTYPE_STAR_M;
s.primaryStarClass = StarSystem::TYPE_STAR_M;
}
m_systems.push_back(s);

View File

@ -15,7 +15,7 @@ public:
struct System {
std::string name;
vector3f p;
StarSystem::SBody::SubType primaryStarClass;
StarSystem::BodyType primaryStarClass;
};
std::vector<System>m_systems;

View File

@ -43,13 +43,13 @@ void Space::Clear(void) {
void Space::GenBody(StarSystem* system, StarSystem::SBody* sbody, Frame* f) {
Body* b;
if(sbody->type == StarSystem::SBody::TYPE_STAR) {
Star* star = new Star(sbody->subtype);
if(sbody->supertype == StarSystem::SUPERTYPE_STAR) {
Star* star = new Star(sbody->type);
star->SetRadius(sbody->radius);
b = star;
} else {
Planet* planet = new Planet(sbody->subtype);
planet->SetRadius(sbody->radius);
Planet* planet = new Planet(sbody);
//planet->SetRadius(sbody->radius);
b = planet;
}
b->SetLabel(sbody->name.c_str());

View File

@ -22,11 +22,11 @@ public:
static dWorldID world;
static std::list<Body*> bodies;
typedef std::list<Body*>::iterator bodiesIter_t;
static Frame* rootFrame;
private:
static void UpdateFramesOfReference(void);
static void CollideFrame(Frame* f);
static void PruneCorpses(void);
static Frame* rootFrame;
//static std::list<Frame*> rootFrames;
static std::list<Body*> corpses;
};

View File

@ -2,18 +2,18 @@
#include "star.h"
#include "l3d.h"
Star::Star(StarSystem::SBody::SubType subtype): Body() {
m_subtype = subtype;
m_radius = 6378135.0;
m_pos = vector3d(0,0,0);
Star::Star(StarSystem::BodyType type): Body() {
this->type = type;
radius = 6378135.0;
pos = vector3d(0,0,0);
}
vector3d Star::GetPosition(void) {
return m_pos;
return pos;
}
void Star::SetPosition(vector3d p) {
m_pos = p;
pos = p;
}
void Star::Render(const Frame* a_camFrame) {
@ -22,7 +22,7 @@ void Star::Render(const Frame* a_camFrame) {
glPushMatrix();
/* TODO duplicates code from Planet.cpp, not good. */
double rad = m_radius;
double rad = radius;
vector3d fpos = GetPositionRelTo(a_camFrame);
double len = fpos.Length();
@ -34,7 +34,7 @@ void Star::Render(const Frame* a_camFrame) {
glTranslatef(fpos.x, fpos.y, fpos.z);
glColor3fv(StarSystem::starColors[m_subtype]);
glColor3fv(StarSystem::starColors[type]);
gluSphere(L3D::gluQuadric, rad, 100, 100);
glPopMatrix();
glEnable(GL_DEPTH_TEST);

View File

@ -6,17 +6,17 @@ class Frame;
class Star: public Body {
public:
Star(StarSystem::SBody::SubType subtype);
Star(StarSystem::BodyType type);
virtual ~Star(void) { };
virtual void SetPosition(vector3d p);
virtual vector3d GetPosition(void);
void SetRadius(double radius) { m_radius = radius; }
double GetRadius(void) { return m_radius; }
void SetRadius(double radius) { this->radius = radius; }
double GetRadius(void) { return radius; }
virtual void Render(const Frame* camFrame);
private:
StarSystem::SBody::SubType m_subtype;
vector3d m_pos;
double m_radius;
StarSystem::BodyType type;
vector3d pos;
double radius;
};

View File

@ -3,7 +3,7 @@
#define CELSIUS 273.15
/* Indexed by enum subtype. */
/* Indexed by enum type. */
float StarSystem::starColors[7][3] = {
{ 1.0, 0.2, 0.0 }, /* M */
{ 1.0, 0.6, 0.1 }, /* K */
@ -20,7 +20,7 @@ static const struct SBodySubTypeInfo {
const char *description;
const char *icon;
float tempMin, tempMax;
} subTypeInfo[StarSystem::SBody::SUBTYPE_MAX] = {
} bodyTypeInfo[StarSystem::TYPE_MAX] = {
{
0.4, 0.5, "Type 'M' red star",
"icons/object_star_m.png",
@ -119,11 +119,11 @@ static const struct SBodySubTypeInfo {
};
const char* StarSystem::SBody::GetAstroDescription(void) {
return subTypeInfo[subtype].description;
return bodyTypeInfo[type].description;
}
const char* StarSystem::SBody::GetIcon(void) {
return subTypeInfo[subtype].icon;
return bodyTypeInfo[type].icon;
}
static const double boltzman_const = 5.6704e-8;
@ -247,17 +247,17 @@ StarSystem::StarSystem(int sector_x, int sector_y, int system_idx) {
/* Primary. */
SBody* primary = new SBody;
StarSystem::SBody::SubType subtype = s.m_systems[system_idx].primaryStarClass;
primary->subtype = subtype;
StarSystem::BodyType type = s.m_systems[system_idx].primaryStarClass;
primary->type = type;
primary->parent = NULL;
primary->radius = SOL_RADIUS*subTypeInfo[subtype].radius;
primary->mass = SOL_MASS*subTypeInfo[subtype].mass;
primary->type = SBody::TYPE_STAR;
primary->averageTemp = rand((int)subTypeInfo[subtype].tempMin,
(int)subTypeInfo[subtype].tempMax);
primary->radius = SOL_RADIUS*bodyTypeInfo[type].radius;
primary->mass = SOL_MASS*bodyTypeInfo[type].mass;
primary->supertype = SUPERTYPE_STAR;
primary->averageTemp = rand((int)bodyTypeInfo[type].tempMin,
(int)bodyTypeInfo[type].tempMax);
rootBody = primary;
int disc_size = rand(6, 100) + rand(60,140)*primary->subtype*primary->subtype;
int disc_size = rand(6, 100) + rand(60,140)*primary->type*primary->type;
//printf("disc_size %.1fAU\n", disc_size/10.0);
std::vector<float>* disc = AccreteDisc(disc_size, 0.1+rand(1.5), rand);
@ -266,7 +266,8 @@ StarSystem::StarSystem(int sector_x, int sector_y, int system_idx) {
if(mass == 0) continue;
SBody* planet = new SBody;
planet->subtype = SBody::SUBTYPE_PLANET_DWARF;
planet->type = TYPE_PLANET_DWARF;
planet->seed = rand.Int32();
planet->temp = 0;
planet->parent = primary;
planet->radius = EARTH_RADIUS;
@ -352,22 +353,22 @@ void StarSystem::SBody::L3DckPlanetType(SBody* star, double distToPrimary, MTRan
if(emass > 317.8*13) {
/* More than 13 jupiter masses can fuse deuterium - is a brown dwarf. */
subtype = SBody::SUBTYPE_BROWN_DWARF;
type = TYPE_BROWN_DWARF;
/* TODO Should prevent mass exceeding 65 jupiter masses or so,
* when it becomes a star.
*/
} else if(emass > 300) {
subtype = SBody::SUBTYPE_PLANET_LARGE_GAS_GIANT;
type = TYPE_PLANET_LARGE_GAS_GIANT;
} else if(emass > 90) {
subtype = SBody::SUBTYPE_PLANET_MEDIUM_GAS_GIANT;
type = TYPE_PLANET_MEDIUM_GAS_GIANT;
} else if(emass > 6) {
subtype = SBody::SUBTYPE_PLANET_SMALL_GAS_GIANT;
type = TYPE_PLANET_SMALL_GAS_GIANT;
} else {
/* Terrestrial planets. */
if(emass < 0.02) {
subtype = SBody::SUBTYPE_PLANET_DWARF;
type = TYPE_PLANET_DWARF;
} else if((emass < 0.2) && (globalwarming < 0.05)) {
subtype = SBody::SUBTYPE_PLANET_SMALL;
type = TYPE_PLANET_SMALL;
} else if(emass < 3) {
if((averageTemp > CELSIUS-10) && (averageTemp < CELSIUS+70)) {
/* Try for life.. */
@ -375,24 +376,24 @@ void StarSystem::SBody::L3DckPlanetType(SBody* star, double distToPrimary, MTRan
double maxTemp = calcSurfaceTemp(star->radius, star->averageTemp, radMin, albedo, globalwarming);
if((minTemp > CELSIUS-10) && (minTemp < CELSIUS+70) &&
(maxTemp > CELSIUS-10) && (maxTemp < CELSIUS+70)) {
subtype = SBody::SUBTYPE_PLANET_INDIGENOUS_LIFE;
type = TYPE_PLANET_INDIGENOUS_LIFE;
} else {
subtype = SBody::SUBTYPE_PLANET_WATER;
type = TYPE_PLANET_WATER;
}
} else {
if(rand(0,1)) subtype = SBody::SUBTYPE_PLANET_CO2;
else subtype = SBody::SUBTYPE_PLANET_METHANE;
if(rand(0,1)) type = TYPE_PLANET_CO2;
else type = TYPE_PLANET_METHANE;
}
} else { /* 3 < emass < 6 */
if((averageTemp > CELSIUS-10) && (averageTemp < CELSIUS+70)) {
subtype = SBody::SUBTYPE_PLANET_WATER_THICK_ATMOS;
type = TYPE_PLANET_WATER_THICK_ATMOS;
} else {
if(rand(0,1)) subtype = SBody::SUBTYPE_PLANET_CO2_THICK_ATMOS;
else subtype = SBody::SUBTYPE_PLANET_METHANE_THICK_ATMOS;
if(rand(0,1)) type = TYPE_PLANET_CO2_THICK_ATMOS;
else type = TYPE_PLANET_METHANE_THICK_ATMOS;
}
}
/* Kinda crappy. */
if((emass > 0.8) && (!rand(0,15))) subtype = SBody::SUBTYPE_PLANET_HIGHLY_VOLCANIC;
if((emass > 0.8) && (!rand(0,15))) type = TYPE_PLANET_HIGHLY_VOLCANIC;
}
/* Generate moons. */
if(genMoons) {
@ -402,7 +403,8 @@ void StarSystem::SBody::L3DckPlanetType(SBody* star, double distToPrimary, MTRan
if(mass == 0) continue;
SBody* moon = new SBody;
moon->subtype = SBody::SUBTYPE_PLANET_DWARF;
moon->type = TYPE_PLANET_DWARF;
moon->seed = rand.Int32();
moon->temp = 0;
moon->parent = this;
moon->radius = EARTH_RADIUS;

View File

@ -39,51 +39,62 @@ public:
matrix4x4d rotMatrix;
};
enum BodyType {
TYPE_STAR_M,
TYPE_STAR_K,
TYPE_STAR_G,
TYPE_STAR_F,
TYPE_STAR_A,
TYPE_STAR_B,
TYPE_STAR_O,
TYPE_BROWN_DWARF,
TYPE_PLANET_SMALL_GAS_GIANT,
TYPE_PLANET_MEDIUM_GAS_GIANT,
TYPE_PLANET_LARGE_GAS_GIANT,
TYPE_PLANET_VERY_LARGE_GAS_GIANT,
TYPE_PLANET_DWARF,
TYPE_PLANET_SMALL,
TYPE_PLANET_WATER,
TYPE_PLANET_CO2,
TYPE_PLANET_METHANE,
TYPE_PLANET_WATER_THICK_ATMOS,
TYPE_PLANET_CO2_THICK_ATMOS,
TYPE_PLANET_METHANE_THICK_ATMOS,
TYPE_PLANET_HIGHLY_VOLCANIC,
TYPE_PLANET_INDIGENOUS_LIFE,
TYPE_MAX
/* TODO: Need larger atmosphereless thing. */
};
enum BodySuperType {
SUPERTYPE_STAR, SUPERTYPE_ROCKY_PLANET, SUPERTYPE_GAS_GIANT
};
struct BodyStats {
};
struct SBody {
~SBody(void);
void EliminateBadChildren(void); /* :D */
void L3DckPlanetType(SBody*, double distToPrimary, MTRand& drand, bool genMoons);
SBody* parent;
std::vector<SBody*> children;
Orbit orbit;
const char* GetAstroDescription(void);
const char* GetIcon(void);
int temp;
Orbit orbit;
int seed; /* planet.cpp can use to generate terrain. */
std::string name;
double radius;
double mass;
double radMin, radMax;
double averageTemp;
enum { TYPE_STAR, TYPE_ROCKY_PLANET, TYPE_GAS_GIANT } type;
enum SubType {
SUBTYPE_STAR_M,
SUBTYPE_STAR_K,
SUBTYPE_STAR_G,
SUBTYPE_STAR_F,
SUBTYPE_STAR_A,
SUBTYPE_STAR_B,
SUBTYPE_STAR_O,
SUBTYPE_BROWN_DWARF,
SUBTYPE_PLANET_SMALL_GAS_GIANT,
SUBTYPE_PLANET_MEDIUM_GAS_GIANT,
SUBTYPE_PLANET_LARGE_GAS_GIANT,
SUBTYPE_PLANET_VERY_LARGE_GAS_GIANT,
SUBTYPE_PLANET_DWARF,
SUBTYPE_PLANET_SMALL,
SUBTYPE_PLANET_WATER,
SUBTYPE_PLANET_CO2,
SUBTYPE_PLANET_METHANE,
SUBTYPE_PLANET_WATER_THICK_ATMOS,
SUBTYPE_PLANET_CO2_THICK_ATMOS,
SUBTYPE_PLANET_METHANE_THICK_ATMOS,
SUBTYPE_PLANET_HIGHLY_VOLCANIC,
SUBTYPE_PLANET_INDIGENOUS_LIFE,
SUBTYPE_MAX
/* TODO: Need larger atmospherless things. */
} subtype;
BodySuperType supertype;
BodyType type;
};
SBody* rootBody;