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 *.la
*.exe *.exe
*.dll *.dll
*.swp
.DS_Store .DS_Store
po*/*.gmo po*/*.gmo
po*/POTFILES po*/POTFILES

3
.gitmodules vendored
View File

@ -1,6 +1,9 @@
[submodule "thirdparty/Spice"] [submodule "thirdparty/Spice"]
path = thirdparty/Spice path = thirdparty/Spice
url = https://github.com/OpenSpace/Spice.git url = https://github.com/OpenSpace/Spice.git
[submodule "content"]
path = content
url = https://github.com/CelestiaProject/CelestiaContent.git
[submodule "thirdparty/fmt"] [submodule "thirdparty/fmt"]
path = thirdparty/fmt path = thirdparty/fmt
url = https://github.com/fmtlib/fmt.git 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) 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() # Honor link flags in try_compile()
if (POLICY CMP0056) if (POLICY CMP0056)
cmake_policy(SET CMP0056 NEW) cmake_policy(SET CMP0056 NEW)
@ -250,14 +245,6 @@ endif()
find_package(Freetype REQUIRED) find_package(Freetype REQUIRED)
link_libraries(Freetype::Freetype) 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) get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames) list (SORT _variableNames)

View File

@ -739,7 +739,7 @@ Code:
* Eliminated obscuring of location labels that occurred low view aspect ratios * Eliminated obscuring of location labels that occurred low view aspect ratios
* Added models of comet Halley and the small moons Pandora and Larissa * Added models of comet Halley and the small moons Pandora and Larissa
* Added limit of knowledge masks for the Galilean moons * 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 R and N
* Lua scripting additions * Lua scripting additions
* View management commands * View management commands

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.

205
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
Celestia is a "real-time space simulation that lets you experience ![Celestia](celestia-logo.png)<br>
our universe in three dimensions". **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 program is free software; you can redistribute it and/or modify it under
This repo is a lesser fork of the upstream project, the terms of the GNU General Public License as published by the Free Software Foundation;
which has been revived. 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 Right drag the mouse to orbit Earth and you might see the Moon and some
GPLv2+ 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 Press H to select our Sun, and then G to go back to our Sun. Right click on
Package was removed from Debian in the ancient days due to bitrot. the sun to bring up a menu of planets and other objects in the solar system.
The upstream code has a new team and active development, using After selecting a planet from the menu, hit G again to travel toward it. Once
recent libraries. The package can be built under Debian Ok, except there, hold down the right mouse button and drag to orbit the planet.
for the `data/` files.
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.
``` ### Star browser
Upstream has not produced any new releases in the last 4 years. In the By default, the Star Browser window displays a table of the 100 nearest stars,
mean time, the package is accumulating bugs due to bitrot. It already along with their Distance, Apparent and Absolute Magnitude, and Type. Clicking
wasn't a trouble-free package, due to some quite important resources not on the column headers will sort the stars. The table is not continuously
being DFSG compliant. 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 ### Solar system browser
didn't exist when the Debian bug was created. So it may be that it The Solar System Browser displays a window with a tree view of all the objects
can be built happily without DFSG issues using new data files. 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.
Celestia depending on NASA's Spice/NAIF may be afoul of Debian's You can use common names, Bayer designations or catalog numbers for stars.
DFSG because the terms are unique. It isn't really a standard license. 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/
Debian tracker link: ### 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.
* https://tracker.debian.org/pkg/celestia 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)
# Build All three types of catalog file are text files that can be updated with your
Mini Debian package build howto. favorite text editing program.
``` ### Building from sources
# Install deps See instructions in file [INSTALL.md](INSTALL.md).
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
# Add ccache to PATH in ~/.bashrc, and log back in ## Contributions
PATH=/usr/lib/ccache:$PATH | **`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.|
# Make dirs to put it all, as it writes packages to the *parent* dir. ### Contributing
mkdir celestia-deb
cd celestia-deb
git clone https://spacecruft.org/spacecruft/CelestiaContent **We welcome feedback, bug reports, and pull requests!**
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
```
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 # text on the display screen. To view the list of fonts available with
# your distribution of Celestia, look in the fonts directory located # your distribution of Celestia, look in the fonts directory located
# under the Celestia root directory. The default fonts are UTF-8 # under the Celestia root directory. The default fonts are UTF-8
# compatible in order to display non-English characters. Font size is # compatible in order to display non-English characters.
# measured in points to ensure the same sizes on all DPI configurations.
# #
# Font: Used to display all informational text. # Font: Used to display all informational text.
# Default: "DejaVuSans.ttf,9" # Default: "sans12.txf"
# #
# LabelFont: Used to display all label text (objects, locations, etc.). # 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. # TitleFont: Used to display object names, messages, and script text.
# Default "DejaVuSans-Bold.ttf,15" # Default "sansbold20.txf"
#------------------------------------------------------------------------ #------------------------------------------------------------------------
Font "DejaVuSans.ttf,9" Font "DejaVuSans.ttf,9"
LabelFont "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\controls_zh_TW.txt"; DestDir: "{app}/locale"; Flags: ignoreversion
Source: "locale\demo_be.cel"; 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_de.cel"; DestDir: "{app}/locale"; Flags: ignoreversion
Source: "locale\demo_es.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 Source: "locale\demo_fr.cel"; DestDir: "{app}/locale"; Flags: ignoreversion

