Merge remote-tracking branch 'origin/master' into feature/shadows

This commit is contained in:
benpm
2025-09-23 09:55:48 -06:00
32 changed files with 802 additions and 374 deletions

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_amor_asteroid.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 4,
Color = { 1.0, 1.0, 1.0 },
TrailFade = 11,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_apollo_asteroid.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 6,
Color = { 0.7, 0.7, 1.0 },
TrailFade = 10,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_aten_asteroid.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 2,
Color = { 0.15, 0.15, 1.0 },
TrailFade = 18,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_atira_asteroid.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 2,
Color = { 0.5, 0.8, 1.0 },
TrailFade = 25,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_centaur_asteroid.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 6,
Color = { 0.94, 0.96, 0.94 },
TrailFade = 18,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_chiron-type_comet.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 10,
Color = { 0.15, 0.1, 1.0 },
TrailFade = 25,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_encke-type_comet.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 2,
Color = { 0.8, 0.34, 1.0 },
TrailFade = 23,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_halley-type_comet.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 9,
Color = { 0.66, 0.66, 0.66 },
TrailFade = 18,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_inner_main_belt_asteroid.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 1,
Color = { 1.0, 1.0, 0.0 },
TrailFade = 0.5,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_jupiter-family_comet.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 10,
Color = { 0.2, 0.8, 0.2 },
TrailFade = 28,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_jupiter_trojan_asteroid.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 1,
Color = { 0.5, 0.8, 0.5 },
TrailFade = 5,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_main_belt_asteroid.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 1,
Color = { 0.0, 0.5, 0.0 },
TrailFade = 0.1,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_mars-crossing_asteroid.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 1,
Color = { 0.814, 0.305, 0.22 },
TrailFade = 13,

View File

