Stellarium Developer guide
v 0.2
Abstract:
This document is aimed at giving a global vision on the organization of the program source code.
Stellarium is almost totally designed in an object oriented way. Its source code is thus quite easy to understand and is well subdivided.
The interface with the OS is done using the SDL library which has proven to be powerfull, truly multiplateform and fast.
Project managment is done using sourceforge.net services for cvs hosting, bug tracking, forums etc.. Globally, everything usefull for the project is available at the main project page http://sourceforge.net/projects/stellarium/.
First of all, as stellarium is mainly programmed in C++ you will need some knowledge in object oriented programming.
You will then need to use the GNU development tools and utilities that are required for working on free projects.
Stellarium source code is stored on sourceforge.net server using cvs (concurent version system). This enable everybody to download the last changes in the sources. The cvs version of stellarium is usually on development and might not work at all.
Here are the first steps to start working on the sourcecode : (see detailed instructions from sourceforge cvs page)
In the stellarium cvs repository, there is only one module called "stellarium"
containing all the project files. So, to get the files as anonymous developer, just type (as explained) :
cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/stellarium login
and type enter when a password is required.
cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/stellarium co stellarium
(co = checkout)
And normally all the project files should be downloaded in a new stellarium/ directory.
In this directory you will find the script autogen.sh that you need to execute in
order to run the automake/autoconf things.
After that you can launch the ./configure script which will analyze your system.
If everything goes fine, the command make should then compile all the sourcecode.
You can now try to launch the local version by typing ./src/stellarium
Here you are!
You can now have a look at the src/ directory where you will find the source files described below.
Edit whatever you want in it and when your new great feature is done you will need to share it with the community of stellarium developers.
At this point, an official developer just have to type cvs commit to update the repository version. But as you are not an official developer (yet!) you will need to create a patch file which will contain all the changes you did on the source code.
cd directory-you-want-to-diff
cvs -z3 diff -u > mypatch.diff
You can now submit mypatch.diff on the sourceforge stellarium page in the patches section
with a clear comment on what is the patch doing.
The project administrator will then have a look at it and decide whether the patch is accepted or rejected for integration into stellarium.
All the files starting with a s_ are "theoricaly" independent of the main program. They manage textures, font and user interface and could be re-used for any other openGL application.
- stel_sdl.h/cpp :
- Class handling sdl functions. It contains the main loop intercepting all the system events and send them to the core.
- stel_core.h/cpp :
- Main stellarium class. It manages all the main components of the program and stores all the attributes of the program.
The 3 main functions of the program are methods of his class. They are :
- init() :
- Initialize the core of the program : creates all the main objects and initialize them.
- update() :
- Update all the objects : time, viewing, planet positions, moves, user interface etc..
- draw() :
- Draw everything on the openGL buffer.
update() and draw() are called in the main loop at each iteration.
The stel_core class manages all the configuration file reading and saving.
- navigator.h/cpp :
- Manage all the astronomical navigational functions. Used for frames conversions.
- observator.h/cpp :
- Manage all the information relative to an observator (position, locales etc..)
- projector.h/cpp and fisheye_projector.h/cpp :
- One of the class i'm proud of :). Manage various kind of projections : perspective, fisheye.
- init_parser.h/cpp :
- Wrapper c++ class for the c library initparser.
- stel_object.h/cpp :
- Abstract mother class for all astronomical objects stars, planets and nebula.
- hip_star.h/cpp and hip_star_mgr.h/cpp :
- Manage stars from the hipparcos catalog and stars collections respectively.
- grid.h/cpp :
- Used for optimization with grid structure while displaying the hipparcos star catalog.
- planet.h/cpp and solarsystem.h/cpp :
- Manage any body which has a defined position inside the solar system.
- nebula.h/cpp and nebula_mgr.h/cpp :
- Manage nebula and nebula collection repectively.
- constellation.h/cpp and constellation_mgr.h/cpp :
- Manage constellations and collection of constellations respectively.
- landscape.h/cpp :
- Manage landscapes.
- stel_atmosphere.h/cpp :
- Manage atmosphere rendering. Uses the classes sky_bright and sky_light to compute sky color and brightness and display it.
- tone_reproductor.h/cpp :
- The class which simulate the eye adaptation to luminance.
- draw.h/cpp :
- Groups some classes used to draw various objects of the program : milky way, grids, astronomical lines, cardinal points.
- stel_ui.h/cpp :
- manage the user interface for stellarium using s_gui/s_tui widgets.
- s_gui.h/cpp :
- All the Graphical User Interface (gui) classes. Used in the desktop version only.
- s_tui.h/cpp :
- All the Text User Interface (tui) classes. Used in planetarium version only.
- s_font.h/cpp :
- Manage fonts. The font in stellarium are not bitmap but taken from a real grey level texture.
- s_texture.h/cpp :
- Class which manages textures. Currently uses glpng library to handle png files.
- callback.h/cpp :
- Handfull class made by the boost library team used to handle callbacks. It's used for the widgets.
- glpng :
- create openGL textures from .png files. Written in C and used thru the s_texture class.
- iniparser :
- config files parsing. Used thru the wrapper class init_parser.
- stellastro :
- miscelaneous astronomical functions.
- stellplanet :
- compute heliocentric positions of solar system planets.
- commonname.fab and name.fab
- desc :
- Contains the commonly used stars names.
- type :
- ascii file, fields separated by
|
(pipe), end of line is CR ('\
n')
- line example :
62956|Alioth
- line format :
- HPnum
|
Star_Name
- HPnum : (unsigned int) Hipparcos catalog star number
- Star_Name : (string) The name string without spaces. The '_' will be replaced by space in the program.
- constellationsart.fab
- desc :
- Contains the constellation art info : i.e. for drawing of mythologic figures.
- type :
- ascii file, fields separated by SPACE, end of line is CR ('
\
n')
- line example :
Lep lepus_m 104 57 24305 90 29 24845 33 42 27288
- line format :
- ConstRef TextureFile x1 y1 HP1 x2 y2 HP2 x3 y3 HP3
- ConstRef : Short international name abreviation in 3 characters, first char in Capital letter
- TextureFile : Texture file name without the extension (no space character). The texture file has to be in the stellarium texture directory.
- x1 y1 hp1 (respectively 2 and 3) : the x and y position of the matching star
with hipparcos number hp1 (respectively 2 and 3) on the texture image. The
values are in pixels with the (0,0) in the upper left corner.
- note :
- the associated texture file must be in png format and have no alpha channel. The drawing background must be black.
- constellationship.fab
- desc :
- Contains the constellations lines shape.
- type :
- ascii file, fields separated by SPACE, end of line is CR ('
\
n')
- line example :
And ANDROMEDE ANDROMEDA 3 9640 5447 5447 4436 4436 3881
- line format :
- ConstRef ConstCommonName ConstInternationnalName NumberOfSegments seg11 seg12 seg21 seg22 etc...
- ConstRef : Short international name abreviation in 3 characters, first char
in Capital letter
- ConstCommonName : Commonly used name (currently in french!)
- ConstInternationnalName : The latin internationnal name.
- NumberOfSegments : the number of segments in the shape.
- segx1 segx2 : the hipparcos number of the stars 1 and 2 joined to form the xth segment.
- courierfont.txt and spacefont.txt
- desc :
- contains the characters position on the font texture.
- type :
- ascii file, fields separated by SPACE, end of line is CR ('
\
n')
- first line example :
CourierFont LineSize 21
- Font Name
- LineSize s : s is the maximum character height.
- other lines example :
065 02 2 14 21 0
- other lines format :
- ascii# x y w h s
- ascii# : ascii number of the character
- x y : position of the upper left corner of the character in the font texture (in pixel).
- w h : width and height of the character on the texture
- s : space to add at the end of the char when displaying.
- messier.fab
- desc :
- Contains the nebula list (not only messier)
- type :
- ascii file, fields separated by SPACE, end of line is CR ('
\
n')
- line example :
1952 RS 05 34.5 +22 +01 8.2 06.0 0 M1_-_Crab_Nebula m1
- line format :
- NGCnumber NebulaType hh min.mm deg min.mm mag size texRotation Name TexName
- NGCnumber : NGC catalog number
- NebulaType : TODO and change..
- hh min.mm : Right ascention hour and minutes and tenth of minutes
- deg min.mm : Declinaison in degree min and tenth of minutes
- mag : magnitude
- size : angular size in arcminute
- Name : Nebula name with '_' replaced by spaces.
- TexName : texture file name. png file without alpha chanel.
- name.txt
- desc :
- More info about stars, not used anymore.
- ssystem.ini
- desc :
- Solar system bodies informations.
- type :
- ini file. One section per body.
- Section example :
[io] // Section name, has to be unique
name = Io // Body name
parent = Jupiter // Body parent
radius = 1821. // Radius in km
halo = true // Do we have to draw a small halo like a star?
color = 1.,1.,1. // Halo color
tex_map = io // Texture map file without extension (has to .png)
tex_halo = star16x16 // Halo texture file
lightning = true // Compute shadow on it
albedo = 0.61 // Body albedo (how it reflects light) range 0 to 1
rot_rotation_offset = 220.8 // For texture alignment
rot_obliquity = 0.0 // Planet Obliquity (rotation axe inclination
// relative to the orbit plane)
coord_func = ell_orbit // Define the coordinate computation funcion :
// can be a custom func or "ell_orbit"
orbit_Epoch = 2443000.00038375// Ell_orbit calculation parameter
orbit_Period = 1.769138 // " "
orbit_SemiMajorAxis = 421600 // " "
orbit_Eccentricity = 0.0041 // " "
orbit_Inclination = 0.040 // " "
orbit_AscendingNode = 312.981 // " "
orbit_LongOfPericenter = 97.73// " "
orbit_MeanLongitude = 106.724 // " "
- landscape.ini
- desc :
- Landscape skins descriptions.
- type :
- ini file. One section per landscape.
- note :
- There can be 2 landscape types, the ones made from a fisheye picture and the ones made from many smaller textures. The fisheye textures must be centered on the zenith, north on the bottom.
- Section example for a fisheye :
[palm] // Section name
name = Palm // Landscape name
type = fisheye // Type = fisheye
maptex = landscapes/horizonalpha512 // Fisheye texture file name
texturefov = 210 // Field of View covered by the texture
// (180 = half dome, 360 = full sphere)
author = Gérard_Dupontd // Author name
Stellarium Developer guide
v 0.2
This document was generated using the
LaTeX2HTML translator Version 2002-2-1 (1.70)
Copyright © 1993, 1994, 1995, 1996,
Nikos Drakos,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999,
Ross Moore,
Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -split 0 -nonavigation developer_guide.tex
The translation was initiated by fabien on 2003-12-19
fabien
2003-12-19