/* render improvements */
static int config_improve_extend_roads = 1; /* set to 1 to extend roads */
static int config_improve_smooth_planets = 1; /* set to 1 to rotate planets smoothly */
+static int config_fix_sky_rotation = 0; /* set to 1 to fix sky rotation */
#define CPU_SPEED 7093790.0;
while (argc > i) {
if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
+ /* | | */
print_info("Usage: %s\n", argv[0]);
print_info(" -s --render-speed original | fast\n");
print_info(" Set speed of rendering to original Amiga or fast speed.\n");
print_info(" Set field-of-view. Default is %.0f.\n", FOV_NOVAGEN);
print_info(" -i --skip-intro\n");
print_info(" Skip intro sequence approaching to Eris space port.\n");
+ print_info(" --fix-sky-rotation\n");
+ print_info(" Sky rotates in the wrong direction, if flying over surface. This is\n");
+ print_info(" fixed by rotating all sky object by 180 degrees. The original (wrong)\n");
+ print_info(" rotation is default, because it preserves the game's spirit!\n");
+ print_info(" This requires OpenGL rendering\n");
print_info("Debug options:\n");
print_info(" -o --debug-opengl\n");
print_info(" Use split screen to display both Amiga and OpenGL rendering.\n");
if (!strcmp(argv[i], "-i") || !strcmp(argv[i], "--skip-intro")) {
config_skip_intro = 1;
} else
+ if (!strcmp(argv[i], "--fix-sky-rotation")) {
+ config_fix_sky_rotation = 1;
+ } else
if (!strcmp(argv[i], "-o") || !strcmp(argv[i], "--debug-opengl")) {
config_debug_opengl = 1;
} else
frame_render = 0;
/* start capturing for improved graphics */
if (render_improved)
- render_capture_start(config_fov, config_improve_extend_roads, config_improve_smooth_planets, config_debug_transparent);
+ render_capture_start(config_fov, config_improve_extend_roads, config_improve_smooth_planets, config_fix_sky_rotation, config_debug_transparent);
/* execute until the rendered image is ready (wait for VBL) */
cycle_count = 0;
/* 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);
}
}