Changes to the shader mode through the debug console is no longer saved. The reduced detail setting is now exposed through the console (also not saved), and disabled by the material test suite.

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3430 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Jens Ayton 2010-05-29 19:42:46 +00:00
parent 834e09c007
commit e12b40f5e2
4 changed files with 34 additions and 3 deletions

View File

@ -64,6 +64,10 @@ maximumShaderMode: String (read-only)
"SHADERS_SIMPLE"
"SHADERS_FULL"
reducedDetailMode: Boolean (read/write)
Whether reduced detail mode is in effect (simplifies graphics in various
different ways).
displayFPS : Boolean (read/write)
Boolean specifying whether FPS (and associated information) should be
displayed.

View File

@ -102,6 +102,7 @@ enum
kConsole_debugFlags, // debug flags, integer, read/write
kConsole_shaderMode, // shader mode, symbolic string, read/write
kConsole_maximumShaderMode, // highest supported shader mode, symbolic string, read-only
kConsole_reducedDetailMode, // reduced detail mode, boolean, read/write
kConsole_displayFPS, // display FPS (and related info), boolean, read/write
kConsole_platformDescription, // Information about system we're running on in unspecified format, string, read-only
@ -132,6 +133,7 @@ static JSPropertySpec sConsoleProperties[] =
{ "debugFlags", kConsole_debugFlags, JSPROP_PERMANENT | JSPROP_ENUMERATE },
{ "shaderMode", kConsole_shaderMode, JSPROP_PERMANENT | JSPROP_ENUMERATE },
{ "maximumShaderMode", kConsole_maximumShaderMode, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
{ "reducedDetailMode", kConsole_reducedDetailMode, JSPROP_PERMANENT | JSPROP_ENUMERATE },
{ "displayFPS", kConsole_displayFPS, JSPROP_PERMANENT | JSPROP_ENUMERATE },
{ "platformDescription", kConsole_platformDescription, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
{ "glVendorString", kConsole_glVendorString, JSPROP_PERMANENT | JSPROP_ENUMERATE | JSPROP_READONLY },
@ -267,6 +269,10 @@ static JSBool ConsoleGetProperty(JSContext *context, JSObject *this, jsval name,
*outValue = [ShaderSettingToString([[OOOpenGLExtensionManager sharedManager] maximumShaderSetting]) javaScriptValueInContext:context];
break;
case kConsole_reducedDetailMode:
*outValue = BOOLToJSVal([UNIVERSE reducedDetail]);
break;
case kConsole_displayFPS:
*outValue = BOOLToJSVal([UNIVERSE displayFPS]);
break;
@ -338,7 +344,14 @@ static JSBool ConsoleSetProperty(JSContext *context, JSObject *this, jsval name,
if (sValue != nil)
{
OOShaderSetting setting = StringToShaderSetting(sValue);
[UNIVERSE setShaderEffectsLevel:setting];
[UNIVERSE setShaderEffectsLevel:setting transiently:YES];
}
break;
case kConsole_reducedDetailMode:
if (JS_ValueToBoolean(context, *value, &bValue))
{
[UNIVERSE setReducedDetail:bValue transiently:YES];
}
break;

View File

@ -603,9 +603,11 @@ double estimatedTimeForJourney(double distance, int hops);
- (BOOL) wireframeGraphics;
- (void) setReducedDetail:(BOOL) value;
- (void) setReducedDetail:(BOOL) value transiently:(BOOL)transiently;
- (BOOL) reducedDetail;
- (void) setShaderEffectsLevel:(OOShaderSetting)value;
- (void) setShaderEffectsLevel:(OOShaderSetting)value transiently:(BOOL)transiently;
- (OOShaderSetting) shaderEffectsLevel;
- (BOOL) useShaders;

View File

@ -8250,9 +8250,15 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context)
- (void) setReducedDetail:(BOOL) value
{
[self setReducedDetail:value transiently:NO];
}
- (void) setReducedDetail:(BOOL) value transiently:(BOOL)transiently
{
reducedDetail = !!value;
[[NSUserDefaults standardUserDefaults] setBool:reducedDetail forKey:@"reduced-detail-graphics"];
if (!transiently) [[NSUserDefaults standardUserDefaults] setBool:reducedDetail forKey:@"reduced-detail-graphics"];
}
@ -8263,6 +8269,12 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context)
- (void) setShaderEffectsLevel:(OOShaderSetting)value
{
[self setShaderEffectsLevel:value transiently:NO];
}
- (void) setShaderEffectsLevel:(OOShaderSetting)value transiently:(BOOL)transiently
{
OOShaderSetting max = [[OOOpenGLExtensionManager sharedManager] maximumShaderSetting];
@ -8273,7 +8285,7 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context)
{
OOLog(@"rendering.opengl.shader.mode", @"Shader mode set to %@.", ShaderSettingToString(value));
shaderEffectsLevel = value;
[[NSUserDefaults standardUserDefaults] setInteger:shaderEffectsLevel forKey:@"shader-mode"];
if (!transiently) [[NSUserDefaults standardUserDefaults] setInteger:shaderEffectsLevel forKey:@"shader-mode"];
[[OOGraphicsResetManager sharedManager] resetGraphicsState];
}
}