Use shaders to draw orbits
parent
5af66f9ab2
commit
fbd83e5587
|
@ -1572,6 +1572,10 @@ void Renderer::renderOrbit(const OrbitPathListEntry& orbitPath,
|
||||||
float nearDist,
|
float nearDist,
|
||||||
float farDist)
|
float farDist)
|
||||||
{
|
{
|
||||||
|
auto *prog = shaderManager->getShader(ShaderProperties::PerVertexColor);
|
||||||
|
if (prog == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
Body* body = orbitPath.body;
|
Body* body = orbitPath.body;
|
||||||
double nearZ = -nearDist; // negate, becase z is into the screen in camera space
|
double nearZ = -nearDist; // negate, becase z is into the screen in camera space
|
||||||
double farZ = -farDist;
|
double farZ = -farDist;
|
||||||
|
@ -1755,7 +1759,6 @@ void Renderer::renderOrbit(const OrbitPathListEntry& orbitPath,
|
||||||
else
|
else
|
||||||
highlight = highlightObject.star() == orbitPath.star;
|
highlight = highlightObject.star() == orbitPath.star;
|
||||||
Vector4f orbitColor = renderOrbitColor(body, highlight, orbitPath.opacity);
|
Vector4f orbitColor = renderOrbitColor(body, highlight, orbitPath.opacity);
|
||||||
glColor4fv(orbitColor.data());
|
|
||||||
|
|
||||||
#ifdef STIPPLED_LINES
|
#ifdef STIPPLED_LINES
|
||||||
glLineStipple(3, 0x5555);
|
glLineStipple(3, 0x5555);
|
||||||
|
@ -1770,6 +1773,7 @@ void Renderer::renderOrbit(const OrbitPathListEntry& orbitPath,
|
||||||
viewFrustumPlaneNormals[i] = frustum.plane(i).normal().cast<double>();
|
viewFrustumPlaneNormals[i] = frustum.plane(i).normal().cast<double>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prog->use();
|
||||||
if (orbit->isPeriodic())
|
if (orbit->isPeriodic())
|
||||||
{
|
{
|
||||||
double period = orbit->getPeriod();
|
double period = orbit->getPeriod();
|
||||||
|
@ -1821,6 +1825,7 @@ void Renderer::renderOrbit(const OrbitPathListEntry& orbitPath,
|
||||||
glDisable(GL_LINE_STIPPLE);
|
glDisable(GL_LINE_STIPPLE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
glUseProgram(0);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue