diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/emu/ui/ui.c | 4 | ||||
-rw-r--r-- | src/emu/video/vector.c | 56 | ||||
-rw-r--r-- | src/emu/video/vector.h | 3 |
3 files changed, 40 insertions, 23 deletions
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; |