summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--hlsl/vector.fx22
-rw-r--r--src/emu/ui/ui.c4
-rw-r--r--src/emu/video/vector.c56
-rw-r--r--src/emu/video/vector.h3
4 files changed, 53 insertions, 32 deletions
diff --git a/hlsl/vector.fx b/hlsl/vector.fx
index 0e5f2ac314c..5b2df81758b 100644
--- a/hlsl/vector.fx
+++ b/hlsl/vector.fx
@@ -42,15 +42,19 @@ uniform float3 LengthParams;
VS_OUTPUT vs_main(VS_INPUT Input)
{
VS_OUTPUT Output = (VS_OUTPUT)0;
-
+
Output.Position = float4(Input.Position.xyz, 1.0f);
Output.Position.xy /= ScreenDims;
- Output.Position.y = 1.0f - Output.Position.y;
- Output.Position.xy -= 0.5f;
- Output.Position *= float4(2.0f, 2.0f, 1.0f, 1.0f);
- Output.Color = Input.Color;
+ Output.Position.y = 1.0f - Output.Position.y; // flip y
+ Output.Position.xy -= 0.5f; // center
+ Output.Position.xy *= 2.0f; // zoom
+
Output.TexCoord = Input.Position.xy / ScreenDims;
+
+ Output.Color = Input.Color;
+
Output.LineInfo = Input.LineInfo;
+
return Output;
}
@@ -64,14 +68,14 @@ VS_OUTPUT vs_main(VS_INPUT Input)
// LengthParams.z: Size at which fade is maximum
float4 ps_main(PS_INPUT Input) : COLOR
{
- float timeModulate = lerp(1.0f, TimeParams.x, TimeParams.y) * 1.0;
+ float timeModulate = lerp(1.0f, TimeParams.x, TimeParams.y);
float lengthModulate = 1.0f - clamp(Input.LineInfo.x / LengthParams.z, 0.0f, 1.0f);
float minLength = 2.0f - clamp(Input.LineInfo.x - 1.0f, 0.0f, 2.0f);
- lengthModulate = lerp(lengthModulate, 4.0f, minLength * 0.5f);
- lengthModulate = lerp(1.0f, timeModulate * lengthModulate, LengthParams.y) * 1.0;
+ lengthModulate = lerp(lengthModulate, 2.0f, minLength * 0.5f);
+ lengthModulate = lerp(1.0f, timeModulate * lengthModulate, LengthParams.y);
- float4 outColor = Input.Color * float4(lengthModulate, lengthModulate, lengthModulate, 1.0f) * 2.0;
+ float4 outColor = Input.Color * float4(lengthModulate, lengthModulate, lengthModulate, 1.0f);
return outColor;
}
diff --git a/src/emu/ui/ui.c b/src/emu/ui/ui.c
index 95b51f24bab..a10d9e2f07f 100644
--- a/src/emu/ui/ui.c
+++ b/src/emu/ui/ui.c
@@ -2340,10 +2340,10 @@ static INT32 slider_flicker(running_machine &machine, void *arg, std::string *st
{
vector_device *vector = NULL;
if (newval != SLIDER_NOCHANGE)
- vector->set_flicker((float)newval * 0.1f);
+ vector->set_flicker((float)newval * 0.001f);
if (str != NULL)
strprintf(*str,"%1.2f", (double) vector->get_flicker());
- return floor(vector->get_flicker() * 10.0f + 0.5f);
+ return floor(vector->get_flicker() * 1000.0f + 0.5f);
}
diff --git a/src/emu/video/vector.c b/src/emu/video/vector.c
index 5e88ad286d9..8857de4c22f 100644
--- a/src/emu/video/vector.c
+++ b/src/emu/video/vector.c
@@ -140,9 +140,8 @@ vector_device::vector_device(const machine_config &mconfig, const char *tag, dev
{
}
-float vector_device::m_flicker_correction = 0.0f;
+float vector_device::m_flicker = 0.0f;
float vector_device::m_beam_width = 0.0f;
-int vector_device::m_flicker;
int vector_device::m_vector_index;
void vector_device::device_start()
@@ -160,13 +159,12 @@ void vector_device::device_start()
void vector_device::set_flicker(float _flicker)
{
- m_flicker_correction = _flicker;
- m_flicker = (int)(m_flicker_correction * 2.55f);
+ m_flicker = _flicker;
}
float vector_device::get_flicker()
{
- return m_flicker_correction;
+ return m_flicker;
}
void vector_device::set_beam(float _beam)
@@ -184,21 +182,30 @@ float vector_device::get_beam()
* Adds a line end point to the vertices list. The vector processor emulation
* needs to call this.
*/
-void vector_device::add_point (int x, int y, rgb_t color, int intensity)
+void vector_device::add_point(int x, int y, rgb_t color, int intensity)
{
point *newpoint;
- if (intensity > 0xff)
- intensity = 0xff;
+ if (intensity > 255)
+ {
+ intensity = 255;
+ }
if (m_flicker && (intensity > 0))
{
- intensity += (intensity * (0x80-(machine().rand()&0xff)) * m_flicker)>>16;
+ float random = (float)(machine().rand() & 255) / 255.0f; // random value between 0.0 and 1.0
+
+ intensity -= (int)(intensity * random * m_flicker);
if (intensity < 0)
+ {
intensity = 0;
- if (intensity > 0xff)
- intensity = 0xff;
+ }
+ if (intensity > 255)
+ {
+ intensity = 255;
+ }
}
+
newpoint = &m_vector_list[m_vector_index];
newpoint->x = x;
newpoint->y = y;
@@ -214,10 +221,11 @@ void vector_device::add_point (int x, int y, rgb_t color, int intensity)
}
}
+
/*
* Add new clipping info to the list
*/
-void vector_device::add_clip (int x1, int yy1, int x2, int y2)
+void vector_device::add_clip(int x1, int yy1, int x2, int y2)
{
point *newpoint;
@@ -241,7 +249,7 @@ void vector_device::add_clip (int x1, int yy1, int x2, int y2)
* The vector CPU creates a new display list. We save the old display list,
* but only once per refresh.
*/
-void vector_device::clear_list (void)
+void vector_device::clear_list(void)
{
m_vector_index = 0;
}
@@ -286,22 +294,32 @@ UINT32 vector_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
}
else
{
+ // todo: implement beam_width_overdrive based on intensity
+
+ float beam_width = m_beam_width * (1.0f / (float)VECTOR_WIDTH_DENOM);
+
coords.x0 = ((float)lastx - xoffs) * xscale;
coords.y0 = ((float)lasty - yoffs) * yscale;
coords.x1 = ((float)curpoint->x - xoffs) * xscale;
coords.y1 = ((float)curpoint->y - yoffs) * yscale;
- if (curpoint->intensity != 0)
- if (!render_clip_line(&coords, &clip))
- screen.container().add_line(coords.x0, coords.y0, coords.x1, coords.y1,
- m_beam_width * (1.0f / (float)VECTOR_WIDTH_DENOM),
- (curpoint->intensity << 24) | (curpoint->col & 0xffffff),
- flags);
+ // todo: extend line length by half beam_width on both sides
+
+ if (curpoint->intensity != 0 && !render_clip_line(&coords, &clip))
+ {
+ screen.container().add_line(
+ coords.x0, coords.y0, coords.x1, coords.y1,
+ beam_width,
+ (curpoint->intensity << 24) | (curpoint->col & 0xffffff),
+ flags);
+ }
lastx = curpoint->x;
lasty = curpoint->y;
}
+
curpoint++;
}
+
return 0;
}
diff --git a/src/emu/video/vector.h b/src/emu/video/vector.h
index 2e922d4a922..7827fce4a21 100644
--- a/src/emu/video/vector.h
+++ b/src/emu/video/vector.h
@@ -56,8 +56,7 @@ public:
virtual void device_start();
private:
- static int m_flicker; /* beam flicker value */
- static float m_flicker_correction;
+ static float m_flicker;
static float m_beam_width;
point *m_vector_list;
static int m_vector_index;