Compare commits

..

1 Commits

Author SHA1 Message Date
transifex-integration[bot] 36d819735f
Translate /po/celestia.pot in be
translation completed for the source file '/po/celestia.pot'
on the 'be' language.
2022-01-31 12:01:51 +00:00
51 changed files with 1325 additions and 3763 deletions

1
.gitignore vendored
View File

@ -9,7 +9,6 @@ Release/
*.la
*.exe
*.dll
*.swp
.DS_Store
po*/*.gmo
po*/POTFILES

3
.gitmodules vendored
View File

@ -1,6 +1,9 @@
[submodule "thirdparty/Spice"]
path = thirdparty/Spice
url = https://github.com/OpenSpace/Spice.git
[submodule "content"]
path = content
url = https://github.com/CelestiaProject/CelestiaContent.git
[submodule "thirdparty/fmt"]
path = thirdparty/fmt
url = https://github.com/fmtlib/fmt.git

View File

@ -2,11 +2,6 @@ cmake_minimum_required(VERSION 3.8)
option(LEGACY_OPENGL_LIBS "Use legacy OpenGL libraries instead of glvnd library (Default: off)" OFF)
# Plain and keyword target_link_libraries() signatures cannot be mixed
if (POLICY CMP0023)
cmake_policy(SET CMP0023 NEW)
endif()
# Honor link flags in try_compile()
if (POLICY CMP0056)
cmake_policy(SET CMP0056 NEW)
@ -250,14 +245,6 @@ endif()
find_package(Freetype REQUIRED)
link_libraries(Freetype::Freetype)
find_package(meshoptimizer CONFIG QUIET)
if(meshoptimizer_FOUND)
message(STATUS "Found meshoptimizer library")
set(HAVE_MESHOPTIMIZER 1)
else()
message(STATUS "meshoptimizer library is missing")
endif()
#[[
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)

108
ChangeLog
View File