@@ -15,9 +15,8 @@ local Object = {
Parent = transforms.SunEclipJ2000.Identifier,
Renderable = {
Type = "RenderableOrbitalKepler",
Path = mpcorb,
Path = mpcorb .. "MPCORB.DAT",
Format = "MPC",
Segments = 200,
SegmentQuality = 4,
Color = { 0.8, 0.15, 0.2 },
TrailFade = 11,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_outer_main_belt_asteroid.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 1,
Color = { 0.4, 0.4, 1.0 },
TrailFade = 2,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_pha.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 3,
Color = { 0.98, 0.09, 0.06 },
TrailFade = 17,

View File

@@ -17,7 +17,6 @@ local Object = {
Type = "RenderableOrbitalKepler",
Path = sssb .. "sssb_data_transneptunian_object_asteroid.csv",
Format = "SBDB",
Segments = 200,
SegmentQuality = 8,
Color = { 0.56, 0.64, 0.95 },
TrailFade = 10,

View File

@@ -39,8 +39,7 @@ namespace documentation { struct Documentation; }
class DashboardTextItem : public DashboardItem {
public:
explicit DashboardTextItem(const ghoul::Dictionary& dictionary, float fontSize = 10.f,
const std::string& fontName = "Mono");
explicit DashboardTextItem(const ghoul::Dictionary& dictionary);
void render(glm::vec2& penPosition) override;

View File

@@ -34,6 +34,7 @@
#include <openspace/util/keys.h>
#include <ghoul/opengl/ghoul_gl.h>
#include <ghoul/opengl/uniformcache.h>
#include <map>
#include <memory>
#include <string>
#include <vector>
@@ -63,6 +64,17 @@ public:
private:
void parallelConnectionChanged(const ParallelConnection::Status& status);
void addToCommand(const std::string& c);
void registerKeyHandlers();
void registerKeyHandler(Key key, KeyModifier modifier, std::function<void()> callback);
// Helper functions for tab autocomplete
void autoCompleteCommand();
size_t detectContext(std::string_view command);
bool gatherPathSuggestions(size_t contextStart);
void gatherFunctionSuggestions(size_t contextStart);
void filterSuggestions();
void cycleSuggestion();
void applySuggestion();
properties::BoolProperty _isVisible;
properties::BoolProperty _shouldBeSynchronized;
@@ -79,12 +91,29 @@ private:
std::vector<std::string> _commandsHistory;
size_t _activeCommand = 0;
std::vector<std::string> _commands;
// Map of registered keybinds and their corresponding callbacks
std::map<KeyWithModifier, std::function<void()>> _keyHandlers;
struct {
int lastIndex;
bool hasInitialValue;
std::string initialValue;
} _autoCompleteInfo;
enum class Context {
None = 0,
Function,
Path
};
struct AutoCompleteState {
AutoCompleteState();
Context context; // Assumed context we are currently in based on
bool isDataDirty; // Flag indicating if we need to update the suggestion data
std::string input; // Part of the command that we're intrested in
std::vector<std::string> suggestions; // All suggestions found so far
int currentIndex; // Current suggestion index
std::string suggestion; // Current suggestion to show
bool cycleReverse; // Whether we should cycle suggestions forward or backwards
size_t insertPosition; // Where to insert the suggestion in the command
};
AutoCompleteState _autoCompleteState;
float _currentHeight = 0.f;
float _targetHeight = 0.f;

View File

@@ -613,6 +613,9 @@ public:
std::string dateFromEphemerisTime(double ephemerisTime, const char* format);
void dateFromEphemerisTime(double ephemerisTime, char* outBuf, int bufferSize,
const std::string& format = "YYYY MON DDTHR:MN:SC.### ::RND") const;
/**
* Returns the \p position of a \p target body relative to an \p observer in a
* specific \p referenceFrame, optionally corrected for \p lightTime (planetary

View File

@@ -136,6 +136,13 @@ public:
*/
std::string_view UTC() const;
/**
* Returns the current time as a formatted date string. The date string can be
* formatted using the SPICE picture parameters as described in
* https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/timout_c.html
*/
std::string_view string(const std::string& format) const;
/**
* Returns the current time as a ISO 8601 formatted, i.e YYYY-MM-DDThh:mm:ssZ.
*

View File

@@ -79,7 +79,7 @@ documentation::Documentation DashboardItemDate::Documentation() {
}
DashboardItemDate::DashboardItemDate(const ghoul::Dictionary& dictionary)
: DashboardTextItem(dictionary, 15.f)
: DashboardTextItem(dictionary)
, _formatString(FormatStringInfo, "Date: {}")
, _timeFormat(TimeFormatInfo, "YYYY MON DD HR:MN:SC.### UTC ::RND")
{

View File

@@ -111,7 +111,7 @@ documentation::Documentation DashboardItemElapsedTime::Documentation() {
}
DashboardItemElapsedTime::DashboardItemElapsedTime(const ghoul::Dictionary& dictionary)
: DashboardTextItem(dictionary, 15.f)
: DashboardTextItem(dictionary)
, _formatString(FormatStringInfo, "Elapsed time: {}")
, _referenceTime(ReferenceTimeInfo)
, _simplifyTime(SimplifyTimeInfo, true)

View File

@@ -69,7 +69,7 @@ documentation::Documentation DashboardItemMission::Documentation() {
}
DashboardItemMission::DashboardItemMission(const ghoul::Dictionary& dictionary)
: DashboardTextItem(dictionary, 15.f)
: DashboardTextItem(dictionary)
{}
void DashboardItemMission::update() {}

View File

@@ -103,7 +103,8 @@ namespace {
// Downloads a file from Lua interpreter
[[codegen::luawrap]] void downloadFile(std::string url, std::string savePath,
bool waitForCompletion = false)
bool waitForCompletion = false,
bool overrideExistingFile = true)
{
using namespace openspace;
@@ -112,7 +113,7 @@ namespace {
global::downloadManager->downloadFile(
url,
savePath,
DownloadManager::OverrideFile::Yes,
DownloadManager::OverrideFile(overrideExistingFile),
DownloadManager::FailOnError::Yes,
5
);

View File

@@ -64,11 +64,10 @@ documentation::Documentation DashboardTextItem::Documentation() {
return codegen::doc<Parameters>("dashboardtextitem");
}
DashboardTextItem::DashboardTextItem(const ghoul::Dictionary& dictionary, float fontSize,
const std::string& fontName)
DashboardTextItem::DashboardTextItem(const ghoul::Dictionary& dictionary)
: DashboardItem(dictionary)
, _fontName(FontNameInfo, fontName)
, _fontSize(FontSizeInfo, fontSize, 6.f, 144.f, 1.f)
, _fontName(FontNameInfo, "Mono")
, _fontSize(FontSizeInfo, 10.f, 6.f, 144.f, 1.f)
{
const Parameters p = codegen::bake<Parameters>(dictionary);

File diff suppressed because it is too large Load Diff

View File

@@ -637,10 +637,26 @@ std::string SpiceManager::dateFromEphemerisTime(double ephemerisTime, const char
et2utc_c(ephemerisTime, "C", SecondsPrecision, BufferSize, Buffer.data());
}
return std::string(Buffer.data());
}
void SpiceManager::dateFromEphemerisTime(double ephemerisTime, char* outBuf,
int bufferSize, const std::string& format) const
{
timout_c(ephemerisTime, format.c_str(), bufferSize, outBuf);
if (failed_c()) {
throwSpiceError(std::format(
"Error converting ephemeris time '{}' to date with format '{}'",
ephemerisTime, format
));
}
if (outBuf[0] == '*') {
// The conversion failed and we need to use et2utc
constexpr int SecondsPrecision = 3;
et2utc_c(ephemerisTime, "C", SecondsPrecision, bufferSize, outBuf);
}
}
glm::dvec3 SpiceManager::targetPosition(const std::string& target,
const std::string& observer,
const std::string& referenceFrame,

View File

@@ -121,6 +121,16 @@ std::string_view Time::UTC() const {
return std::string_view(b);
}
std::string_view Time::string(const std::string& format) const {
char* b = reinterpret_cast<char*>(
global::memoryManager->TemporaryMemory.allocate(128)
);
std::memset(b, 0, 128);
SpiceManager::ref().dateFromEphemerisTime(_time, b, 128, format.c_str());
return std::string_view(b);
}
std::string_view Time::ISO8601() const {
ZoneScoped;

View File

@@ -349,13 +349,18 @@ namespace {
/**
* Returns the current time as an date string of the form
* (YYYY MON DDTHR:MN:SC.### ::RND) as returned by SPICE.
* Returns the current time as an date string. The format of the returned string can be
* adjusted by providing the format picture. The default picture that is used will be
* (YYYY MON DDTHR:MN:SC.### ::RND). See
* https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/timout_c.html
* for documentation on how the format string can be formatted
*
* \return The current time, in the format used by SPICE (YYYY MON DDTHR:MN:SC.### ::RND)
*/
[[codegen::luawrap("SPICE")]] std::string currentTimeSpice() {
return std::string(openspace::global::timeManager->time().UTC());
[[codegen::luawrap("SPICE")]] std::string currentTimeSpice(
std::string format = "YYYY MON DDTHR:MN:SC.### ::RND")
{
return std::string(openspace::global::timeManager->time().string(format));
}
/**

View File

@@ -1,6 +1,10 @@
{
"profile": "empty",
"commands": [
{
"type": "asset",
"value": "examples/screenspacerenderable/screenspaceimagelocal/imagelocal.asset"
},
{
"type": "asset",
"value": "examples/screenspacerenderable/screenspacedebugplane/debugplane.asset"
@@ -33,31 +37,8 @@
{
"type": "property",
"value": {
"property": "RenderEngine.ShowLog",
"value": true
}
},
{
"type": "script",
"value": "openspace.printInfo('abcdefghijklmnopqrstuvwxyz')"
},
{
"type": "script",
"value": "openspace.printInfo('ABCDEFGHIJKLMNOPQRSTUVWXYZ')"
},
{
"type": "script",
"value": "openspace.printInfo('0123456789:-;!@#$%^&*()_+')"
},
{
"type": "wait",
"value": 5
},
{
"type": "property",
"value": {
"property": "RenderEngine.ShowLog",
"value": false
"property": "ScreenSpace.ScreenSpaceDebugPlane_Example.Texture",
"value": 2
}
},
{