DSF wrote:Ken,
If this may help you, I have implemented a little bit more information on the screen tampering with Celestia code, but it was not forthright.
The code I entered, mainly, allows me to see the Body mass, Gravity, Orbital Radius and Density, though more information is easily inserted if you put this into it.
First, I created a nw entry in the ssc files for bodies listing their Mass whigh goes like this:
Mass 5.98E+24
That's earth's mass.
Then, to make Celestia read this information, I added a new private property to the Body class in "body.h":
double mass;
and the following new methods:
double getMass() const;
void setMass(double);
float getDensity() const;
float getGravity() const;
which were defined in "body.cpp" like this:
double Body::getMass() const
{
return mass;
}
void Body::setMass(double _mass)
{
mass = _mass;
}
float Body::getGravity() const
{
return GRAVITATIONAL_CONSTANT * mass / pow(radius*1000, 2);
}
float Body::getDensity() const
{
return mass*1000 / (4 * PI * pow(radius*100000, 3) / 3);
}
Thus, the "CreatePlanet" function in "Solarsys.cpp" had to be altered to actually make Celestia read the information in the ssc files. This was easily done with the following lines:
double mass = 0.0;
planetData->getNumber("Mass", mass);
body->setMass(mass);
inserted at about line 377 of solarsys.cpp (right after the code loads the oblateness data).
Lastly, I modified "celestiacore.cpp" to allow it to display the new extra information, altering the "displayPlanetInfo" method by adding:
if (detail > 2)
{
overlay << "Period: " << body.getOrbit()->getPeriod() << " Earth days\n";
if (body.getMass() > 0)
{
overlay.printf("Mass: %.2E Kg\n", body.getMass());
overlay.printf("Gravity: %.2f m/s2\n", body.getGravity());
overlay.printf("Orbital Radius: %.2E km\n", body.getOrbit()->getBoundingRadius());
overlay.printf("Density: %.2f g/cm3\n", body.getDensity());
}
}
You may notice that the condition "if (detail > 2)" refers to a detail lever which will never be properly selected in Celestia, since its detail levels are 0, 1 or 2. I added a new detail level in the render options menu called "astro" with code 3 that allows for the selection of this new information.
The result:
![Embarassed :oops:](./images/smilies/icon_redface.gif)
pffff moi windows XP
Code: Select all
celestia\
celestia\data
celestia\extras
celestia\fonts
celestia\models
celestia\shaders
celestia\textures
![Question :?:](./images/smilies/icon_question.gif)
![Question :?:](./images/smilies/icon_question.gif)
![Question :?:](./images/smilies/icon_question.gif)
http://cvs.sourceforge.net/viewcvs.py/c ... ortby=date
CVS ??
bye tomorrow...