diff --git a/src/moon/ui/screens/options/categories/mvideo.cpp b/src/moon/ui/screens/options/categories/mvideo.cpp index 03502ae9..29f83011 100644 --- a/src/moon/ui/screens/options/categories/mvideo.cpp +++ b/src/moon/ui/screens/options/categories/mvideo.cpp @@ -25,6 +25,9 @@ MVideoCategory::MVideoCategory() : MoonCategory("TEXT_OPT_VIDEO"){ texY = 57; hudY = 74; #endif + this->catOptions.push_back(new MWValue(22, texY, "TEXT_OPT_TEXFILTER", {.index = (int*)&configFiltering, .values = &filters, .valueKeys = true}, true)); + this->catOptions.push_back(new MWValue(22, texY, "Enable antialias", {.bvar = &configWindow.enable_antialias}, false)); + this->catOptions.push_back(new MWValue(22, texY, "Antialias level", {.ivar = (int*)&configWindow.antialias_level, .max = 16, .min = 2, .step = 2, .rawValue = true}, false)); this->catOptions.push_back(new MWValue(22, texY, "TEXT_OPT_TEXFILTER", {.index = (int*)&configFiltering, .values = &filters, .valueKeys = true}, true)); this->catOptions.push_back(new MWValue(22, hudY, "TEXT_OPT_HUD", {.bvar = &configHUD}, true)); #ifndef TARGET_SWITCH diff --git a/src/moon/ui/widgets/mw-value.cpp b/src/moon/ui/widgets/mw-value.cpp index 7863b6f9..c3bfed0e 100644 --- a/src/moon/ui/widgets/mw-value.cpp +++ b/src/moon/ui/widgets/mw-value.cpp @@ -109,7 +109,7 @@ void MWValue::Draw(){ float value = isFloat ? *this->bind.fvar : *this->bind.ivar; float max = this->bind.max; - wstring text = to_wstring((int)(100 * (value / max))) + L"%"; + wstring text = !this->bind.rawValue ? to_wstring((int)(100 * (value / max))) + L"%" : to_wstring((int)value); tmpWidth += MoonGetTextWidth(text, scale, false); MoonDrawWideText(this->x + ( 10 + barWidth / 2 ) - tmpWidth / 2 + titleWidth, this->y, text, scale, {58, 249, 252, 255}, true, true); diff --git a/src/moon/ui/widgets/mw-value.h b/src/moon/ui/widgets/mw-value.h index e21b2258..5adb5d66 100644 --- a/src/moon/ui/widgets/mw-value.h +++ b/src/moon/ui/widgets/mw-value.h @@ -18,6 +18,7 @@ struct MWValueBind{ int *index; std::vector* values; bool valueKeys; + bool rawValue; uint32_t* bindKeys; std::string keyIcon; diff --git a/src/pc/configfile.c b/src/pc/configfile.c index d211965b..39ef01a6 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -48,6 +48,8 @@ ConfigWindow configWindow = { .fullscreen = false, .exiting_fullscreen = false, .settings_changed = false, + .enable_antialias = true, + .antialias_level = 4 }; unsigned int configLanguage = 0; diff --git a/src/pc/configfile.h b/src/pc/configfile.h index 9fd44318..0a6cf3e7 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -15,6 +15,8 @@ typedef struct { bool fullscreen; bool exiting_fullscreen; bool settings_changed; + bool enable_antialias; + unsigned int antialias_level; } ConfigWindow; extern ConfigWindow configWindow; diff --git a/src/pc/gfx/gfx_opengl.c b/src/pc/gfx/gfx_opengl.c index b3d090b0..48c27aa3 100644 --- a/src/pc/gfx/gfx_opengl.c +++ b/src/pc/gfx/gfx_opengl.c @@ -370,7 +370,7 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(uint32_t shad } } - if (opt_alpha && opt_noise) + if (opt_alpha && opt_noise) append_line(fs_buf, &fs_len, "texel.a *= floor(random(floor(vec3(gl_FragCoord.xy, frame_count))) + 0.5);"); if (opt_alpha) { @@ -627,9 +627,9 @@ static void gfx_opengl_init(void) { sys_fatal("OpenGL 2.1+ is required.\nReported version: %s%d.%d", is_es ? "ES" : "", vmajor, vminor); glGenBuffers(1, &opengl_vbo); - + glBindBuffer(GL_ARRAY_BUFFER, opengl_vbo); - + glDepthFunc(GL_LEQUAL); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } @@ -645,6 +645,10 @@ static void gfx_opengl_start_frame(void) { glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_SCISSOR_TEST); + if(configWindow.enable_antialias) + glEnable(GL_MULTISAMPLE); + else + glDisable(GL_MULTISAMPLE); } static void gfx_opengl_end_frame(void) { diff --git a/src/pc/gfx/gfx_sdl2.c b/src/pc/gfx/gfx_sdl2.c index db4fa8a9..0e675c9f 100644 --- a/src/pc/gfx/gfx_sdl2.c +++ b/src/pc/gfx/gfx_sdl2.c @@ -219,8 +219,9 @@ static void gfx_sdl_init(const char *window_title) { SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); #endif - //SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); - //SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1); + SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, configWindow.antialias_level); + SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); #ifdef TARGET_SWITCH configWindow.fullscreen = false; diff --git a/src/pc/pc_main.c b/src/pc/pc_main.c index a87d967f..a4d7211a 100644 --- a/src/pc/pc_main.c +++ b/src/pc/pc_main.c @@ -207,30 +207,13 @@ void main_func(char *argv[]) { else if (gCLIOpts.FullScreen == 2) configWindow.fullscreen = false; - #if defined(WAPI_SDL1) || defined(WAPI_SDL2) wm_api = &gfx_sdl; - #elif defined(WAPI_DXGI) - wm_api = &gfx_dxgi; - #else - #error No window API! - #endif - - #if defined(RAPI_D3D11) - rendering_api = &gfx_direct3d11_api; - # define RAPI_NAME "DirectX 11" - #elif defined(RAPI_D3D12) - rendering_api = &gfx_direct3d12_api; - # define RAPI_NAME "DirectX 12" - #elif defined(RAPI_GL) || defined(RAPI_GL_LEGACY) rendering_api = &gfx_opengl_api; # ifdef USE_GLES # define RAPI_NAME "OpenGL ES" # else # define RAPI_NAME "OpenGL" # endif - #else - #error No rendering API! - #endif char window_title[96] = "Super Mario 64 - Moon64 (" RAPI_NAME ")";