| 79 | } |
| 80 | |
| 81 | void PickingSystem::processCircle(glm::ivec2 center, float radius, bool cumulative) { |
| 82 | if (radius <= 0.0f) { |
| 83 | return; |
| 84 | } |
| 85 | if (!cumulative) { |
| 86 | clearSelection(); |
| 87 | } |
| 88 | |
| 89 | BaseRenderer* rend = renderer->get(); |
| 90 | const float radiusSqr = radius * radius; |
| 91 | for (size_t i = 0; i < atomStorage->size(); ++i) { |
| 92 | const glm::vec3 worldPos = displayAtomPos(i); |
| 93 | const glm::ivec2 atomScreen{rend->camera.worldToScreen(worldPos)}; |
| 94 | const glm::vec2 diff = glm::vec2(atomScreen - center); |
| 95 | if ((diff.x * diff.x + diff.y * diff.y) <= radiusSqr) { |
| 96 | selectedAtomIds.insert(atomStorage->atomId(i)); |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | bool PickingSystem::pickAtom(glm::ivec2 screenPos, float tolerance, AtomHit& hit) const { |
| 102 | BaseRenderer* rend = renderer->get(); |
no test coverage detected