mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
Scanline Variation
- added option for scanline variation
This commit is contained in:
parent
4de23e7624
commit
b507dbb5fc
9 changed files with 23 additions and 13 deletions
|
@ -125,10 +125,11 @@ uniform float2 ScreenOffset = float2(0.0f, 0.0f);
|
|||
|
||||
uniform float ScanlineAlpha = 0.0f;
|
||||
uniform float ScanlineScale = 1.0f;
|
||||
uniform float ScanlineHeight = 1.0f;
|
||||
uniform float ScanlineVariation = 1.0f;
|
||||
uniform float ScanlineOffset = 1.0f;
|
||||
uniform float ScanlineBrightScale = 1.0f;
|
||||
uniform float ScanlineBrightOffset = 1.0f;
|
||||
uniform float ScanlineOffset = 1.0f;
|
||||
uniform float ScanlineHeight = 1.0f;
|
||||
|
||||
uniform float3 BackColor = float3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
|
@ -262,7 +263,7 @@ float4 ps_main(PS_INPUT Input) : COLOR
|
|||
float ScanlineCoord = SourceCoord.y * SourceDims.y * ScanlineScale * PI;
|
||||
float ScanlineCoordJitter = ScanlineOffset * PHI;
|
||||
float ScanlineSine = sin(ScanlineCoord + ScanlineCoordJitter);
|
||||
float ScanlineWide = ScanlineHeight + max(1.0f, ScanlineHeight) * (1.0f - ColorBrightness);
|
||||
float ScanlineWide = ScanlineHeight + ScanlineVariation * max(1.0f, ScanlineHeight) * (1.0f - ColorBrightness);
|
||||
float ScanlineAmount = pow(ScanlineSine * ScanlineSine, ScanlineWide);
|
||||
float ScanlineBrightness = ScanlineAmount * BrightnessScale + BrightnessOffset * BrightnessScale;
|
||||
|
||||
|
|
|
@ -52,4 +52,4 @@ bloom_lvl6_weight 0.04
|
|||
bloom_lvl7_weight 0.02
|
||||
bloom_lvl8_weight 0.02
|
||||
bloom_lvl9_weight 0.01
|
||||
bloom_lvl10_weight 0.01
|
||||
bloom_lvl10_weight 0.01
|
||||
|
|
|
@ -52,4 +52,4 @@ bloom_lvl6_weight 0.04
|
|||
bloom_lvl7_weight 0.02
|
||||
bloom_lvl8_weight 0.02
|
||||
bloom_lvl9_weight 0.01
|
||||
bloom_lvl10_weight 0.01
|
||||
bloom_lvl10_weight 0.01
|
||||
|
|
|
@ -18,6 +18,7 @@ vignetting 0.0
|
|||
scanline_alpha 0.50
|
||||
scanline_size 1.0
|
||||
scanline_height 1.0
|
||||
scanline_variation 1.0
|
||||
scanline_bright_scale 2.0
|
||||
scanline_bright_offset 0.0
|
||||
scanline_jitter 0.0
|
||||
|
@ -57,4 +58,4 @@ bloom_lvl6_weight 0.04
|
|||
bloom_lvl7_weight 0.02
|
||||
bloom_lvl8_weight 0.02
|
||||
bloom_lvl9_weight 0.01
|
||||
bloom_lvl10_weight 0.01
|
||||
bloom_lvl10_weight 0.01
|
||||
|
|
|
@ -25,11 +25,6 @@ smooth_border 0.0
|
|||
reflection 0.0
|
||||
vignetting 0.0
|
||||
scanline_alpha 0.0
|
||||
scanline_size 0.0
|
||||
scanline_height 0.0
|
||||
scanline_bright_scale 0.0
|
||||
scanline_bright_offset 0.0
|
||||
scanline_jitter 0.0
|
||||
defocus 0.0,0.0
|
||||
converge_x 0.0,0.0,0.0
|
||||
converge_y 0.0,0.0,0.0
|
||||
|
@ -72,4 +67,4 @@ bloom_lvl6_weight 0.48
|
|||
bloom_lvl7_weight 0.32
|
||||
bloom_lvl8_weight 0.24
|
||||
bloom_lvl9_weight 0.16
|
||||
bloom_lvl10_weight 0.08
|
||||
bloom_lvl10_weight 0.08
|
||||
|
|
|
@ -691,6 +691,7 @@ void shaders::init(d3d_base *d3dintf, running_machine *machine, renderer_d3d9 *r
|
|||
options->scanline_alpha = winoptions.screen_scanline_amount();
|
||||
options->scanline_scale = winoptions.screen_scanline_scale();
|
||||
options->scanline_height = winoptions.screen_scanline_height();
|
||||
options->scanline_variation = winoptions.screen_scanline_variation();
|
||||
options->scanline_bright_scale = winoptions.screen_scanline_bright_scale();
|
||||
options->scanline_bright_offset = winoptions.screen_scanline_bright_offset();
|
||||
options->scanline_jitter = winoptions.screen_scanline_jitter();
|
||||
|
@ -987,6 +988,7 @@ int shaders::create_resources(bool reset)
|
|||
post_effect->add_uniform("ScanlineAlpha", uniform::UT_FLOAT, uniform::CU_POST_SCANLINE_ALPHA);
|
||||
post_effect->add_uniform("ScanlineScale", uniform::UT_FLOAT, uniform::CU_POST_SCANLINE_SCALE);
|
||||
post_effect->add_uniform("ScanlineHeight", uniform::UT_FLOAT, uniform::CU_POST_SCANLINE_HEIGHT);
|
||||
post_effect->add_uniform("ScanlineVariation", uniform::UT_FLOAT, uniform::CU_POST_SCANLINE_VARIATION);
|
||||
post_effect->add_uniform("ScanlineBrightScale", uniform::UT_FLOAT, uniform::CU_POST_SCANLINE_BRIGHT_SCALE);
|
||||
post_effect->add_uniform("ScanlineBrightOffset", uniform::UT_FLOAT, uniform::CU_POST_SCANLINE_BRIGHT_OFFSET);
|
||||
post_effect->add_uniform("Power", uniform::UT_VEC3, uniform::CU_POST_POWER);
|
||||
|
@ -2271,6 +2273,7 @@ enum slider_option
|
|||
SLIDER_SCANLINE_ALPHA,
|
||||
SLIDER_SCANLINE_SCALE,
|
||||
SLIDER_SCANLINE_HEIGHT,
|
||||
SLIDER_SCANLINE_VARIATION,
|
||||
SLIDER_SCANLINE_BRIGHT_SCALE,
|
||||
SLIDER_SCANLINE_BRIGHT_OFFSET,
|
||||
SLIDER_SCANLINE_JITTER,
|
||||
|
@ -2347,6 +2350,7 @@ slider_desc shaders::s_sliders[] =
|
|||
{ "Scanline Darkness", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_SCANLINE_ALPHA, 0.01f, "%1.2f", {} },
|
||||
{ "Scanline Screen Scale", 0, 100, 400, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_SCANLINE_SCALE, 0.01f, "%1.2f", {} },
|
||||
{ "Scanline Height", 0, 100, 400, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_SCANLINE_HEIGHT, 0.01f, "%1.2f", {} },
|
||||
{ "Scanline Height Variation", 0, 100, 400, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_SCANLINE_VARIATION, 0.01f, "%1.2f", {} },
|
||||
{ "Scanline Brightness", 0, 100, 200, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_SCANLINE_BRIGHT_SCALE, 0.01f, "%1.2f", {} },
|
||||
{ "Scanline Brightness Overdrive", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_SCANLINE_BRIGHT_OFFSET, 0.01f, "%1.2f", {} },
|
||||
{ "Scanline Jitter", 0, 0, 100, 1, SLIDER_FLOAT, SLIDER_SCREEN_TYPE_LCD_OR_RASTER, SLIDER_SCANLINE_JITTER, 0.01f, "%1.2f", {} },
|
||||
|
@ -2421,6 +2425,7 @@ void *shaders::get_slider_option(int id, int index)
|
|||
case SLIDER_SCANLINE_ALPHA: return &(options->scanline_alpha);
|
||||
case SLIDER_SCANLINE_SCALE: return &(options->scanline_scale);
|
||||
case SLIDER_SCANLINE_HEIGHT: return &(options->scanline_height);
|
||||
case SLIDER_SCANLINE_VARIATION: return &(options->scanline_variation);
|
||||
case SLIDER_SCANLINE_BRIGHT_SCALE: return &(options->scanline_bright_scale);
|
||||
case SLIDER_SCANLINE_BRIGHT_OFFSET: return &(options->scanline_bright_offset);
|
||||
case SLIDER_SCANLINE_JITTER: return &(options->scanline_jitter);
|
||||
|
@ -2829,6 +2834,9 @@ void uniform::update()
|
|||
case CU_POST_SCANLINE_HEIGHT:
|
||||
m_shader->set_float("ScanlineHeight", options->scanline_height);
|
||||
break;
|
||||
case CU_POST_SCANLINE_VARIATION:
|
||||
m_shader->set_float("ScanlineVariation", options->scanline_variation);
|
||||
break;
|
||||
case CU_POST_SCANLINE_BRIGHT_SCALE:
|
||||
m_shader->set_float("ScanlineBrightScale", options->scanline_bright_scale);
|
||||
break;
|
||||
|
|
|
@ -97,6 +97,7 @@ public:
|
|||
CU_POST_SCANLINE_ALPHA,
|
||||
CU_POST_SCANLINE_SCALE,
|
||||
CU_POST_SCANLINE_HEIGHT,
|
||||
CU_POST_SCANLINE_VARIATION,
|
||||
CU_POST_SCANLINE_BRIGHT_SCALE,
|
||||
CU_POST_SCANLINE_BRIGHT_OFFSET,
|
||||
CU_POST_POWER,
|
||||
|
@ -208,6 +209,7 @@ struct hlsl_options
|
|||
float scanline_alpha;
|
||||
float scanline_scale;
|
||||
float scanline_height;
|
||||
float scanline_variation;
|
||||
float scanline_bright_scale;
|
||||
float scanline_bright_offset;
|
||||
float scanline_jitter;
|
||||
|
@ -343,7 +345,7 @@ public:
|
|||
void delete_resources(bool reset);
|
||||
|
||||
// slider-related functions
|
||||
slider_state *init_slider_list();
|
||||
void init_slider_list();
|
||||
void *get_slider_option(int id, int index = 0);
|
||||
|
||||
private:
|
||||
|
|
|
@ -304,6 +304,7 @@ const options_entry windows_options::s_option_entries[] =
|
|||
{ WINOPTION_SCANLINE_AMOUNT";fs_scanam(0.0-4.0)", "0.0", OPTION_FLOAT, "overall alpha scaling value for scanlines" },
|
||||
{ WINOPTION_SCANLINE_SCALE";fs_scansc(0.0-4.0)", "1.0", OPTION_FLOAT, "overall height scaling value for scanlines" },
|
||||
{ WINOPTION_SCANLINE_HEIGHT";fs_scanh(0.0-4.0)", "1.0", OPTION_FLOAT, "individual height scaling value for scanlines" },
|
||||
{ WINOPTION_SCANLINE_VARIATION";fs_scanv(0.0-4.0)", "1.0", OPTION_FLOAT, "individual height varying value for scanlines" },
|
||||
{ WINOPTION_SCANLINE_BRIGHT_SCALE";fs_scanbs(0.0-2.0)", "1.0", OPTION_FLOAT, "overall brightness scaling value for scanlines (multiplicative)" },
|
||||
{ WINOPTION_SCANLINE_BRIGHT_OFFSET";fs_scanbo(0.0-1.0)", "0.0", OPTION_FLOAT, "overall brightness offset value for scanlines (additive)" },
|
||||
{ WINOPTION_SCANLINE_JITTER";fs_scanjt(0.0-4.0)", "0.0", OPTION_FLOAT, "overall interlace jitter scaling value for scanlines" },
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#define WINOPTION_SCANLINE_AMOUNT "scanline_alpha"
|
||||
#define WINOPTION_SCANLINE_SCALE "scanline_size"
|
||||
#define WINOPTION_SCANLINE_HEIGHT "scanline_height"
|
||||
#define WINOPTION_SCANLINE_VARIATION "scanline_variation"
|
||||
#define WINOPTION_SCANLINE_BRIGHT_SCALE "scanline_bright_scale"
|
||||
#define WINOPTION_SCANLINE_BRIGHT_OFFSET "scanline_bright_offset"
|
||||
#define WINOPTION_SCANLINE_JITTER "scanline_jitter"
|
||||
|
@ -148,6 +149,7 @@ public:
|
|||
float screen_scanline_amount() const { return float_value(WINOPTION_SCANLINE_AMOUNT); }
|
||||
float screen_scanline_scale() const { return float_value(WINOPTION_SCANLINE_SCALE); }
|
||||
float screen_scanline_height() const { return float_value(WINOPTION_SCANLINE_HEIGHT); }
|
||||
float screen_scanline_variation() const { return float_value(WINOPTION_SCANLINE_VARIATION); }
|
||||
float screen_scanline_bright_scale() const { return float_value(WINOPTION_SCANLINE_BRIGHT_SCALE); }
|
||||
float screen_scanline_bright_offset() const { return float_value(WINOPTION_SCANLINE_BRIGHT_OFFSET); }
|
||||
float screen_scanline_jitter() const { return float_value(WINOPTION_SCANLINE_JITTER); }
|
||||
|
|
Loading…
Reference in a new issue