Planet.cpp   Planet.cpp 
skipping to change at line 220 skipping to change at line 220
" vec3 P3;\n" " vec3 P3;\n"
"\n" "\n"
" if(isRing)\n" " if(isRing)\n"
" P3 = P;\n" " P3 = P;\n"
" else\n" " else\n"
" {\n" " {\n"
" data = texture2D(info, vec2(current, current) / infoSize) ;\n" " data = texture2D(info, vec2(current, current) / infoSize) ;\n"
" P3 = normalize(P) * data.w;\n" " P3 = normalize(P) * data.w;\n"
" }\n" " }\n"
"\n" "\n"
" float L = length(Lp - P3);\n"
" RS = L * tan(asin(RS / L));\n"
" float R = atan(RS / L); //RS / L;\n"
"\n"
" if((lambert > 0.0) || isRing)\n" " if((lambert > 0.0) || isRing)\n"
" {\n" " {\n"
" if(ring && !isRing)\n" " if(ring && !isRing)\n"
" {\n" " {\n"
" vec3 ray = normalize(Lp);\n" " vec3 ray = normalize(Lp);\n"
" vec3 normal = normalize(vec3(0.0, 0.0, 1.0));\n" " vec3 normal = normalize(vec3(0.0, 0.0, 1.0));\n"
" float u = - dot(P3, normal) / dot(ray, normal);\n" " float u = - dot(P3, normal) / dot(ray, normal);\n"
"\n" "\n"
" if(u > 0.0 && u < 1e10)\n" " if(u > 0.0 && u < 1e10)\n"
" {\n" " {\n"
skipping to change at line 251 skipping to change at line 255
"\n" "\n"
" for(int i = 1; i < infoCount; i++)\n" " for(int i = 1; i < infoCount; i++)\n"
" {\n" " {\n"
" if(current == i && !isRing)\n" " if(current == i && !isRing)\n"
" continue;\n" " continue;\n"
"\n" "\n"
" data = texture2D(info, vec2(i, current) / infoSize);\ n" " data = texture2D(info, vec2(i, current) / infoSize);\ n"
" vec3 C = data.rgb;\n" " vec3 C = data.rgb;\n"
" float radius = data.a;\n" " float radius = data.a;\n"
"\n" "\n"
" float L = length(Lp - P3);\n"
" float l = length(C - P3);\n" " float l = length(C - P3);\n"
"\n" " radius = l * tan(asin(radius / l));\n"
" float R = RS / L;\n" " float r = atan(radius / l); //radius / l;\n"
" float r = radius / l;\n" " float d = acos(min(1.0, dot(normalize(Lp - P3), norma
" float d = length( (Lp - P3) / L - (C - P3) / l );\n" lize(C - P3)))); //length( (Lp - P3) / L - (C - P3) / l );\n"
"\n" "\n"
" float illumination = 1.0;\n" " float illumination = 1.0;\n"
"\n" "\n"
" // distance too far\n" " // distance too far\n"
" if(d >= R + r)\n" " if(d >= R + r)\n"
" {\n" " {\n"
" illumination = 1.0;\n" " illumination = 1.0;\n"
" }\n" " }\n"
" // umbra\n" " // umbra\n"
" else if(r >= R + d)\n" " else if(r >= R + d)\n"
skipping to change at line 622 skipping to change at line 624
coordFunc(date, eclipticPos, userDataPtr); coordFunc(date, eclipticPos, userDataPtr);
lastJD = date; lastJD = date;
} }
} }
void Planet::computePosition(const double date) void Planet::computePosition(const double date)
{ {
if (orbitFader.getInterstate()>0.000001 && deltaOrbitJD > 0 && (fabs (lastOrbitJD-date)>deltaOrbitJD || !orbitCached)) if (orbitFader.getInterstate()>0.000001 && deltaOrbitJD > 0 && (fabs (lastOrbitJD-date)>deltaOrbitJD || !orbitCached))
{ {
// calculate orbit first (for line drawing)
double date_increment = re.siderealPeriod/ORBIT_SEGMENTS;
double calc_date; double calc_date;
// int delta_points = (int)(0.5 + (date - lastOrbitJD)/date_ increment); // int delta_points = (int)(0.5 + (date - lastOrbitJD)/date_ increment);
int delta_points; int delta_points;
if( date > lastOrbitJD ) if( date > lastOrbitJD )
{ {
delta_points = (int)(0.5 + (date - lastOrbitJD)/date _increment); delta_points = (int)(0.5 + (date - lastOrbitJD)/delt aOrbitJD);
} }
else else
{ {
delta_points = (int)(-0.5 + (date - lastOrbitJD)/dat e_increment); delta_points = (int)(-0.5 + (date - lastOrbitJD)/del taOrbitJD);
} }
double new_date = lastOrbitJD + delta_points*date_increment; double new_date = lastOrbitJD + delta_points*deltaOrbitJD;
// qDebug( "Updating orbit coordinates for %s (delta %f) (%d points)\n", name.c_str(), deltaOrbitJD, delta_points); // qDebug( "Updating orbit coordinates for %s (delta %f) (%d points)\n", name.c_str(), deltaOrbitJD, delta_points);
if( delta_points > 0 && delta_points < ORBIT_SEGMENTS && orb itCached) if( delta_points > 0 && delta_points < ORBIT_SEGMENTS && orb itCached)
{ {
for( int d=0; d<ORBIT_SEGMENTS; d++ ) for( int d=0; d<ORBIT_SEGMENTS; d++ )
{ {
if(d + delta_points >= ORBIT_SEGMENTS ) if(d + delta_points >= ORBIT_SEGMENTS )
{ {
// calculate new points // calculate new points
calc_date = new_date + (d-ORBIT_SEGM ENTS/2)*date_increment; calc_date = new_date + (d-ORBIT_SEGM ENTS/2)*deltaOrbitJD;
// date increments between points wi ll not be completely constant though // date increments between points wi ll not be completely constant though
computeTransMatrix(calc_date); computeTransMatrix(calc_date);
if (osculatingFunc) if (osculatingFunc)
{ {
(*osculatingFunc)(date,calc_ date,eclipticPos); (*osculatingFunc)(date,calc_ date,eclipticPos);
} }
else else
{ {
coordFunc(calc_date, eclipti cPos, userDataPtr); coordFunc(calc_date, eclipti cPos, userDataPtr);
skipping to change at line 681 skipping to change at line 680
lastOrbitJD = new_date; lastOrbitJD = new_date;
} }
else if( delta_points < 0 && abs(delta_points) < ORBIT_SEGME NTS && orbitCached) else if( delta_points < 0 && abs(delta_points) < ORBIT_SEGME NTS && orbitCached)
{ {
for( int d=ORBIT_SEGMENTS-1; d>=0; d-- ) for( int d=ORBIT_SEGMENTS-1; d>=0; d-- )
{ {
if(d + delta_points < 0 ) if(d + delta_points < 0 )
{ {
// calculate new points // calculate new points
calc_date = new_date + (d-ORBIT_SEGM ENTS/2)*date_increment; calc_date = new_date + (d-ORBIT_SEGM ENTS/2)*deltaOrbitJD;
computeTransMatrix(calc_date); computeTransMatrix(calc_date);
if (osculatingFunc) { if (osculatingFunc) {
(*osculatingFunc)(date,calc_ date,eclipticPos); (*osculatingFunc)(date,calc_ date,eclipticPos);
} }
else else
{ {
coordFunc(calc_date, eclipti cPos, userDataPtr); coordFunc(calc_date, eclipti cPos, userDataPtr);
} }
orbitP[d] = eclipticPos; orbitP[d] = eclipticPos;
skipping to change at line 710 skipping to change at line 709
lastOrbitJD = new_date; lastOrbitJD = new_date;
} }
else if( delta_points || !orbitCached) else if( delta_points || !orbitCached)
{ {
// update all points (less efficient) // update all points (less efficient)
for( int d=0; d<ORBIT_SEGMENTS; d++ ) for( int d=0; d<ORBIT_SEGMENTS; d++ )
{ {
calc_date = date + (d-ORBIT_SEGMENTS/2)*date _increment; calc_date = date + (d-ORBIT_SEGMENTS/2)*delt aOrbitJD;
computeTransMatrix(calc_date); computeTransMatrix(calc_date);
if (osculatingFunc) if (osculatingFunc)
{ {
(*osculatingFunc)(date,calc_date,ecl ipticPos); (*osculatingFunc)(date,calc_date,ecl ipticPos);
} }
else else
{ {
coordFunc(calc_date, eclipticPos, us erDataPtr); coordFunc(calc_date, eclipticPos, us erDataPtr);
} }
orbitP[d] = eclipticPos; orbitP[d] = eclipticPos;
skipping to change at line 1645 skipping to change at line 1644
{ {
if (!orbitFader.getInterstate()) if (!orbitFader.getInterstate())
return; return;
if (!re.siderealPeriod) if (!re.siderealPeriod)
return; return;
const StelProjectorP prj = core->getProjection(StelCore::FrameHelioc entricEcliptic); const StelProjectorP prj = core->getProjection(StelCore::FrameHelioc entricEcliptic);
renderer->setBlendMode(BlendMode_Alpha); renderer->setBlendMode(BlendMode_Alpha);
renderer->setGlobalColor(orbitColor[0], orbitColor[1], renderer->setGlobalColor(orbitColor[0], orbitColor[1],
orbitColor[2], orbitFader.getInterstate()); orbitColor[2], orbitFader.getInterstate());
Vec3d onscreen; Vec3d onscreen;
// special case - use current Planet position as center vertex so th at draws // special case - use current Planet position as center vertex so th at draws
// on it's orbit all the time (since segmented rather than smooth cu rve) // on it's orbit all the time (since segmented rather than smooth cu rve)
Vec3d savePos = orbit[ORBIT_SEGMENTS/2]; Vec3d savePos = orbit[ORBIT_SEGMENTS/2];
orbit[ORBIT_SEGMENTS/2]=getHeliocentricEclipticPos(); orbit[ORBIT_SEGMENTS/2]=getHeliocentricEclipticPos();
orbit[ORBIT_SEGMENTS]=orbit[0]; orbit[ORBIT_SEGMENTS]=orbit[0];
int nbIter = closeOrbit ? ORBIT_SEGMENTS : ORBIT_SEGMENTS-1; int nbIter = closeOrbit ? ORBIT_SEGMENTS : ORBIT_SEGMENTS-1;
if(NULL == orbitVertices) if(NULL == orbitVertices)
 End of changes. 11 change blocks. 
15 lines changed or deleted 15 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/