[Glide64] Get lodmode to use enum

This commit is contained in:
zilmar 2017-01-30 08:03:23 +11:00
parent 88e5009afa
commit 5f0ece5dde
5 changed files with 40 additions and 28 deletions

View File

@ -15521,12 +15521,18 @@ void Combine()
Alpha0[(rdp.cycle1 >> 16) & 7], Alpha1[(rdp.cycle1 >> 19) & 7], Alpha2[(rdp.cycle1 >> 22) & 7], Alpha3[(rdp.cycle1 >> 25) & 7],
Alpha0[(rdp.cycle2 >> 16) & 7], Alpha1[(rdp.cycle2 >> 19) & 7], Alpha2[(rdp.cycle2 >> 22) & 7], Alpha3[(rdp.cycle2 >> 25) & 7]);
if (!rdp.LOD_en || rdp.cur_tile == rdp.mipmap_level)
{
lod_frac = rdp.prim_lodfrac;
else if (g_settings->lodmode == 0)
}
else if (g_settings->lodmode() == CSettings::LOD_Off)
{
lod_frac = 0;
}
else
{
lod_frac = 10;
}
rdp.noise = RDP::noise_none;
uint32_t found = TRUE;

View File

@ -500,10 +500,10 @@ public:
TTSetTxt(IDC_TXT_LOD_CALC, tooltip.c_str());
TTSetTxt(IDC_CMB_LOD_CALC, tooltip.c_str());
m_cmbLOD.Attach(GetDlgItem(IDC_CMB_LOD_CALC));
m_cmbLOD.SetItemData(m_cmbLOD.AddString("off"), 0);
m_cmbLOD.SetItemData(m_cmbLOD.AddString("fast"), 1);
m_cmbLOD.SetItemData(m_cmbLOD.AddString("precise"), 2);
SetComboBoxIndex(m_cmbLOD, g_settings->lodmode);
m_cmbLOD.SetItemData(m_cmbLOD.AddString("off"), CSettings::LOD_Off);
m_cmbLOD.SetItemData(m_cmbLOD.AddString("fast"), CSettings::LOD_Fast);
m_cmbLOD.SetItemData(m_cmbLOD.AddString("precise"), CSettings::LOD_Precise);
SetComboBoxIndex(m_cmbLOD, g_settings->lodmode());
tooltip = "Aspect ratio of the output:\n\nMost N64 games use 4:3 aspect ratio, but some support widescreen too.\nYou may select appropriate aspect here and set widescreen mode in game settings->\nIn \"Stretch\" mode the output will be stretched to the entire screen, other modes may add black borders if necessary";
TTSetTxt(IDC_TXT_ASPECT_RATIO, tooltip.c_str());
@ -565,7 +565,7 @@ public:
g_settings->SetSwapMode((CSettings::SwapMode_t)m_cmbBufferSwap.GetItemData(m_cmbBufferSwap.GetCurSel()));
g_settings->fog = m_cbxFog.GetCheck() == BST_CHECKED;
g_settings->buff_clear = m_cbxBuffer.GetCheck() == BST_CHECKED;
g_settings->lodmode = m_cmbLOD.GetItemData(m_cmbLOD.GetCurSel());
g_settings->SetLODmode((CSettings::PixelLevelOfDetail_t)m_cmbLOD.GetItemData(m_cmbLOD.GetCurSel()));
CButton * fb_buttons[] =
{

View File

@ -26,7 +26,7 @@ vsync(0),
fog(0),
buff_clear(0),
m_swapmode(SwapMode_Old),
lodmode(0),
m_lodmode(LOD_Off),
m_aspectmode(Aspect_4x3),
m_frame_buffer(0),
//Texture filtering options
@ -149,7 +149,7 @@ void CSettings::RegisterSettings(void)
general_setting(Set_optimize_texrect_default, "optimize_texrect", true);
general_setting(Set_filtering_default, "filtering", CSettings::Filter_Automatic);
general_setting(Set_lodmode_default, "lodmode", 0);
general_setting(Set_lodmode_default, "lodmode", CSettings::LOD_Off);
general_setting(Set_fog_default, "fog", 1);
general_setting(Set_buff_clear_default, "buff_clear", 1);
general_setting(Set_swapmode_default, "swapmode", SwapMode_New);
@ -215,6 +215,15 @@ void CSettings::SetAspectmode(AspectMode_t value)
}
}
void CSettings::SetLODmode(PixelLevelOfDetail_t value)
{
if (value != m_lodmode)
{
m_lodmode = value;
m_dirty = true;
}
}
void CSettings::SetFiltering(Filtering_t value)
{
if (value != m_filtering)
@ -503,7 +512,6 @@ void CSettings::ReadGameSettings(const char * name)
g_settings->fog = GetSetting(g_romopen ? Set_fog : Set_fog_default);
g_settings->buff_clear = GetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default);
g_settings->lodmode = GetSetting(g_romopen ? Set_lodmode : Set_lodmode_default);
#ifdef _WIN32
g_settings->res_data = GetSetting(Set_Resolution);
if (g_settings->res_data < 0 || g_settings->res_data >= 0x18) g_settings->res_data = 12;
@ -564,6 +572,7 @@ void CSettings::ReadGameSettings(const char * name)
SetFiltering((Filtering_t)GetSetting(g_romopen ? Set_filtering : Set_filtering_default));
SetSwapMode((SwapMode_t)GetSetting(g_romopen ? Set_swapmode : Set_swapmode_default));
SetAspectmode((AspectMode_t)GetSetting(g_romopen ? Set_aspect : Set_aspect_default));
SetLODmode((PixelLevelOfDetail_t)GetSetting(g_romopen ? Set_lodmode : Set_lodmode_default));
g_settings->flame_corona = g_settings->hacks(hack_Zelda) && !fb_depth_render_enabled();
}
@ -613,7 +622,7 @@ void CSettings::WriteSettings(void)
SetSetting(g_romopen ? Set_fog : Set_fog_default, g_settings->fog);
SetSetting(g_romopen ? Set_buff_clear : Set_buff_clear_default, g_settings->buff_clear);
SetSetting(g_romopen ? Set_swapmode : Set_swapmode_default, g_settings->swapmode());
SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, g_settings->lodmode);
SetSetting(g_romopen ? Set_lodmode : Set_lodmode_default, lodmode());
SetSetting(g_romopen ? Set_aspect : Set_aspect_default, m_aspectmode);
SetSetting(g_romopen ? Set_fb_read_always : Set_fb_read_always_default, g_settings->fb_ref_enabled() ? true : false);

