diff options
author | 2016-03-23 22:37:45 +0100 | |
---|---|---|
committer | 2016-03-23 22:37:45 +0100 | |
commit | bfd9275427da83849ba962f2fdeda2e64b8d84b3 (patch) | |
tree | 572302f756c4d89b97e442da83bc2af86e8672e7 /src/emu/video | |
parent | 7e2bedbc766d8a4e5d564b99d01c779aaf8c7406 (diff) |
Improved junction points of vector lines
- and fixed size of vector points
Diffstat (limited to 'src/emu/video')
-rw-r--r-- | src/emu/video/vector.cpp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/src/emu/video/vector.cpp b/src/emu/video/vector.cpp index 36c303eda42..456ad9a00c2 100644 --- a/src/emu/video/vector.cpp +++ b/src/emu/video/vector.cpp @@ -350,14 +350,31 @@ UINT32 vector_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, coords.x1 = ((float)curpoint->x - xoffs) * xscale; coords.y1 = ((float)curpoint->y - yoffs) * yscale; - // extend zero-length vector line (vector point) by quarter beam_width on both sides - if (fabs(coords.x0 - coords.x1) < FLT_EPSILON && - fabs(coords.y0 - coords.y1) < FLT_EPSILON) + float xdistance = coords.x0 - coords.x1; + float ydistance = coords.y0 - coords.y1; + + // extend zero-length vector line (vector point) by 3/8 beam_width on both sides + if (fabs(xdistance) < FLT_EPSILON && + fabs(ydistance) < FLT_EPSILON) + { + coords.x0 += xratio * beam_width * 0.375f; + coords.y0 += yratio * beam_width * 0.375f; + coords.x1 -= xratio * beam_width * 0.375f; + coords.y1 -= yratio * beam_width * 0.375f; + } + // extend vector line by 3/8 beam_width on both sides + else { - coords.x0 += xratio * beam_width * 0.25f; - coords.y0 += yratio * beam_width * 0.25f; - coords.x1 -= xratio * beam_width * 0.25f; - coords.y1 -= yratio * beam_width * 0.25f; + xdistance *= xratio; + ydistance *= yratio; + float length = sqrt(xdistance * xdistance + ydistance * ydistance); + float xdirection = xdistance / length; + float ydirection = ydistance / length; + + coords.x0 += xratio * beam_width * 0.375f * xdirection; + coords.y0 += yratio * beam_width * 0.375f * ydirection; + coords.x1 -= xratio * beam_width * 0.375f * xdirection; + coords.y1 -= yratio * beam_width * 0.375f * ydirection; } if (curpoint->intensity != 0 && !render_clip_line(&coords, &clip)) |