More timer related tweaks with respect to view direction changes.
This commit is contained in:
parent
c24e18e0fc
commit
7e07f19a25
2 changed files with 45 additions and 34 deletions
|
@ -77,7 +77,7 @@ double goal_view_offset = 0.0;
|
||||||
double Simtime;
|
double Simtime;
|
||||||
|
|
||||||
/* Another hack */
|
/* Another hack */
|
||||||
int use_signals = 0;
|
int use_signals = 1;
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
@ -215,39 +215,42 @@ static void fgUpdateVisuals( void ) {
|
||||||
|
|
||||||
void fgUpdateTimeDepCalcs(int multi_loop) {
|
void fgUpdateTimeDepCalcs(int multi_loop) {
|
||||||
struct flight_params *f;
|
struct flight_params *f;
|
||||||
|
int i;
|
||||||
|
|
||||||
f = ¤t_aircraft.flight;
|
f = ¤t_aircraft.flight;
|
||||||
|
|
||||||
/* update the flight model */
|
/* update the flight model */
|
||||||
if ( multi_loop < 0 ) {
|
if ( multi_loop < 0 ) {
|
||||||
printf("updating flight model with default = %d\n", DEFAULT_MULTILOOP);
|
multi_loop = DEFAULT_MULTILOOP;
|
||||||
fgFlightModelUpdate(FG_LARCSIM, f, DEFAULT_MULTILOOP);
|
|
||||||
} else {
|
|
||||||
printf("updating flight model with dynamic = %d\n", multi_loop);
|
|
||||||
fgFlightModelUpdate(FG_LARCSIM, f, multi_loop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fabs(goal_view_offset - view_offset) < 0.09 ) {
|
/* printf("updating flight model x %d\n", multi_loop); */
|
||||||
view_offset = goal_view_offset;
|
fgFlightModelUpdate(FG_LARCSIM, f, multi_loop);
|
||||||
} else {
|
|
||||||
/* move view_offset towards goal_view_offset */
|
for ( i = 0; i < multi_loop; i++ ) {
|
||||||
if ( goal_view_offset > view_offset ) {
|
if ( fabs(goal_view_offset - view_offset) < 0.05 ) {
|
||||||
if ( goal_view_offset - view_offset < M_PI ) {
|
view_offset = goal_view_offset;
|
||||||
view_offset += 0.05;
|
break;
|
||||||
} else {
|
|
||||||
view_offset -= 0.05;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ( view_offset - goal_view_offset < M_PI ) {
|
/* move view_offset towards goal_view_offset */
|
||||||
view_offset -= 0.05;
|
if ( goal_view_offset > view_offset ) {
|
||||||
|
if ( goal_view_offset - view_offset < M_PI ) {
|
||||||
|
view_offset += 0.01;
|
||||||
|
} else {
|
||||||
|
view_offset -= 0.01;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
view_offset += 0.05;
|
if ( view_offset - goal_view_offset < M_PI ) {
|
||||||
|
view_offset -= 0.01;
|
||||||
|
} else {
|
||||||
|
view_offset += 0.01;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( view_offset > PI2 ) {
|
||||||
|
view_offset -= PI2;
|
||||||
|
} else if ( view_offset < 0 ) {
|
||||||
|
view_offset += PI2;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if ( view_offset > PI2 ) {
|
|
||||||
view_offset -= PI2;
|
|
||||||
} else if ( view_offset < 0 ) {
|
|
||||||
view_offset += PI2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,13 +295,15 @@ static void fgMainLoop( void ) {
|
||||||
int elapsed, multi_loop;
|
int elapsed, multi_loop;
|
||||||
|
|
||||||
elapsed = fgGetTimeInterval();
|
elapsed = fgGetTimeInterval();
|
||||||
printf("Time interval is = %d, previous remainder is = %d\n", elapsed,
|
/* printf("Time interval is = %d, previous remainder is = %d\n", elapsed,
|
||||||
remainder);
|
remainder); */
|
||||||
|
printf("--> Frame rate is = %.2f\n", 1000.0 / (float)elapsed);
|
||||||
|
elapsed += remainder;
|
||||||
|
|
||||||
multi_loop = ((float)elapsed * 0.001) * DEFAULT_MODEL_HZ;
|
multi_loop = ((float)elapsed * 0.001) * DEFAULT_MODEL_HZ;
|
||||||
remainder = elapsed - ((multi_loop*1000) / DEFAULT_MODEL_HZ);
|
remainder = elapsed - ((multi_loop*1000) / DEFAULT_MODEL_HZ);
|
||||||
printf("Model iterations needed = %d, new remainder = %d\n", multi_loop,
|
/* printf("Model iterations needed = %d, new remainder = %d\n", multi_loop,
|
||||||
remainder);
|
remainder); */
|
||||||
|
|
||||||
aircraft_debug(1);
|
aircraft_debug(1);
|
||||||
fgUpdateVisuals();
|
fgUpdateVisuals();
|
||||||
|
@ -470,10 +475,13 @@ int main( int argc, char *argv[] ) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.15 1997/06/17 03:41:10 curt
|
/* Revision 1.16 1997/06/17 04:19:16 curt
|
||||||
/* Nonsignal based interval timing is now working.
|
/* More timer related tweaks with respect to view direction changes.
|
||||||
/* This would be a good time to look at cleaning up the code structure a bit.
|
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.15 1997/06/17 03:41:10 curt
|
||||||
|
* Nonsignal based interval timing is now working.
|
||||||
|
* This would be a good time to look at cleaning up the code structure a bit.
|
||||||
|
*
|
||||||
* Revision 1.14 1997/06/16 19:32:51 curt
|
* Revision 1.14 1997/06/16 19:32:51 curt
|
||||||
* Starting to add general timer support.
|
* Starting to add general timer support.
|
||||||
*
|
*
|
||||||
|
|
|
@ -44,7 +44,7 @@ GLint mesh2GL(struct mesh *m) {
|
||||||
int i, j, istep, jstep, iend, jend;
|
int i, j, istep, jstep, iend, jend;
|
||||||
float temp;
|
float temp;
|
||||||
|
|
||||||
istep = jstep = 15; /* Detail level 1 -- 1200 ... */
|
istep = jstep = 16; /* Detail level 1 -- 1200 ... */
|
||||||
|
|
||||||
mesh = glGenLists(1);
|
mesh = glGenLists(1);
|
||||||
glNewList(mesh, GL_COMPILE);
|
glNewList(mesh, GL_COMPILE);
|
||||||
|
@ -104,9 +104,12 @@ GLint mesh2GL(struct mesh *m) {
|
||||||
|
|
||||||
|
|
||||||
/* $Log$
|
/* $Log$
|
||||||
/* Revision 1.17 1997/06/16 19:32:52 curt
|
/* Revision 1.18 1997/06/17 04:19:17 curt
|
||||||
/* Starting to add general timer support.
|
/* More timer related tweaks with respect to view direction changes.
|
||||||
/*
|
/*
|
||||||
|
* Revision 1.17 1997/06/16 19:32:52 curt
|
||||||
|
* Starting to add general timer support.
|
||||||
|
*
|
||||||
* Revision 1.16 1997/06/02 03:40:07 curt
|
* Revision 1.16 1997/06/02 03:40:07 curt
|
||||||
* A tiny bit more view tweaking.
|
* A tiny bit more view tweaking.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue