Added rendering of ecliptic line and support for turning it on and off via

script.
ver1_6_1
Chris Laurel 2008-06-07 01:35:24 +00:00
parent 33a9728bc5
commit c00a2a0f47
3 changed files with 21 additions and 3 deletions

View File

@ -228,6 +228,7 @@ Color Renderer::PlanetEquatorColor (0.5f, 1.0f, 1.0f);
Color Renderer::GalacticGridColor (0.38f, 0.38f, 0.28f);
Color Renderer::EclipticGridColor (0.38f, 0.28f, 0.38f);
Color Renderer::HorizonGridColor (0.38f, 0.38f, 0.38f);
Color Renderer::EclipticColor (0.5f, 0.1f, 0.1f);
// Some useful unit conversions
@ -3327,9 +3328,7 @@ void Renderer::draw(const Observer& observer,
glEnable(GL_TEXTURE_2D);
// Render sky grids first--these will always be in the background
if (renderFlags & (ShowCelestialSphere | ShowGalacticGrid | ShowEclipticGrid | ShowHorizonGrid))
{
glColor(EquatorialGridColor);
glDisable(GL_TEXTURE_2D);
if ((renderFlags & ShowSmoothLines) != 0)
enableSmoothLines();
@ -10092,6 +10091,21 @@ void Renderer::renderSkyGrids(const Observer& observer)
}
}
}
if (renderFlags & ShowEcliptic)
{
// Draw the J2000.0 ecliptic; trivial, since this forms the basis for
// Celestia's coordinate system.
const int subdivision = 200;
glColor(EclipticColor);
glBegin(GL_LINE_LOOP);
for (int i = 0; i < subdivision; i++)
{
double theta = (double) i / (double) subdivision * 2 * PI;
glVertex3f((float) cos(theta) * 1000.0f, 0.0f, (float) sin(theta) * 1000.0f);
}
glEnd();
}
}

View File

@ -157,6 +157,7 @@ class Renderer
ShowGalacticGrid = 0x400000,
ShowEclipticGrid = 0x800000,
ShowHorizonGrid = 0x1000000,
ShowEcliptic = 0x2000000,
};
enum StarStyle
@ -811,6 +812,7 @@ class Renderer
static Color GalacticGridColor;
static Color EclipticGridColor;
static Color HorizonGridColor;
static Color EclipticColor;
};

View File

@ -125,6 +125,7 @@ void CelxLua::initRenderFlagMap()
RenderFlagMap["nebulae"] = Renderer::ShowNebulae;
RenderFlagMap["openclusters"] = Renderer::ShowOpenClusters;
RenderFlagMap["cloudshadows"] = Renderer::ShowCloudShadows;
RenderFlagMap["ecliptic"] = Renderer::ShowEcliptic;
}
void CelxLua::initLabelFlagMap()
@ -243,7 +244,8 @@ void CelxLua::initLineColorMap()
LineColorMap["eclipticgrid"] = &Renderer::EclipticGridColor;
LineColorMap["horizontalgrid"] = &Renderer::HorizonGridColor;
LineColorMap["planetographicgrid"] = &Renderer::PlanetographicGridColor;
LineColorMap["planetequator"] = &Renderer::PlanetEquatorColor;
LineColorMap["planetequator"] = &Renderer::PlanetEquatorColor;
LineColorMap["ecliptic"] = &Renderer::EclipticColor;
}