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
5 static Texture* galaxyTex = NULL;
6 static Texture* shadowTex = NULL;
8 -static Texture* eclipseShadowTextures[4];
9 +static Texture* eclipseShadowTextures[8]; //MB
11 static ResourceHandle starTexB = InvalidResource;
12 static ResourceHandle starTexA = InvalidResource;
15 static int nCoordLabels = 32;
16 static SphericalCoordLabel* coordLabels = NULL;
18 +static bool hasAtmosphere = false; //MB
20 Renderer::Renderer() :
24 float r = (float) sqrt(u * u + v * v);
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);
33 + { /* cout << "Test ombre modif";
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
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;
64 + // pixel[0] = pixVal;
65 + //pixel[1] = pixVal;
66 + //pixel[2] = pixVal;
67 + // cout << pixel[0] ; //MB */
70 + else { // cas normal MB
74 // The pixel value should depend on the area of the sun which is
82 static void IllumMapEval(float x, float y, float z,
85 // Create the eclipse shadow textures
87 - for (int i = 0; i < 4; i++)
88 + for (int i = 0; i < 8; i++) //MB
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;
98 + if ( hasAtmosphere==true)
100 + /* cout <<" Test Eclipse Lune";
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];
113 + eclipseTex = shadowTex;
118 eclipseTex = eclipseShadowTextures[0];
119 else if (umbra < 0.35f)
120 eclipseTex = eclipseShadowTextures[1];
121 @@ -2170,7 +2232,7 @@
122 eclipseTex = eclipseShadowTextures[3];
124 eclipseTex = shadowTex;
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);
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
142 + /////////////////////: