From 11d5330c7363ea13a44a20c51a3d56d807c21aba Mon Sep 17 00:00:00 2001 From: Cat Flynn Date: Tue, 20 Aug 2024 20:21:44 +0100 Subject: [PATCH] fix: copy particle id on construction --- src/main.cpp | 7 +++---- src/particlevisualizer.hpp | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 708df89..1b42efc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -106,12 +106,11 @@ int main() // TODO: add something in a nice eccentric orbit around the moon // make the earth-moon system ParticleMap map; - map.setParticle({"moon", 7.3e22}); map.setParticle({"earth", 5.9e24}); - map.setRelationship("moon", "earth", orbit); - // TODO: there is a bug where re-ordering the visualizers breaks rendering - ParticleVisualizer moonVis(map, "moon", 0.1, litProgram, unlitProgram); + map.setParticle({"moon", 7.3e22}); + map.setRelationship("earth", "moon", orbit); ParticleVisualizer earthVis(map, "earth", 0.2, litProgram, unlitProgram); + ParticleVisualizer moonVis(map, "moon", 0.1, litProgram, unlitProgram); OrbitVisualizer orbitVis(orbit, unlitProgram); // register input diff --git a/src/particlevisualizer.hpp b/src/particlevisualizer.hpp index 19808e2..d16c987 100644 --- a/src/particlevisualizer.hpp +++ b/src/particlevisualizer.hpp @@ -17,7 +17,7 @@ class ParticleVisualizer void updateModelMatrix(); const ParticleMap& _map; - const std::string& _particleId; + const std::string _particleId; Icosphere _sphere; Widget _widget; };