1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Add config option to change polygon offset values

This commit is contained in:
Gillou68310 2015-07-06 13:58:51 +02:00 committed by Sergey Lipskiy
parent cbbd5d17de
commit ef46331c39
5 changed files with 35 additions and 2 deletions

View File

@ -35,6 +35,11 @@ void Config::resetToDefaults()
generalEmulation.enableHWLighting = 0;
generalEmulation.enableCustomSettings = 1;
generalEmulation.hacks = 0;
#ifdef ANDROID
generalEmulation.forcePolygonOffset = 0;
generalEmulation.polygonOffsetFactor = 0.0f;
generalEmulation.polygonOffsetUnits = 0.0f;
#endif
frameBufferEmulation.enable = 1;
frameBufferEmulation.copyDepthToRDRAM = 1;

View File

@ -45,6 +45,11 @@ struct Config
u32 enableHWLighting;
u32 enableCustomSettings;
u32 hacks;
#ifdef ANDROID
u32 forcePolygonOffset;
f32 polygonOffsetFactor;
f32 polygonOffsetUnits;
#endif
} generalEmulation;
enum Aspect {

View File

@ -1298,8 +1298,14 @@ void OGLRender::_initStates()
glDisable( GL_POLYGON_OFFSET_FILL );
glDepthFunc( GL_ALWAYS );
glDepthMask( FALSE );
} else
glPolygonOffset( -3.0f, -3.0f );
} else {
#ifdef ANDROID
if(config.generalEmulation.forcePolygonOffset != 0)
glPolygonOffset(config.generalEmulation.polygonOffsetFactor, config.generalEmulation.polygonOffsetUnits);
else
#endif
glPolygonOffset(-3.0f, -3.0f);
}
OGLVideo & ogl = video();
glViewport(0, ogl.getHeightOffset(), ogl.getScreenWidth(), ogl.getScreenHeight());

View File

@ -66,6 +66,14 @@ bool Config_SetDefault()
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableHWLighting", config.generalEmulation.enableHWLighting, "Enable hardware per-pixel lighting.");
assert(res == M64ERR_SUCCESS);
#ifdef ANDROID
res = ConfigSetDefaultBool(g_configVideoGliden64, "ForcePolygonOffset", config.generalEmulation.forcePolygonOffset, "If true, use polygon offset values specified below");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultFloat(g_configVideoGliden64, "PolygonOffsetFactor", config.generalEmulation.polygonOffsetFactor, "Specifies a scale factor that is used to create a variable depth offset for each polygon");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultFloat(g_configVideoGliden64, "PolygonOffsetUnits", config.generalEmulation.polygonOffsetUnits, "Is multiplied by an implementation-specific value to create a constant depth offset");
assert(res == M64ERR_SUCCESS);
#endif
//#Frame Buffer Settings:"
res = ConfigSetDefaultBool(g_configVideoGliden64, "EnableFBEmulation", config.frameBufferEmulation.enable, "Enable frame and|or depth buffer emulation.");
assert(res == M64ERR_SUCCESS);
@ -173,6 +181,11 @@ void Config_LoadConfig()
config.generalEmulation.enableNoise = ConfigGetParamBool(g_configVideoGliden64, "EnableNoise");
config.generalEmulation.enableLOD = ConfigGetParamBool(g_configVideoGliden64, "EnableLOD");
config.generalEmulation.enableHWLighting = ConfigGetParamBool(g_configVideoGliden64, "EnableHWLighting");
#ifdef ANDROID
config.generalEmulation.forcePolygonOffset = ConfigGetParamBool(g_configVideoGliden64, "ForcePolygonOffset");
config.generalEmulation.polygonOffsetFactor = ConfigGetParamFloat(g_configVideoGliden64, "PolygonOffsetFactor");
config.generalEmulation.polygonOffsetUnits = ConfigGetParamFloat(g_configVideoGliden64, "PolygonOffsetUnits");
#endif
//#Frame Buffer Settings:"
config.frameBufferEmulation.enable = ConfigGetParamBool(g_configVideoGliden64, "EnableFBEmulation");
config.frameBufferEmulation.copyToRDRAM = ConfigGetParamBool(g_configVideoGliden64, "EnableCopyColorToRDRAM");

View File

@ -18,9 +18,11 @@ ptr_ConfigDeleteSection ConfigDeleteSection = NULL;
ptr_ConfigSaveSection ConfigSaveSection = NULL;
ptr_ConfigSaveFile ConfigSaveFile = NULL;
ptr_ConfigSetDefaultInt ConfigSetDefaultInt = NULL;
ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat = NULL;
ptr_ConfigSetDefaultBool ConfigSetDefaultBool = NULL;
ptr_ConfigSetDefaultString ConfigSetDefaultString = NULL;
ptr_ConfigGetParamInt ConfigGetParamInt = NULL;
ptr_ConfigGetParamFloat ConfigGetParamFloat = NULL;
ptr_ConfigGetParamBool ConfigGetParamBool = NULL;
ptr_ConfigGetParamString ConfigGetParamString = NULL;
@ -51,9 +53,11 @@ m64p_error PluginAPI::PluginStartup(m64p_dynlib_handle _CoreLibHandle)
ConfigSaveSection = (ptr_ConfigSaveSection)DLSYM(_CoreLibHandle, "ConfigSaveSection");
ConfigSaveFile = (ptr_ConfigSaveFile)DLSYM(_CoreLibHandle, "ConfigSaveFile");
ConfigSetDefaultInt = (ptr_ConfigSetDefaultInt)DLSYM(_CoreLibHandle, "ConfigSetDefaultInt");
ConfigSetDefaultFloat = (ptr_ConfigSetDefaultFloat)DLSYM(_CoreLibHandle, "ConfigSetDefaultFloat");
ConfigSetDefaultBool = (ptr_ConfigSetDefaultBool)DLSYM(_CoreLibHandle, "ConfigSetDefaultBool");
ConfigSetDefaultString = (ptr_ConfigSetDefaultString)DLSYM(_CoreLibHandle, "ConfigSetDefaultString");
ConfigGetParamInt = (ptr_ConfigGetParamInt)DLSYM(_CoreLibHandle, "ConfigGetParamInt");
ConfigGetParamFloat = (ptr_ConfigGetParamFloat)DLSYM(_CoreLibHandle, "ConfigGetParamFloat");
ConfigGetParamBool = (ptr_ConfigGetParamBool)DLSYM(_CoreLibHandle, "ConfigGetParamBool");
ConfigGetParamString = (ptr_ConfigGetParamString)DLSYM(_CoreLibHandle, "ConfigGetParamString");