| 713 | } |
| 714 | |
| 715 | List<LightSource> NetworkedAnimator::lightSources(Vec2F const& translate) const { |
| 716 | List<LightSource> lightSources; |
| 717 | for (auto const& pair : m_lights) { |
| 718 | if (!pair.second.active.get()) |
| 719 | continue; |
| 720 | |
| 721 | Vec2F position = {pair.second.xPosition.get(), pair.second.yPosition.get()}; |
| 722 | float pointAngle = constrainAngle(pair.second.pointAngle.get()); |
| 723 | Mat3F transformation = Mat3F::identity(); |
| 724 | if (pair.second.anchorPart) |
| 725 | transformation = partTransformation(*pair.second.anchorPart); |
| 726 | transformation = groupTransformation(pair.second.transformationGroups) * transformation; |
| 727 | position = transformation.transformVec2(position); |
| 728 | pointAngle = transformation.transformAngle(pointAngle); |
| 729 | if (pair.second.rotationGroup) { |
| 730 | auto const& rg = m_rotationGroups.get(*pair.second.rotationGroup); |
| 731 | position = (position - pair.second.rotationCenter.value(rg.rotationCenter)).rotate(rg.currentAngle) |
| 732 | + pair.second.rotationCenter.value(rg.rotationCenter); |
| 733 | pointAngle += rg.currentAngle; |
| 734 | } |
| 735 | position = globalTransformation().transformVec2(position); |
| 736 | if (m_flipped.get()) { |
| 737 | if (pointAngle > 0) |
| 738 | pointAngle = Constants::pi / 2 + constrainAngle(Constants::pi / 2 - pointAngle); |
| 739 | else |
| 740 | pointAngle = -Constants::pi / 2 - constrainAngle(pointAngle + Constants::pi / 2); |
| 741 | } |
| 742 | |
| 743 | Color color = pair.second.color.get(); |
| 744 | if (pair.second.flicker) |
| 745 | color.setValue(clamp(color.value() * pair.second.flicker->value(SinWeightOperator<float>()), 0.0f, 1.0f)); |
| 746 | |
| 747 | lightSources.append(LightSource{ |
| 748 | position + translate, |
| 749 | color.toRgbF(), |
| 750 | pair.second.pointLight ? LightType::Point : LightType::Spread, |
| 751 | pair.second.pointBeam, |
| 752 | pointAngle, |
| 753 | pair.second.beamAmbience |
| 754 | }); |
| 755 | } |
| 756 | return lightSources; |
| 757 | } |
| 758 | |
| 759 | void NetworkedAnimator::update(float dt, DynamicTarget* dynamicTarget) { |
| 760 | dt *= m_animationRate.get(); |
nothing calls this directly
no test coverage detected