summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author ImJezze <jezze@gmx.net>2016-03-24 17:00:21 +0100
committer ImJezze <jezze@gmx.net>2016-03-24 17:00:21 +0100
commit6c95a274901c935bb57cdde5b0edd4cf772091ed (patch)
tree6e0e0697acccc46233aca8d3aa4f71e0ffb7330e
parentbfd9275427da83849ba962f2fdeda2e64b8d84b3 (diff)
Fixed direction of vector extension
-rw-r--r--src/emu/video/vector.cpp26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/emu/video/vector.cpp b/src/emu/video/vector.cpp
index 456ad9a00c2..e6db787d12c 100644
--- a/src/emu/video/vector.cpp
+++ b/src/emu/video/vector.cpp
@@ -332,18 +332,16 @@ UINT32 vector_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
}
else
{
- float beam_intensity_width = m_beam_width_min;
-
float intensity = (float)curpoint->intensity / 255.0f;
+ float intensity_weight = normalized_sigmoid(intensity, m_beam_intensity_weight);
- // check for dynamic intensity
- if (m_min_intensity != m_max_intensity)
- {
- float intensity_weight = normalized_sigmoid(intensity, m_beam_intensity_weight);
- beam_intensity_width = (m_beam_width_max - m_beam_width_min) * intensity_weight + m_beam_width_min;
- }
+ // check for static intensity
+ float beam_width = m_min_intensity == m_max_intensity
+ ? m_beam_width_min
+ : m_beam_width_min + intensity_weight * (m_beam_width_max - m_beam_width_min);
- float beam_width = beam_intensity_width * (1.0f / (float)VECTOR_WIDTH_DENOM);
+ // normalize width
+ beam_width *= 1.0f / (float)VECTOR_WIDTH_DENOM;
coords.x0 = ((float)lastx - xoffs) * xscale;
coords.y0 = ((float)lasty - yoffs) * yscale;
@@ -365,16 +363,14 @@ UINT32 vector_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
// extend vector line by 3/8 beam_width on both sides
else
{
- 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;
+ coords.x0 += xratio * beam_width * 0.375f * (xdirection / xratio);
+ coords.y0 += yratio * beam_width * 0.375f * (ydirection / yratio);
+ coords.x1 -= xratio * beam_width * 0.375f * (xdirection / xratio);
+ coords.y1 -= yratio * beam_width * 0.375f * (ydirection / yratio);
}
if (curpoint->intensity != 0 && !render_clip_line(&coords, &clip))