S3DRenderer.cpp   S3DRenderer.cpp 
skipping to change at line 813 skipping to change at line 813
shaderParameters.shadowTransform = false; shaderParameters.shadowTransform = false;
return success; return success;
} }
void S3DRenderer::calculateLighting() void S3DRenderer::calculateLighting()
{ {
//calculate which light source we need + intensity //calculate which light source we need + intensity
float ambientBrightness, directionalBrightness,emissiveFactor; float ambientBrightness, directionalBrightness,emissiveFactor;
float eclipseFactor=GETSTELMODULE(SolarSystem)->getEclipseFactor(Ste lApp::getInstance().getCore());
Vec3d sunPosition = sun->getAltAzPosAuto(core); Vec3d sunPosition = sun->getAltAzPosAuto(core);
sunPosition.normalize(); sunPosition.normalize();
Vec3d moonPosition = moon->getAltAzPosAuto(core); Vec3d moonPosition = moon->getAltAzPosAuto(core);
float moonPhaseAngle = moon->getPhase(core->getObserverHeliocentricE clipticPos()); float moonPhaseAngle = moon->getPhase(core->getObserverHeliocentricE clipticPos());
moonPosition.normalize(); moonPosition.normalize();
Vec3d venusPosition = venus->getAltAzPosAuto(core); Vec3d venusPosition = venus->getAltAzPosAuto(core);
float venusPhaseAngle = venus->getPhase(core->getObserverHeliocentri cEclipticPos()); float venusPhaseAngle = venus->getPhase(core->getObserverHeliocentri cEclipticPos());
venusPosition.normalize(); venusPosition.normalize();
skipping to change at line 890 skipping to change at line 891
// I don't know if this can ever happen, but in this case, // I don't know if this can ever happen, but in this case,
// directly use the same model as LandscapeMgr::update uses for the lightscapeBrightness // directly use the same model as LandscapeMgr::update uses for the lightscapeBrightness
emissiveFactor = 0.0f; emissiveFactor = 0.0f;
if (sunPosition[2]<-0.14f) emissiveFactor=1.0f; if (sunPosition[2]<-0.14f) emissiveFactor=1.0f;
else if (sunPosition[2]<-0.05f) emissiveFactor = 1.0f-(sunPo sition[2]+0.14)/(-0.05+0.14); else if (sunPosition[2]<-0.05f) emissiveFactor = 1.0f-(sunPo sition[2]+0.14)/(-0.05+0.14);
} }
// calculate ambient light // calculate ambient light
if(sinSunAngle > -0.3f) // sun above -18 deg? if(sinSunAngle > -0.3f) // sun above -18 deg?
{ {
lightInfo.sunAmbient = qMin(0.3f, sinSunAngle+0.3f); lightInfo.sunAmbient = qMin(0.3f, sinSunAngle+0.3f)*eclipseF actor;
ambientBrightness += lightInfo.sunAmbient; ambientBrightness += lightInfo.sunAmbient;
} }
else else
lightInfo.sunAmbient = 0.0f; lightInfo.sunAmbient = 0.0f;
if ((sinMoonAngle>0.0f) && (sinSunAngle<0.0f)) if ((sinMoonAngle>0.0f) && (sinSunAngle<0.0f))
{ {
lightInfo.moonAmbient = sqrt(sinMoonAngle * ((std::cos(moonP haseAngle)+1)/2)) * LUNAR_BRIGHTNESS_FACTOR; lightInfo.moonAmbient = sqrt(sinMoonAngle * ((std::cos(moonP haseAngle)+1)/2)) * LUNAR_BRIGHTNESS_FACTOR;
ambientBrightness += lightInfo.moonAmbient; ambientBrightness += lightInfo.moonAmbient;
} }
else else
lightInfo.moonAmbient = 0.0f; lightInfo.moonAmbient = 0.0f;
// Now find shadow caster + directional light, if any: // Now find shadow caster + directional light, if any:
if (sinSunAngle>-0.1f) if (sinSunAngle>-0.1f)
{ {
directionalBrightness=qMin(0.7f, std::sqrt(sinSunAngle+0.1f) ); // limit to 0.7 in order to keep total below 1. directionalBrightness=qMin(0.7f, std::sqrt(sinSunAngle+0.1f) )*eclipseFactor; // limit to 0.7 in order to keep total below 1.
//redundant //redundant
//lightPosition = sunPosition; //lightPosition = sunPosition;
if (shaderParameters.shadows) lightInfo.shadowCaster = Light Parameters::SC_Sun; if (shaderParameters.shadows) lightInfo.shadowCaster = Light Parameters::SC_Sun;
lightInfo.directionalSource = LightParameters::DS_Sun; lightInfo.directionalSource = LightParameters::DS_Sun;
} }
// "else" is required now, else we have lunar shadow with sun above horizon... // "else" is required now, else we have lunar shadow with sun above horizon...
else if (sinMoonAngle>0.0f) else if (sinMoonAngle>0.0f)
{ {
float moonBrightness = std::sqrt(sinMoonAngle) * ((std::cos( moonPhaseAngle)+1.0f)/2.0f) * LUNAR_BRIGHTNESS_FACTOR; float moonBrightness = std::sqrt(sinMoonAngle) * ((std::cos( moonPhaseAngle)+1.0f)/2.0f) * LUNAR_BRIGHTNESS_FACTOR;
moonBrightness -= (ambientBrightness-0.05f)/2.0f; moonBrightness -= (ambientBrightness-0.05f)/2.0f;
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/