~ubuntu-branches/debian/sid/stellarium/sid

« back to all changes in this revision

Viewing changes to src/core/modules/Planet.cpp

  • Committer: Package Import Robot
  • Author(s): Tomasz Buchert
  • Date: 2013-08-04 15:06:55 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20130804150655-iji0vb5navh3lk13
Tags: 0.12.2-1
* Imported Upstream version 0.12.2
* Added dependency to phonon (to enable video/sound)
* Fixed VCS links
* Removed unused lintian tag (embedded-library glee)
* Dropped obsolete patch
* Update copyright

Show diffs side-by-side

added added

removed removed

Lines of Context:
217
217
          "        P3 = normalize(P) * data.w;\n"
218
218
          "    }\n"
219
219
          "\n"
 
220
          "    float L = length(Lp - P3);\n"
 
221
          "    RS = L * tan(asin(RS / L));\n"
 
222
          "    float R = atan(RS / L); //RS / L;\n"
 
223
          "\n"
220
224
          "    if((lambert > 0.0) || isRing)\n"
221
225
          "    {\n"
222
226
          "        if(ring && !isRing)\n"
248
252
          "            vec3 C = data.rgb;\n"
249
253
          "            float radius = data.a;\n"
250
254
          "\n"
251
 
          "            float L = length(Lp - P3);\n"
252
255
          "            float l = length(C - P3);\n"
253
 
          "\n"
254
 
          "            float R = RS / L;\n"
255
 
          "            float r = radius / l;\n"
256
 
          "            float d = length( (Lp - P3) / L - (C - P3) / l );\n"
 
256
          "            radius = l * tan(asin(radius / l));\n"
 
257
          "            float r = atan(radius / l); //radius / l;\n"
 
258
          "            float d = acos(min(1.0, dot(normalize(Lp - P3), normalize(C - P3)))); //length( (Lp - P3) / L - (C - P3) / l );\n"
257
259
          "\n"
258
260
          "            float illumination = 1.0;\n"
259
261
          "\n"
620
622
 
621
623
        if (orbitFader.getInterstate()>0.000001 && deltaOrbitJD > 0 && (fabs(lastOrbitJD-date)>deltaOrbitJD || !orbitCached))
622
624
        {
623
 
 
624
 
                // calculate orbit first (for line drawing)
625
 
                double date_increment = re.siderealPeriod/ORBIT_SEGMENTS;
626
625
                double calc_date;
627
626
                // int delta_points = (int)(0.5 + (date - lastOrbitJD)/date_increment);
628
627
                int delta_points;
629
628
 
630
629
                if( date > lastOrbitJD )
631
630
                {
632
 
                        delta_points = (int)(0.5 + (date - lastOrbitJD)/date_increment);
 
631
                        delta_points = (int)(0.5 + (date - lastOrbitJD)/deltaOrbitJD);
633
632
                }
634
633
                else
635
634
                {
636
 
                        delta_points = (int)(-0.5 + (date - lastOrbitJD)/date_increment);
 
635
                        delta_points = (int)(-0.5 + (date - lastOrbitJD)/deltaOrbitJD);
637
636
                }
638
 
                double new_date = lastOrbitJD + delta_points*date_increment;
 
637
                double new_date = lastOrbitJD + delta_points*deltaOrbitJD;
639
638
 
640
639
                // qDebug( "Updating orbit coordinates for %s (delta %f) (%d points)\n", name.c_str(), deltaOrbitJD, delta_points);
641
640
 
647
646
                                if(d + delta_points >= ORBIT_SEGMENTS )
648
647
                                {
649
648
                                        // calculate new points
650
 
                                        calc_date = new_date + (d-ORBIT_SEGMENTS/2)*date_increment;
 
649
                                        calc_date = new_date + (d-ORBIT_SEGMENTS/2)*deltaOrbitJD;
651
650
 
652
651
                                        // date increments between points will not be completely constant though
653
652
                                        computeTransMatrix(calc_date);
679
678
                                if(d + delta_points < 0 )
680
679
                                {
681
680
                                        // calculate new points
682
 
                                        calc_date = new_date + (d-ORBIT_SEGMENTS/2)*date_increment;
 
681
                                        calc_date = new_date + (d-ORBIT_SEGMENTS/2)*deltaOrbitJD;
683
682
 
684
683
                                        computeTransMatrix(calc_date);
685
684
                                        if (osculatingFunc) {
708
707
                        // update all points (less efficient)
709
708
                        for( int d=0; d<ORBIT_SEGMENTS; d++ )
710
709
                        {
711
 
                                calc_date = date + (d-ORBIT_SEGMENTS/2)*date_increment;
 
710
                                calc_date = date + (d-ORBIT_SEGMENTS/2)*deltaOrbitJD;
712
711
                                computeTransMatrix(calc_date);
713
712
                                if (osculatingFunc)
714
713
                                {
1647
1646
 
1648
1647
        renderer->setBlendMode(BlendMode_Alpha);
1649
1648
        renderer->setGlobalColor(orbitColor[0], orbitColor[1], 
1650
 
                                 orbitColor[2], orbitFader.getInterstate());
 
1649
                                 orbitColor[2], orbitFader.getInterstate());
1651
1650
 
1652
1651
        Vec3d onscreen;
1653
1652
        // special case - use current Planet position as center vertex so that draws