View File

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

View File

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

View File

@ -12,7 +12,7 @@ usr/bin/3dstocmod
usr/bin/cmodfix usr/bin/cmodfix
usr/bin/txt2cmod usr/bin/txt2cmod
usr/bin/cmodsphere usr/bin/cmodsphere
#usr/bin/qttxf usr/bin/qttxf
#usr/bin/spice2xyzv #usr/bin/spice2xyzv
usr/bin/vsoptrunc-rect usr/bin/vsoptrunc-rect
usr/bin/vsoptrunc-sph 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 celestia (1.7.0~git20190807+d9746691+0) UNRELEASED; urgency=medium
* New snapshot build * New snapshot build

1
debian/control vendored
View File

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

2
debian/rules vendored
View File

@ -26,8 +26,6 @@ override_dh_auto_configure:
override_dh_install: 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 {} ';' find debian/tmp/usr/bin/ -type f ! -name *.pl -exec chrpath --delete {} ';'
chrpath --delete debian/tmp/usr/lib/*/libcelestia.so.* chrpath --delete debian/tmp/usr/lib/*/libcelestia.so.*
dh_install --fail-missing dh_install --fail-missing

View File

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

View File

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

2551
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()); getOrientation());
GLSLUnlit_RenderContext rc(renderer, getRadius(), &mv, m.projection); 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); g->render(rc);
renderer->enableBlending(); renderer->enableBlending();

View File

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

View File

@ -17,43 +17,59 @@
using namespace Eigen; using namespace Eigen;
using namespace std; using namespace std;
// TODO: More of the functions in this module should be converted to
// methods of the StarBrowser class.
struct CloserStarPredicate struct CloserStarPredicate
{ {
Vector3f pos; Vector3f pos;
bool operator()(const Star* star0, const Star* star1) const 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 struct BrighterStarPredicate
{ {
Vector3f pos; Vector3f pos;
UniversalCoord ucPos; UniversalCoord ucPos;
bool operator()(const Star* star0, const Star* star1) const bool operator()(const Star* star0, const Star* star1) const
{ {
float d0 = (pos - star0->getPosition()).norm(); Vector3f p0 = star0->getPosition();
float d1 = (pos - star1->getPosition()).norm(); 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 return (star0->getApparentMagnitude(d0) <
// a more precise distance estimate. star1->getApparentMagnitude(d1));
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);
} }
}; };
struct BrightestStarPredicate struct BrightestStarPredicate
{ {
bool operator()(const Star* star0, const Star* star1) const bool operator()(const Star* star0, const Star* star1) const
{ {
return star0->getAbsoluteMagnitude() < star1->getAbsoluteMagnitude(); return (star0->getAbsoluteMagnitude() <
star1->getAbsoluteMagnitude());
} }
}; };
struct SolarSystemPredicate struct SolarSystemPredicate
{ {
Vector3f pos; Vector3f pos;
@ -69,7 +85,11 @@ struct SolarSystemPredicate
bool hasPlanets1 = (iter != solarSystems->end()); bool hasPlanets1 = (iter != solarSystems->end());
if (hasPlanets1 == hasPlanets0) 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 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 uint16_t
StellarClass::packV1() const 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) bool operator<(const StellarClass& sc0, const StellarClass& sc1)
{ {
return sc0.packV2() < sc1.packV2(); return sc0.packV2() < sc1.packV2();
@ -209,7 +273,6 @@ enum ParseState
LumClassVState, LumClassVState,
LumClassIdashState, LumClassIdashState,
LumClassIaState, LumClassIaState,
LumClassIdashaState,
WDTypeState, WDTypeState,
WDExtendedTypeState, WDExtendedTypeState,
WDSubclassState, WDSubclassState,
@ -419,8 +482,6 @@ StellarClass::parse(const string& st)
case 'V': case 'V':
state = LumClassVState; state = LumClassVState;
break; break;
case ' ':
break;
default: default:
state = EndState; state = EndState;
break; break;
@ -474,8 +535,7 @@ StellarClass::parse(const string& st)
switch (c) switch (c)
{ {
case 'a': case 'a':
state = LumClassIdashaState; state = LumClassIaState;
i++;
break; break;
case 'b': case 'b':
lumClass = StellarClass::Lum_Ib; lumClass = StellarClass::Lum_Ib;
@ -489,24 +549,6 @@ StellarClass::parse(const string& st)
break; break;
case LumClassIaState: 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) switch (c)
{ {
case '0': case '0':

View File

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

View File

@ -80,10 +80,6 @@ if(ENABLE_FFMPEG)
target_link_libraries(celestia ${FFMPEG_LIBRARIES}) target_link_libraries(celestia ${FFMPEG_LIBRARIES})
endif() endif()
if (HAVE_MESHOPTIMIZER)
target_link_libraries(celestia meshoptimizer::meshoptimizer)
endif()
install(TARGETS celestia LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} NAMELINK_SKIP) install(TARGETS celestia LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} NAMELINK_SKIP)
add_subdirectory(glut) 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) void actionRenderRingShadows(GtkToggleAction* action, AppData* app)
{ {
setRenderFlag(app, Renderer::ShowRingShadows, gtk_toggle_action_get_active(action)); 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 /* Unlike the other interfaces, which go through each menu item and set
* the corresponding renderFlag, we go the other way and set the menu * 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) switch (i)
{ {
@ -1299,7 +1294,6 @@ void resyncRenderActions(AppData* app)
case Renderer::ShowAtmospheres: actionName = "RenderAtmospheres"; break; case Renderer::ShowAtmospheres: actionName = "RenderAtmospheres"; break;
case Renderer::ShowSmoothLines: actionName = "RenderAA"; break; case Renderer::ShowSmoothLines: actionName = "RenderAA"; break;
case Renderer::ShowEclipseShadows: actionName = "RenderEclipseShadows"; break; case Renderer::ShowEclipseShadows: actionName = "RenderEclipseShadows"; break;
case Renderer::ShowPlanetRings: actionName = "RenderPlanetRings"; break;
case Renderer::ShowRingShadows: actionName = "RenderRingShadows"; break; case Renderer::ShowRingShadows: actionName = "RenderRingShadows"; break;
case Renderer::ShowBoundaries: actionName = "RenderConstellationBoundaries"; break; case Renderer::ShowBoundaries: actionName = "RenderConstellationBoundaries"; break;
case Renderer::ShowAutoMag: actionName = "RenderAutoMagnitude"; break; case Renderer::ShowAutoMag: actionName = "RenderAutoMagnitude"; break;
@ -1323,7 +1317,7 @@ void resyncRenderActions(AppData* app)
action = gtk_action_group_get_action(app->agRender, actionName); action = gtk_action_group_get_action(app->agRender, actionName);
/* The current i anded with the renderFlags gives state of flag */ /* 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 actionRenderAsteroids(GtkToggleAction*, AppData*);
void actionRenderComets(GtkToggleAction*, AppData*); void actionRenderComets(GtkToggleAction*, AppData*);
void actionRenderSpacecrafts(GtkToggleAction*, AppData*); void actionRenderSpacecrafts(GtkToggleAction*, AppData*);
void actionRenderPlanetRings(GtkToggleAction*, AppData*);
void actionRenderRingShadows(GtkToggleAction*, AppData*); void actionRenderRingShadows(GtkToggleAction*, AppData*);
void actionRenderStars(GtkToggleAction*, AppData*); void actionRenderStars(GtkToggleAction*, AppData*);

View File

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

View File

@ -149,15 +149,9 @@ static void addPlanetarySystemToTree(const PlanetarySystem* sys, GtkTreeStore* s
case Body::Planet: case Body::Planet:
type = "Planet"; type = "Planet";
break; break;
case Body::DwarfPlanet:
type = "Dwarf Planet";
break;
case Body::Moon: case Body::Moon:
type = "Moon"; type = "Moon";
break; break;
case Body::MinorMoon:
type = "Minor Moon";
break;
case Body::Asteroid: case Body::Asteroid:
type = "Asteroid"; type = "Asteroid";
break; 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::ShowAtmospheres, "RenderFlags", "atmospheres", &errors);
getFlag64(file, &rf, Renderer::ShowSmoothLines, "RenderFlags", "smoothLines", &errors); getFlag64(file, &rf, Renderer::ShowSmoothLines, "RenderFlags", "smoothLines", &errors);
getFlag64(file, &rf, Renderer::ShowEclipseShadows, "RenderFlags", "eclipseShadows", &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::ShowRingShadows, "RenderFlags", "ringShadows", &errors);
getFlag64(file, &rf, Renderer::ShowBoundaries, "RenderFlags", "boundaries", &errors); getFlag64(file, &rf, Renderer::ShowBoundaries, "RenderFlags", "boundaries", &errors);
getFlag64(file, &rf, Renderer::ShowAutoMag, "RenderFlags", "autoMag", &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", "atmospheres", (rf & Renderer::ShowAtmospheres) != 0);
g_key_file_set_boolean(file, "RenderFlags", "smoothLines", (rf & Renderer::ShowSmoothLines) != 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", "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", "ringShadows", (rf & Renderer::ShowRingShadows) != 0);
g_key_file_set_boolean(file, "RenderFlags", "boundaries", (rf & Renderer::ShowBoundaries) != 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); 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 }, { "RenderComets", NULL, "Comets", NULL, NULL, G_CALLBACK(actionRenderComets), FALSE },
{ "RenderAsteroids", NULL, "Asteroids", NULL, NULL, G_CALLBACK(actionRenderAsteroids), FALSE }, { "RenderAsteroids", NULL, "Asteroids", NULL, NULL, G_CALLBACK(actionRenderAsteroids), FALSE },
{ "RenderSpacecrafts", NULL, "Spacecraft", NULL, NULL, G_CALLBACK(actionRenderSpacecrafts), 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 }, { "RenderRingShadows", NULL, "Ring Shadows", NULL, NULL, G_CALLBACK(actionRenderRingShadows), FALSE },
{ "RenderStars", NULL, "Stars", NULL, NULL, G_CALLBACK(actionRenderStars), FALSE }, { "RenderStars", NULL, "Stars", NULL, NULL, G_CALLBACK(actionRenderStars), FALSE },
}; };

View File

@ -14,15 +14,9 @@
#include <iterator> #include <iterator>
#include <tuple> #include <tuple>
#include <utility> #include <utility>
#include <celutil/logger.h>
#ifdef HAVE_MESHOPTIMIZER
#include <meshoptimizer.h>
#endif
#include "mesh.h" #include "mesh.h"
using celestia::util::GetLogger;
namespace cmod namespace cmod
{ {
@ -44,13 +38,6 @@ VertexDescription appendingAttributes(const VertexDescription& desc, It begin, I
return VertexDescription(std::move(allAttributes)); 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 } // end unnamed namespace
@ -333,7 +320,13 @@ Mesh::addGroup(PrimitiveGroupType prim,
{ {
PrimitiveGroup g; PrimitiveGroup g;
if (prim == PrimitiveGroupType::LineStrip || prim == PrimitiveGroupType::LineList) if (prim == PrimitiveGroupType::LineStrip || prim == PrimitiveGroupType::LineList)
{
g = createLinePrimitiveGroup(prim == PrimitiveGroupType::LineStrip, indices); g = createLinePrimitiveGroup(prim == PrimitiveGroupType::LineStrip, indices);
}
else
{
g.primOverride = prim;
}
g.indices = std::move(indices); g.indices = std::move(indices);
g.prim = prim; g.prim = prim;
@ -400,80 +393,9 @@ Mesh::aggregateByMaterial()
{ {
return g0.materialIndex < g1.materialIndex; 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 bool
Mesh::pick(const Eigen::Vector3d& rayOrigin, const Eigen::Vector3d& rayDirection, PickResult* result) const Mesh::pick(const Eigen::Vector3d& rayOrigin, const Eigen::Vector3d& rayDirection, PickResult* result) const
{ {
@ -741,52 +663,4 @@ Mesh::getPrimitiveCount() const
return count; 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 } // end namespace cmod

View File

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

View File

@ -15,11 +15,8 @@
#include <Eigen/Geometry> #include <Eigen/Geometry>
#include <celutil/logger.h>
#include "model.h" #include "model.h"
using celestia::util::GetLogger;
namespace cmod namespace cmod
{ {
@ -318,6 +315,7 @@ Model::usesTextureType(TextureSemantic t) const
} }
bool bool
Model::OpacityComparator::operator()(const Mesh& a, const Mesh& b) const 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 // Sort the meshes so that completely opaque ones are first
std::sort(meshes.begin(), meshes.end(), std::ref(comparator)); 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 } // end namespace cmod

View File

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

View File

@ -11,9 +11,7 @@
#include "mainwindow.h" #include "mainwindow.h"
#include <QApplication> #include <QApplication>
#include <QGLFormat> #include <QGLFormat>
#include <celutil/logger.h>
using celestia::util::CreateLogger;
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
@ -53,7 +51,5 @@ main(int argc, char *argv[])
// open events. // open events.
app.installEventFilter(&window); app.installEventFilter(&window);
CreateLogger();
return app.exec(); 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 switch (luminosityClass) //without this questionmark a nullchar is written to the file
{ //causing that a dump of stardb is not a textfile but binary. { //causing that a dump of stardb is not a textfile but binary.
case StellarClass::Lum_Ia0: case StellarClass::Lum_Ia0:
out << "Ia-0"; out << "I-a0";
break; break;
case StellarClass::Lum_Ia: case StellarClass::Lum_Ia:
out << "Ia"; out << "I-a";
break; break;
case StellarClass::Lum_Ib: case StellarClass::Lum_Ib:
out << "Ib"; out << "I-b";
break; break;
case StellarClass::Lum_II: case StellarClass::Lum_II:
out << "II"; out << "II";

View File

@ -111,13 +111,13 @@ void printStellarClass(uint16_t sc, ostream& out)
switch (luminosityClass) switch (luminosityClass)
{ {
case StellarClass::Lum_Ia0: case StellarClass::Lum_Ia0:
out << "Ia-0"; out << "I-a0";
break; break;
case StellarClass::Lum_Ia: case StellarClass::Lum_Ia:
out << "Ia"; out << "I-a";
break; break;
case StellarClass::Lum_Ib: case StellarClass::Lum_Ib:
out << "Ib"; out << "I-b";
break; break;
case StellarClass::Lum_II: case StellarClass::Lum_II:
out << "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) 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" file(COPY "${CMAKE_SOURCE_DIR}/test/data/iss/models/iss.cmod"
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")

View File

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

View File

@ -1,22 +1,22 @@
#include <cstdint> #include <celengine/stellarclass.h>
#include <catch.hpp> #include <catch.hpp>
#include <celengine/stellarclass.h> #define CHECK_NORMAL_STAR(u, _class, _str) \
#define CHECK_NORMAL_STAR(u, _class) \
REQUIRE(u.getStarType() == StellarClass::NormalStar); \ REQUIRE(u.getStarType() == StellarClass::NormalStar); \
REQUIRE(u.getSpectralClass() == _class); \ REQUIRE(u.getSpectralClass() == _class); \
REQUIRE(u.getSubclass() == 5); \ 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.getStarType() == StellarClass::WhiteDwarf); \
REQUIRE(u.getSpectralClass() == _class); \ REQUIRE(u.getSpectralClass() == _class); \
REQUIRE(u.getSubclass() == 5); \ 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") SECTION("StellarClass::Spectral_WO")
{ {
@ -25,21 +25,21 @@ TEST_CASE("StellarClass packing", "[StellarClass]")
5, 5,
StellarClass::Lum_Ia0); StellarClass::Lum_Ia0);
std::uint16_t packed; uint16_t packed;
StellarClass u; StellarClass u;
SECTION("Packed as V1") SECTION("Packed as V1")
{ {
packed = sc.packV1(); packed = sc.packV1();
REQUIRE(u.unpackV1(packed)); 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") SECTION("Packed as V2")
{ {
packed = sc.packV2(); packed = sc.packV2();
REQUIRE(u.unpackV2(packed)); 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, 5,
StellarClass::Lum_Ia0); StellarClass::Lum_Ia0);
std::uint16_t packed; uint16_t packed;
StellarClass u; StellarClass u;
SECTION("Packed as V1") SECTION("Packed as V1")
{ {
packed = sc.packV1(); packed = sc.packV1();
REQUIRE(u.unpackV1(packed)); 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") SECTION("Packed as V2")
{ {
packed = sc.packV2(); packed = sc.packV2();
REQUIRE(u.unpackV2(packed)); 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, 5,
StellarClass::Lum_Ia0); StellarClass::Lum_Ia0);
std::uint16_t packed; uint16_t packed;
StellarClass u; StellarClass u;
SECTION("Packed as V1") SECTION("Packed as V1")
{ {
packed = sc.packV1(); packed = sc.packV1();
REQUIRE(u.unpackV1(packed)); 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") SECTION("Packed as V2")
{ {
packed = sc.packV2(); packed = sc.packV2();
REQUIRE(u.unpackV2(packed)); 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, 5,
StellarClass::Lum_Ia0); StellarClass::Lum_Ia0);
std::uint16_t packed; uint16_t packed;
StellarClass u; StellarClass u;
SECTION("Packed as V1") SECTION("Packed as V1")
{ {
packed = sc.packV1(); packed = sc.packV1();
REQUIRE(u.unpackV1(packed)); 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") SECTION("Packed as V2")
{ {
packed = sc.packV2(); packed = sc.packV2();
REQUIRE(u.unpackV2(packed)); 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, 5,
StellarClass::Lum_Ia0); StellarClass::Lum_Ia0);
std::uint16_t packed; uint16_t packed;
StellarClass u; StellarClass u;
SECTION("Packed as V1") SECTION("Packed as V1")
{ {
packed = sc.packV1(); packed = sc.packV1();
REQUIRE(u.unpackV1(packed)); 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") SECTION("Packed as V2")
{ {
packed = sc.packV2(); packed = sc.packV2();
REQUIRE(u.unpackV2(packed)); 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, 5,
StellarClass::Lum_Ia0); StellarClass::Lum_Ia0);
std::uint16_t packed; uint16_t packed;
StellarClass u; StellarClass u;
SECTION("Packed as V1") SECTION("Packed as V1")
{ {
packed = sc.packV1(); packed = sc.packV1();
REQUIRE(u.unpackV1(packed)); 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") SECTION("Packed as V2")
{ {
packed = sc.packV2(); packed = sc.packV2();
REQUIRE(u.unpackV2(packed)); 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, 5,
StellarClass::Lum_Ia0); StellarClass::Lum_Ia0);
std::uint16_t packed; uint16_t packed;
StellarClass u; StellarClass u;
SECTION("Packed as V1") SECTION("Packed as V1")
{ {
packed = sc.packV1(); packed = sc.packV1();
REQUIRE(u.unpackV1(packed)); REQUIRE(u.unpackV1(packed));
CHECK_WHITE_DWARF(u, StellarClass::Spectral_DO); CHECK_WHITE_DWARF(u, StellarClass::Spectral_DO, "WD");
} }
SECTION("Packed as V2") SECTION("Packed as V2")
{ {
packed = sc.packV2(); packed = sc.packV2();
REQUIRE(u.unpackV2(packed)); 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);
}
} }