refactor: move sphere to visualizer

This commit is contained in:
Cat Flynn 2024-08-18 13:22:04 +01:00
parent 284c82f7ea
commit 4d9adf2e7f
3 changed files with 5 additions and 7 deletions

View File

@ -95,7 +95,6 @@ int main()
// set up scene
Icosphere planet(0.2, 3, litProgram);
//Orbiter orbiter(orbiterSphere, orbit, unlitProgram);
Orbiter orbiter;
Orbit& orbit = orbiter.getOrbit();
orbit.setSemiMajorAxis(.75);
@ -104,8 +103,7 @@ int main()
orbit.setArgumentOfPeriapsis(2.0);
orbit.setLongitudeOfAscendingNode(0.1);
Icosphere orbiterSphere(0.07, 2, litProgram);
OrbiterVisualizer orbiterVisualizer(orbiter, orbiterSphere, unlitProgram);
OrbiterVisualizer orbiterVisualizer(orbiter, litProgram, unlitProgram);
OrbitVisualizer orbitVisualizer(orbit, unlitProgram);
// register input

View File

@ -1,7 +1,7 @@
#include "orbitervisualizer.hpp"
OrbiterVisualizer::OrbiterVisualizer(Orbiter& orbiter, Icosphere& sphere, GLuint shaderProgram)
: _orbiter(orbiter), _sphere(sphere), _widget(shaderProgram)
OrbiterVisualizer::OrbiterVisualizer(Orbiter& orbiter, GLuint sphereShaderProgram, GLuint widgetShaderProgram)
: _orbiter(orbiter), _sphere({0.07, 2, sphereShaderProgram}), _widget(widgetShaderProgram)
{
}

View File

@ -7,7 +7,7 @@
class OrbiterVisualizer
{
public:
OrbiterVisualizer(Orbiter& orbiter, Icosphere& sphere, GLuint shaderProgram);
OrbiterVisualizer(Orbiter& orbiter, GLuint sphereShaderProgram, GLuint widgetShaderProgram);
~OrbiterVisualizer() = default;
void render(float time);
@ -16,6 +16,6 @@ class OrbiterVisualizer
void updateModelMatrix();
Orbiter& _orbiter;
Icosphere& _sphere;
Icosphere _sphere;
Widget _widget;
};