]> git.pld-linux.org Git - packages/celestia.git/blob - celestia-moon_eclipse.patch
http://bruckner.homelinux.net/files/moon_eclipse.zip
[packages/celestia.git] / celestia-moon_eclipse.patch
1 diff -ruN celestia-1.2.4-/src/celengine/render.cpp celestia-1.2.4/src/celengine/render.cpp
2 --- celestia-1.2.4-/src/celengine/render.cpp    Thu May  2 19:53:47 2002
3 +++ celestia-1.2.4/src/celengine/render.cpp     Sun Dec 22 22:44:25 2002
4 @@ -72,7 +72,7 @@
5  static Texture* galaxyTex = NULL;
6  static Texture* shadowTex = NULL;
7  
8 -static Texture* eclipseShadowTextures[4];
9 +static Texture* eclipseShadowTextures[8];      //MB
10  
11  static ResourceHandle starTexB = InvalidResource;
12  static ResourceHandle starTexA = InvalidResource;
13 @@ -99,7 +99,7 @@
14  
15  static int nCoordLabels = 32;
16  static SphericalCoordLabel* coordLabels = NULL;
17 -
18 +static bool hasAtmosphere = false;           //MB
19  
20  Renderer::Renderer() :
21      windowWidth(0),
22 @@ -202,11 +202,52 @@
23  {
24      float r = (float) sqrt(u * u + v * v);
25      int pixVal = 255;
26 +       float um;
27  
28      // Leave some white pixels around the edges to the shadow doesn't
29      // 'leak'.  We'll also set the maximum mip map level for this texture to 3
30      // so we don't have problems with the edge texels at high mip map levels.
31      r = r / (15.0f / 16.0f);
32 +if (umbra>=1) // MB
33 +    {     /* cout << "Test ombre modif";
34 +           cout << umbra;                          //MB
35 +           cout <<"  \n";    */
36 +
37 +   um=umbra-1.0;      // MB
38 +     pixel[0] = pixVal;
39 +     pixel[1] = pixVal;
40 +        pixel[2] = pixVal;
41 +     if (r < 1)
42 +     {
43 +        // The pixel value should depend on the area of the sun which is
44 +        // occluded.  We just fudge it here and use the square root of the
45 +        // radius.
46 +        if (r <= um)
47 +           {
48 +          // pixVal = 0;
49 +            pixel[0] = 60;
50 +            pixel[1] = 10;
51 +            pixel[2] = 0;
52 +            }
53 +        else
54 +           {
55 +           pixVal = (int) (sqrt((r - um) / (1 - um)) * 255.99f);
56 +            if (pixVal<196)  pixel[0] = pixVal + 60;
57 +            if (pixVal<236)  pixel[1] = pixVal + 20;
58 +            pixVal = (int) (sqrt((r - um) / (1 - um)) *r*255.99f);
59 +            if (pixVal>10)  pixel[2] = pixVal; else   pixel[2] =0;
60 +
61 +            }
62 +     }
63 +
64 +    // pixel[0] = pixVal;
65 +     //pixel[1] = pixVal;
66 +     //pixel[2] = pixVal;
67 +     //  cout << pixel[0] ;                          //MB    */
68 +      // cout <<"  \n";
69 +  }
70 +     else {                           // cas normal MB
71 +
72      if (r < 1)
73      {
74          // The pixel value should depend on the area of the sun which is
75 @@ -221,6 +262,7 @@
76      pixel[0] = pixVal;
77      pixel[1] = pixVal;
78      pixel[2] = pixVal;
79 +       }
80  };
81  
82  static void IllumMapEval(float x, float y, float z,
83 @@ -292,7 +334,7 @@
84  
85          // Create the eclipse shadow textures
86          {
87 -            for (int i = 0; i < 4; i++)
88 +            for (int i = 0; i < 8; i++)                        //MB
89              {
90                  ShadowTextureFunction func(i * 0.25f);
91                  eclipseShadowTextures[i] =
92 @@ -2160,7 +2202,27 @@
93          // the umbra and penumbra.
94          Texture* eclipseTex = NULL;
95          float umbra = shadow.umbraRadius / shadow.penumbraRadius;
96 -        if (umbra < 0.1f)
97 +
98 +        if ( hasAtmosphere==true)
99 +        {
100 +       /* cout <<" Test Eclipse Lune";
101 +        cout <<"  \n";
102 +        cout <<umbra;                          //MB
103 +        cout <<"  \n";   */
104 +         if (umbra < 0.1f)
105 +            eclipseTex = eclipseShadowTextures[4];
106 +         else if (umbra < 0.35f)
107 +            eclipseTex = eclipseShadowTextures[5];
108 +         else if (umbra < 0.6f)
109 +                       eclipseTex = eclipseShadowTextures[6];
110 +         else if (umbra < 0.9f)
111 +            eclipseTex = eclipseShadowTextures[7];
112 +         else
113 +            eclipseTex = shadowTex;
114 +        }
115 +        else
116 +        {
117 +               if (umbra < 0.1f)
118              eclipseTex = eclipseShadowTextures[0];
119          else if (umbra < 0.35f)
120              eclipseTex = eclipseShadowTextures[1];
121 @@ -2170,7 +2232,7 @@
122              eclipseTex = eclipseShadowTextures[3];
123          else
124              eclipseTex = shadowTex;
125 -
126 +               }
127          // Compute the transformation to use for generating texture
128          // coordinates from the object vertices.
129          Point3f origin = shadow.origin * planetMat;
130 @@ -2633,6 +2695,16 @@
131                  (appOccluderRadius - appSunRadius) / appOccluderRadius;
132              eclipseShadows.insert(eclipseShadows.end(), shadow);
133  
134 +               /////////////////////////
135 +         if (caster.getName() == "Earth" ) hasAtmosphere=true;    //MB
136 +            // if (receiver.getName() == "Earth" "Sol") hasAtmosphere=true;    //MB
137 +          else   hasAtmosphere=false;
138 +        /*  cout << caster.getName();//MB
139 +          cout <<receiver .getName();//MB
140 +          cout << hasAtmosphere;                          //MB
141 +           cout <<"  \n";  */
142 +       /////////////////////:
143 +
144              return true;
145          }
146      }
This page took 0.085892 seconds and 3 git commands to generate.