Renamed - (void) setFov:(float)value fromRadians:(BOOL)fromRadians to - (void) setFov:(float)value fromRadians:(BOOL)fromFraction and - (float) fov:(BOOL)inRadians to - (float) fov:(BOOL)inFraction.

This commit is contained in:
AnotherCommander 2015-04-12 12:34:02 +02:00
parent 88d4ad587d
commit ae5641ba72
7 changed files with 16 additions and 16 deletions

View File

@ -243,7 +243,7 @@ extern int debug;
- (void) setGammaValue: (float) value;
- (float) gammaValue;
- (void) setFov:(float)value fromRadians:(BOOL)fromRadians;
- (float) fov:(BOOL)inRadians;
- (void) setFov:(float)value fromFraction:(BOOL)fromFraction;
- (float) fov:(BOOL)inFraction;
@end

View File

@ -1227,15 +1227,15 @@ static void UnapplyCursorState(OOMouseInteractionMode mode)
}
- (void) setFov:(float)value fromRadians:(BOOL)fromRadians
- (void) setFov:(float)value fromFraction:(BOOL)fromFraction
{
_fov = fromRadians ? value : tan((value / 2) * M_PI / 180);
_fov = fromFraction ? value : tan((value / 2) * M_PI / 180);
}
- (float) fov:(BOOL)inRadians
- (float) fov:(BOOL)inFraction
{
return inRadians ? _fov : 2 * atan(_fov) * 180 / M_PI;
return inFraction ? _fov : 2 * atan(_fov) * 180 / M_PI;
}
@end

View File

@ -2828,7 +2828,7 @@ NSComparisonResult marketSorterByMassUnit(id a, id b, void *market);
[hud setScannerZoom:z1];
}
[[UNIVERSE gameView] setFov:fieldOfView fromRadians:YES];
[[UNIVERSE gameView] setFov:fieldOfView fromFraction:YES];
// scanner sanity check - lose any targets further than maximum scanner range
ShipEntity *primeTarget = [self primaryTarget];

View File

@ -3113,7 +3113,7 @@ static NSTimeInterval time_last_frame;
fovStep : 0.0f) - ((leftKeyDown && (fov > MIN_FOV_DEG)) ? fovStep : 0.0f));
if (fov > MAX_FOV_DEG) fov = MAX_FOV_DEG;
if (fov < MIN_FOV_DEG) fov = MIN_FOV_DEG;
[gameView setFov:fov fromRadians:NO];
[gameView setFov:fov fromFraction:NO];
fieldOfView = [gameView fov:YES];
int fovTicks = (int)((fov - MIN_FOV_DEG) / fovStep);
NSString* fovWordDesc = DESC(@"gameoptions-fov-value");

View File

@ -306,8 +306,8 @@ static GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEV
wireframeGraphics = [prefs oo_boolForKey:@"wireframe-graphics" defaultValue:NO];
doProcedurallyTexturedPlanets = [prefs oo_boolForKey:@"procedurally-textured-planets" defaultValue:YES];
[inGameView setGammaValue:[prefs oo_floatForKey:@"gamma-value" defaultValue:1.0f]];
[inGameView setFov:OOClamp_0_max_f([prefs oo_floatForKey:@"fov-value" defaultValue:57.2f], MAX_FOV_DEG) fromRadians:NO];
if ([inGameView fov:NO] < MIN_FOV_DEG) [inGameView setFov:MIN_FOV_DEG fromRadians:NO];
[inGameView setFov:OOClamp_0_max_f([prefs oo_floatForKey:@"fov-value" defaultValue:57.2f], MAX_FOV_DEG) fromFraction:NO];
if ([inGameView fov:NO] < MIN_FOV_DEG) [inGameView setFov:MIN_FOV_DEG fromFraction:NO];
// Set up speech synthesizer.
#if OOLITE_SPEECH_SYNTH

View File

@ -285,8 +285,8 @@ extern int debug;
- (void) setGammaValue: (float) value;
- (float) gammaValue;
- (void) setFov:(float)value fromRadians:(BOOL)fromRadians;
- (float) fov:(BOOL)inRadians;
- (void) setFov:(float)value fromFraction:(BOOL)fromFraction;
- (float) fov:(BOOL)inFraction;
// Check current state of shift key rather than relying on last event.
+ (BOOL)pollShiftKey;

View File

@ -2321,15 +2321,15 @@ keys[a] = NO; keys[b] = NO; \
}
- (void) setFov:(float)value fromRadians:(BOOL)fromRadians
- (void) setFov:(float)value fromFraction:(BOOL)fromFraction
{
_fov = fromRadians ? value : tan((value / 2) * M_PI / 180);
_fov = fromFraction ? value : tan((value / 2) * M_PI / 180);
}
- (float) fov:(BOOL)inRadians
- (float) fov:(BOOL)inFraction
{
return inRadians ? _fov : 2 * atan(_fov) * 180 / M_PI;
return inFraction ? _fov : 2 * atan(_fov) * 180 / M_PI;
}