mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Remove PolygonStipple related code and its control from the GUI.
Add GUI control for hardware lighting instead.
This commit is contained in:
parent
dfb8b0f04b
commit
f6c2437e18
|
@ -109,11 +109,8 @@ static DWORD64 ACEncodeD[] =
|
|||
7, 7, 7, 7, 7, 7, 7, 7, 0, 1, 2, 3, 4, 5, 7, 7, 7, 7, 7, 6, 7
|
||||
};
|
||||
|
||||
bool bHWLightingCalculation = false;
|
||||
|
||||
void Combiner_Init()
|
||||
{
|
||||
bHWLightingCalculation = true;
|
||||
InitGLSLCombiner();
|
||||
combiner.root = NULL;
|
||||
combiner.current = NULL;
|
||||
|
|
14
Config.cpp
14
Config.cpp
|
@ -84,8 +84,8 @@ void Config_LoadConfig()
|
|||
RegQueryValueEx( hKey, "Hardware Frame Buffer Textures", 0, NULL, (BYTE*)&value, &size );
|
||||
OGL.frameBufferTextures = value ? TRUE : FALSE;
|
||||
|
||||
RegQueryValueEx( hKey, "Dithered Alpha Testing", 0, NULL, (BYTE*)&value, &size );
|
||||
OGL.usePolygonStipple = value ? TRUE : FALSE;
|
||||
RegQueryValueEx( hKey, "Hardware lighting", 0, NULL, (BYTE*)&value, &size );
|
||||
OGL.bHWLighting = value ? TRUE : FALSE;
|
||||
|
||||
RegQueryValueEx( hKey, "Texture Bit Depth", 0, NULL, (BYTE*)&value, &size );
|
||||
OGL.textureBitDepth = value;
|
||||
|
@ -106,7 +106,7 @@ void Config_LoadConfig()
|
|||
OGL.frameBufferTextures = FALSE;
|
||||
OGL.enable2xSaI = FALSE;
|
||||
OGL.textureBitDepth = 1;
|
||||
OGL.usePolygonStipple = FALSE;
|
||||
OGL.bHWLighting = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,8 +139,8 @@ void Config_SaveConfig()
|
|||
value = OGL.frameBufferTextures ? 1 : 0;
|
||||
RegSetValueEx( hKey, "Hardware Frame Buffer Textures", 0, REG_DWORD, (BYTE*)&value, 4 );
|
||||
|
||||
value = OGL.usePolygonStipple ? 1 : 0;
|
||||
RegSetValueEx( hKey, "Dithered Alpha Testing", 0, REG_DWORD, (BYTE*)&value, 4 );
|
||||
value = OGL.bHWLighting ? 1 : 0;
|
||||
RegSetValueEx( hKey, "Hardware lighting", 0, REG_DWORD, (BYTE*)&value, 4 );
|
||||
|
||||
value = OGL.textureBitDepth;
|
||||
RegSetValueEx( hKey, "Texture Bit Depth", 0, REG_DWORD, (BYTE*)&value, 4 );
|
||||
|
@ -175,7 +175,7 @@ void Config_ApplyDlgConfig( HWND hWndDlg )
|
|||
OGL.windowedHeight = windowedModes[i].height;
|
||||
|
||||
OGL.frameBufferTextures = (SendDlgItemMessage( hWndDlg, IDC_FRAMEBUFFER, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
|
||||
OGL.usePolygonStipple = (SendDlgItemMessage( hWndDlg, IDC_DITHEREDALPHATEST, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
|
||||
OGL.bHWLighting = (SendDlgItemMessage( hWndDlg, IDC_HWLIGHT, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
|
||||
|
||||
if (!OGL.fullscreen)
|
||||
OGL_ResizeWindow();
|
||||
|
@ -330,7 +330,7 @@ BOOL CALLBACK ConfigDlgProc( HWND hWndDlg, UINT message, WPARAM wParam, LPARAM l
|
|||
SendDlgItemMessage( hWndDlg, IDC_FOG, BM_SETCHECK, OGL.fog ? (LPARAM)BST_CHECKED : (LPARAM)BST_UNCHECKED, NULL );
|
||||
SendDlgItemMessage( hWndDlg, IDC_FRAMEBUFFER, BM_SETCHECK, OGL.frameBufferTextures ? (LPARAM)BST_CHECKED : (LPARAM)BST_UNCHECKED, NULL );
|
||||
|
||||
SendDlgItemMessage( hWndDlg, IDC_DITHEREDALPHATEST, BM_SETCHECK, OGL.usePolygonStipple ? (LPARAM)BST_CHECKED : (LPARAM)BST_UNCHECKED, NULL );
|
||||
SendDlgItemMessage( hWndDlg, IDC_HWLIGHT, BM_SETCHECK, OGL.bHWLighting ? (LPARAM)BST_CHECKED : (LPARAM)BST_UNCHECKED, NULL );
|
||||
|
||||
_ltoa( cache.maxBytes / 1048576, text, 10 );
|
||||
SendDlgItemMessage( hWndDlg, IDC_CACHEMEGS, WM_SETTEXT, NULL, (LPARAM)text );
|
||||
|
|
|
@ -14,7 +14,7 @@ static GtkWidget *configWindow = NULL;
|
|||
//static GtkWidget *bitdepthCombo[2], *resolutionCombo[2];
|
||||
static GtkWidget *resolutionCombo;
|
||||
static GtkWidget *enable2xSAICheck, *forceBilinearCheck, *enableFogCheck;
|
||||
static GtkWidget *enableHardwareFBCheck, *enablePolygonStippleCheck;
|
||||
static GtkWidget *enableHardwareFBCheck, *enableHardwareLighting;
|
||||
static GtkWidget *textureDepthCombo;
|
||||
static GtkWidget *textureCacheEntry;
|
||||
static const char *pluginDir = 0;
|
||||
|
@ -77,7 +77,7 @@ static void okButton_clicked( GtkWidget *widget, void *data )
|
|||
OGL.enable2xSaI = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enable2xSAICheck) );
|
||||
OGL.fog = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableFogCheck) );
|
||||
OGL.frameBufferTextures = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableHardwareFBCheck) );
|
||||
OGL.usePolygonStipple = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enablePolygonStippleCheck) );
|
||||
OGL.bHWLighting = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(enableHardwareLighting) );
|
||||
const char *depth = gtk_entry_get_text( GTK_ENTRY(GTK_COMBO(textureDepthCombo)->entry) );
|
||||
OGL.textureBitDepth = 1;
|
||||
for (i = 0; textureBitDepth[i] != 0; i++)
|
||||
|
@ -112,7 +112,7 @@ static void okButton_clicked( GtkWidget *widget, void *data )
|
|||
fprintf( f, "enable 2xSAI=%d\n", OGL.enable2xSaI );
|
||||
fprintf( f, "enable fog=%d\n", OGL.fog );
|
||||
fprintf( f, "enable HardwareFB=%d\n", OGL.frameBufferTextures );
|
||||
fprintf( f, "enable dithered alpha=%d\n", OGL.usePolygonStipple );
|
||||
fprintf( f, "enable hardware lighting=%d\n", OGL.bHWLighting );
|
||||
fprintf( f, "texture depth=%d\n", OGL.textureBitDepth );
|
||||
fprintf( f, "cache size=%d\n", cache.maxBytes / 1048576 );
|
||||
|
||||
|
@ -150,7 +150,7 @@ static void configWindow_show( GtkWidget *widget, void *data )
|
|||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enable2xSAICheck), (OGL.enable2xSaI) );
|
||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(forceBilinearCheck), (OGL.forceBilinear) );
|
||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableFogCheck), (OGL.fog) );
|
||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enablePolygonStippleCheck), (OGL.usePolygonStipple) );
|
||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableHardwareLighting), (OGL.bHWLighting) );
|
||||
|
||||
// textures
|
||||
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(enableHardwareFBCheck), (OGL.frameBufferTextures) );
|
||||
|
@ -271,7 +271,7 @@ static int Config_CreateWindow()
|
|||
enable2xSAICheck = gtk_check_button_new_with_label( "Enable 2xSAI texture scaling" );
|
||||
forceBilinearCheck = gtk_check_button_new_with_label( "Force bilinear filtering" );
|
||||
enableFogCheck = gtk_check_button_new_with_label( "Enable fog" );
|
||||
enablePolygonStippleCheck = gtk_check_button_new_with_label( "Enable dithered alpha testing" );
|
||||
enableHardwareLighting = gtk_check_button_new_with_label( "Enable hardware lighting" );
|
||||
|
||||
/* // row 0
|
||||
gtk_table_attach_defaults( GTK_TABLE(displayTable), bitdepthLabel, 1, 2, 0, 1 );
|
||||
|
@ -300,7 +300,7 @@ static int Config_CreateWindow()
|
|||
|
||||
// row 4
|
||||
gtk_table_attach_defaults( GTK_TABLE(displayTable), enable2xSAICheck, 0, 1, 4, 5 );
|
||||
gtk_table_attach_defaults( GTK_TABLE(displayTable), enablePolygonStippleCheck, 1, 2, 4, 5 );
|
||||
gtk_table_attach_defaults( GTK_TABLE(displayTable), enableHardwareLighting, 1, 2, 4, 5 );
|
||||
|
||||
// textures frame
|
||||
texturesFrame = gtk_frame_new( "Textures" );
|
||||
|
@ -373,7 +373,7 @@ void Config_LoadConfig()
|
|||
OGL.fog = 1;
|
||||
OGL.textureBitDepth = 1; // normal (16 & 32 bits)
|
||||
OGL.frameBufferTextures = 0;
|
||||
OGL.usePolygonStipple = 0;
|
||||
OGL.bHWLighting = 0;
|
||||
cache.maxBytes = 32 * 1048576;
|
||||
|
||||
// read configuration
|
||||
|
@ -450,9 +450,9 @@ void Config_LoadConfig()
|
|||
{
|
||||
OGL.frameBufferTextures = atoi( val );
|
||||
}
|
||||
else if (!strcasecmp( line, "enable dithered alpha" ))
|
||||
else if (!strcasecmp( line, "enable hardware lighting" ))
|
||||
{
|
||||
OGL.usePolygonStipple = atoi( val );
|
||||
OGL.bHWLighting = atoi( val );
|
||||
}
|
||||
else if (!strcasecmp( line, "texture depth" ))
|
||||
{
|
||||
|
|
|
@ -407,7 +407,7 @@ GLSLCombiner::GLSLCombiner(Combiner *_color, Combiner *_alpha) {
|
|||
} else {
|
||||
assert(strstr(strCombiner, "readtex") == 0);
|
||||
}
|
||||
if (bHWLightingCalculation)
|
||||
if (OGL.bHWLighting)
|
||||
strcat(fragment_shader, " float intensity = calc_light(int(secondary_color.r), input_color); \n");
|
||||
else
|
||||
strcat(fragment_shader, " input_color = gl_Color.rgb;\n");
|
||||
|
@ -448,7 +448,7 @@ GLSLCombiner::GLSLCombiner(Combiner *_color, Combiner *_alpha) {
|
|||
m_aShaders[uShaderIdx++] = fragmentShader;
|
||||
glAttachShader(m_program, g_calc_depth_shader_object);
|
||||
m_aShaders[uShaderIdx++] = g_calc_depth_shader_object;
|
||||
if (bHWLightingCalculation) {
|
||||
if (OGL.bHWLighting) {
|
||||
glAttachShader(m_program, g_calc_light_shader_object);
|
||||
m_aShaders[uShaderIdx++] = g_calc_light_shader_object;
|
||||
}
|
||||
|
|
10
OpenGL.cpp
10
OpenGL.cpp
|
@ -616,11 +616,6 @@ void OGL_UpdateStates()
|
|||
glDisable( GL_ALPHA_TEST );
|
||||
*/
|
||||
Combiner_UpdateAlphaTestInfo();
|
||||
|
||||
if (OGL.usePolygonStipple && (gDP.otherMode.alphaCompare == G_AC_DITHER) && !(gDP.otherMode.alphaCvgSel))
|
||||
glEnable( GL_POLYGON_STIPPLE );
|
||||
else
|
||||
glDisable( GL_POLYGON_STIPPLE );
|
||||
}
|
||||
|
||||
if (gDP.changed & CHANGED_SCISSOR)
|
||||
|
@ -828,11 +823,6 @@ void OGL_AddTriangle( SPVertex *vertices, int v0, int v1, int v2 )
|
|||
|
||||
void OGL_DrawTriangles()
|
||||
{
|
||||
if (OGL.usePolygonStipple && (gDP.otherMode.alphaCompare == G_AC_DITHER) && !(gDP.otherMode.alphaCvgSel))
|
||||
{
|
||||
OGL.lastStipple = (OGL.lastStipple + 1) & 0x7;
|
||||
glPolygonStipple( OGL.stipplePattern[(BYTE)(gDP.envColor.a * 255.0f) >> 3][OGL.lastStipple] );
|
||||
}
|
||||
Combiner_UpdateCombineDepthInfo();
|
||||
glDrawArrays( GL_TRIANGLES, 0, OGL.numVertices );
|
||||
if (OGL.bImageTexture) {
|
||||
|
|
2
OpenGL.h
2
OpenGL.h
|
@ -62,7 +62,6 @@ struct GLInfo
|
|||
#ifndef __LINUX__
|
||||
HWND hFullscreenWnd;
|
||||
#endif
|
||||
BOOL usePolygonStipple;
|
||||
GLubyte stipplePattern[32][8][128];
|
||||
BYTE lastStipple;
|
||||
|
||||
|
@ -74,6 +73,7 @@ struct GLInfo
|
|||
} framebuffer_mode;
|
||||
bool bImageTexture;
|
||||
bool captureScreen;
|
||||
BOOL bHWLighting;
|
||||
};
|
||||
|
||||
extern GLInfo OGL;
|
||||
|
|
BIN
Resource.aps
BIN
Resource.aps
Binary file not shown.
|
@ -119,8 +119,7 @@ BEGIN
|
|||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,154,171,10
|
||||
COMBOBOX IDC_TEXTUREBPP,87,118,107,75,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Texture Bit Depth:",IDC_STATIC,15,120,60,8
|
||||
CONTROL "Enabled Dithered Alpha Testing",IDC_DITHEREDALPHATEST,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,81,116,10
|
||||
CONTROL "Enabled Hardware Lighting",IDC_HWLIGHT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,82,101,10
|
||||
END
|
||||
|
||||
IDD_MICROCODEDLG DIALOGEX 0, 0, 384, 129
|
||||
|
|
4
gSP.cpp
4
gSP.cpp
|
@ -110,7 +110,7 @@ void gSPProcessVertex( u32 v )
|
|||
TransformVector( &gSP.vertices[v].nx, gSP.matrix.modelView[gSP.matrix.modelViewi] );
|
||||
Normalize( &gSP.vertices[v].nx );
|
||||
|
||||
if (!bHWLightingCalculation) {
|
||||
if (!OGL.bHWLighting) {
|
||||
f32 r = gSP.lights[gSP.numLights].r;
|
||||
f32 g = gSP.lights[gSP.numLights].g;
|
||||
f32 b = gSP.lights[gSP.numLights].b;
|
||||
|
@ -385,7 +385,7 @@ void gSPLight( u32 l, s32 n )
|
|||
Normalize( &gSP.lights[n].x );
|
||||
}
|
||||
|
||||
if (bHWLightingCalculation) {
|
||||
if (OGL.bHWLighting) {
|
||||
float fLightPos[4] = {gSP.lights[n].x, gSP.lights[n].y, gSP.lights[n].z, 0.0};
|
||||
glLightfv(GL_LIGHT0+n, GL_POSITION, fLightPos);
|
||||
float fLightColor[4] = {gSP.lights[n].r, gSP.lights[n].g, gSP.lights[n].b, 1.0};
|
||||
|
|
1
gSP.h
1
gSP.h
|
@ -99,7 +99,6 @@ struct gSPInfo
|
|||
};
|
||||
|
||||
extern gSPInfo gSP;
|
||||
extern bool bHWLightingCalculation;
|
||||
|
||||
void gSPLoadUcodeEx( u32 uc_start, u32 uc_dstart, u16 uc_dsize );
|
||||
void gSPNoOp();
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#define IDC_TEXTBOX 1097
|
||||
#define IDC_CHECK2 1098
|
||||
#define IDC_DITHEREDALPHATEST 1098
|
||||
#define IDC_HWLIGHT 1098
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue
Block a user