/* rendering options */
static int extend_roads; /* extend roads in its original width, rather than just using a single point */
+static int fix_sky_rotation; /* sky will rotate correctly by rotating planets/comet by 180 degrees */
static double fov;
static double debug_opacity;
static double frustum_slope_64, frustum_slope_fov;
}
/* rendering starts, initialize variables */
-void render_capture_start(double _fov, int _extend_roads, int _smooth_planets, int debug)
+void render_capture_start(double _fov, int _extend_roads, int _smooth_planets, int _fix_sky_rotation, int debug)
{
#if defined(DEBUG_COLOR) || defined(DEBUG_VERTEX)
printf("start rendering a new frame...\n");
/* set rendering options */
fov = _fov;
extend_roads = _extend_roads;
+ fix_sky_rotation = _fix_sky_rotation;
/* set some transpareny, if debugging is enabled */
debug_opacity = (debug) ? 0.5 : 1.0;
double x[MAX_POLYGON], y[MAX_POLYGON], z[MAX_POLYGON];
int i;
int rc;
+ double rotate_sky = 0.0;
#ifdef DEBUG_ITEMS
printf("RENDER_ITEM_COMET_POLYGON\n");
if (rc < 0)
break;
/* rotate vertex */
- if (motion_new.planet_rotation)
+ if (motion_new.planet_rotation) {
+ if (fix_sky_rotation)
+ rotate_sky = M_PI;
rotate_coordinate(0.0, inclination, azimuth, &x[i], &y[i], &z[i]);
- rotate_coordinate(roll, pitch, yaw, &x[i], &y[i], &z[i]);
+ }
+ rotate_coordinate(roll, pitch, yaw + rotate_sky, &x[i], &y[i], &z[i]);
}
/* render */
opengl_render_polygon_and_line(x, y, z, render_item->u.polygon.vertices); /* no culling, because we render only two (out of four) planes! */
double _sin, _cos;
int i;
int rc;
+ double rotate_sky = 0.0;
#ifdef DEBUG_ITEMS
printf("RENDER_ITEM_PLANET\n");
size = render_item->u.planet.size;
/* rotate vertex */
if (motion_new.planet_rotation) {
+ if (fix_sky_rotation)
+ rotate_sky = M_PI;
rotate_coordinate(0.0, inclination, azimuth, &sun_x, &sun_y, &sun_z);
rotate_coordinate(0.0, inclination, azimuth, &loc_x, &loc_y, &loc_z);
}
- rotate_coordinate(roll, pitch, yaw, &sun_x, &sun_y, &sun_z);
- rotate_coordinate(roll, pitch, yaw, &loc_x, &loc_y, &loc_z);
+ rotate_coordinate(roll, pitch, yaw + rotate_sky, &sun_x, &sun_y, &sun_z);
+ rotate_coordinate(roll, pitch, yaw + rotate_sky, &loc_x, &loc_y, &loc_z);
/* distance to planet */
dist = sqrt(loc_x * loc_x + loc_y * loc_y + loc_z * loc_z);
double x, y, z;
int i;
double red, green, blue;
+ double rotate_sky = 0.0;
#ifdef DEBUG_ITEMS
printf("RENDER_ITEM_STARS\n");
x = -sin(h) * cos(v1);
y = sin(v1);
z = cos(h) * cos(v1);
- if (motion_new.planet_rotation)
+ if (motion_new.planet_rotation) {
+ if (fix_sky_rotation)
+ rotate_sky = M_PI;
rotate_coordinate(0.0, inclination, azimuth, &x, &y, &z);
- rotate_coordinate(roll, pitch, yaw, &x, &y, &z);
+ }
+ rotate_coordinate(roll, pitch, yaw + rotate_sky, &x, &y, &z);
opengl_render_point(1000000.0 * x, 1000000.0 * y, 1000000.0 * z, 0.0);
}
if (v2 < 0.934 && v2 > -0.934) {
x = -sin(h) * cos(v2);
y = sin(v2);
z = cos(h) * cos(v2);
- if (motion_new.planet_rotation)
+ if (motion_new.planet_rotation) {
+ if (fix_sky_rotation)
+ rotate_sky = M_PI;
rotate_coordinate(0.0, inclination, azimuth, &x, &y, &z);
- rotate_coordinate(roll, pitch, yaw, &x, &y, &z);
+ }
+ rotate_coordinate(roll, pitch, yaw + rotate_sky, &x, &y, &z);
opengl_render_point(1000000.0 * x, 1000000.0 * y, 1000000.0 * z, 0.0);
}
}