From 032806000b6606cc26c55f96a3873455e815167c Mon Sep 17 00:00:00 2001 From: curt Date: Tue, 8 Sep 1998 15:04:33 +0000 Subject: [PATCH] Optimizations by Norman Vine. --- Main/options.cxx | 7 +++++-- Main/views.cxx | 21 +++++++++++++++------ Main/views.hxx | 19 +++++++++++-------- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/Main/options.cxx b/Main/options.cxx index ab5be64f3..8ad3b419c 100644 --- a/Main/options.cxx +++ b/Main/options.cxx @@ -511,8 +511,8 @@ void fgOPTIONS::usage ( void ) { printf("General Options:\n"); printf("\t--help -h: print usage\n"); printf("\t--fg-root=path: specify the root path for all the data files\n"); - printf("\t--disable-gamemode: disable full-screen game mode\n"); - printf("\t--enable-gamemode: enable full-screen game mode\n"); + printf("\t--disable-game-mode: disable full-screen game mode\n"); + printf("\t--enable-game-mode: enable full-screen game mode\n"); printf("\t--disable-splash-screen: disable splash screen\n"); printf("\t--enable-splash-screen: enable splash screen\n"); printf("\t--disable-intro-music: disable introduction music\n"); @@ -579,6 +579,9 @@ fgOPTIONS::~fgOPTIONS( void ) { // $Log$ +// Revision 1.24 1998/09/08 15:04:33 curt +// Optimizations by Norman Vine. +// // Revision 1.23 1998/08/27 17:02:07 curt // Contributions from Bernie Bright // - use strings for fg_root and airport_id and added methods to return diff --git a/Main/views.cxx b/Main/views.cxx index 096c349c4..6d21d920c 100644 --- a/Main/views.cxx +++ b/Main/views.cxx @@ -59,7 +59,7 @@ void fgVIEW::Init( void ) { winWidth = 640; // FG_DEFAULT_WIN_WIDTH winHeight = 480; // FG_DEFAULT_WIN_HEIGHT win_ratio = (double) winWidth / (double) winHeight; - update_fov = TRUE; + update_fov = true; } @@ -75,18 +75,24 @@ void fgVIEW::UpdateFOV( fgOPTIONS *o ) { // printf("theta_x = %.2f\n", theta_x); sin_fov_x = sin(theta_x); cos_fov_x = cos(theta_x); - slope_x = - cos_fov_x / sin_fov_x; - // (HUH?) sin_fov_x /= slope_x; + slope_x = -cos_fov_x / sin_fov_x; // printf("slope_x = %.2f\n", slope_x); +#if defined( USE_FAST_FOV_CLIP ) + fov_x_clip = slope_x*cos_fov_x - sin_fov_x; +#endif // defined( USE_FAST_FOV_CLIP ) + // calculate sin() and cos() of fov / 2 in Y direction; theta_y = (fov * DEG_TO_RAD) / 2.0; // printf("theta_y = %.2f\n", theta_y); sin_fov_y = sin(theta_y); cos_fov_y = cos(theta_y); slope_y = cos_fov_y / sin_fov_y; - // (HUH?) sin_fov_y /= slope_y; // printf("slope_y = %.2f\n", slope_y); + +#if defined( USE_FAST_FOV_CLIP ) + fov_y_clip = -(slope_y*cos_fov_y + sin_fov_y); +#endif // defined( USE_FAST_FOV_CLIP ) } @@ -249,10 +255,10 @@ void fgVIEW::UpdateViewMath( fgFLIGHT *f ) { MAT3mat R, TMP, UP, LOCAL, VIEW; double ntmp; - if(update_fov == TRUE) { + if(update_fov == true) { // printf("Updating fov\n"); UpdateFOV(¤t_options); - update_fov = FALSE; + update_fov = false; } scenery.center.x = scenery.next_center.x; @@ -538,6 +544,9 @@ fgVIEW::~fgVIEW( void ) { // $Log$ +// Revision 1.20 1998/09/08 15:04:35 curt +// Optimizations by Norman Vine. +// // Revision 1.19 1998/08/20 20:32:34 curt // Reshuffled some of the code in and around views.[ch]xx // diff --git a/Main/views.hxx b/Main/views.hxx index 77acb063c..dfd1d5d74 100644 --- a/Main/views.hxx +++ b/Main/views.hxx @@ -40,14 +40,10 @@ #include "options.hxx" -#ifndef BOOL -#define BOOL int -#endif -#ifndef TRUE -#define FALSE 0 -#define TRUE 1 -#endif +// used in views.cxx and tilemgr.cxx +#define USE_FAST_FOV_CLIP + // Define a structure containing view information class fgVIEW { @@ -61,7 +57,7 @@ public: double goal_view_offset; // flag forcing update of fov related stuff - BOOL update_fov; + bool update_fov; // fov of view is specified in the y direction, win_ratio is used to // calculate the fov in the X direction = width/height @@ -83,6 +79,10 @@ public: // slope of view frustum edge in eye space X axis double slope_x; +#if defined( USE_FAST_FOV_CLIP ) + double fov_x_clip, fov_y_clip; +#endif // USE_FAST_FOV_CLIP + // View frustum cull ratio (% of tiles culled ... used for // reporting purposes) double vfc_ratio; @@ -181,6 +181,9 @@ extern fgVIEW current_view; // $Log$ +// Revision 1.13 1998/09/08 15:04:36 curt +// Optimizations by Norman Vine. +// // Revision 1.12 1998/08/24 20:11:15 curt // Added i/I to toggle full vs. minimal HUD. // Added a --hud-tris vs --hud-culled option. -- 2.39.2