1
0
Fork 0

First pass at view frustum culling now operational.

This commit is contained in:
curt 1998-05-17 16:59:03 +00:00
parent 5c03d933a3
commit fdc94bd13a
3 changed files with 18 additions and 12 deletions

View file

@ -1,6 +1,6 @@
EXTRA_DIST = runfg.in runfg.bat.in EXTRA_DIST = runfg.in runfg.bat.in
bin_PROGRAMS = fg ttest bin_PROGRAMS = fg
bin_SCRIPTS = runfg runfg.bat bin_SCRIPTS = runfg runfg.bat
@ -31,10 +31,6 @@ fg_LDADD = \
$(top_builddir)/Lib/Debug/libDebug.la \ $(top_builddir)/Lib/Debug/libDebug.la \
$(top_builddir)/Lib/zlib/libz.la $(top_builddir)/Lib/zlib/libz.la
ttest_SOURCES = ttest.cxx
ttest_LDADD = $(top_builddir)/Lib/Math/libMath.la \
INCLUDES += \ INCLUDES += \
-DGLUT \ -DGLUT \
-I$(top_builddir) \ -I$(top_builddir) \

View file

@ -72,23 +72,23 @@ void fgVIEW::Update( fgFLIGHT *f ) {
scenery.center.y = scenery.next_center.y; scenery.center.y = scenery.next_center.y;
scenery.center.z = scenery.next_center.z; scenery.center.z = scenery.next_center.z;
printf("win_ratio = %.2f\n", win_ratio); // printf("win_ratio = %.2f\n", win_ratio);
// calculate sin() and cos() of fov / 2 in X direction; // calculate sin() and cos() of fov / 2 in X direction;
theta_x = FG_PI_2 - (o->fov * win_ratio * DEG_TO_RAD) / 2.0; theta_x = (o->fov * win_ratio * DEG_TO_RAD) / 2.0;
printf("theta_x = %.2f\n", theta_x); // printf("theta_x = %.2f\n", theta_x);
sin_fov_x = sin(theta_x); sin_fov_x = sin(theta_x);
cos_fov_x = cos(theta_x); cos_fov_x = cos(theta_x);
slope_x = sin_fov_x / cos_fov_x; slope_x = sin_fov_x / cos_fov_x;
printf("slope_x = %.2f\n", slope_x); // printf("slope_x = %.2f\n", slope_x);
// calculate sin() and cos() of fov / 2 in Y direction; // calculate sin() and cos() of fov / 2 in Y direction;
theta_y = FG_PI_2 - (o->fov * DEG_TO_RAD) / 2.0; theta_y = (o->fov * DEG_TO_RAD) / 2.0;
printf("theta_y = %.2f\n", theta_y); // printf("theta_y = %.2f\n", theta_y);
sin_fov_y = sin(theta_y); sin_fov_y = sin(theta_y);
cos_fov_y = cos(theta_y); cos_fov_y = cos(theta_y);
slope_y = sin_fov_y / cos_fov_y; slope_y = sin_fov_y / cos_fov_y;
printf("slope_y = %.2f\n", slope_y); // printf("slope_y = %.2f\n", slope_y);
// calculate the cartesion coords of the current lat/lon/0 elev // calculate the cartesion coords of the current lat/lon/0 elev
p.lon = FG_Longitude; p.lon = FG_Longitude;
@ -318,6 +318,9 @@ fgVIEW::~fgVIEW( void ) {
// $Log$ // $Log$
// Revision 1.10 1998/05/17 16:59:03 curt
// First pass at view frustum culling now operational.
//
// Revision 1.9 1998/05/16 13:08:37 curt // Revision 1.9 1998/05/16 13:08:37 curt
// C++ - ified views.[ch]xx // C++ - ified views.[ch]xx
// Shuffled some additional view parameters into the fgVIEW class. // Shuffled some additional view parameters into the fgVIEW class.

View file

@ -69,6 +69,10 @@ public:
// slope of view frustum edge in eye space X axis // slope of view frustum edge in eye space X axis
double slope_x; double slope_x;
// View frustum cull ratio (% of tiles culled ... used for
// reporting purposes)
double vfc_ratio;
// absolute view position // absolute view position
fgCartesianPoint3d abs_view_pos; fgCartesianPoint3d abs_view_pos;
@ -142,6 +146,9 @@ extern fgVIEW current_view;
// $Log$ // $Log$
// Revision 1.7 1998/05/17 16:59:04 curt
// First pass at view frustum culling now operational.
//
// Revision 1.6 1998/05/16 13:08:37 curt // Revision 1.6 1998/05/16 13:08:37 curt
// C++ - ified views.[ch]xx // C++ - ified views.[ch]xx
// Shuffled some additional view parameters into the fgVIEW class. // Shuffled some additional view parameters into the fgVIEW class.