Allow sunset color be defined in an .ssc file.

ver1_5_1
Chris Laurel 2003-05-26 04:43:54 +00:00
parent 514078ac0f
commit e224430853
3 changed files with 11 additions and 2 deletions

View File

@ -19,6 +19,10 @@ class Atmosphere
public:
Atmosphere() :
height(0.0f),
lowerColor(0.0f, 0.0f, 0.0f),
upperColor(0.0f, 0.0f, 0.0f),
skyColor(0.0f, 0.0f, 0.0f),
sunsetColor(1.0f, 0.6f, 0.5f),
cloudHeight(0.0f),
cloudSpeed(0.0f),
cloudTexture() {};
@ -28,6 +32,7 @@ class Atmosphere
Color lowerColor;
Color upperColor;
Color skyColor;
Color sunsetColor;
float cloudHeight;
float cloudSpeed;
MultiResTexture cloudTexture;

View File

@ -2024,6 +2024,9 @@ void Renderer::renderEllipsoidAtmosphere(const Atmosphere& atmosphere,
Vec3f topColor(atmosphere.upperColor.red(),
atmosphere.upperColor.green(),
atmosphere.upperColor.blue());
Vec3f sunsetColor(atmosphere.sunsetColor.red(),
atmosphere.sunsetColor.green(),
atmosphere.sunsetColor.blue());
if (within)
{
Vec3f skyColor(atmosphere.skyColor.red(),
@ -2034,7 +2037,7 @@ void Renderer::renderEllipsoidAtmosphere(const Atmosphere& atmosphere,
else
topColor = skyColor + (topColor - skyColor) * (ellipDist / height);
}
Vec3f zenith = (skyContour[0].v + skyContour[nSlices / 2].v);
zenith.normalize();
zenith *= skyContour[0].centerDist * (1.0f + height * 2.0f);
@ -2107,7 +2110,7 @@ void Renderer::renderEllipsoidAtmosphere(const Atmosphere& atmosphere,
brightness *= minOpacity + (1.0f - minOpacity) * fade * atten;
Vec3f color = (1.0f - hh) * botColor + hh * topColor;
if (redness != 0.0f)
color = (1.0f - redness) * color + redness * Vec3f(1.0f, 0.6f, 0.5f);
color = (1.0f - redness) * color + redness * sunsetColor;
Color(brightness * color.x,
brightness * color.y,
brightness * color.z,

View File

@ -413,6 +413,7 @@ static Body* CreatePlanet(PlanetarySystem* system,
atmosData->getColor("Lower", atmosphere->lowerColor);
atmosData->getColor("Upper", atmosphere->upperColor);
atmosData->getColor("Sky", atmosphere->skyColor);
atmosData->getColor("Sunset", atmosphere->sunsetColor);
atmosData->getNumber("CloudHeight", atmosphere->cloudHeight);
atmosData->getNumber("CloudSpeed", atmosphere->cloudSpeed);
atmosphere->cloudSpeed = degToRad(atmosphere->cloudSpeed);