Star Browser Body Types and other ehancements/fixes

ver1_5_1
Deon Ramsey 2002-03-18 21:54:54 +00:00
parent d9a1545a6d
commit aa3835f0f3
6 changed files with 65 additions and 36 deletions

View File

@ -461,3 +461,6 @@ Code:
against Mesa 4 headers.
* Unix Gtk: removed bug in Text enter mode. (dramsey)
* Unix Gtk: Menus for new Labels. (dramsey)
* Unix Gtk: Star Browser Body Types. (dramsey)
* Unix Gtk: Correct Underlines for Menus. (dramsey)
* Guess Body Types more accurately. (dramsey)

View File

@ -880,7 +880,7 @@
}
# A few asteriods for fun . . .
# A few asteroids for fun . . .
"Ceres" "Sol"
{
Class "asteroid"

View File

@ -667,7 +667,7 @@ void Renderer::render(const Observer& observer,
*solarSystem->getPlanets(),
observer,
Mat4d::identity(), now,
(labelMode & (PlanetLabels | MoonLabels | AsteroidLabels | SpacecraftLabels)) != 0);
(labelMode & (BodyLabelMask)) != 0);
starTex->bind();
}

View File

@ -51,6 +51,7 @@ class Renderer
GalaxyLabels = 0x10,
AsteroidLabels = 0x20,
SpacecraftLabels = 0x40,
BodyLabelMask = (PlanetLabels | MoonLabels | AsteroidLabels | SpacecraftLabels),
};
enum {

View File

@ -261,9 +261,11 @@ static Body* CreatePlanet(PlanetarySystem* system,
}
body->setOrbit(orbit);
int classification = Body::Planet;
if (system->getPrimaryBody() != NULL)
classification = Body::Moon;
double radius = 10000.0;
planetData->getNumber("Radius", radius);
body->setRadius(radius);
int classification = Body::Unknown;
string classificationName;
if (planetData->getString("Class", classificationName))
{
@ -280,16 +282,30 @@ static Body* CreatePlanet(PlanetarySystem* system,
else
classification = Body::Unknown;
}
if(classification == Body::Unknown)
{
//Try to guess the type
if (system->getPrimaryBody() != NULL)
{
if(radius > 0.1)
classification = Body::Moon;
else
classification = Body::Spacecraft;
}
else
{
if(radius < 1000.0)
classification = Body::Asteroid;
else
classification = Body::Planet;
}
}
body->setClassification(classification);
double albedo = 0.5;
planetData->getNumber("Albedo", albedo);
body->setAlbedo(albedo);
double radius = 10000.0;
planetData->getNumber("Radius", radius);
body->setRadius(radius);
double oblateness = 0.0;
planetData->getNumber("Oblateness", oblateness);
body->setOblateness(oblateness);

View File

@ -1094,20 +1094,29 @@ void addPlanetarySystemToTree(const PlanetarySystem* sys, GtkCTreeNode *parent,
{
Body* world = sys->getBody(i);
tmp[0] = g_strdup(world->getName().c_str());
if (lev == 2)
switch(world->getClassification())
{
if (world->getRadius() >= 1000.0)
tmp[1]="Planet";
else
tmp[1]="Planetoid";
}
else
{
if (world->getRadius() > 0.1)
tmp[1]="Moon";
else
tmp[1]="Satellite";
case Body::Planet:
tmp[1]="Planet";
break;
case Body::Moon:
tmp[1]="Moon";
break;
case Body::Asteroid:
tmp[1]="Asteroid";
break;
case Body::Comet:
tmp[1]="Comet";
break;
case Body::Spacecraft:
tmp[1]="Spacecraft";
break;
case Body::Unknown:
default:
tmp[1]="-";
break;
}
const PlanetarySystem* satellites = world->getSatellites();
child=gtk_ctree_insert_node(GTK_CTREE(ctree), parent, NULL,
(char**) tmp , 0 , NULL, NULL, NULL, NULL,
@ -1688,23 +1697,23 @@ static void menuSetTime()
static GtkItemFactoryEntry menuItems[] =
{
{ "/_File", NULL, NULL, 0, "<Branch>" },
{ "/File", NULL, NULL, 0, "<Branch>" },
{ "/File/Capture Image...", "F10", menuCaptureImage,0, NULL },
{ "/File/Quit", "<control>Q", gtk_main_quit, 0, NULL },
{ "/_Navigation", NULL, NULL, 0, "<Branch>" },
{ "/Navigation", NULL, NULL, 0, "<Branch>" },
{ "/Navigation/Select Sol", "H", menuSelectSol, 0, NULL },
{ "/Navigation/Tour Guide", NULL, menuTourGuide, 0, NULL },
{ "/Navigation/Select Object...", NULL, menuSelectObject, 0, NULL },
{ "/Navigation/Goto Object...", NULL, menuGotoObject,0, NULL },
{ "/Navigation/sep1", NULL, NULL, 0, "<Separator>" },
{ "/Navigation/Center Selection", "C", menuCenter, 0, NULL },
{ "/Navigation/Goto Selection", "G", menuGoto, 0, NULL },
{ "/Navigation/Follow Selection", "F", menuFollow, 0, NULL },
{ "/Navigation/_Center Selection", "C", menuCenter, 0, NULL },
{ "/Navigation/_Goto Selection", "G", menuGoto, 0, NULL },
{ "/Navigation/_Follow Selection", "F", menuFollow, 0, NULL },
{ "/Navigation/Sync Orbit", "Y", menuSync, 0, NULL },
{ "/Navigation/Track Selection", "T", menuTrack, 0, NULL },
{ "/Navigation/_Track Selection", "T", menuTrack, 0, NULL },
{ "/Navigation/sep2", NULL, NULL, 0, "<Separator>" },
{ "/Navigation/Celestial Browser", NULL,menuBrowser, 0, NULL },
{ "/_Time", NULL, NULL, 0, "<Branch>" },
{ "/Time", NULL, NULL, 0, "<Branch>" },
{ "/Time/10x Faster", "L", menuFaster, 0, NULL },
{ "/Time/10x Slower", "K", menuSlower, 0, NULL },
{ "/Time/Pause", "space", menuPause, 0, NULL },
@ -1712,12 +1721,12 @@ static GtkItemFactoryEntry menuItems[] =
{ "/Time/Reverse", "J", menuReverse, 0, NULL },
{ "/Time/Set Time", NULL, menuSetTime, 0, NULL },
{ "/Time/sep1", NULL, NULL, 0, "<Separator>" },
{ "/Time/Show Local Time", "I", NULL, Menu_ShowLocTime, "<ToggleItem>" },
{ "/_Render", NULL, NULL, 0, "<Branch>" },
{ "/Time/Show Local T_ime", "I", NULL, Menu_ShowLocTime, "<ToggleItem>" },
{ "/Render", NULL, NULL, 0, "<Branch>" },
{ "/Render/Show Galaxies", "U", NULL, Menu_ShowGalaxies, "<ToggleItem>" },
{ "/Render/Show Atmospheres", "<control>A",NULL, Menu_ShowAtmospheres, "<ToggleItem>" },
{ "/Render/Show Clouds", "I", NULL, Menu_ShowClouds, "<ToggleItem>" },
{ "/Render/Show Orbits", "O", NULL, Menu_ShowOrbits, "<ToggleItem>" },
{ "/Render/Show _Orbits", "O", NULL, Menu_ShowOrbits, "<ToggleItem>" },
{ "/Render/Show Constellations", "slash",NULL, Menu_ShowConstellations, "<ToggleItem>" },
{ "/Render/Show Coordinate Sphere", "semicolon",NULL, Menu_ShowCelestialSphere, "<ToggleItem>" },
{ "/Render/Show Night Side Lights", "<control>L",NULL, Menu_ShowNightSideMaps, "<ToggleItem>" },
@ -1727,12 +1736,12 @@ static GtkItemFactoryEntry menuItems[] =
{ "/Render/More Stars Visible", "bracketleft", menuMoreStars, 0, NULL },
{ "/Render/Fewer Stars Visible", "bracketright", menuLessStars, 0, NULL },
{ "/Render/sep2", NULL, NULL, 0, "<Separator>" },
{ "/Render/Label Planets", "P", NULL, Menu_PlanetLabels, "<ToggleItem>" },
{ "/Render/Label Moons", "M", NULL, Menu_MoonLabels, "<ToggleItem>" },
{ "/Render/Label _Planets", "P", NULL, Menu_PlanetLabels, "<ToggleItem>" },
{ "/Render/Label _Moons", "M", NULL, Menu_MoonLabels, "<ToggleItem>" },
{ "/Render/Label Asteroids&Comets", "W",NULL, Menu_AsteroidLabels, "<ToggleItem>" },
{ "/Render/Label Spacecraft", "N", NULL, Menu_CraftLabels, "<ToggleItem>" },
{ "/Render/Label Stars", "B", NULL, Menu_StarLabels, "<ToggleItem>" },
{ "/Render/Label Galaxies", "E", NULL, Menu_GalaxyLabels, "<ToggleItem>" },
{ "/Render/Label Galaxi_es", "E", NULL, Menu_GalaxyLabels, "<ToggleItem>" },
{ "/Render/Label Constellations", "equal",NULL, Menu_ConstellationLabels, "<ToggleItem>" },
{ "/Render/Show Info Text", "V", menuShowInfo, 0, NULL },
{ "/Render/sep3", NULL, NULL, 0, "<Separator>" },
@ -1741,8 +1750,8 @@ static GtkItemFactoryEntry menuItems[] =
{ "/Render/Ambient/Low", NULL, menuLowAmbient,0, NULL },
{ "/Render/Ambient/Medium", NULL, menuMedAmbient,0, NULL },
{ "/Render/Ambient/High", NULL, menuHiAmbient, 0, NULL },
{ "/_Help", NULL, NULL, 0, "<LastBranch>" },
{ "/Help/Run Demo", "D", menuRunDemo, 0, NULL },
{ "/Help", NULL, NULL, 0, "<LastBranch>" },
{ "/Help/Run _Demo", "D", menuRunDemo, 0, NULL },
{ "/Help/sep1", NULL, NULL, 0, "<Separator>" },
{ "/Help/Controls", NULL, menuControls, 0, NULL },
{ "/Help/OpenGL Info", NULL, menuOpenGL, 0, NULL },