@ -246,7 +246,7 @@ Code:
* Windows version: InstallShield setup
* Windows version: added controls help dialog
* UNIX version: implemented find object and about dialogs (Gnome/Gtk only)
Code:
* Moved star browser and solar system browser code into separate modules
* Fixed DPRINTF macro so it's not broken in g++
@ -276,7 +276,7 @@ Code:
textures added to OpenGL Info dialog.
* New objects: Comet Borrelly, the giant Kuiper Belt object 2001 KX76,
and the Hubble Space Telescope
Code:
* Rewrote texture and model managers
* Cleaned up simulation.cpp to use frames of reference and eliminated a lot
@ -393,7 +393,7 @@ Code:
a single modeless dialog.
* Fixed period and rotation of Phoebe
1.2.1
* Unix: configure.in changes to better find OpenGL libraries by Bruckner.
* Added accurate orbital calculations for Galilean satellites.
@ -404,7 +404,7 @@ Code:
* Windows: Fixed crash that occurred when recalling a location with
no selection
1.2.2
* Improved find algorithm for starnames, and combined names from hdnames.dat
into starnames.dat. Also added several additional names and variant spellings
@ -557,7 +557,7 @@ Code:
* New colors for celestial grid and constellation figures
* Tuning of Gnome GUI: underlined key accelerators, enabled operation of all
dialogs and menus with ALT <key>, arrow keys, and Tab
* Linux: GUI now synced with current state of pixel/vertex shaders
* Linux: GUI now synced with current state of pixel/vertex shaders
* New keyboard bindings:
Ctrl+Y : automag toggle
Ctrl+T : toggle display of comet tails
@ -572,16 +572,16 @@ Code:
when building with VS.NET
* Cleaned up OpenGL extension initialization
* Significantly improved the reliability of object selection via mouse
click, notably for small fields of view in the arcsec range.
click, notably for small fields of view in the arcsec range.
* Fixed the 'move' script command
* New script commands: setfaintestautomag45deg {magnitude float},
lookback {}
* [,] keys now adjust the limiting magnitude at 45 degrees
field of view, if automag is ON. Values displayed via flash messages
* New script commands: setfaintestautomag45deg {magnitude float},
lookback {}
* [,] keys now adjust the limiting magnitude at 45 degrees
field of view, if automag is ON. Values displayed via flash messages
* Associated the 'looking back' operation with the '*' key shortcut
* Fixed bug in orbits of Galilean moons
* Corrected equatorial planes and rotation offsets for the major planets
* Linux: Added KDE interface, all features of the GTK interface are
* Linux: Added KDE interface, all features of the GTK interface are
available (except for the Tour Guide), new features include:
- Bookmarks / URLs;
- History navigation;* Improved drag and drop of cel:// URLs on Windows
@ -632,8 +632,8 @@ Code:
- Markers may also be set on objects using the right-click context menu
- Added mark/unmark commands for scripts
- Bound Ctrl+K to toggle display of markers
- Added flash messages indicating on|off status of markers
- Implemented markers into KDE interface
- Added flash messages indicating on|off status of markers
- Implemented markers into KDE interface
* Added triangle-accurate picking of mesh objects
* Multiview
- Ctrl+R : split view vertically
@ -664,7 +664,7 @@ Code:
* Updated configuration files for new versions of autoconf
1.3.1
* Improved inclusion of light travel delay, also in KDE time setting dialog
* Improved inclusion of light travel delay, also in KDE time setting dialog
* Fixed lookback command for subsequent changes of target speed
* Allow wildcard character * inplace of extension for texture filenames
* Fix bump mapping (again)
@ -706,7 +706,7 @@ Code:
* Made cancel script command stop motion, tracking, and any object-relative
coordinate system.
* Adjusted estimates for radii and rotation periods of extrasolar planets;
rotation rates account (somewhat) for the effects of tidal despinning.
rotation rates account (somewhat) for the effects of tidal despinning.
* Fixed a bug that was causing precision loss in orientation values; this fixes
some of the jerkiness apparent at very low fields of view.
* Corrected radii of Uranus's rings
@ -739,7 +739,7 @@ Code:
* Eliminated obscuring of location labels that occurred low view aspect ratios
* Added models of comet Halley and the small moons Pandora and Larissa
* Added limit of knowledge masks for the Galilean moons
* Changed spectral class of carbon stars to C, which supersedes and combines
* Changed spectral class of carbon stars to C, which supercedes and combines
R and N
* Lua scripting additions
* View management commands
@ -760,7 +760,7 @@ Code:
* Implemented an algorithm for importance weights to avoid overlapping or
too crowded location labels for Mars, Venus and the Moon
* Added new textures for Titan based on recent imaging from the Cassini
mission
mission
* Improved depth sorting so that hidden surface removal works properly for
overlapping objects
* Added theoretical estimates of oblateness and rotation rate for extrasolar
@ -805,16 +805,16 @@ Code:
* Implemented new GLSL render path; NVIDIA combiners and GeForceFX paths
deprecated.
* Display UTF-8 superscript digits in some star names
* Updated the Titan texture. It accomodates all published high resolution
imaging from the Cassini mission until and including the flyby of 03/31/05.
* Updated the Titan texture. It accomodates all published high resolution
imaging from the Cassini mission until and including the flyby of 03/31/05.
* Updated the Iapetus texture. It accomodates all published high resolution
imaging from the Cassini mission, including also a unique hires photo taken
in "Saturn shine".
imaging from the Cassini mission, including also a unique hires photo taken
in "Saturn shine".
* Added catalogs of 163 visual and 39 spectroscopic binary orbits,
respectively, (S<>erhjelm 1999, Pourbaix 2000) with known primary/secondary
mass ratios.
* Added an extended and precise data base of 942 galaxies
(Steinicke's rev. NGC/IC, 2005) with a magnitude cutoff Bmag < 12.
* Added an extended and precise data base of 942 galaxies
(Steinicke's rev. NGC/IC, 2005) with a magnitude cutoff Bmag < 12.
* Included the commented PERL scripts used to extract and adapt the binary
orbit and galaxy data from published professional catalogs.
* Added --extrasdir command line option for specifying additional directories
@ -843,13 +843,13 @@ Code:
- fixed automake bug where GConf schema would always install
- removed linking against glut for no reason
* Implemented complete precision catalog (Steinicke's revised NGC/IC, 2005) of
10610 galaxies with
- distance information from four catalogs ( 6 methods ),
- <= 4 alternate names,
- info-URLs,
- absolute magnitudes and
10610 galaxies with
- distance information from four catalogs ( 6 methods ),
- <= 4 alternate names,
- info-URLs,
- absolute magnitudes and
- correct sizes & orientations in space, as calculated from catalog
parameters.
parameters.
* Included well commented Perl script (deepsky.pl) as documentation. The used distance determination method is indicated in catalog for each galaxy.
* Updated binary star data base (visualbins.stc, spectbins.dsc) and respective
PERL catalog extraction scripts (visualbins.pl, spectbins.pl), such as to eliminate double occurences wrto nearstars.stc (, which remained unaffected).
@ -890,7 +890,7 @@ Code:
template from S0 disk template via rescaling by (1.0f, 3.8f, 1.0f);
- fixed wrong x,y alignment of elliptical rescaling.
* Added code to ease compilation with newer Xcode versions (Macintosh).
* Updated src/celengine/Makefile.am for Linux building.
* Updated src/celengine/Makefile.am for Linux building.
* Introduced a new cel function => renderflags {set "nebulae"}.
* Reduced the default value of 'faintestAutoMag45deg' from 8.5 to 7.0.
* Fixed the visibility of the Milky Way during day-time and the abrupt
@ -904,10 +904,10 @@ Code:
* Deleted various source code files that became superfluous.
* Improved comet display. Introduced a neat scheme implementing comet tail
fading (between 4 and 6 AU for Sol). Systems with several suns and
luminosities different from the solar one are accounted for.
* Implemented a new, simple scheme avoiding overcrowded galaxy labels.
luminosities different from the solar one are accounted for.
* Implemented a new, simple scheme avoiding overcrowded galaxy labels.
Their "importance" is sorted according to apparent magnitude! Thus the
labels of the brightest galaxies pop up first upon zooming in...
labels of the brightest galaxies pop up first upon zooming in...
* Fixes/workarounds for OpenGL 2.0 render paths on both nVidia and ATI cards.
@ -932,7 +932,7 @@ Code:
located inside the galaxy (Milky Way...).
* Eliminated various incorrect Hubble type acronyms in deepsky.dsc that had
penetrated the PERL filter.
* Add the corrected PERL script deepsky.pl.
* Add the corrected PERL script deepsky.pl.
* Mac: Universal binary - runs natively on Intel and PPC
* Mac: OpenGL 2.0 render path should now work on many configurations
(requires OS X 10.4.3 or later)
@ -948,7 +948,7 @@ Code:
* Mac: Fixed crash when LANG or LC environment variables are set
* Mac: Added bona fide English and French help menu
* Mac: Cleaned up README in general
* Added Phoebe textures in medres and lores directories from recent published
* Added Phoebe textures in medres and lores directories from recent published
Ciclops cylindrical maps
* Updated Titan and Iapetus textures in lores directory
* Windows: save and restore the last used GL render path
@ -959,10 +959,10 @@ Code:
* KDE: Reverted mouse wheel action to be compatible with the other interfaces.
* KDE: New configurable splash screen
(http://celestia.teyssier.org/splash_spec.html)
* Updated/added Tethys textures in lores, medres and hires directories.
* Updated/added Tethys textures in lores, medres and hires directories.
* Added locations on Phoebe in satmoons2.ssc, as extracted from USGS/IAU
official data.
* Added Mesh for Phoebe texture.
* Added Mesh for Phoebe texture.
* Updated Iapetus texture.
* Moved locations files from extras into data directory for inclusion in
standard package.
@ -1002,7 +1002,7 @@ Code:
- HIP 14810 c, HD 185269 b, Gliese 849 b
- Mu Ara e
- Gliese 581 c & d, HD 175541 b, HD 210702 b, HD192699 b
- HD 47536 c, XO-2 b, HD 147506 (HAT-P-2), HD 17092 b
- HD 47536 c, XO-2 b, HD 147506 (HAT-P-2), HD 17092 b
* Revised orbits of many extrasolar planets to reflect new data
* Added stars for new extrasolar planets: GSC 92941-01657
* Mac: Show menu bar when moving mouse to top of screen in full screen
@ -1067,7 +1067,7 @@ Code:
* Added cmodsphere, a utility for producing cmod meshes from height samples
regularly spaced in longitude and latitude.
* COPYING, controls.txt, start script, and guide can all be localized
* cel and celx scripting:
* cel and celx scripting:
- added openclusters and cloudshadows render flags
- added location, nebulae, openclusers, and i18nconsteallations label flags
* Established Barycentric Dynamical Time (TDB) as the time scale used
@ -1090,12 +1090,12 @@ Code:
spectra
* Made star orbit paths visible
* galaxies:
-changed galaxy template format to standard (grayscale) PNG
-changed galaxy template format to standard (grayscale) PNG
-allow a custom template for each galaxy in deepsky.dsc
-new approach to thickness of galaxy (arms): assumed proportional to read-in
brightness values
brightness values
-emulate dust lanes around galactic plane (y=0)
-considerable improvement of Milky Way appearance as seen from Earth
-considerable improvement of Milky Way appearance as seen from Earth
-implement galaxy labels of transparency increasing with distance, thus
providing a neat 3d effect
* galaxy templates:
@ -1114,10 +1114,10 @@ Code:
- Guarded against crash when the JPL ephemeris file can't be found
* Generalized rotations
- Clear syntax for ssc files
- UniformRotation
- UniformRotation
- PrecessingOrientation
- SampledOrientation - interpolated sequence of quaternion key frames
* Scripting improvements
* Scripting improvements
- New celx scripting commands:
- utctotdb and tdbtoutc
- gl commands
@ -1125,7 +1125,7 @@ Code:
- iterators: celestia:stars and celestia:dsos
- get/setaltazimuthmode
- Lua hooks for script extensions to Celestia
- Script interfaces for orbits and rotation models (ScriptedOrbit and
- Script interfaces for orbits and rotation models (ScriptedOrbit and
ScriptedRotation)
- Support Lua 5.1 (5.0 compatibility retained)
- Made celestia:loadtexture use relative file names
@ -1148,7 +1148,7 @@ Code:
* Corrected kilometers per light year constant
* Added various improvements to the MilkyWay & other galaxy template display.
* Added E0.png galaxy template that allows for better En, n=1..7 elliptical
shapes.
shapes.
* Fixed sizes of irregular galaxies (factor of 2!).
* Prevented galaxy code from crashing if a template is missing.
* Improved selection of galaxies by taking into account their 3d shape
@ -1163,11 +1163,11 @@ Code:
* Windows: Fixed crash that occurred when star browser was closed
* Fixed bug that made moons disappear as a planet approached stellar transit
* Added a major update of the galaxy database such that close to 100% of the
galaxies now involve distance measurements
* Included the complete local group of galaxies
galaxies now involve distance measurements
* Included the complete local group of galaxies
* Added varying label transparency also for stars
* Added the PERL scripts used for extraction of galaxy and binary orbit data
from scientific sources. They both are useful tools and a concise
from scientific sources. They both are useful tools and a concise
documentation of Celestia's data
* updated binary orbit data (visualbins.stc and spectbins.stc) along with
respective PERL scripts (visualbins.pl and spectbins.pl)
@ -1220,7 +1220,7 @@ Code:
HD 167042 b, HD 74156 d, HD 285968 b, V391 Peg b,
HD 132406 b, HD 43691 b, NGC 2423 3 b, Gliese 317 b & c,
TrES-3, HD 155358 b&c, HD 5319 b, HD 75898 b, OGLE-TR-182 b, WASP-3 b,
55 Cnc f, Lupus-TR-3 b, OGLE-TR-211 b, HD 156846 b, HD 4113 b, Kap CrB b,
55 Cnc f, Lupus-TR-3 b, OGLE-TR-211 b, HD 156846 b, HD 4113 b, Kap CrB b,
GD 66 b, XO-3 b, WASP-4 b TW Hya b
removed HD 33636 b
* Set up transit of Gliese 436
@ -1383,7 +1383,7 @@ Bug fixes
* Fixed search path for Lua scripts
* Fixed numerous bugs that occurred when an object's orbit center was different
* Fixed a bug in the celx function celestia:getscreendimension
* Fixed bug with returning Hubble type for galaxies
* Fixed bug with returning Hubble type for galaxies
* Eliminated error-prone min/max macros; use STL functions instead
* Fixed discrepancy between apparent magnitudes shown in the 3D view and
the star browser.
@ -1424,9 +1424,9 @@ Data file updates
* Changed class of small outer planet moons to minormoon
* Included new and updated solar system body features from the IAU
* Added provisional rotation period for Eris
Tools
* Added Perl script globulars.pl used to extract the globular data from scientific publications and as documentation
* Added Perl script globulars.pl used to extract the globular data from scientific publications and as documentation
* Added spice2xyzv tool for extracting xyzv files from a pool of SPICE kernels
* Added Perl script to build cross-indices
* Added Perl script to generate CHARM2 catalog
@ -1557,7 +1557,7 @@ Scripting
- windowbordersvisible, setwindowbordersvisible
* Split celx scripting support into several modules
* Cel scripting
- splitview, deleteview, singleview, setactiveview
- splitview, deleteview, singleview, setactiveview
- setgalaxylightgain
- setradius
- setlinecolor

View File

@ -1,142 +0,0 @@
| **`Release`** | **`Localized`** | **`License`** | **`Contribute`** |
|-------------------|---------------|---------------|---------------|
|[![GitHub release](https://img.shields.io/github/v/release/CelestiaProject/Celestia?label=Release)](https://celestia.space/download.html) | [![Localization](https://img.shields.io/badge/Localized-85%25-green.svg)](#) | [![License](https://img.shields.io/github/license/CelestiaProject/Celestia?label=License)](https://github.com/CelestiaProject/Celestia/blob/master/COPYING) | [![Contribute](https://img.shields.io/badge/PRs-Welcome-brightgreen.svg)](#contributing) |
# Celestia
![Celestia](celestia-logo.png)<br>
**A real-time space simulation that lets you experience our universe in three dimensions.**
**Copyright © 2001-2021, Celestia Development Team**<br>
**Celestia website: https://celestia.space**<br>
**Celestia Wikibook: https://en.wikibooks.org/wiki/Celestia**<br>
**Celestia forums: https://celestia.space/forum/**<br>
**Celestia Subreddit: https://www.reddit.com/r/Celestiasoftware/**<br>
**Celestia Archive Repository: https://github.com/Anthony-B-Russo10/Celestia-Archive**
## License
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details,
which you should have received along with this program (filename: COPYING).
If not, request a copy from:<br>
Free Software Foundation, Inc.<br>
59 Temple Place - Suite 330<br>
Boston, MA 02111-1307<br>
USA
## Getting started
Celestia will start up in a window, and if everything is working correctly,
you'll see Earth in front of a field of stars. Displayed on-screen, is some
information about your target (Earth), your speed, and the current time
(Universal Time, so it'll probably be a few hours off from your computer's
clock).
Right drag the mouse to orbit Earth and you might see the Moon and some
familiar constellations. Left dragging the mouse changes your orientation
also, but the camera rotates about its center instead of rotating around
Earth. Rolling the mouse wheel will change your distance to Earth--you can
move light years away, then roll the wheel in the opposite direction to get
back to your starting location. If your mouse lacks a wheel, you can use the
Home and End keys instead.
When running Celestia, you will usually have some object selected. Currently,
it's Earth, but it could also be a star, moon, spacecraft, galaxy, or some
other object. The simplest way to select an object is to click on it. Try
clicking on a star to select it. The information about Earth is replaced with
some details about the star. Press G (or use the Navigation menu), and you'll
zoom through space toward the selected star. If you press G again, you'll
approach the star even closer.
Press H to select our Sun, and then G to go back to our Sun. Right click on
the sun to bring up a menu of planets and other objects in the solar system.
After selecting a planet from the menu, hit G again to travel toward it. Once
there, hold down the right mouse button and drag to orbit the planet.
The Tour Guide is a list of some of the more interesting objects you can visit
in Celestia. Select the Tour Guide option in the Navigation menu to display
the Tour Guide window. Choose a destination from the list, click the Goto
button, and you're off.
That covers the very basics. For a more in-depth look at Celestia and the
controls available to you, download the "Celestia User's Guide" (written by
Frank Gregorio), available in several languages, from:<br>
https://celestia.space/guides.html<br>
This web page also includes links to the Celestia README file translated into
Japanese.
### Star browser
By default, the Star Browser window displays a table of the 100 nearest stars,
along with their Distance, Apparent and Absolute Magnitude, and Type. Clicking
on the column headers will sort the stars. The table is not continuously
updated, so if you travel to another star, you should press the Refresh button
to update the table for your current position. The radio buttons beneath the
table let you switch between viewing a list of Nearest, Brightest, or 'With
planets' stars. As with the solar system browser, clicking on any star name
in the table will select it. Use this feature along with the Center and Go
To buttons to tour the stars visible from any night sky in the galaxy.
### Solar system browser
The Solar System Browser displays a window with a tree view of all the objects
in the nearest solar system (if there is one within a light year of your current
position.) Clicking on the name of any object in the window will select it.
You can then use the Center or Go To buttons to display that object in the main
Celestia window.
### Selecting objects by name
Celestia provides several ways to select an object by name...
1. Choose 'Select Object' from the Navigation menu, type in the object name, and click OK.
2. Press Enter, type in the entire object name, and press Enter again.
3. Press Enter, type in the first few characters of the object name,
press the Tab key to move through the displayed listing until the object is highlighted,
then press Enter again.
You can use common names, Bayer designations or catalog numbers for stars.
Celestia currently supports the HIP, HD and SAO catalogs. Catalog numbers must
be entered with a space between the prefix and the catalog number.
### Known issues
For up-to-the-minute answers to some common problems encountered when running
Celestia, please view either the FAQ in the Help menu or take a look at the
"Celestia User's FAQ" located on the Celestia User's Forum:
https://celestia.space/forum/
### User modifiable elements
You can modify how Celestia starts up each time you run it, by defining your
own start-up settings. Simply open the file "start.cel" in a plain text
editor and follow the in-file instructions. Also, view the celestia.cfg file
in a plain text editor to see additional settings.
Celestia allows you to easily add real, hypothetical, or fictional objects
by creating new catalog files. It is *not* recommended that you alter the
built-in data files; nearly all desired modifications and additions can be
made by placing new catalog files in Celestia's extras folders. There are three
types of catalog files:
* ssc (solar system catalog: planets, moons, spacecraft, etc.)
* stc (star catalog)
* dsc (deep sky catalog: galaxies, star clusters, and nebulae)
All three types of catalog file are text files that can be updated with your
favorite text editing program.
### Building from sources
See instructions in file [INSTALL.md](INSTALL.md).
## Contributions
| **`Authors`** | **`Contributors`** | **`Documentation`** | **`Other`** |
|-----------------|---------------------|------------------|-------------------|
| Chris Laurel, Clint Weisbrod, Fridger Schrempp, Bob Ippolito, Christophe Teyssier, Hank Ramsey, Grant Hutchison, Pat Suwalski, Toti, Da Woon Jung, Vincent Giangiulio, Andrew Tribick, Hleb Valoshka, Łukasz Buczyński, Li Linfeng | Deon Ramsey, Christopher Andre, Colin Walters, Peter Chapman, James Holmes, Harald Schmidt, Nils Larsson, Sergey Leonov, Alexell, Dmitry Brant, Janus | Selden Ball, Frank Gregorio, Hitoshi Suzuki, Christophe Teyssier, Diego Rodriguez, Don Goyette, Harald Schmidt | Creators of scientific database, texture maps, 3D models and used libraries, you can see in full README.|
### Contributing
**We welcome feedback, bug reports, and pull requests!**
For pull requests, please stick to the following guidelines:
* Be sure to test your code changes.
* Follow the existing code style (e.g., indents).
* Put a lot of comments into the code, if necessary.
* Separate unrelated changes into multiple pull requests.

207
README.md
View File

@ -1,110 +1,143 @@
| **`Release`** | **`Localized`** | **`License`** | **`Contribute`** |
|-------------------|---------------|---------------|---------------|
|[![GitHub release](https://img.shields.io/github/v/release/CelestiaProject/Celestia?label=Release)](https://celestia.space/download.html) | [![Localization](https://img.shields.io/badge/Localized-85%25-green.svg)](#) | [![License](https://img.shields.io/github/license/CelestiaProject/Celestia?label=License)](https://github.com/CelestiaProject/Celestia/blob/master/COPYING) | [![Contribute](https://img.shields.io/badge/PRs-Welcome-brightgreen.svg)](#contributing) |
# Celestia
Celestia is a "real-time space simulation that lets you experience
our universe in three dimensions".
![Celestia](celestia-logo.png)<br>
**A real-time space simulation that lets you experience our universe in three dimensions.**
![celestia-screenshot](pics/celestia-screenshot.png)
**Copyright © 2001-2021, Celestia Development Team**<br>
**Celestia website: https://celestia.space**<br>
**Celestia Wikibook: https://en.wikibooks.org/wiki/Celestia**<br>
**Celestia forums: https://celestia.space/forum/**<br>
**Celestia Discord Server: https://discordapp.com/invite/WEWDcJh**<br>
**Celestia Subreddit: https://www.reddit.com/r/Celestiasoftware/**<br>
**Celestia Archive Repository: https://github.com/Anthony-B-Russo10/Celestia-Archive**
## License
# Upstream
This repo is a lesser fork of the upstream project,
which has been revived.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
* https://celestia.space/
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details,
which you should have received along with this program (filename: COPYING).
If not, request a copy from:<br>
Free Software Foundation, Inc.<br>
59 Temple Place - Suite 330<br>
Boston, MA 02111-1307<br>
USA
* https://github.com/CelestiaProject/Celestia
## Getting started
See also: `README-upstream`, `README-upstream.md`.
Celestia will start up in a window, and if everything is working correctly,
you'll see Earth in front of a field of stars. Displayed on-screen, is some
information about your target (Earth), your speed, and the current time
(Universal Time, so it'll probably be a few hours off from your computer's
clock).
## License/Copyright
GPLv2+
Right drag the mouse to orbit Earth and you might see the Moon and some
familiar constellations. Left dragging the mouse changes your orientation
also, but the camera rotates about its center instead of rotating around
Earth. Rolling the mouse wheel will change your distance to Earth--you can
move light years away, then roll the wheel in the opposite direction to get
back to your starting location. If your mouse lacks a wheel, you can use the
Home and End keys instead.
Copyright © 2001-2021, Celestia Development Team
When running Celestia, you will usually have some object selected. Currently,
it's Earth, but it could also be a star, moon, spacecraft, galaxy, or some
other object. The simplest way to select an object is to click on it. Try
clicking on a star to select it. The information about Earth is replaced with
some details about the star. Press G (or use the Navigation menu), and you'll
zoom through space toward the selected star. If you press G again, you'll
approach the star even closer.
# Debian
Package was removed from Debian in the ancient days due to bitrot.
The upstream code has a new team and active development, using
recent libraries. The package can be built under Debian Ok, except
for the `data/` files.
Press H to select our Sun, and then G to go back to our Sun. Right click on
the sun to bring up a menu of planets and other objects in the solar system.
After selecting a planet from the menu, hit G again to travel toward it. Once
there, hold down the right mouse button and drag to orbit the planet.
Debian upstream bug:
The Tour Guide is a list of some of the more interesting objects you can visit
in Celestia. Select the Tour Guide option in the Navigation menu to display
the Tour Guide window. Choose a destination from the list, click the Goto
button, and you're off.
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=809916
That covers the very basics. For a more in-depth look at Celestia and the
controls available to you, download the "Celestia User's Guide" (written by
Frank Gregorio), available in several languages, from:<br>
https://celestia.space/guides.html<br>
This web page also includes links to the Celestia README file translated into
Japanese.
```
Upstream has not produced any new releases in the last 4 years. In the
mean time, the package is accumulating bugs due to bitrot. It already
wasn't a trouble-free package, due to some quite important resources not
being DFSG compliant.
```
### Star browser
By default, the Star Browser window displays a table of the 100 nearest stars,
along with their Distance, Apparent and Absolute Magnitude, and Type. Clicking
on the column headers will sort the stars. The table is not continuously
updated, so if you travel to another star, you should press the Refresh button
to update the table for your current position. The radio buttons beneath the
table let you switch between viewing a list of Nearest, Brightest, or 'With
planets' stars. As with the solar system browser, clicking on any star name
in the table will select it. Use this feature along with the Center and Go
To buttons to tour the stars visible from any night sky in the galaxy.
I do see some of the resources now are CC-by-SA 4.0, a license which
didn't exist when the Debian bug was created. So it may be that it
can be built happily without DFSG issues using new data files.
### Solar system browser
The Solar System Browser displays a window with a tree view of all the objects
in the nearest solar system (if there is one within a light year of your current
position.) Clicking on the name of any object in the window will select it.
You can then use the Center or Go To buttons to display that object in the main
Celestia window.
### Selecting objects by name
Celestia provides several ways to select an object by name...
1. Choose 'Select Object' from the Navigation menu, type in the object name, and click OK.
2. Press Enter, type in the entire object name, and press Enter again.
3. Press Enter, type in the first few characters of the object name,
press the Tab key to move through the displayed listing until the object is highlighted,
then press Enter again.
You can use common names, Bayer designations or catalog numbers for stars.
Celestia currently supports the HIP, HD and SAO catalogs. Catalog numbers must
be entered with a space between the prefix and the catalog number.
Celestia depending on NASA's Spice/NAIF may be afoul of Debian's
DFSG because the terms are unique. It isn't really a standard license.
### Known issues
For up-to-the-minute answers to some common problems encountered when running
Celestia, please view either the FAQ in the Help menu or take a look at the
"Celestia User's FAQ" located on the Celestia User's Forum:
https://celestia.space/forum/
### User modifiable elements
You can modify how Celestia starts up each time you run it, by defining your
own start-up settings. Simply open the file "start.cel" in a plain text
editor and follow the in-file instructions. Also, view the celestia.cfg file
in a plain text editor to see additional settings.
Debian tracker link:
Celestia allows you to easily add real, hypothetical, or fictional objects
by creating new catalog files. It is *not* recommended that you alter the
built-in data files; nearly all desired modifications and additions can be
made by placing new catalog files in Celestia's extras folders. There are three
types of catalog files:
* ssc (solar system catalog: planets, moons, spacecraft, etc.)
* stc (star catalog)
* dsc (deep sky catalog: galaxies, star clusters, and nebulae)
* https://tracker.debian.org/pkg/celestia
All three types of catalog file are text files that can be updated with your
favorite text editing program.
# Build
Mini Debian package build howto.
### Building from sources
See instructions in file [INSTALL.md](INSTALL.md).
```
# Install deps
sudo apt update
sudo apt install build-essential ccache devscripts \
debhelper chrpath cmake freeglut3-dev libeigen3-dev libfmt-dev \
libfreetype6-dev libepoxy-dev libglu1-mesa-dev libgtk2.0-dev \
libgtkglext1-dev libjpeg62-turbo-dev libluajit-5.1-dev libpng-dev \
libqt5opengl5-dev libtheora-dev qtbase5-dev qtbase5-dev-tools
## Contributions
| **`Authors`** | **`Contributors`** | **`Documentation`** | **`Other`** |
|-----------------|---------------------|------------------|-------------------|
| Chris Laurel, Clint Weisbrod, Fridger Schrempp, Bob Ippolito, Christophe Teyssier, Hank Ramsey, Grant Hutchison, Pat Suwalski, Toti, Da Woon Jung, Vincent Giangiulio, Andrew Tribick, Hleb Valoshka, Łukasz Buczyński, Li Linfeng | Deon Ramsey, Christopher Andre, Colin Walters, Peter Chapman, James Holmes, Harald Schmidt, Nils Larsson, Sergey Leonov, Alexell, Dmitry Brant, Janus | Selden Ball, Frank Gregorio, Hitoshi Suzuki, Christophe Teyssier, Diego Rodriguez, Don Goyette, Harald Schmidt | Creators of scientific database, texture maps, 3D models and used libraries, you can see in full README.|
# Add ccache to PATH in ~/.bashrc, and log back in
PATH=/usr/lib/ccache:$PATH
### Contributing
# Make dirs to put it all, as it writes packages to the *parent* dir.
mkdir celestia-deb
cd celestia-deb
git clone https://spacecruft.org/spacecruft/CelestiaContent
cd CelestiaContent
# Build the source package, writes to parent dir
dpkg-buildpackage -rfakeroot -S -uc -us -sa
# Build Debian Packages
dpkg-buildpackage -rfakeroot -b -uc
cd ..
# Install the data package
sudo dpkg -i celestia-data_1.7.0~git20211202+668347e9+0_all.deb
# Make sure apt is happy
sudo apt -f install
git clone --recursive https://spacecruft.org/spacecruft/celestia
cd celestia
# Build the source package, writes to parent dir
dpkg-buildpackage -rfakeroot -S -uc -us -sa
# Build Debian Packages
dpkg-buildpackage -rfakeroot -b -uc
cd ..
# Install
sudo dpkg -i celestia_1.7.0~git20220520+1_all.deb \
celestia-common_1.7.0~git20220520+1_all.deb \
celestia-qt_1.7.0~git20220520+1_amd64.deb \
celestia-tools_1.7.0~git20220520+1_amd64.deb \
libcelestia1.7_1.7.0~git20220520+1_amd64.deb
# Make sure apt is happy
sudo apt -f install
```
**We welcome feedback, bug reports, and pull requests!**
For pull requests, please stick to the following guidelines:
* Be sure to test your code changes.
* Follow the existing code style (e.g., indents).
* Put a lot of comments into the code, if necessary.
* Separate unrelated changes into multiple pull requests.

View File

@ -227,17 +227,16 @@ StarTextures
# text on the display screen. To view the list of fonts available with
# your distribution of Celestia, look in the fonts directory located
# under the Celestia root directory. The default fonts are UTF-8
# compatible in order to display non-English characters. Font size is
# measured in points to ensure the same sizes on all DPI configurations.
# compatible in order to display non-English characters.
#
# Font: Used to display all informational text.
# Default: "DejaVuSans.ttf,9"
# Default: "sans12.txf"
#
# LabelFont: Used to display all label text (objects, locations, etc.).
# Default "DejaVuSans.ttf,9"
# Default "sans12.txf"
#
# TitleFont: Used to display object names, messages, and script text.
# Default "DejaVuSans-Bold.ttf,15"
# Default "sansbold20.txf"
#------------------------------------------------------------------------
Font "DejaVuSans.ttf,9"
LabelFont "DejaVuSans.ttf,9"

View File

@ -212,7 +212,6 @@ Source: "locale\controls_zh_CN.txt"; DestDir: "{app}/locale"; Flags: ignor
Source: "locale\controls_zh_TW.txt"; DestDir: "{app}/locale"; Flags: ignoreversion
Source: "locale\demo_be.cel"; DestDir: "{app}/locale"; Flags: ignoreversion
Source: "locale\demo_bg.cel"; DestDir: "{app}/locale"; Flags: ignoreversion
Source: "locale\demo_de.cel"; DestDir: "{app}/locale"; Flags: ignoreversion
Source: "locale\demo_es.cel"; DestDir: "{app}/locale"; Flags: ignoreversion
Source: "locale\demo_fr.cel"; DestDir: "{app}/locale"; Flags: ignoreversion

View File

@ -3,5 +3,4 @@
#cmakedefine HAVE_FLOAT_CHARCONV
#cmakedefine HAVE_STD_FILESYSTEM
#cmakedefine HAVE_WORDEXP
#cmakedefine HAVE_MESHOPTIMIZER
#cmakedefine WORDS_BIGENDIAN

View File

@ -1,5 +1,3 @@
README.md
README-upstream
README-upstream.md
README
AUTHORS
TRANSLATORS

View File

@ -12,7 +12,7 @@ usr/bin/3dstocmod
usr/bin/cmodfix
usr/bin/txt2cmod
usr/bin/cmodsphere
#usr/bin/qttxf
usr/bin/qttxf
#usr/bin/spice2xyzv
usr/bin/vsoptrunc-rect
usr/bin/vsoptrunc-sph

13
debian/changelog vendored
View File

@ -1,16 +1,3 @@
celestia (1.7.0~git20220520+1) UNRELEASED; urgency=medium
* Fix control character ^M in perl scripts.
-- Jeff Moe <moe@spacecruft.org> Fri, 20 May 2022 21:02:00 -0600
celestia (1.7.0~git20220520+0) UNRELEASED; urgency=medium
* New snapshot build.
* Remove missing qttxf.
-- Jeff Moe <moe@spacecruft.org> Fri, 20 May 2022 19:55:59 -0600
celestia (1.7.0~git20190807+d9746691+0) UNRELEASED; urgency=medium
* New snapshot build

1
debian/control vendored
View File

@ -5,7 +5,6 @@ Maintainer: Hleb Valoshka <375gnu@gmail.com>
Build-Depends: debhelper (>= 10~),
chrpath,
cmake (>= 3.1~),
dos2unix,
freeglut3-dev,
libeigen3-dev (>= 3.3~),
libfmt-dev (>= 4),

2
debian/rules vendored
View File

@ -26,8 +26,6 @@ override_dh_auto_configure:
override_dh_install:
dos2unix ./src/tools/stardb/buildstardb.pl
dos2unix ./src/tools/xindex/buildxindices.pl
find debian/tmp/usr/bin/ -type f ! -name *.pl -exec chrpath --delete {} ';'
chrpath --delete debian/tmp/usr/lib/*/libcelestia.so.*
dh_install --fail-missing

View File

@ -3,10 +3,10 @@
labels { clear "planets|minorplanets|stars|constellations" }
renderflags { set "stars|planets"
clear "constellations|orbits|cloudmaps" }
print { text "Начало на демонстрацията...\nНатиснете „Esc“ за край." origin "center" duration 2 }
print { text "Начало на демонстрацията . . .\nНатиснете ESC за край." origin "center" duration 2 }
wait { duration 2.0 }
print { text "Нека да започнем от нашия дом..." row -3 }
print { text "Нека да започнем от нашия дом . . ." row -3 }
select { object "Sol/Earth" }
cancel {}
# goto { time 0 distance 3 upframe "ecliptical" }
@ -18,25 +18,25 @@
wait { duration 1.0 }
follow {}
print { text "В момента се намираме на 12 500 км. над Земята." row -3 duration 5 }
print { text "В момента се намираме на 12 500 км над Земята" row -3 duration 5 }
orbit { axis [ 0 1 0 ] rate 30 duration 10 }
print { text "Като добавим и облаците, Земята изглежда по-позната." row -3}
print { text "Като добавим и облаците, Земята изглежда по позната." row -3}
wait { duration 0.1 }
renderflags { set "cloudmaps" }
orbit { axis [ 0 1 0 ] rate 30 duration 6 }
print { text "Следваща спирка: Луната" row -3 }
print { text "Следваща спирка: Луната." row -3 }
select { object "Moon" }
goto { time 5 distance 4 upframe "equatorial" }
wait { duration 5.5 }
print { text "Оглеждайте се за Земята и Слънцето, докато обикаляме около Луната." row -3}
print { text "Оглеждайте се за Земята и Слънцето, докато се движим около Луната" row -3}
orbit { axis [ 0 1 0 ] rate 30 duration 10 }
print { text "Напред към Слънцето!" row -3}
print { text "Напред към Слънцето." row -3}
select { object "Sol" }
goto { time 8 distance 12 upframe "equatorial" up [ 0 1 0 ] }
wait { duration 8.5 }
print { text "От това разстояние може да видим тъмните слънчеви петна по повърхността му." row -3}
print { text "От това разстояние могат да се видят тъмните слънчеви петна по повърхността му." row -3}
orbit { axis [ 0 1 0 ] rate 20 duration 10 }
print { text "Нека да се отдалечим и разгледаме вътрешната част на Слънчевата система." row -3}
@ -44,10 +44,10 @@
renderflags { set "orbits" }
changedistance { duration 4.0 rate 1.0 }
print { text "Да включим имената на планетите..." row -3}
print { text "Да включим имената на планетите . . ." row -3}
labels { set "planets" }
wait { duration 1.0 }
print { text "Може да ускорим времето за да видим как планетите обикалят около Слънцето." row -3}
print { text "Можем да ускорим времето за да видим как планетите обикалят около Слънцето." row -3}
timerate { rate 2592000 }
wait { duration 3.0 }
print { text "Всяка секунда в реално време е равна на един месец в симулацията." row -3}
@ -56,7 +56,7 @@
print { text "В момента, времето е спряно." row -3}
wait { duration 1.0 }
print { text "Следваща спирка: Сатурн" row -3}
print { text "Следващата ни дестинация е Сатурн." row -3}
select { object "Saturn" }
center { time 2 }
wait { duration 2 }
@ -64,12 +64,12 @@
wait { duration 6.5 }
renderflags { clear "orbits" }
labels { clear "planets" }
print { text "Няколко от спътниците на Сатурн са видими като ярки точки." row -3 duration 3}
print { text "Няколко от луните на Сатурн са видими като ярки точки" row -3 duration 3}
orbit { axis [ 0 1 0 ] rate 30 duration 12 }
select { object "Mimas" }
goto { time 5 distance 4 upframe "equatorial" }
print { text "Най-интересната характеристика на Мимас е огромният кратер Хершел." row -3 duration 9 }
print { text "Най-интересната характеристика на Мимас е огромния кратер Хершел." row -3 duration 9 }
orbit { axis [ 0 1 0 ] rate 30 duration 12 }
changedistance { duration 6.0 rate 0.5 }
@ -82,22 +82,22 @@
wait { duration 2 }
select { object "Alpha UMa" }
center { time 2 }
print { text "Ако живеете в северното полукълбо, ще разпознаете Волската кола в съзвездието Голямата мечка." row -3 duration 3 }
print { text "Ако живеете в северното полукълбо, ще разпознаете Колата в съзвездието Голямата мечка." row -3 duration 3 }
wait { duration 4 }
select { object "Polaris" }
center { time 2 }
wait { duration 2 }
print { text "Това е Поларис, известна още като Северната звезда." row -3}
print { text "А това е Поларис, известна още като Северната звезда." row -3}
wait { duration 1 }
labels { set "stars" }
wait { duration 2 }
print { text "Поларис е част от Малката мечка." row -3}
wait { duration 2 }
print { text "За по-добра ориентация в небето, „Celestia“ може да активира очертанията на съзвездията..." row -3}
print { text "За по-добра ориентация в небето, Celestia може да активира диаграмите на съзвездията . . ." row -3}
renderflags { set "constellations" }
wait { duration 2 }
print { text "...и имената на съзвездията." row -3}
print { text ". . . и имената на съзвездията" row -3}
labels { set "constellations" }
wait { duration 2 }
@ -114,7 +114,7 @@
wait { duration 4 }
rotate { axis [ 0.707 0.707 0 ] rate 20 duration 7 }
print { text "Нека да включим показването на галактиките за да видим Млечния път." row -3 duration 4 }
print { text "Нека да включим рендерирането на галактиките за да видим Млечния път" row -3 duration 4 }
renderflags { set "galaxies" }
rotate { axis [ 0.707 0.707 0 ] rate 20 duration 14 }
rotate { axis [ 0.707 0.707 0 ] rate 20 duration 10 }
@ -122,7 +122,7 @@
select { object "Antares" }
center { time 5 }
wait { duration 3 }
print { text "Сега ще посетим Антарес, това е звезда червен гигант в съзвездието Скорпион." row -3 duration 5 }
print { text "Сега ще пътуваме до Антарес, това е звезда червен гигант в съзвездието Скорпион." row -3 duration 5 }
wait { duration 2 }
renderflags { clear "constellations" }
labels { clear "constellations|stars" }
@ -134,13 +134,13 @@
print { text "Въпреки че сме 10 пъти по-далече от Антарес\nотколкото Земята е от Слънцето, масивната звезда червен гигант изглежда застрашително голяма." row -3}
wait { duration 4.0 }
print { text "Нека да се отдалечим за да видим как изглежда нашата галактика..." row -3}
print { text "Нека да се отдалечим за да видим как изглежда нашата галактика . . ." row -3}
changedistance { duration 10.0 rate 2.0 }
select { object "Milky Way" }
print { text "Това е Млечният път." row -3 duration 6 }
print { text "Това е Млечния път." row -3 duration 6 }
orbit { axis [ 1 0 0 ] rate 30 duration 16.0 }
print { text "Време е да се прибираме..." row -3}
print { text "Време е да се прибираме . . ." row -3}
select { object "Sol/Earth" }
goto { time 20 distance 10 upframe "equatorial" }

View File

@ -1,7 +1,7 @@
{
Name "Юпитер"
Target "Sol/Jupiter"
Description "Юпитер е най-голямата планета в Слънчевата система и е на пета позиция от Слънцето. Както и останалите външни планети, Юпитер е газов гигант без твърда повърхност. Голямото червено петно е най-голямата и най-продължителната буря в турболентната атмосфера на планетата тази вихрушка с размерите на Земята съществува от около 300 години."
Description "Юпитер е най-голямата планета в Слънчевата система и е на пета позиция от Слънцето. Както и останалите външни планети, Юпитер е газов гигант без твърда повърхност. Голямото червено петно е най-голямата и най-продължителната буря в турболентната атмосфера на планетата; тази вихрушка с размерите на Земята съществува от около 300 години."
}
{
@ -9,13 +9,13 @@
Target "Sol/Pluto"
Distance 40000
DistanceUnits "km"
Description "Плутон обикаля около Слънцето на средно разстояние от шест милиарда километра. Спътникът му Харон е толкова голям, че често ги наричат заедно с Плутон „двойната планета“."
Description "Плутон обикаля около Слънцето на средно разстояние от шест милиарда километра. Луната му Харон е толкова голяма, че често ги наричат с Плутон 'двойна планета'."
}
{
Name "Ерос"
Target "Sol/Eros"
Description "Ерос е астероид във формата на картоф и е дълъг около 33 км. Благодарение на космическия апарат NEAR Shoemaker, за Ерос знаем повече, отколкото за който и да било друг астероид. На 14 Февруари 2001 г., „NEAR“ се спусна на Ерос и стана първият апарат, приземил се на астероид."
Description "Ерос е астероид във формата на картоф и е дълъг около 33 км. Благодарение на космическия апарат NEAR Shoemaker, за Ерос знаем повече, отколкото за който и да било друг астероид. На 14 февруари 2001 г. NEAR се спусна на Ерос и стана първият апарат, приземил се на астероид."
}
{
@ -23,7 +23,7 @@
Target "Alpha Centauri"
Distance 90
DistanceUnits "au"
Description "Алфа Кентавър А и Б, заедно с Проксима Кентавър, са най-близката звездна система до Земята. Алфа Кентавър А много прилича на Слънцето, въпреки че е малко по-стара и по-ярка звезда. Алфа Кентавър Б е по-тъмна и по-червеникава, а Проксима Кентавър е толкова слаба, че не може да се види с невъоръжено око, въпреки, че е най-близката звезда до Слънцето."
Description "Алфа Кантавър А и Б, заедно с Проксима Кентавър, са най-близката звездна система до Земята. Алфа Кентавър А много прилича на Слънцето, въпреки че е малко по-стара и по-ярка. Б е по-тъмна и по-червеникава, а Проксима е толкова слаба, че не може да се види с невъоръжено око, въпреки, че е най-близката звезда до Слънцето."
}
{
@ -31,7 +31,7 @@
Target "Alcyone"
Distance 35
DistanceUnits "ly"
Description "Звездният куп Плеяди е група ярки, наскоро формирани звезди. Плеядите носят името на седем сестри от гръцката митология, въпреки че телескопите са разкрили, че в звездния куп има доста повече от седем звезди."
Description "Звездния куп Плеяди е група ярки, наскоро формирани звезди. Плеядите носят името на седем сестри от гръцката митология, въпреки, че телескопите са разкрили, че в звездния куп има доста повече от седем звезди."
}
{
@ -39,13 +39,13 @@
Target "63 Tau"
Distance 25
DistanceUnits "ly"
Description "Носещи името на петте дъщери на Атлас и Аетра, Хиядите са един от най-видните разсеяни звездни купове в небето. Звездите от звездния куп Хияди са на около 660 милиона години - около шест пъти по-стари от по-горещите и по-сини Плеяди."
Description "Носещи името на петте дъщери на Атлас и Аетра, Хиядите са един от най-видните разсеяни звездни купове в небето. Звездите от звездния куп Хияди са на около 660 милиона години - около шест пъти по-стари от по-горещите и по-сини Плеяди."
}
{
Name "Глийзе 876 б"
Target "Gliese 876/b"
Description "Глийзе 876/б е гигантска планета в орбита около червено джудже. Тя е в резонанс 2:1 с друга планета от същата система."
Description "Глийзе 876/б е гигантска планета в орбита около червено джудже. Тя е в резонанс 2:1 с друга планета от същата система."
}
{
@ -53,24 +53,24 @@
Target "Sol/Ida"
Distance 200
DistanceUnits "km"
Description "Космическият апарат Галилео засне астероида 243 Ида през 1993 г. на път към Юпитер. Снимките разкриха, че Ида има малък спътник, по-късно наречен Дактил. От тогава до сега са открити още няколко астероида със спътници."
Description "Космическият апарат Галилео фотографира астероида 243 Ида през 1993 г. на път към Юпитер. Снимките разкриха, че Ида има малък сателит, по-късно наречен Дактил. От тогава насам са открити още няколко астероида със спътници."
}
{
Name "51 Пегас б"
Target "51 Peg/b"
Description "51 Пегас б е първата открита планета, която обикаля около нормална звезда, различна от Слънцето. Тя е газов гигант и орбитата ѝ е изключително близо до нейната звездата - по-малко от една пета от разстоянието между Меркурий и Слънцето. Съществуването на такава планета толкова близо до звезда накара астрономите да преразгледат теориите си за формирането на планетните системи."
Description "51 Пегас б е първата открита планета, която обикаля около нормална звезда, различна от Слънцето. Тя е планета газов гигант и орбитата ѝ е изключително близо до звездата ѝ - по-малко от една пета от разстоянието между Меркурий и Слънцето. Съществуването на такава планета толкова близо до звезда накара астрономите да преразгледат теориите си за формирането на планетните системи."
}
{
Name "Албирео"
Target "Albireo"
Distance 0.6
Description "Заради контрастните оранжеви и синьо-бели цветове на съставните ѝ звезди, двойната звездна система Албирео е смятана за една от най-красивите двойки в небето. Оранжевата звезда е гигант от клас K, а спътникът ѝ е джудже от клас B."
Description "Заради контрастните оранжеви и синьо-бели цветове на съставните ѝ звезди, двойната звездна система Албирео е смятана за една от най-красивите двойки в небето. Оранжевата звезда е клас K гигант, а спътникът ѝ е B джудже."
}
{
Name "Кометата Борели"
Target "Sol/Borrelly"
Description "На 22 Септември 2001 г., кометата Борели стана втората комета, която е заснета от космически апарат от близко разстояние. Въпреки че не е проектиран за това, „Deep Space“ 1 се приближи на 2 200 километра от ядрото на Борели и изпрати най-добрите снимки на ядро на комета, с които разполагаме."
Description "На 22 Септември 2001 г., кометата Борели стана втората комета, която беше снимана от космически апарат от близко разстояние. Въпреки че не беше проектиран да облита комети, Deep Space 1 се приближи на 2 200 километра от ядрото на Борели и ни изпрати най-добрите снимки на ядро на комета, с които разполагаме."
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 KiB

2555
po/be.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -100,7 +100,7 @@ void Nebula::render(const Vector3f& /*offset*/,
getOrientation());
GLSLUnlit_RenderContext rc(renderer, getRadius(), &mv, m.projection);
rc.setPointScale(2.0f * getRadius() / pixelSize);
rc.setPointScale(2.0f * getRadius() / pixelSize * renderer->getScreenDpi() / 96.0f);
g->render(rc);
renderer->enableBlending();

View File

@ -2570,14 +2570,14 @@ void Renderer::renderObject(const Vector3f& pos,
geometryScale = obj.radius;
scaleFactors = obj.radius * obj.semiAxes;
ringsScaleFactor = obj.radius * obj.semiAxes.maxCoeff();
ri.pointScale = 2.0f * obj.radius / pixelSize;
ri.pointScale = 2.0f * obj.radius / pixelSize * screenDpi / 96.0f;
}
else
{
geometryScale = obj.geometryScale;
scaleFactors = Vector3f::Constant(geometryScale);
ringsScaleFactor = geometryScale;
ri.pointScale = 2.0f * geometryScale / pixelSize;
ri.pointScale = 2.0f * geometryScale / pixelSize * screenDpi / 96.0f;
}
// Apply the modelview transform for the object
Affine3f transform = Translation3f(pos) * obj.orientation.conjugate();

View File

@ -387,7 +387,7 @@ static float rotperiod_M[3][10] =
const char* LumClassNames[StellarClass::Lum_Count] = {
"Ia-0", "Ia", "Ib", "II", "III", "IV", "V", "VI", ""
"I-a0", "I-a", "I-b", "II", "III", "IV", "V", "VI", ""
};
const char* SubclassNames[11] = {

View File

@ -17,43 +17,59 @@
using namespace Eigen;
using namespace std;
// TODO: More of the functions in this module should be converted to
// methods of the StarBrowser class.
struct CloserStarPredicate
{
Vector3f pos;
bool operator()(const Star* star0, const Star* star1) const
{
return (pos - star0->getPosition()).squaredNorm() < (pos - star1->getPosition()).squaredNorm();
Vector3f p0 = star0->getPosition();
Vector3f p1 = star1->getPosition();
#if 0
Vector3f v0(p0.x * 1e6 - pos.x, p0.y * 1e6 - pos.y, p0.z * 1e6 - pos.z);
Vector3f v1(p1.x * 1e6 - pos.x, p1.y * 1e6 - pos.y, p1.z * 1e6 - pos.z);
#endif
Vector3f v0 = p0 * 1.0e6f - pos;
Vector3f v1 = p1 * 1.0e6f - pos;
return (v0.squaredNorm() < v1.squaredNorm());
}
};
struct BrighterStarPredicate
{
Vector3f pos;
UniversalCoord ucPos;
bool operator()(const Star* star0, const Star* star1) const
{
float d0 = (pos - star0->getPosition()).norm();
float d1 = (pos - star1->getPosition()).norm();
Vector3f p0 = star0->getPosition();
Vector3f p1 = star1->getPosition();
Vector3f v0 = p0 * 1.0e6f - pos;
Vector3f v1 = p1 * 1.0e6f - pos;
float d0 = v0.norm();
float d1 = v1.norm();
// If the stars are closer than one light year, use
// a more precise distance estimate.
if (d0 < 1.0f)
d0 = ucPos.offsetFromLy(star0->getPosition()).norm();
if (d1 < 1.0f)
d1 = ucPos.offsetFromLy(star1->getPosition()).norm();
return star0->getApparentMagnitude(d0) < star1->getApparentMagnitude(d1);
return (star0->getApparentMagnitude(d0) <
star1->getApparentMagnitude(d1));
}
};
struct BrightestStarPredicate
{
bool operator()(const Star* star0, const Star* star1) const
{
return star0->getAbsoluteMagnitude() < star1->getAbsoluteMagnitude();
return (star0->getAbsoluteMagnitude() <
star1->getAbsoluteMagnitude());
}
};
struct SolarSystemPredicate
{
Vector3f pos;
@ -69,7 +85,11 @@ struct SolarSystemPredicate
bool hasPlanets1 = (iter != solarSystems->end());
if (hasPlanets1 == hasPlanets0)
{
return ((pos - star0->getPosition()).squaredNorm() < (pos - star1->getPosition()).squaredNorm());
Vector3f p0 = star0->getPosition();
Vector3f p1 = star1->getPosition();
Vector3f v0 = p0 * 1.0e6f - pos;
Vector3f v1 = p1 * 1.0e6f - pos;
return (v0.squaredNorm() < v1.squaredNorm());
}
else
{

View File

@ -57,6 +57,62 @@ Color StellarClass::getApparentColor(StellarClass::SpectralClass sc) const
}
}
// The << method of converting the stellar class to a string is
// preferred, but it's not always practical, especially when you've
// got a completely broken implementation of stringstreams to
// deal with (*cough* gcc *cough*).
string StellarClass::str() const
{
char s0, s1;
const char* s2 = "";
switch (getStarType())
{
case StellarClass::WhiteDwarf:
return "WD";
case StellarClass::NeutronStar:
return "Q";
case StellarClass::BlackHole:
return "X";
case StellarClass::NormalStar:
s0 = "OBAFGKMRSNWWW?LTYC"[(unsigned int) getSpectralClass()];
s1 = "0123456789"[getSubclass()];
switch (getLuminosityClass())
{
case StellarClass::Lum_Ia0:
s2 = " I-a0";
break;
case StellarClass::Lum_Ia:
s2 = " I-a";
break;
case StellarClass::Lum_Ib:
s2 = " I-b";
break;
case StellarClass::Lum_II:
s2 = " II";
break;
case StellarClass::Lum_III:
s2 = " III";
break;
case StellarClass::Lum_IV:
s2 = " IV";
break;
case StellarClass::Lum_V:
s2 = " V";
break;
case StellarClass::Lum_VI:
s2 = " VI";
break;
default: break; // Do nothing, but prevent GCC4 warnings (Beware: potentially dangerous)
}
return fmt::sprintf("%c%c%s", s0, s1, s2);
}
return "?";
}
uint16_t
StellarClass::packV1() const
{
@ -182,6 +238,14 @@ StellarClass::unpackV2(uint16_t st)
}
ostream& operator<<(ostream& os, const StellarClass& sc)
{
os << sc.str();
return os;
}
bool operator<(const StellarClass& sc0, const StellarClass& sc1)
{
return sc0.packV2() < sc1.packV2();
@ -209,7 +273,6 @@ enum ParseState
LumClassVState,
LumClassIdashState,
LumClassIaState,
LumClassIdashaState,
WDTypeState,
WDExtendedTypeState,
WDSubclassState,
@ -419,8 +482,6 @@ StellarClass::parse(const string& st)
case 'V':
state = LumClassVState;
break;
case ' ':
break;
default:
state = EndState;
break;
@ -474,8 +535,7 @@ StellarClass::parse(const string& st)
switch (c)
{
case 'a':
state = LumClassIdashaState;
i++;
state = LumClassIaState;
break;
case 'b':
lumClass = StellarClass::Lum_Ib;
@ -489,24 +549,6 @@ StellarClass::parse(const string& st)
break;
case LumClassIaState:
switch (c)
{
case '0':
lumClass = StellarClass::Lum_Ia0;
state = EndState;
break;
case '-':
state = LumClassIdashaState;
i++;
break;
default:
lumClass = StellarClass::Lum_Ia;
state = EndState;
break;
}
break;
case LumClassIdashaState:
switch (c)
{
case '0':

View File

@ -35,9 +35,9 @@ public:
Spectral_G = 4,
Spectral_K = 5,
Spectral_M = 6,
Spectral_R = 7, // superseded by class C
Spectral_R = 7, // superceded by class C
Spectral_S = 8,
Spectral_N = 9, // superseded by class C
Spectral_N = 9, // superceded by class C
Spectral_WC = 10,
Spectral_WN = 11,
Spectral_WO = 12,
@ -98,6 +98,8 @@ public:
Color getApparentColor() const;
Color getApparentColor(StellarClass::SpectralClass sc) const;
std::string str() const;
static StellarClass parse(const std::string&);
friend bool operator<(const StellarClass& sc0, const StellarClass& sc1);
@ -121,6 +123,8 @@ private:
};
std::ostream& operator<<(std::ostream& os, const StellarClass& sc);
// A rough ordering of stellar classes, from 'early' to 'late' . . .
// Useful for organizing a list of stars by spectral class.
bool operator<(const StellarClass& sc0, const StellarClass& sc1);

View File

@ -80,10 +80,6 @@ if(ENABLE_FFMPEG)
target_link_libraries(celestia ${FFMPEG_LIBRARIES})
endif()
if (HAVE_MESHOPTIMIZER)
target_link_libraries(celestia meshoptimizer::meshoptimizer)
endif()
install(TARGETS celestia LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} NAMELINK_SKIP)
add_subdirectory(glut)

View File

@ -943,11 +943,6 @@ void actionRenderSpacecrafts(GtkToggleAction* action, AppData* app)
}
void actionRenderPlanetRings(GtkToggleAction* action, AppData* app)
{
setRenderFlag(app, Renderer::ShowPlanetRings, gtk_toggle_action_get_active(action));
}
void actionRenderRingShadows(GtkToggleAction* action, AppData* app)
{
setRenderFlag(app, Renderer::ShowRingShadows, gtk_toggle_action_get_active(action));
@ -1275,9 +1270,9 @@ void resyncRenderActions(AppData* app)
/* Unlike the other interfaces, which go through each menu item and set
* the corresponding renderFlag, we go the other way and set the menu
* based on the renderFlag. Last one is ShowPlanetRings. */
* based on the renderFlag. Last one is ShowFadingOrbits. */
for (uint64_t i = Renderer::ShowStars; i <= Renderer::ShowPlanetRings; i *= 2)
for (uint64_t i = Renderer::ShowStars; i <= Renderer::ShowFadingOrbits; i *= 2)
{
switch (i)
{
@ -1299,7 +1294,6 @@ void resyncRenderActions(AppData* app)
case Renderer::ShowAtmospheres: actionName = "RenderAtmospheres"; break;
case Renderer::ShowSmoothLines: actionName = "RenderAA"; break;
case Renderer::ShowEclipseShadows: actionName = "RenderEclipseShadows"; break;
case Renderer::ShowPlanetRings: actionName = "RenderPlanetRings"; break;
case Renderer::ShowRingShadows: actionName = "RenderRingShadows"; break;
case Renderer::ShowBoundaries: actionName = "RenderConstellationBoundaries"; break;
case Renderer::ShowAutoMag: actionName = "RenderAutoMagnitude"; break;
@ -1323,7 +1317,7 @@ void resyncRenderActions(AppData* app)
action = gtk_action_group_get_action(app->agRender, actionName);
/* The current i anded with the renderFlags gives state of flag */
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), (i & rf) != 0);
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), (i & rf));
}
}
}

View File

@ -96,7 +96,6 @@ void actionRenderMinorMoons(GtkToggleAction*, AppData*);
void actionRenderAsteroids(GtkToggleAction*, AppData*);
void actionRenderComets(GtkToggleAction*, AppData*);
void actionRenderSpacecrafts(GtkToggleAction*, AppData*);
void actionRenderPlanetRings(GtkToggleAction*, AppData*);
void actionRenderRingShadows(GtkToggleAction*, AppData*);
void actionRenderStars(GtkToggleAction*, AppData*);

View File

@ -58,7 +58,6 @@
<menuitem action='RenderAsteroids'/>
<menuitem action='RenderComets'/>
<menuitem action='RenderSpacecrafts'/>
<menuitem action='RenderPlanetRings'/>
<menuitem action='RenderRingShadows'/>
<menuitem action='RenderStars'/>
</menu>

View File

@ -149,15 +149,9 @@ static void addPlanetarySystemToTree(const PlanetarySystem* sys, GtkTreeStore* s
case Body::Planet:
type = "Planet";
break;
case Body::DwarfPlanet:
type = "Dwarf Planet";
break;
case Body::Moon:
type = "Moon";
break;
case Body::MinorMoon:
type = "Minor Moon";
break;
case Body::Asteroid:
type = "Asteroid";
break;

View File

@ -155,7 +155,6 @@ void applySettingsFileMain(AppData* app, GKeyFile* file)
getFlag64(file, &rf, Renderer::ShowAtmospheres, "RenderFlags", "atmospheres", &errors);
getFlag64(file, &rf, Renderer::ShowSmoothLines, "RenderFlags", "smoothLines", &errors);
getFlag64(file, &rf, Renderer::ShowEclipseShadows, "RenderFlags", "eclipseShadows", &errors);
getFlag64(file, &rf, Renderer::ShowPlanetRings, "RenderFlags", "planetRings", &errors);
getFlag64(file, &rf, Renderer::ShowRingShadows, "RenderFlags", "ringShadows", &errors);
getFlag64(file, &rf, Renderer::ShowBoundaries, "RenderFlags", "boundaries", &errors);
getFlag64(file, &rf, Renderer::ShowAutoMag, "RenderFlags", "autoMag", &errors);
@ -268,7 +267,6 @@ void saveSettingsFile(AppData* app)
g_key_file_set_boolean(file, "RenderFlags", "atmospheres", (rf & Renderer::ShowAtmospheres) != 0);
g_key_file_set_boolean(file, "RenderFlags", "smoothLines", (rf & Renderer::ShowSmoothLines) != 0);
g_key_file_set_boolean(file, "RenderFlags", "eclipseShadows", (rf & Renderer::ShowEclipseShadows) != 0);
g_key_file_set_boolean(file, "RenderFlags", "planetRings", (rf & Renderer::ShowPlanetRings) != 0);
g_key_file_set_boolean(file, "RenderFlags", "ringShadows", (rf & Renderer::ShowRingShadows) != 0);
g_key_file_set_boolean(file, "RenderFlags", "boundaries", (rf & Renderer::ShowBoundaries) != 0);
g_key_file_set_boolean(file, "RenderFlags", "autoMag", (rf & Renderer::ShowAutoMag) != 0);

View File

@ -155,7 +155,6 @@ static const GtkToggleActionEntry actionsRenderFlags[] = {
{ "RenderComets", NULL, "Comets", NULL, NULL, G_CALLBACK(actionRenderComets), FALSE },
{ "RenderAsteroids", NULL, "Asteroids", NULL, NULL, G_CALLBACK(actionRenderAsteroids), FALSE },
{ "RenderSpacecrafts", NULL, "Spacecraft", NULL, NULL, G_CALLBACK(actionRenderSpacecrafts), FALSE },
{ "RenderPlanetRings", NULL, "Planet Rings", NULL, NULL, G_CALLBACK(actionRenderPlanetRings), FALSE },
{ "RenderRingShadows", NULL, "Ring Shadows", NULL, NULL, G_CALLBACK(actionRenderRingShadows), FALSE },
{ "RenderStars", NULL, "Stars", NULL, NULL, G_CALLBACK(actionRenderStars), FALSE },
};

View File

@ -14,15 +14,9 @@
#include <iterator>
#include <tuple>
#include <utility>
#include <celutil/logger.h>
#ifdef HAVE_MESHOPTIMIZER
#include <meshoptimizer.h>
#endif
#include "mesh.h"
using celestia::util::GetLogger;
namespace cmod
{
@ -44,13 +38,6 @@ VertexDescription appendingAttributes(const VertexDescription& desc, It begin, I
return VertexDescription(std::move(allAttributes));
}
bool
isOpaqueMaterial(const Material &material)
{
return (!(material.opacity > 0.01f && material.opacity < 1.0f)) &&
material.blend != BlendMode::AdditiveBlend;
}
} // end unnamed namespace
@ -333,7 +320,13 @@ Mesh::addGroup(PrimitiveGroupType prim,
{
PrimitiveGroup g;
if (prim == PrimitiveGroupType::LineStrip || prim == PrimitiveGroupType::LineList)
{
g = createLinePrimitiveGroup(prim == PrimitiveGroupType::LineStrip, indices);
}
else
{
g.primOverride = prim;
}
g.indices = std::move(indices);
g.prim = prim;
@ -400,80 +393,9 @@ Mesh::aggregateByMaterial()
{
return g0.materialIndex < g1.materialIndex;
});
mergePrimitiveGroups();
}
void
Mesh::mergePrimitiveGroups()
{
if (groups.size() < 2)
return;
std::vector<PrimitiveGroup> newGroups;
for (size_t i = 0; i < groups.size(); i++)
{
auto &g = groups[i];
if (g.vertexCountOverride == 0 && g.prim == PrimitiveGroupType::TriStrip)
{
std::vector<Index32> newIndices;
newIndices.reserve(g.indices.size() * 2);
for (size_t j = 0, e = g.indices.size() - 2; j < e; j++)
{
auto x = g.indices[j + 0];
auto y = g.indices[j + 1];
auto z = g.indices[j + 2];
// skip degenerated triangles
if (x == y || y == z || z == x)
continue;
if ((j & 1) != 0) // FIXME: CCW hardcoded
std::swap(y, z);
newIndices.push_back(x);
newIndices.push_back(y);
newIndices.push_back(z);
}
g.indices = std::move(newIndices);
g.prim = PrimitiveGroupType::TriList;
}
if (i == 0 || g.vertexCountOverride != 0 || g.prim != PrimitiveGroupType::TriList)
{
newGroups.push_back(std::move(g));
}
else
{
auto &p = newGroups.back();
if (p.prim != g.prim || p.materialIndex != g.materialIndex)
{
newGroups.push_back(std::move(g));
}
else
{
p.indices.reserve(p.indices.size() + g.indices.size());
p.indices.insert(p.indices.end(), g.indices.begin(), g.indices.end());
}
}
}
GetLogger()->info("Optimized mesh groups: had {} groups, now: {} of them.\n", groups.size(), newGroups.size());
groups = std::move(newGroups);
}
void
Mesh::optimize()
{
#ifdef HAVE_MESHOPTIMIZER
if (groups.size() > 1)
return;
auto &g = groups.front();
meshopt_optimizeVertexCache(g.indices.data(), g.indices.data(), g.indices.size(), nVertices);
meshopt_optimizeOverdraw(g.indices.data(), g.indices.data(), g.indices.size(), reinterpret_cast<float*>(vertices.data()), nVertices, vertexDesc.strideBytes, 1.05f);
meshopt_optimizeVertexFetch(vertices.data(), g.indices.data(), g.indices.size(), vertices.data(), nVertices, vertexDesc.strideBytes);
#endif
}
bool
Mesh::pick(const Eigen::Vector3d& rayOrigin, const Eigen::Vector3d& rayDirection, PickResult* result) const
{
@ -741,52 +663,4 @@ Mesh::getPrimitiveCount() const
return count;
}
void
Mesh::merge(const Mesh &other)
{
auto &ti = groups.front().indices;
const auto &oi = other.groups.front().indices;
ti.reserve(ti.size() + oi.size());
for (auto i : oi)
ti.push_back(i + nVertices);
vertices.reserve(vertices.size() + other.vertices.size());
vertices.insert(vertices.end(), other.vertices.begin(), other.vertices.end());
nVertices += other.nVertices;
}
bool
Mesh::canMerge(const Mesh &other, const std::vector<Material> &materials) const
{
if (getGroupCount() != 1 || other.getGroupCount() != 1)
return false;
const auto &tg = groups.front();
const auto &og = other.groups.front();
if (tg.vertexCountOverride != 0 || og.vertexCountOverride != 0 || tg.prim != PrimitiveGroupType::TriList)
return false;
if (std::tie(tg.materialIndex, tg.prim, vertexDesc.strideBytes) !=
std::tie(og.materialIndex, og.prim, other.vertexDesc.strideBytes))
return false;
if (!isOpaqueMaterial(materials[tg.materialIndex]) || !isOpaqueMaterial(materials[og.materialIndex]))
return false;
for (auto i = VertexAttributeSemantic::Position;
i < VertexAttributeSemantic::SemanticMax;
i = static_cast<VertexAttributeSemantic>(1 + static_cast<uint16_t>(i)))
{
auto &ta = vertexDesc.getAttribute(i);
auto &oa = other.vertexDesc.getAttribute(i);
if (ta.format != oa.format || ta.offsetWords != oa.offsetWords)
return false;
}
return true;
}
} // end namespace cmod

View File

@ -237,13 +237,8 @@ class Mesh
unsigned int getVertexStrideWords() const { return vertexDesc.strideBytes / sizeof(cmod::VWord); }
unsigned int getPrimitiveCount() const;
void merge(const Mesh&);
bool canMerge(const Mesh&, const std::vector<Material> &materials) const;
void optimize();
private:
PrimitiveGroup createLinePrimitiveGroup(bool lineStrip, const std::vector<Index32>& indices);
void mergePrimitiveGroups();
VertexDescription vertexDesc{ };

View File

@ -15,11 +15,8 @@
#include <Eigen/Geometry>
#include <celutil/logger.h>
#include "model.h"
using celestia::util::GetLogger;
namespace cmod
{
@ -318,6 +315,7 @@ Model::usesTextureType(TextureSemantic t) const
}
bool
Model::OpacityComparator::operator()(const Mesh& a, const Mesh& b) const
{
@ -337,25 +335,6 @@ Model::sortMeshes(const MeshComparator& comparator)
// Sort the meshes so that completely opaque ones are first
std::sort(meshes.begin(), meshes.end(), std::ref(comparator));
std::vector<Mesh> newMeshes;
newMeshes.push_back(meshes[0].clone());
for (size_t i = 1; i < meshes.size(); i++)
{
auto &p = newMeshes.back();
if (!p.canMerge(meshes[i], materials))
{
newMeshes.push_back(meshes[i].clone());
continue;
}
p.merge(meshes[i]);
}
GetLogger()->info("Merged similar meshes: {} -> {}.\n", meshes.size(), newMeshes.size());
for (auto &mesh : newMeshes)
mesh.optimize();
meshes = std::move(newMeshes);
}
} // end namespace cmod

View File

@ -266,9 +266,6 @@ static void checkTimeslice(lua_State* l, lua_Debug* /*ar*/)
// allow the script to perform cleanup
void LuaState::cleanup()
{
if (!costate)
return;
if (ioMode == Asking)
{
// Restore renderflags:

View File

@ -11,9 +11,7 @@
#include "mainwindow.h"
#include <QApplication>
#include <QGLFormat>
#include <celutil/logger.h>
using celestia::util::CreateLogger;
int
main(int argc, char *argv[])
@ -53,7 +51,5 @@ main(int argc, char *argv[])
// open events.
app.installEventFilter(&window);
CreateLogger();
return app.exec();
}

View File

@ -0,0 +1,28 @@
if(NOT ENABLE_QT)
message("Qt frontend is disabled, not building qttxf.")
return()
endif()
if(USE_QT6)
message("Qt tools not supported on Qt6, not building cmodview.")
return()
endif()
if(APPLE AND EXISTS /usr/local/opt/qt5)
# Homebrew installs Qt5 (up to at least 5.9.1) in
# /usr/local/qt5, ensure it can be found by CMake since
# it is not in the default /usr/local prefix.
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
endif()
set(QT_LIBS Widgets)
find_package(Qt5 COMPONENTS ${QT_LIBS} CONFIG REQUIRED)
# Instruct CMake to run moc automatically when needed
set(CMAKE_AUTOMOC ON)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_executable(qttxf WIN32 main.cpp mainwindow.cpp)
install(TARGETS qttxf RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
qt5_use_modules(qttxf ${QT_LIBS})

View File

@ -0,0 +1,10 @@
qttxf is a simple GUI tool for creating bitmap font files for use with
Celestia and other applications. The font files are saved in the TXF format
introduced by Mark Kilgard in his GLUT toolkit.
qttxf is Copyright (C) 2009 by Chris Laurel, and is distributed under the
terms of the GNU General Public License version 2. Please forward comments
and patches to claurel@gmail.com.

View File

@ -0,0 +1,23 @@
// qttxf - a Qt-based application to generate GLUT txf files from
// system fonts
//
// Copyright (C) 2009, Chris Laurel <claurel@gmail.com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#include <QApplication>
#include "mainwindow.h"
int
main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow window;
window.show();
return app.exec();
}

View File

@ -0,0 +1,391 @@
// qttxf - a Qt-based application to generate GLUT txf files from
// system fonts
//
// Copyright (C) 2009, Chris Laurel <claurel@gmail.com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#include "mainwindow.h"
#include <QComboBox>
#include <QFontComboBox>
#include <QScrollArea>
#include <QLabel>
#include <QFont>
#include <QDataStream>
#include <QDebug>
#include <QMessageBox>
#include <QFile>
#include <QAction>
#include <QMenuBar>
#include <QMenu>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QFileDialog>
#include <QPainter>
// TXF format constants
const char* TXF_HEADER_BYTES = "\377txf";
const quint32 TXF_ENDIANNESS_TEST = 0x12345678;
MainWindow::MainWindow() :
m_scrollArea(nullptr),
m_imageWidget(nullptr),
m_fontCombo(nullptr),
m_sizeCombo(nullptr),
m_styleCombo(nullptr),
m_saveAction(nullptr)
{
QWidget *centralWidget = new QWidget();
QLabel *fontLabel = new QLabel(tr("Font:"));
m_fontCombo = new QFontComboBox;
QLabel *sizeLabel = new QLabel(tr("Size:"));
m_sizeCombo = new QComboBox;
QLabel *styleLabel = new QLabel(tr("Style:"));
m_styleCombo = new QComboBox;
m_scrollArea = new QScrollArea();
m_imageWidget = new QLabel();
m_scrollArea->setWidget(m_imageWidget);
findStyles(m_fontCombo->currentFont());
findSizes(m_fontCombo->currentFont());
connect(m_fontCombo, SIGNAL(currentFontChanged(const QFont &)),
this, SLOT(findStyles(const QFont &)));
connect(m_fontCombo, SIGNAL(currentFontChanged(const QFont &)),
this, SLOT(findSizes(const QFont &)));
connect(m_fontCombo, SIGNAL(currentFontChanged(const QFont &)),
this, SLOT(updateFont(const QFont &)));
connect(m_sizeCombo, SIGNAL(currentIndexChanged(const QString &)),
this, SLOT(updateSize(const QString &)));
connect(m_styleCombo, SIGNAL(currentIndexChanged(const QString &)),
this, SLOT(updateStyle(const QString &)));
QHBoxLayout *controlsLayout = new QHBoxLayout;
controlsLayout->addWidget(fontLabel);
controlsLayout->addWidget(m_fontCombo, 1);
controlsLayout->addWidget(sizeLabel);
controlsLayout->addWidget(m_sizeCombo, 1);
controlsLayout->addWidget(styleLabel);
controlsLayout->addWidget(m_styleCombo, 1);
QVBoxLayout *centralLayout = new QVBoxLayout();
centralLayout->addLayout(controlsLayout);
centralLayout->addWidget(m_scrollArea, 1);
centralWidget->setLayout(centralLayout);
setCentralWidget(centralWidget);
setWindowTitle("QtTXF");
QMenuBar* menuBar = new QMenuBar(this);
QMenu* fileMenu = new QMenu(tr("File"));
m_saveAction = new QAction(tr("&Save..."), this);
QAction* quitAction = new QAction(tr("&Quit"), this);
fileMenu->addAction(m_saveAction);
fileMenu->addAction(quitAction);
menuBar->addMenu(fileMenu);
setMenuBar(menuBar);
m_saveAction->setShortcut(QKeySequence::Save);
connect(m_saveAction, SIGNAL(triggered()), this, SLOT(saveFont()));
quitAction->setShortcut(QKeySequence("Ctrl+Q"));
connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
buildTxf();
}
void MainWindow::findStyles(const QFont &font)
{
QFontDatabase fontDatabase;
QString currentItem = m_styleCombo->currentText();
m_styleCombo->clear();
QString style;
foreach (style, fontDatabase.styles(font.family()))
{
m_styleCombo->addItem(style);
}
int styleIndex = m_styleCombo->findText(currentItem);
if (styleIndex == -1)
m_styleCombo->setCurrentIndex(0);
else
m_styleCombo->setCurrentIndex(styleIndex);
}
void MainWindow::findSizes(const QFont &font)
{
QFontDatabase fontDatabase;
QString currentSize = m_sizeCombo->currentText();
m_sizeCombo->blockSignals(true);
m_sizeCombo->clear();
int size;
if (fontDatabase.isSmoothlyScalable(font.family(), fontDatabase.styleString(font)))
{
foreach(size, QFontDatabase::standardSizes())
{
m_sizeCombo->addItem(QVariant(size).toString());
m_sizeCombo->setEditable(true);
}
}
else
{
foreach (size, fontDatabase.smoothSizes(font.family(), fontDatabase.styleString(font)))
{
m_sizeCombo->addItem(QVariant(size).toString());
m_sizeCombo->setEditable(false);
}
}
m_sizeCombo->blockSignals(false);
int sizeIndex = m_sizeCombo->findText(currentSize);
if (sizeIndex == -1)
{
m_sizeCombo->setCurrentIndex(qMax(0, m_sizeCombo->count() / 3));
}
else
{
m_sizeCombo->setCurrentIndex(sizeIndex);
}
}
void
MainWindow::updateFont(const QFont& font)
{
qDebug() << font.family() << " match: " << font.exactMatch();
m_currentFont.setFamily(font.family());
buildTxf();
}
void
MainWindow::updateSize(const QString& sizeString)
{
m_currentFont.setPointSize(sizeString.toInt());
buildTxf();
}
void
MainWindow::updateStyle(const QString& /* styleName */)
{
buildTxf();
}
void
MainWindow::saveFont()
{
if (!m_fontData.isEmpty())
{
QString fileName = QFileDialog::getSaveFileName(this,
tr("Save Font File"),
"",
tr("Texture Fonts (*.txf)"));
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly))
{
QMessageBox::warning(this, tr("File Error"), tr("Error writing to %1").arg(fileName));
return;
}
QDataStream out(&file);
out.writeRawData(m_fontData.data(), m_fontData.length());
file.close();
}
}
struct BasicGlyphInfo
{
QChar ch;
int height;
};
bool operator<(const BasicGlyphInfo& info0, const BasicGlyphInfo& info1)
{
return info0.height > info1.height;
}
bool
MainWindow::buildTxf()
{
// Build a txf font from the current system font. Attempt to fit it into a 128x128
// texture, progressively increasing the texture size until it fits.
bool fitsInTexture = false;
int textureWidth = 128;
int textureHeight = 128;
while (textureWidth <= 1024 && !fitsInTexture)
{
m_fontData.clear();
QDataStream out(&m_fontData, QIODevice::WriteOnly);
if (buildTxf(m_currentFont, out, textureWidth, textureHeight))
{
fitsInTexture = true;
}
if (textureWidth == textureHeight)
textureWidth *= 2;
else
textureHeight *= 2;
}
if (!fitsInTexture)
{
QMessageBox::warning(this,
tr("Font Error"),
tr("Font is too large to fit in texture"));
m_fontData.clear();
}
m_saveAction->setEnabled(fitsInTexture);
return fitsInTexture;
}
QString characterRange(unsigned int firstChar, unsigned int lastChar)
{
QString s;
for (unsigned int i = firstChar; i <= lastChar; ++i)
{
s += QChar(i);
}
return s;
}
bool
MainWindow::buildTxf(const QFont& font, QDataStream& out, int texWidth, int texHeight)
{
QString charset;
charset += characterRange(0x0020, 0x007e); // ASCII
charset += characterRange(0x00a0, 0x00ff); // Latin-1 supplement
charset += characterRange(0x0100, 0x017f); // Latin Extended-A
charset += characterRange(0x0391, 0x03ce); // Greek
QPixmap pixmap(texWidth, texHeight);
QPainter painter(&pixmap);
QVector<BasicGlyphInfo> glyphInfoList;
QFont devFont(font, &pixmap);
QFontMetrics fm(devFont);
for (int i = 0; i < charset.length(); i++)
{
QChar ch = charset[i];
if (fm.inFont(ch))
{
BasicGlyphInfo info;
info.ch = ch;
info.height = fm.boundingRect(ch).height();
glyphInfoList << info;
}
}
// Sort the glyphs by height so that they pack more compactly
// into the available space.
std::sort(glyphInfoList.begin(), glyphInfoList.end());
if (glyphInfoList.isEmpty())
{
return false;
}
// Write txf file header
int maxAscent = 0;
int maxDescent = 0;
out.writeRawData(TXF_HEADER_BYTES, 4);
out << TXF_ENDIANNESS_TEST;
out << (quint32) 0;
out << (quint32) texWidth << (quint32) texHeight;
out << (quint32) maxAscent << (quint32) maxDescent;
out << (quint32) glyphInfoList.size();
// Clear the image
painter.fillRect(0, 0, texWidth, texHeight, Qt::black);
int rowHeight = glyphInfoList.first().height;
int x = 1;
int y = rowHeight;
int xSpacing = 3;
int ySpacing = 3;
painter.setFont(devFont);
foreach (BasicGlyphInfo info, glyphInfoList)
{
QRect bounds = fm.boundingRect(info.ch);
if (x + bounds.width() >= texWidth)
{
y += rowHeight + ySpacing;
rowHeight = bounds.height();
x = 1;
if (y >= texHeight)
{
qDebug() << "Not enough room in font glyph texture.";
return false;
}
}
painter.setPen(Qt::white);
painter.drawText(x - bounds.left(), y - bounds.bottom(), QString(info.ch));
#if 0
// Show bounding rectangles for debugging
painter.setPen(Qt::red);
QRect glyphRect = bounds;
glyphRect.translate(x - bounds.left(), y - bounds.bottom());
painter.drawRect(glyphRect);
#endif
// Write out the glyph record;
out << (quint16) info.ch.unicode();
out << (quint8) (bounds.width() + 2) << (quint8) (bounds.height() + 2);
out << (qint8) bounds.left() << (qint8) (-bounds.bottom());
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
out << (qint8) fm.horizontalAdvance(info.ch);
#else
out << (qint8) fm.width(info.ch);
#endif
out << (quint8) 0; /* unused */
out << (quint16) (x - 1) << (quint16) (texHeight - y - 2);
x += bounds.width() + xSpacing;
}
// Write out the glyph texture map
QImage glyphImage = pixmap.toImage();
for (int iy = 0; iy < texHeight; iy++)
{
for (int ix = 0; ix < texWidth; ix++)
{
QRgb rgb = glyphImage.pixel(ix, texHeight - iy - 1);
out << (quint8) qGreen(rgb);
}
}
QLabel* label = new QLabel(m_scrollArea);
label->setPixmap(pixmap);
m_scrollArea->setWidget(label);
return true;
}

View File

@ -0,0 +1,54 @@
// qttxf - a Qt-based application to generate GLUT txf files from
// system fonts
//
// Copyright (C) 2009, Chris Laurel <claurel@gmail.com>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#ifndef _QTTXF_MAINWINDOW_H_
#define _QTTXF_MAINWINDOW_H_
#include <QMainWindow>
#include <QString>
class QComboBox;
class QFontComboBox;
class QScrollArea;
class QLabel;
class QFont;
class QDataStream;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
bool buildTxf();
bool buildTxf(const QFont& font, QDataStream& out, int texWidth, int texHeight);
public slots:
void findStyles(const QFont& font);
void findSizes(const QFont& font);
void updateFont(const QFont& font);
void updateSize(const QString& sizeString);
void updateStyle(const QString& styleName);
void saveFont();
private:
QScrollArea *m_scrollArea;
QLabel* m_imageWidget;
QFontComboBox* m_fontCombo;
QComboBox* m_sizeCombo;
QComboBox* m_styleCombo;
QAction* m_saveAction;
QFont m_currentFont;
QByteArray m_fontData;
};
#endif // _QTTXF_MAINWINDOW_H_

View File

@ -0,0 +1,15 @@
TEMPLATE = app
TARGET = qttxf
QT += widgets
DESTDIR = build
OBJECTS_DIR = build
MOC_DIR = build
HEADERS = \
mainwindow.h
SOURCES = \
mainwindow.cpp \
main.cpp

View File

@ -161,13 +161,13 @@ void printStellarClass(uint16_t sc, ostream& out)
switch (luminosityClass) //without this questionmark a nullchar is written to the file
{ //causing that a dump of stardb is not a textfile but binary.
case StellarClass::Lum_Ia0:
out << "Ia-0";
out << "I-a0";
break;
case StellarClass::Lum_Ia:
out << "Ia";
out << "I-a";
break;
case StellarClass::Lum_Ib:
out << "Ib";
out << "I-b";
break;
case StellarClass::Lum_II:
out << "II";

View File

@ -111,13 +111,13 @@ void printStellarClass(uint16_t sc, ostream& out)
switch (luminosityClass)
{
case StellarClass::Lum_Ia0:
out << "Ia-0";
out << "I-a0";
break;
case StellarClass::Lum_Ia:
out << "Ia";
out << "I-a";
break;
case StellarClass::Lum_Ib:
out << "Ib";
out << "I-b";
break;
case StellarClass::Lum_II:
out << "II";

Binary file not shown.

View File

@ -1,37 +0,0 @@
#include <cstdint>
#include <memory>
#include <catch.hpp>
#include <cel3ds/3dsmodel.h>
#include <cel3ds/3dsread.h>
TEST_CASE("Load a 3DS file", "[3ds] [integration]")
{
std::unique_ptr<M3DScene> scene = Read3DSFile("huygens.3ds");
REQUIRE(scene != nullptr);
REQUIRE(scene->getMaterialCount() == 4);
REQUIRE(scene->getModelCount() == UINT32_C(8));
std::uint32_t meshCount = 0;
std::uint32_t faceCount = 0;
std::uint32_t vertexCount = 0;
for (std::uint32_t i = 0; i < scene->getModelCount(); ++i)
{
const M3DModel* model = scene->getModel(i);
REQUIRE(model != nullptr);
meshCount += model->getTriMeshCount();
for (std::uint32_t j = 0; j < model->getTriMeshCount(); ++j)
{
const M3DTriangleMesh* mesh = model->getTriMesh(j);
REQUIRE(mesh != nullptr);
faceCount += static_cast<std::uint32_t>(mesh->getFaceCount());
vertexCount += static_cast<std::uint32_t>(mesh->getVertexCount());
}
}
REQUIRE(meshCount == 8);
REQUIRE(faceCount == 6098);
REQUIRE(vertexCount == 3263);
}

View File

@ -1,7 +1,4 @@
test_case(3ds_load)
test_case(cmod_bin_ascii_roundtrip)
file(COPY "${CMAKE_SOURCE_DIR}/test/data/huygens.3ds"
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
file(COPY "${CMAKE_SOURCE_DIR}/test/data/iss/models/iss.cmod"
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")

View File

@ -1,6 +1,4 @@
if(NOT HAVE_FLOAT_CHARCONV)
test_case(charconv_compat)
endif()
test_case(charconv_compat)
test_case(greek)
test_case(hash)
test_case(logger)

View File

@ -1,22 +1,22 @@
#include <cstdint>
#include <celengine/stellarclass.h>
#include <catch.hpp>
#include <celengine/stellarclass.h>
#define CHECK_NORMAL_STAR(u, _class) \
#define CHECK_NORMAL_STAR(u, _class, _str) \
REQUIRE(u.getStarType() == StellarClass::NormalStar); \
REQUIRE(u.getSpectralClass() == _class); \
REQUIRE(u.getSubclass() == 5); \
REQUIRE(u.getLuminosityClass() == StellarClass::Lum_Ia0);
REQUIRE(u.getLuminosityClass() == StellarClass::Lum_Ia0); \
REQUIRE(u.str() == _str);
#define CHECK_WHITE_DWARF(u, _class) \
#define CHECK_WHITE_DWARF(u, _class, _str) \
REQUIRE(u.getStarType() == StellarClass::WhiteDwarf); \
REQUIRE(u.getSpectralClass() == _class); \
REQUIRE(u.getSubclass() == 5); \
REQUIRE(u.getLuminosityClass() == StellarClass::Lum_Unknown);
REQUIRE(u.getLuminosityClass() == StellarClass::Lum_Unknown); \
REQUIRE(u.str() == _str);
TEST_CASE("StellarClass packing", "[StellarClass]")
TEST_CASE("StellarClass", "[StellarClass]")
{
SECTION("StellarClass::Spectral_WO")
{
@ -25,21 +25,21 @@ TEST_CASE("StellarClass packing", "[StellarClass]")
5,
StellarClass::Lum_Ia0);
std::uint16_t packed;
uint16_t packed;
StellarClass u;
SECTION("Packed as V1")
{
packed = sc.packV1();
REQUIRE(u.unpackV1(packed));
CHECK_NORMAL_STAR(u, StellarClass::Spectral_Unknown);
CHECK_NORMAL_STAR(u, StellarClass::Spectral_Unknown, "?5 I-a0");
}
SECTION("Packed as V2")
{
packed = sc.packV2();
REQUIRE(u.unpackV2(packed));
CHECK_NORMAL_STAR(u, StellarClass::Spectral_WO);
CHECK_NORMAL_STAR(u, StellarClass::Spectral_WO, "W5 I-a0");
}
}
@ -50,21 +50,21 @@ TEST_CASE("StellarClass packing", "[StellarClass]")
5,
StellarClass::Lum_Ia0);
std::uint16_t packed;
uint16_t packed;
StellarClass u;
SECTION("Packed as V1")
{
packed = sc.packV1();
REQUIRE(u.unpackV1(packed));
CHECK_NORMAL_STAR(u, StellarClass::Spectral_Unknown);
CHECK_NORMAL_STAR(u, StellarClass::Spectral_Unknown, "?5 I-a0");
}
SECTION("Packed as V2")
{
packed = sc.packV2();
REQUIRE(u.unpackV2(packed));
CHECK_NORMAL_STAR(u, StellarClass::Spectral_Y);
CHECK_NORMAL_STAR(u, StellarClass::Spectral_Y, "Y5 I-a0");
}
}
@ -75,21 +75,21 @@ TEST_CASE("StellarClass packing", "[StellarClass]")
5,
StellarClass::Lum_Ia0);
std::uint16_t packed;
uint16_t packed;
StellarClass u;
SECTION("Packed as V1")
{
packed = sc.packV1();
REQUIRE(u.unpackV1(packed));
CHECK_NORMAL_STAR(u, StellarClass::Spectral_Unknown);
CHECK_NORMAL_STAR(u, StellarClass::Spectral_Unknown, "?5 I-a0");
}
SECTION("Packed as V2")
{
packed = sc.packV2();
REQUIRE(u.unpackV2(packed));
CHECK_NORMAL_STAR(u, StellarClass::Spectral_Unknown);
CHECK_NORMAL_STAR(u, StellarClass::Spectral_Unknown, "?5 I-a0");
}
}
@ -100,21 +100,21 @@ TEST_CASE("StellarClass packing", "[StellarClass]")
5,
StellarClass::Lum_Ia0);
std::uint16_t packed;
uint16_t packed;
StellarClass u;
SECTION("Packed as V1")
{
packed = sc.packV1();
REQUIRE(u.unpackV1(packed));
CHECK_NORMAL_STAR(u, StellarClass::Spectral_C);
CHECK_NORMAL_STAR(u, StellarClass::Spectral_C, "C5 I-a0");
}
SECTION("Packed as V2")
{
packed = sc.packV2();
REQUIRE(u.unpackV2(packed));
CHECK_NORMAL_STAR(u, StellarClass::Spectral_C);
CHECK_NORMAL_STAR(u, StellarClass::Spectral_C, "C5 I-a0");
}
}
@ -125,21 +125,21 @@ TEST_CASE("StellarClass packing", "[StellarClass]")
5,
StellarClass::Lum_Ia0);
std::uint16_t packed;
uint16_t packed;
StellarClass u;
SECTION("Packed as V1")
{
packed = sc.packV1();
REQUIRE(u.unpackV1(packed));
CHECK_NORMAL_STAR(u, StellarClass::Spectral_L);
CHECK_NORMAL_STAR(u, StellarClass::Spectral_L, "L5 I-a0");
}
SECTION("Packed as V2")
{
packed = sc.packV2();
REQUIRE(u.unpackV2(packed));
CHECK_NORMAL_STAR(u, StellarClass::Spectral_L);
CHECK_NORMAL_STAR(u, StellarClass::Spectral_L, "L5 I-a0");
}
}
@ -151,21 +151,21 @@ TEST_CASE("StellarClass packing", "[StellarClass]")
5,
StellarClass::Lum_Ia0);
std::uint16_t packed;
uint16_t packed;
StellarClass u;
SECTION("Packed as V1")
{
packed = sc.packV1();
REQUIRE(u.unpackV1(packed));
CHECK_NORMAL_STAR(u, StellarClass::Spectral_T);
CHECK_NORMAL_STAR(u, StellarClass::Spectral_T, "T5 I-a0");
}
SECTION("Packed as V2")
{
packed = sc.packV2();
REQUIRE(u.unpackV2(packed));
CHECK_NORMAL_STAR(u, StellarClass::Spectral_T);
CHECK_NORMAL_STAR(u, StellarClass::Spectral_T, "T5 I-a0");
}
}
@ -176,87 +176,22 @@ TEST_CASE("StellarClass packing", "[StellarClass]")
5,
StellarClass::Lum_Ia0);
std::uint16_t packed;
uint16_t packed;
StellarClass u;
SECTION("Packed as V1")
{
packed = sc.packV1();
REQUIRE(u.unpackV1(packed));
CHECK_WHITE_DWARF(u, StellarClass::Spectral_DO);
CHECK_WHITE_DWARF(u, StellarClass::Spectral_DO, "WD");
}
SECTION("Packed as V2")
{
packed = sc.packV2();
REQUIRE(u.unpackV2(packed));
CHECK_WHITE_DWARF(u, StellarClass::Spectral_DO);
CHECK_WHITE_DWARF(u, StellarClass::Spectral_DO, "WD");
}
}
}
TEST_CASE("StellarClass parsing", "[StellarClass]")
{
SECTION("Luminosity class I-a0")
{
StellarClass sc = StellarClass::parse("A9I-a0");
REQUIRE(sc.getStarType() == StellarClass::NormalStar);
REQUIRE(sc.getSpectralClass() == StellarClass::Spectral_A);
REQUIRE(sc.getSubclass() == 9);
REQUIRE(sc.getLuminosityClass() == StellarClass::Lum_Ia0);
}
SECTION("Luminosity class Ia-0")
{
StellarClass sc = StellarClass::parse("K Ia-0");
REQUIRE(sc.getStarType() == StellarClass::NormalStar);
REQUIRE(sc.getSpectralClass() == StellarClass::Spectral_K);
REQUIRE(sc.getSubclass() == StellarClass::Subclass_Unknown);
REQUIRE(sc.getLuminosityClass() == StellarClass::Lum_Ia0);
}
SECTION("Luminosity class Ia0")
{
StellarClass sc = StellarClass::parse("M3Ia0");
REQUIRE(sc.getStarType() == StellarClass::NormalStar);
REQUIRE(sc.getSpectralClass() == StellarClass::Spectral_M);
REQUIRE(sc.getSubclass() == 3);
REQUIRE(sc.getLuminosityClass() == StellarClass::Lum_Ia0);
}
SECTION("Luminosity class Ia")
{
StellarClass sc = StellarClass::parse("F7Ia");
REQUIRE(sc.getStarType() == StellarClass::NormalStar);
REQUIRE(sc.getSpectralClass() == StellarClass::Spectral_F);
REQUIRE(sc.getSubclass() == 7);
REQUIRE(sc.getLuminosityClass() == StellarClass::Lum_Ia);
}
SECTION("Luminosity class I-a")
{
StellarClass sc = StellarClass::parse("G4 I-a");
REQUIRE(sc.getStarType() == StellarClass::NormalStar);
REQUIRE(sc.getSpectralClass() == StellarClass::Spectral_G);
REQUIRE(sc.getSubclass() == 4);
REQUIRE(sc.getLuminosityClass() == StellarClass::Lum_Ia);
}
SECTION("Luminosity class Ib")
{
StellarClass sc = StellarClass::parse("B6 Ib");
REQUIRE(sc.getStarType() == StellarClass::NormalStar);
REQUIRE(sc.getSpectralClass() == StellarClass::Spectral_B);
REQUIRE(sc.getSubclass() == 6);
REQUIRE(sc.getLuminosityClass() == StellarClass::Lum_Ib);
}
SECTION("Luminosity class I-b")
{
StellarClass sc = StellarClass::parse("O5I-b");
REQUIRE(sc.getStarType() == StellarClass::NormalStar);
REQUIRE(sc.getSpectralClass() == StellarClass::Spectral_O);
REQUIRE(sc.getSubclass() == 5);
REQUIRE(sc.getLuminosityClass() == StellarClass::Lum_Ib);
}
}