View File

@ -90,6 +90,13 @@ public:
SwapMode_Hybrid = 2,
};
enum PixelLevelOfDetail_t
{
LOD_Off = 0,
LOD_Fast = 1,
LOD_Precise = 2,
};
uint32_t res_x, scr_res_x;
uint32_t res_y, scr_res_y;
#ifndef ANDROID
@ -103,7 +110,6 @@ public:
int fog;
int buff_clear;
int lodmode;
enum FBCRCMODE
@ -135,6 +141,7 @@ public:
inline Filtering_t filtering(void) const { return m_filtering; }
inline SwapMode_t swapmode(void) const { return m_swapmode; }
inline PixelLevelOfDetail_t lodmode(void) const { return m_lodmode; }
inline AspectMode_t aspectmode(void) const { return m_aspectmode; }
//Texture filtering options
std::string texture_dir;
@ -200,6 +207,7 @@ public:
int wrpFBO;
int wrpAnisotropic;
void SetAspectmode(AspectMode_t value);
void SetLODmode(PixelLevelOfDetail_t value);
void SetFiltering(Filtering_t value);
void SetSwapMode(SwapMode_t value);
void UpdateFrameBufferBits(uint32_t BitsToAdd, uint32_t BitsToRemove);
@ -220,6 +228,7 @@ private:
ScreenRotate_t m_rotate;
Filtering_t m_filtering;
SwapMode_t m_swapmode;
PixelLevelOfDetail_t m_lodmode;
hacks_t m_hacks;
};

View File

@ -971,7 +971,7 @@ static void CalculateLOD(VERTEX *v, int n)
double intptr;
float s_scale = rdp.tiles[rdp.cur_tile].width / 255.0f;
float t_scale = rdp.tiles[rdp.cur_tile].height / 255.0f;
if (g_settings->lodmode == 1)
if (g_settings->lodmode() == CSettings::LOD_Fast)
{
deltaS = (v[1].u0 / v[1].q - v[0].u0 / v[0].q) * s_scale;
deltaT = (v[1].v0 / v[1].q - v[0].v0 / v[0].q) * t_scale;
@ -1569,20 +1569,13 @@ static void render_tri(uint16_t linew, int old_interpolate)
}
}
if (g_settings->lodmode > 0 && rdp.cur_tile < rdp.mipmap_level)
if (g_settings->lodmode() != CSettings::LOD_Off && rdp.cur_tile < rdp.mipmap_level)
{
CalculateLOD(rdp.vtxbuf, n);
}
cmb.cmb_ext_use = cmb.tex_cmb_ext_use = 0;
/*
if (rdp.tbuff_tex)
{
for (int k = 0; k < 3; k++)
{
WriteTrace(TraceRDP, TraceDebug, "v%d %f->%f, width: %d. height: %d, tex_width: %d, tex_height: %d, lr_u: %f, lr_v: %f", k, vv0[k], pv[k]->v1, rdp.tbuff_tex->width, rdp.tbuff_tex->height, rdp.tbuff_tex->tex_width, rdp.tbuff_tex->tex_height, rdp.tbuff_tex->lr_u, rdp.tbuff_tex->lr_v);
}
}
*/
if (g_settings->wireframe)
{
SetWireframeCol();
@ -1595,11 +1588,6 @@ static void render_tri(uint16_t linew, int old_interpolate)
}
else
{
// VERTEX ** pv = rdp.vtx_buffer?(vtx_list2):(vtx_list1);
// for (int k = 0; k < n; k ++)
// WriteTrace(TraceRDP, TraceDebug, "DRAW[%d]: v.x = %f, v.y = %f, v.z = %f, v.u = %f, v.v = %f", k, pv[k]->x, pv[k]->y, pv[k]->z, pv[k]->coord[rdp.t0<<1], pv[k]->coord[(rdp.t0<<1)+1]);
// pv[k]->y = g_settings->res_y - pv[k]->y;
if (linew > 0)
{
VERTEX *V0 = &rdp.vtxbuf[0];