Comet.cpp   Comet.cpp 
skipping to change at line 254 skipping to change at line 254
if (withDecimalDegree) if (withDecimalDegree)
{ {
oss << QString(q_("Phase Angle: %1")).arg(StelUtils: :radToDecDegStr(getPhaseAngle(observerHelioPos),4,false,true)) << "<br>"; oss << QString(q_("Phase Angle: %1")).arg(StelUtils: :radToDecDegStr(getPhaseAngle(observerHelioPos),4,false,true)) << "<br>";
oss << QString(q_("Elongation: %1")).arg(StelUtils:: radToDecDegStr(elongation,4,false,true)) << "<br>"; oss << QString(q_("Elongation: %1")).arg(StelUtils:: radToDecDegStr(elongation,4,false,true)) << "<br>";
} }
else else
{ {
oss << QString(q_("Phase Angle: %1")).arg(StelUtils: :radToDmsStr(getPhaseAngle(observerHelioPos), true)) << "<br>"; oss << QString(q_("Phase Angle: %1")).arg(StelUtils: :radToDmsStr(getPhaseAngle(observerHelioPos), true)) << "<br>";
oss << QString(q_("Elongation: %1")).arg(StelUtils:: radToDmsStr(elongation, true)) << "<br>"; oss << QString(q_("Elongation: %1")).arg(StelUtils:: radToDmsStr(elongation, true)) << "<br>";
} }
} }
if ((flags&Size) && (tailFactors[0]>0.0f)) if ((flags&Size) && (tailFactors[0]>0.0f))
{ {
// GZ: Add estimates for coma diameter and tail length. // GZ: Add estimates for coma diameter and tail length.
// xgettext:no-c-format // xgettext:no-c-format
oss << QString(q_("Coma diameter (estimate): %1 km")) oss << QString(q_("Coma diameter (estimate): %1 km"))
.arg(floor(tailFactors[0]*AU/1000.0f)*1000.0f, 0, 'f', 0); .arg(floor(tailFactors[0]*AU/1000.0f)*1000.0f, 0, 'f', 0);
oss << "<br>"; oss << "<br>";
// xgettext:no-c-format // xgettext:no-c-format
oss << QString(q_("Gas tail length (estimate): %1 Mio km")) oss << QString(q_("Gas tail length (estimate): %1 Mio km"))
.arg(tailFactors[1]*AU*1e-6, 0, 'G', 3); .arg(tailFactors[1]*AU*1e-6, 0, 'G', 3);
oss << "<br>"; oss << "<br>";
} }
postProcessInfoString(str, flags); postProcessInfoString(str, flags);
return str; return str;
} }
QVariantMap Comet::getInfoMap(const StelCore *core) const
{
QVariantMap map = StelObject::getInfoMap(core);
map.insert("tail-length-km", tailFactors[1]*AU);
map.insert("coma-diameter-km", tailFactors[0]*AU);
return map;
}
void Comet::setSemiMajorAxis(const double value) void Comet::setSemiMajorAxis(const double value)
{ {
semiMajorAxis = value; semiMajorAxis = value;
} }
double Comet::getSiderealPeriod() const double Comet::getSiderealPeriod() const
{ {
double period; double period;
if (semiMajorAxis>0) if (semiMajorAxis>0)
period = StelUtils::calculateSiderealPeriod(semiMajorAxis); period = StelUtils::calculateSiderealPeriod(semiMajorAxis);
skipping to change at line 547 skipping to change at line 554
drawTail(core,transfo,true); // gas tail drawTail(core,transfo,true); // gas tail
drawTail(core,transfo,false); // dust tail drawTail(core,transfo,false); // dust tail
} }
//Coma: this is just a fan disk tilted towards the observer;-) //Coma: this is just a fan disk tilted towards the observer;-)
drawComa(core, transfo); drawComa(core, transfo);
return; return;
} }
void Comet::drawTail(StelCore* core, StelProjector::ModelViewTranformP tran sfo, bool gas) void Comet::drawTail(StelCore* core, StelProjector::ModelViewTranformP tran sfo, bool gas)
{ {
StelPainter* sPainter = new StelPainter(core->getProjection(transfo) StelPainter sPainter(core->getProjection(transfo));
); sPainter.setBlending(true, GL_ONE, GL_ONE);
glEnable(GL_BLEND); sPainter.setCullFace(false);
glBlendFunc(GL_ONE, GL_ONE);
glDisable(GL_CULL_FACE);
tailTexture->bind(); tailTexture->bind();
if (gas) { if (gas) {
sPainter->setArrays((Vec3d*)gastailVertexArr.constData(), (V sPainter.setArrays((Vec3d*)gastailVertexArr.constData(), (Ve
ec2f*)tailTexCoordArr.constData(), (Vec3f*)gastailColorArr.constData()); c2f*)tailTexCoordArr.constData(), (Vec3f*)gastailColorArr.constData());
sPainter->drawFromArray(StelPainter::Triangles, tailIndices. sPainter.drawFromArray(StelPainter::Triangles, tailIndices.s
size(), 0, true, tailIndices.constData()); ize(), 0, true, tailIndices.constData());
} else { } else {
sPainter->setArrays((Vec3d*)dusttailVertexArr.constData(), ( sPainter.setArrays((Vec3d*)dusttailVertexArr.constData(), (V
Vec2f*)tailTexCoordArr.constData(), (Vec3f*)dusttailColorArr.constData()); ec2f*)tailTexCoordArr.constData(), (Vec3f*)dusttailColorArr.constData());
sPainter->drawFromArray(StelPainter::Triangles, tailIndices. sPainter.drawFromArray(StelPainter::Triangles, tailIndices.s
size(), 0, true, tailIndices.constData()); ize(), 0, true, tailIndices.constData());
} }
glDisable(GL_BLEND); sPainter.setBlending(false);
delete sPainter;
sPainter=NULL;
} }
void Comet::drawComa(StelCore* core, StelProjector::ModelViewTranformP tran sfo) void Comet::drawComa(StelCore* core, StelProjector::ModelViewTranformP tran sfo)
{ {
// Find rotation matrix from 0/0/1 to viewdirection! crossproduct fo r axis (normal vector), dotproduct for angle. // Find rotation matrix from 0/0/1 to viewdirection! crossproduct fo r axis (normal vector), dotproduct for angle.
Vec3d eclposNrm=eclipticPos - core->getObserverHeliocentricEclipticP os() ; eclposNrm.normalize(); Vec3d eclposNrm=eclipticPos - core->getObserverHeliocentricEclipticP os() ; eclposNrm.normalize();
Mat4d comarot=Mat4d::rotation(Vec3d(0.0, 0.0, 1.0)^(eclposNrm), std: :acos(Vec3d(0.0, 0.0, 1.0).dot(eclposNrm)) ); Mat4d comarot=Mat4d::rotation(Vec3d(0.0, 0.0, 1.0)^(eclposNrm), std: :acos(Vec3d(0.0, 0.0, 1.0).dot(eclposNrm)) );
StelProjector::ModelViewTranformP transfo2 = transfo->clone(); StelProjector::ModelViewTranformP transfo2 = transfo->clone();
transfo2->combine(comarot); transfo2->combine(comarot);
StelPainter* sPainter = new StelPainter(core->getProjection(transfo2 )); StelPainter sPainter(core->getProjection(transfo2));
glEnable(GL_BLEND); sPainter.setBlending(true, GL_ONE, GL_ONE);
glBlendFunc(GL_ONE, GL_ONE); sPainter.setCullFace(false);
glDisable(GL_CULL_FACE);
StelToneReproducer* eye = core->getToneReproducer(); StelToneReproducer* eye = core->getToneReproducer();
float lum = core->getSkyDrawer()->surfacebrightnessToLuminance(getVM agnitudeWithExtinction(core)+11.0f); // How to calibrate? float lum = core->getSkyDrawer()->surfacebrightnessToLuminance(getVM agnitudeWithExtinction(core)+11.0f); // How to calibrate?
// Get the luminance scaled between 0 and 1 // Get the luminance scaled between 0 and 1
float aLum =eye->adaptLuminanceScaled(lum); float aLum =eye->adaptLuminanceScaled(lum);
float magFactor=qMin(qMax(aLum, 0.25f), 2.0f); float magFactor=qMin(qMax(aLum, 0.25f), 2.0f);
comaTexture->bind(); comaTexture->bind();
sPainter->setColor(0.3f*magFactor,0.7*magFactor,magFactor); sPainter.setColor(0.3f*magFactor,0.7*magFactor,magFactor);
sPainter->setArrays((Vec3d*)comaVertexArr.constData(), (Vec2f*)comaT sPainter.setArrays((Vec3d*)comaVertexArr.constData(), (Vec2f*)comaTe
exCoordArr.constData()); xCoordArr.constData());
sPainter->drawFromArray(StelPainter::Triangles, comaVertexArr.size() sPainter.drawFromArray(StelPainter::Triangles, comaVertexArr.size()/
/3); 3);
glDisable(GL_BLEND);
delete sPainter; sPainter.setBlending(false);
sPainter=NULL;
} }
// Formula found at http://www.projectpluto.com/update7b.htm#comet_tail_for mula // Formula found at http://www.projectpluto.com/update7b.htm#comet_tail_for mula
Vec2f Comet::getComaDiameterAndTailLengthAU() Vec2f Comet::getComaDiameterAndTailLengthAU()
{ {
float r = getHeliocentricEclipticPos().length(); float r = getHeliocentricEclipticPos().length();
float mhelio = absoluteMagnitude + slopeParameter * log10(r); float mhelio = absoluteMagnitude + slopeParameter * log10(r);
float Do = pow(10.0f, ((-0.0033f*mhelio - 0.07f) * mhelio + 3.25f)); float Do = pow(10.0f, ((-0.0033f*mhelio - 0.07f) * mhelio + 3.25f));
float common = 1.0f - pow(10.0f, (-2.0f*r)); float common = 1.0f - pow(10.0f, (-2.0f*r));
float D = Do * common * (1.0f - pow(10.0f, -r)) * (1000.0f*AU_KM); float D = Do * common * (1.0f - pow(10.0f, -r)) * (1000.0f*AU_KM);
 End of changes. 10 change blocks. 
31 lines changed or deleted 29 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/