MeteorStream.cpp   MeteorStream.cpp 
skipping to change at line 32 skipping to change at line 32
MeteorStream::MeteorStream(const StelCore* core, MeteorStream::MeteorStream(const StelCore* core,
int speed, int speed,
float radiantAlpha, float radiantAlpha,
float radiantDelta, float radiantDelta,
float pidx, float pidx,
QList<MeteorShower::colorPair> colors) QList<MeteorShower::colorPair> colors)
: m_speed(speed) : m_speed(speed)
, m_segments(10) , m_segments(10)
{ {
qsrand (QDateTime::currentMSecsSinceEpoch());
// if speed is zero, use a random value // if speed is zero, use a random value
if (!speed) if (!speed)
{ {
m_speed = 11+(double)rand()/((double)RAND_MAX+1)*61; // abs range 11-72 km/s m_speed = 11+(double)qrand()/((double)RAND_MAX+1)*61; // ab s range 11-72 km/s
} }
// view matrix of meteor model // view matrix of meteor model
m_viewMatrix = Mat4d::zrotation(radiantAlpha) * Mat4d::yrotation(M_P I_2 - radiantDelta); m_viewMatrix = Mat4d::zrotation(radiantAlpha) * Mat4d::yrotation(M_P I_2 - radiantDelta);
// building meteor model // building meteor model
m_alive = Meteor::initMeteorModel(core, m_segments, m_viewMatrix, me teor); m_alive = Meteor::initMeteorModel(core, m_segments, m_viewMatrix, me teor);
if (!m_alive) if (!m_alive)
{ {
return; return;
} }
// implements the population index // implements the population index
float oneMag = -0.2; // negative, working in different scale ( 0 to 1 - where 1 is brighter) float oneMag = -0.2; // negative, working in different scale ( 0 to 1 - where 1 is brighter)
if (pidx) // is not zero if (pidx) // is not zero
{ {
if (rand()%100 < 100.f/pidx) // probability if (qrand()%100 < 100.f/pidx) // probability
{ {
meteor.mag += oneMag; // (m+1) meteor.mag += oneMag; // (m+1)
} }
} }
// determine the meteor color // determine the meteor color
if (colors.isEmpty()) { if (colors.isEmpty()) {
colors.push_back(MeteorShower::colorPair("white", 100)); colors.push_back(MeteorShower::colorPair("white", 100));
} else { } else {
// handle cases when the total intensity is less than 100 // handle cases when the total intensity is less than 100
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 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/