summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander V. Wolf <alex.v.wolf@gmail.com>2022-05-20 21:08:31 +0700
committerAlexander V. Wolf <alex.v.wolf@gmail.com>2022-05-20 21:08:31 +0700
commit56c1d54f6e15946c69b6c5d333632562b9ddc967 (patch)
treea7a3634818886f9a6e6ccd78fb2ca8605911cbee
parentd5619749ded4476e61744c832524af5616350312 (diff)
Fixed rendering orbits of artificial satellites (fix #2452)
-rw-r--r--plugins/Satellites/src/Satellite.cpp35
1 files changed, 17 insertions, 18 deletions
diff --git a/plugins/Satellites/src/Satellite.cpp b/plugins/Satellites/src/Satellite.cpp
index 1dc51b034c..c3aec8ee90 100644
--- a/plugins/Satellites/src/Satellite.cpp
+++ b/plugins/Satellites/src/Satellite.cpp
@@ -995,33 +995,32 @@ void Satellite::draw(StelCore* core, StelPainter& painter)
void Satellite::drawOrbit(StelCore *core, StelPainter& painter)
{
- Vec3d position, onscreen;
- Vec3f drawColor;
int size = orbitPoints.size();
- QVector<Vec3d> vertexArray;
- QVector<Vec4f> colorArray;
- StelProjectorP prj = painter.getProjector();
-
- vertexArray.resize(size);
- colorArray.resize(size);
-
- //Rest of points
- for (int i=1; i<size; i++)
+ if (size>0)
{
- position = core->altAzToJ2000(orbitPoints[i].toVec3d(), StelCore::RefractionOff);
- position.normalize();
- if (prj->project(position, onscreen)) // check position on the screen
+ Vec3d position;
+ Vec3f drawColor;
+ QVector<Vec3d> vertexArray;
+ QVector<Vec4f> colorArray;
+ vertexArray.resize(size);
+ colorArray.resize(size);
+
+ //Rest of points
+ for (int i=0; i<size; i++)
{
- vertexArray.append(position);
+ position = core->altAzToJ2000(orbitPoints[i].toVec3d(), StelCore::RefractionOff);
+ position.normalize();
+ vertexArray[i] = position;
drawColor = (visibilityPoints[i] == gSatWrapper::VISIBLE) ? orbitColor : invisibleSatelliteColor;
if (hideInvisibleSatellitesFlag && visibilityPoints[i] != gSatWrapper::VISIBLE)
- colorArray.append(Vec4f(0.f,0.f,0.f,0.f)); // hide invisible part of orbit
+ colorArray[i] = Vec4f(0.f,0.f,0.f,0.f); // hide invisible part of orbit
else
- colorArray.append(Vec4f(drawColor, hintBrightness * calculateOrbitSegmentIntensity(i)));
+ colorArray[i] = Vec4f(drawColor, hintBrightness * calculateOrbitSegmentIntensity(i));
}
+
+ painter.drawPath(vertexArray, colorArray); // (does client state switching as needed internally)
}
- painter.drawPath(vertexArray, colorArray); // (does client state switching as needed internally)
}
float Satellite::calculateOrbitSegmentIntensity(int segNum)