fix: copy particle id on construction

This commit is contained in:
Cat Flynn 2024-08-20 20:21:44 +01:00
parent 56aa50251b
commit 11d5330c73
2 changed files with 4 additions and 5 deletions

View File

@ -106,12 +106,11 @@ int main()
// TODO: add something in a nice eccentric orbit around the moon // TODO: add something in a nice eccentric orbit around the moon
// make the earth-moon system // make the earth-moon system
ParticleMap map; ParticleMap map;
map.setParticle({"moon", 7.3e22});
map.setParticle({"earth", 5.9e24}); map.setParticle({"earth", 5.9e24});
map.setRelationship("moon", "earth", orbit); map.setParticle({"moon", 7.3e22});
// TODO: there is a bug where re-ordering the visualizers breaks rendering map.setRelationship("earth", "moon", orbit);
ParticleVisualizer moonVis(map, "moon", 0.1, litProgram, unlitProgram);
ParticleVisualizer earthVis(map, "earth", 0.2, litProgram, unlitProgram); ParticleVisualizer earthVis(map, "earth", 0.2, litProgram, unlitProgram);
ParticleVisualizer moonVis(map, "moon", 0.1, litProgram, unlitProgram);
OrbitVisualizer orbitVis(orbit, unlitProgram); OrbitVisualizer orbitVis(orbit, unlitProgram);
// register input // register input

View File

@ -17,7 +17,7 @@ class ParticleVisualizer
void updateModelMatrix(); void updateModelMatrix();
const ParticleMap& _map; const ParticleMap& _map;
const std::string& _particleId; const std::string _particleId;
Icosphere _sphere; Icosphere _sphere;
Widget _widget; Widget _widget;
}; };