Merge branch 'master' into thesis/2025/black-hole

This commit is contained in:
Wilhelm Björkström
2025-03-06 09:34:39 +01:00
9 changed files with 116 additions and 45 deletions

View File

@@ -1,5 +1,5 @@
local CarringtonLongitudeToHEEQ180Rotation = {
-- This isa rotation matrix to go from the Carrington longitude reference frame to the
-- This is a rotation matrix to go from the Carrington longitude reference frame to the
-- HEEQ180 reference frame. At the reference time, MAS_seq = 0, 2000-07-14T08:33:37.105
-- the Carrington longitude was 309.3 degrees.
-- Difference from HEEQ => 360-309.3=50.7 (or 0-309.3 = -309.3). However this leads to

View File

@@ -115,7 +115,7 @@ DistanceUnitNames { {
{ "Furlong", "Furlongs", "fur" },
{ "Mile", "Miles", "mi" },
{ "League", "Leagues", "league" },
{ "Nautical Mile", "Nautical Miles", "nm" }
{ "Nautical Mile", "Nautical Miles", "NM" }
}};
constexpr bool isValidDistanceUnitName(std::string_view name) {

View File

@@ -240,11 +240,6 @@ void renderStringProperty(Property* prop, const std::string& ownerName,
void renderListProperty(const std::string& name, const std::string& fullIdentifier,
const std::string& stringValue)
{
ghoul_assert(
stringValue.size() > 2,
"an empty list should have the string value '[]'"
);
// Remove brackets from the string value
const std::string value = stringValue.substr(1, stringValue.size() - 2);
@@ -371,8 +366,8 @@ void renderIntProperty(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + '.' + name).c_str());
IntProperty::ValueType value = *p;
const int min = p->minValue();
const int max = p->maxValue();
const int min = std::max(p->minValue(), std::numeric_limits<int>::lowest() + 1);
const int max = std::min(p->maxValue(), std::numeric_limits<int>::max() - 1);
const bool changed = ImGui::SliderInt(name.c_str(), &value, min, max);
if (showTooltip) {
@@ -395,8 +390,14 @@ void renderIVec2Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + '.' + name).c_str());
IVec2Property::ValueType value = *p;
const int min = glm::compMin(p->minValue());
const int max = glm::compMax(p->maxValue());
const int min = std::max(
glm::compMin(p->minValue()),
std::numeric_limits<int>::lowest() / 2
);
const int max = std::min(
glm::compMax(p->maxValue()),
std::numeric_limits<int>::max() / 2
);
const bool changed = ImGui::SliderInt2(name.c_str(), &value.x, min, max);
if (showTooltip) {
renderTooltip(prop, tooltipDelay);
@@ -418,8 +419,14 @@ void renderIVec3Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + '.' + name).c_str());
IVec3Property::ValueType value = *p;
const int min = glm::compMin(p->minValue());
const int max = glm::compMax(p->maxValue());
const int min = std::max(
glm::compMin(p->minValue()),
std::numeric_limits<int>::lowest() / 2
);
const int max = std::min(
glm::compMax(p->maxValue()),
std::numeric_limits<int>::max() / 2
);
const bool changed = ImGui::SliderInt3(name.c_str(), &value.x, min, max);
if (showTooltip) {
renderTooltip(prop, tooltipDelay);
@@ -440,8 +447,14 @@ void renderIVec4Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + '.' + name).c_str());
IVec4Property::ValueType value = *p;
const int min = glm::compMin(p->minValue());
const int max = glm::compMax(p->maxValue());
const int min = std::max(
glm::compMin(p->minValue()),
std::numeric_limits<int>::lowest() / 2
);
const int max = std::min(
glm::compMax(p->maxValue()),
std::numeric_limits<int>::max() / 2
);
const bool changed = ImGui::SliderInt4(name.c_str(), &value.x, min, max);
if (showTooltip) {
renderTooltip(prop, tooltipDelay);
@@ -462,8 +475,8 @@ void renderFloatProperty(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + '.' + name).c_str());
FloatProperty::ValueType value = *p;
const float min = p->minValue();
const float max = p->maxValue();
const float min = std::max(p->minValue(), std::numeric_limits<float>::lowest() / 2.f);
const float max = std::min(p->maxValue(), std::numeric_limits<float>::max() / 2.f);
const bool changed = ImGui::SliderFloat(
name.c_str(),
&value,
@@ -492,8 +505,14 @@ void renderVec2Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + '.' + name).c_str());
Vec2Property::ValueType value = *p;
const float min = glm::compMin(p->minValue());
const float max = glm::compMax(p->maxValue());
const float min = std::max(
glm::compMin(p->minValue()),
std::numeric_limits<float>::lowest() / 2.f
);
const float max = std::min(
glm::compMax(p->maxValue()),
std::numeric_limits<float>::max() / 2.f
);
const bool changed = ImGui::SliderFloat2(
name.c_str(),
&value.x,
@@ -522,8 +541,14 @@ void renderVec3Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + '.' + name).c_str());
Vec3Property::ValueType value = *p;
const float min = glm::compMin(p->minValue());
const float max = glm::compMax(p->maxValue());
const float min = std::max(
glm::compMin(p->minValue()),
std::numeric_limits<float>::lowest() / 2.f
);
const float max = std::min(
glm::compMax(p->maxValue()),
std::numeric_limits<float>::max() / 2.f
);
bool changed = false;
if (prop->viewOption(Property::ViewOptions::Color)) {
changed = ImGui::ColorEdit3(name.c_str(), glm::value_ptr(value));
@@ -558,8 +583,14 @@ void renderVec4Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + '.' + name).c_str());
Vec4Property::ValueType value = *p;
const float min = glm::compMin(p->minValue());
const float max = glm::compMax(p->maxValue());
const float min = std::max(
glm::compMin(p->minValue()),
std::numeric_limits<float>::lowest() / 2.f
);
const float max = std::min(
glm::compMax(p->maxValue()),
std::numeric_limits<float>::max() / 2.f
);
bool changed = false;
if (prop->viewOption(Property::ViewOptions::Color)) {
changed = ImGui::ColorEdit4(name.c_str(), glm::value_ptr(value));
@@ -594,8 +625,14 @@ void renderDVec2Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + '.' + name).c_str());
glm::vec2 value = glm::dvec2(*p);
const float min = static_cast<float>(glm::compMin(p->minValue()));
const float max = static_cast<float>(glm::compMax(p->maxValue()));
const float min = std::max(
static_cast<float>(glm::compMin(p->minValue())),
std::numeric_limits<float>::lowest() / 2.f
);
const float max = std::min(
static_cast<float>(glm::compMax(p->maxValue())),
std::numeric_limits<float>::max() / 2.f
);
const bool changed = ImGui::SliderFloat2(
name.c_str(),
&value.x,
@@ -624,8 +661,14 @@ void renderDVec3Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + '.' + name).c_str());
glm::vec3 value = glm::dvec3(*p);
const float min = static_cast<float>(glm::compMin(p->minValue()));
const float max = static_cast<float>(glm::compMax(p->maxValue()));
const float min = std::max(
static_cast<float>(glm::compMin(p->minValue())),
std::numeric_limits<float>::lowest() / 2.f
);
const float max = std::min(
static_cast<float>(glm::compMax(p->maxValue())),
std::numeric_limits<float>::max() / 2.f
);
const bool changed = ImGui::SliderFloat3(
name.c_str(),
glm::value_ptr(value),
@@ -654,8 +697,14 @@ void renderDVec4Property(Property* prop, const std::string& ownerName,
ImGui::PushID((ownerName + '.' + name).c_str());
glm::vec4 value = glm::dvec4(*p);
const float min = static_cast<float>(glm::compMin(p->minValue()));
const float max = static_cast<float>(glm::compMax(p->maxValue()));
const float min = std::max(
static_cast<float>(glm::compMin(p->minValue())),
std::numeric_limits<float>::lowest() / 2.f
);
const float max = std::min(
static_cast<float>(glm::compMax(p->maxValue())),
std::numeric_limits<float>::max() / 2.f
);
const bool changed = ImGui::SliderFloat4(
name.c_str(),
&value.x,
@@ -690,13 +739,19 @@ void renderDMat2Property(Property* prop, const std::string& ownerName,
glm::compMin(p->minValue()[0]),
glm::compMin(p->minValue()[1])
);
const float min = static_cast<float>(glm::compMin(minValues));
const float min = std::max(
static_cast<float>(glm::compMin(minValues)),
std::numeric_limits<float>::lowest() / 2.f
);
const glm::dvec2 maxValues = glm::dvec2(
glm::compMax(p->maxValue()[0]),
glm::compMax(p->maxValue()[1])
);
const float max = static_cast<float>(glm::compMax(maxValues));
const float max = std::min(
static_cast<float>(glm::compMax(maxValues)),
std::numeric_limits<float>::max() / 2.f
);
bool changed = false;
changed |= ImGui::SliderFloat2(
@@ -743,14 +798,20 @@ void renderDMat3Property(Property* prop, const std::string& ownerName,
glm::compMin(p->minValue()[1]),
glm::compMin(p->minValue()[2])
);
const float min = static_cast<float>(glm::compMin(minValues));
const float min = std::max(
static_cast<float>(glm::compMin(minValues)),
std::numeric_limits<float>::lowest() / 2.f
);
const glm::dvec3 maxValues = glm::dvec3(
glm::compMax(p->maxValue()[0]),
glm::compMax(p->maxValue()[1]),
glm::compMax(p->maxValue()[2])
);
const float max = static_cast<float>(glm::compMax(maxValues));
const float max = std::min(
static_cast<float>(glm::compMax(maxValues)),
std::numeric_limits<float>::max() / 2.f
);
bool changed = false;
changed |= ImGui::SliderFloat3(
@@ -806,7 +867,10 @@ void renderDMat4Property(Property* prop, const std::string& ownerName,
glm::compMin(p->minValue()[2]),
glm::compMin(p->minValue()[3])
);
const float min = static_cast<float>(glm::compMin(minValues));
const float min = std::max(
static_cast<float>(glm::compMin(minValues)),
std::numeric_limits<float>::lowest() / 2.f
);
const glm::dvec4 maxValues = glm::dvec4(
glm::compMax(p->maxValue()[0]),
@@ -814,7 +878,10 @@ void renderDMat4Property(Property* prop, const std::string& ownerName,
glm::compMax(p->maxValue()[2]),
glm::compMax(p->maxValue()[3])
);
const float max = static_cast<float>(glm::compMax(maxValues));
const float max = std::min(
static_cast<float>(glm::compMax(maxValues)),
std::numeric_limits<float>::max() / 2.f
);
bool changed = false;
changed |= ImGui::SliderFloat4(

View File

@@ -175,12 +175,13 @@ documentation::Documentation ProjectionComponent::Documentation() {
ProjectionComponent::ProjectionComponent()
: properties::PropertyOwner({ "ProjectionComponent", "Projection Component" })
, _performProjection(ProjectionInfo, true)
, _clearAllProjections(ClearProjectionInfo, false)
, _clearAllProjections(ClearProjectionInfo)
, _projectionFading(FadingInfo, 1.f, 0.f, 1.f)
, _textureSize(TextureSizeInfo, glm::ivec2(16), glm::ivec2(16), glm::ivec2(32768))
, _applyTextureSize(ApplyTextureSizeInfo)
{
addProperty(_performProjection);
_clearAllProjections.onChange([this]() { _needsClearProjection = true; });
addProperty(_clearAllProjections);
addProperty(_projectionFading);
@@ -790,7 +791,7 @@ bool ProjectionComponent::doesPerformProjection() const {
}
bool ProjectionComponent::needsClearProjection() const {
return _clearAllProjections;
return _needsClearProjection;
}
bool ProjectionComponent::needsMipMapGeneration() const {
@@ -857,7 +858,7 @@ void ProjectionComponent::clearAllProjections() {
glBindFramebuffer(GL_FRAMEBUFFER, defaultFBO);
glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
_clearAllProjections = false;
_needsClearProjection = false;
_mipMapDirty = true;
}

View File

@@ -27,9 +27,9 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/triggerproperty.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/triggerproperty.h>
#include <openspace/properties/vector/ivec2property.h>
#include <openspace/util/spicemanager.h>
#include <ghoul/opengl/ghoul_gl.h>
@@ -100,7 +100,7 @@ private:
protected:
properties::BoolProperty _performProjection;
properties::BoolProperty _clearAllProjections;
properties::TriggerProperty _clearAllProjections;
properties::FloatProperty _projectionFading;
properties::IVec2Property _textureSize;
@@ -125,7 +125,8 @@ protected:
GLuint _depthFboID = 0;
GLint _defaultFBO = 0;
GLint _viewport[4] = { 0, 0, 0, 0};
GLint _viewport[4] = { 0, 0, 0, 0 };
bool _needsClearProjection = false;
struct {
bool isEnabled = false;

View File

@@ -23,7 +23,9 @@
##########################################################################################
function (set_openspace_compile_settings target)
target_compile_features(${target} PUBLIC cxx_std_23)
# Switching to cxx_std_23 triggers a bug in Clang17
# https://github.com/llvm/llvm-project/issues/61415
target_compile_features(${target} PUBLIC cxx_std_20)
set(MSVC_WARNINGS
"/MP" # Multi-threading support