Wednesday, May 9, 2012

Coma no halo

I put a fake comet for testing in Stellarium with these values:

[0testcomet]
parent = Sun
orbit_Inclination = 40
coord_func = comet_orbit
orbit_Eccentricity = 0.432778
orbit_ArgOfPericenter = 117.8131
absolute_magnitude = -50
name = 0testComet
slope_parameter = 4
lighting = false
tex_map = nomap.png
color = 1.0, 1.0, 1.0
orbit_AscendingNode = 207.8674
albedo = 1
radius = 5
orbit_PericenterDistance = 10
type = comet
orbit_TimeAtPericenter = 2456447.93229167

It showed up on Stellarium like this:
So there was the textures/halo.png. Normally it is only visible as a dot[1]. But putting tex_halo = NULL in ssystem.ini didn't help.

[1]At absolute_magnitude = -10, it looked like how it usually does:

There shouldn't be a halo even when the comet is large.

Tracking it down to StelSkyDrawer.cpp/postDrawSky3dModel():
SolarSystem::draw()
   for each(Planet &p, systemPlanets)
        p->draw()

Planet::draw()
    core -> getSkyDrawer()-> postDrawSky3dModel(); // last line

Added the following public member functions to Planet:
void setIsComet(bool is);
bool getIsComet(); // returns true
And the member variable bool isComet, which by default is false, until set to true in SolarSystem.cpp when comet object is initialized.

Then, in postDrawSky3dModel(), halo is skipped if the object is a comet. So now 0testComet only shows up as a fuzzy ball of light. Still, at this magnitude it should have tails and the coma shouldn't be spherical.


Update: knowing whether or not planet is comet throughout the rest of the code could be useful since the way draw() will work should be different.

Update 2: To draw comet,
(1) postDrawSky3dModelComet(), or
(2) a drawing laid on top of postDrawSky3dModel()
i.e.

Planet::draw()
    if Comet,
          comet->postDrawSky3dModelComet()
    core -> getSkyDrawer()-> postDrawSky3dModel(); // last line
(3) a comet exclusive function
i.e.

Planet::draw()
    if Comet,
          comet->postDrawSky3dModelComet()
    else
          core -> getSkyDrawer()-> postDrawSky3dModel(); // last line

Probably shouldn't completely separate Comet class from Solar System or Planet parent class.

No comments:

Post a Comment