TrailGroup.cpp   TrailGroup.cpp 
skipping to change at line 39 skipping to change at line 39
j2000ToTrailNative=Mat4d::identity(); j2000ToTrailNative=Mat4d::identity();
j2000ToTrailNativeInverted=Mat4d::identity(); j2000ToTrailNativeInverted=Mat4d::identity();
} }
static QVector<Vec3d> vertexArray; static QVector<Vec3d> vertexArray;
static QVector<Vec4f> colorArray; static QVector<Vec4f> colorArray;
void TrailGroup::draw(StelCore* core, StelPainter* sPainter) void TrailGroup::draw(StelCore* core, StelPainter* sPainter)
{ {
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
float currentTime = core->getJDay(); float currentTime = core->getJDE();
StelProjector::ModelViewTranformP transfo = core->getJ2000ModelViewT ransform(); StelProjector::ModelViewTranformP transfo = core->getJ2000ModelViewT ransform();
transfo->combine(j2000ToTrailNativeInverted); transfo->combine(j2000ToTrailNativeInverted);
sPainter->setProjector(core->getProjection(transfo)); sPainter->setProjector(core->getProjection(transfo));
foreach (const Trail& trail, allTrails) foreach (const Trail& trail, allTrails)
{ {
Planet* hpl = dynamic_cast<Planet*>(trail.stelObject.data()) ; Planet* hpl = dynamic_cast<Planet*>(trail.stelObject.data()) ;
if (hpl!=NULL) if (hpl!=NULL)
{ {
// Avoid drawing the trails if the object is the hom e planet // Avoid drawing the trails if the object is the hom e planet
QString homePlanetName = hpl->getEnglishName(); QString homePlanetName = hpl->getEnglishName();
skipping to change at line 62 skipping to change at line 62
} }
const QList<Vec3d>& posHistory = trail.posHistory; const QList<Vec3d>& posHistory = trail.posHistory;
vertexArray.resize(posHistory.size()); vertexArray.resize(posHistory.size());
colorArray.resize(posHistory.size()); colorArray.resize(posHistory.size());
for (int i=0;i<posHistory.size();++i) for (int i=0;i<posHistory.size();++i)
{ {
float colorRatio = 1.f-(currentTime-times.at(i))/tim eExtent; float colorRatio = 1.f-(currentTime-times.at(i))/tim eExtent;
colorArray[i].set(trail.color[0], trail.color[1], tr ail.color[2], colorRatio*opacity); colorArray[i].set(trail.color[0], trail.color[1], tr ail.color[2], colorRatio*opacity);
vertexArray[i]=posHistory.at(i); vertexArray[i]=posHistory.at(i);
} }
sPainter->setVertexPointer(3, GL_DOUBLE, vertexArray.constDa sPainter->drawPath(vertexArray, colorArray);
ta());
sPainter->setColorPointer(4, GL_FLOAT, colorArray.constData(
));
sPainter->enableClientStates(true, false, true);
sPainter->drawFromArray(StelPainter::LineStrip, vertexArray.
size(), 0, true);
sPainter->enableClientStates(false);
} }
} }
// Add 1 point to all the curves at current time and suppress too old point s // Add 1 point to all the curves at current time and suppress too old point s
void TrailGroup::update() void TrailGroup::update()
{ {
times.append(StelApp::getInstance().getCore()->getJDay()); times.append(StelApp::getInstance().getCore()->getJDE());
for (QList<Trail>::Iterator iter=allTrails.begin();iter!=allTrails.e nd();++iter) for (QList<Trail>::Iterator iter=allTrails.begin();iter!=allTrails.e nd();++iter)
{ {
iter->posHistory.append(j2000ToTrailNative*iter->stelObject- >getJ2000EquatorialPos(StelApp::getInstance().getCore())); iter->posHistory.append(j2000ToTrailNative*iter->stelObject- >getJ2000EquatorialPos(StelApp::getInstance().getCore()));
} }
if (StelApp::getInstance().getCore()->getJDay()-times.at(0)>timeExte nt) if (StelApp::getInstance().getCore()->getJDE()-times.at(0)>timeExten t)
{ {
times.pop_front(); times.pop_front();
for (QList<Trail>::Iterator iter=allTrails.begin();iter!=all Trails.end();++iter) for (QList<Trail>::Iterator iter=allTrails.begin();iter!=all Trails.end();++iter)
{ {
iter->posHistory.pop_front(); iter->posHistory.pop_front();
} }
} }
} }
// Set the matrix to use to post process J2000 positions before storing in the trail // Set the matrix to use to post process J2000 positions before storing in the trail
 End of changes. 4 change blocks. 
11 lines changed or deleted 4 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/