| 66 | } |
| 67 | |
| 68 | void WirePane::renderWire(Vec2F from, Vec2F to, Color baseColor) { |
| 69 | if (m_worldClient->isTileProtected(Vec2I::floor(from)) || m_worldClient->isTileProtected(Vec2I::floor(to))) |
| 70 | return; |
| 71 | |
| 72 | from = m_worldPainter->camera().worldToScreen(from); |
| 73 | to = m_worldPainter->camera().worldToScreen(to); |
| 74 | |
| 75 | auto rangeRand = [&](float dev, float min, float max) { |
| 76 | return clamp<float>(Random::nrandf(dev, max), min, max); |
| 77 | }; |
| 78 | |
| 79 | float lineThickness = m_worldPainter->camera().pixelRatio() * rangeRand(m_beamWidthDev, m_minBeamWidth, m_maxBeamWidth); |
| 80 | float beamTransparency = rangeRand(m_beamTransDev, m_minBeamTrans, m_maxBeamTrans); |
| 81 | baseColor.setAlphaF(baseColor.alphaF() * beamTransparency); |
| 82 | Color innerStripe = baseColor; |
| 83 | innerStripe.setValue(1 - (1 - innerStripe.value()) / m_innerBrightnessScale); |
| 84 | innerStripe.setSaturation(innerStripe.saturation() / m_innerBrightnessScale); |
| 85 | Color firstStripe = innerStripe; |
| 86 | innerStripe.setValue(1 - (1 - innerStripe.value()) / m_innerBrightnessScale); |
| 87 | innerStripe.setSaturation(innerStripe.saturation() / m_innerBrightnessScale); |
| 88 | Color secondStripe = innerStripe; |
| 89 | |
| 90 | context()->drawLine(from, to, baseColor.toRgba(), lineThickness); |
| 91 | context()->drawLine(from, to, firstStripe.toRgba(), lineThickness * m_firstStripeThickness); |
| 92 | context()->drawLine(from, to, secondStripe.toRgba(), lineThickness * m_secondStripeThickness); |
| 93 | } |
| 94 | |
| 95 | void WirePane::renderImpl() { |
| 96 | if (!m_worldClient->inWorld()) |
nothing calls this directly
no test coverage detected