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

(this is not a complete merge of all of moon-shot's features, it's only shadow mapping)
This commit is contained in:
benpm
2025-09-10 16:09:32 -06:00
2637 changed files with 67930 additions and 58364 deletions

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -28,9 +28,9 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/data/dataloader.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/properties/triggerproperty.h>
#include <openspace/properties/misc/optionproperty.h>
#include <openspace/properties/misc/stringproperty.h>
#include <openspace/properties/misc/triggerproperty.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/vector/vec2property.h>
#include <openspace/properties/vector/vec4property.h>
@@ -46,9 +46,9 @@ namespace documentation { struct Documentation; }
* like the color map file itself (converted to a texture), colors to use for missing
* values and the available data columns and value ranges.
*
* @TODO Also provide a small shader snippet that can be included in fragment shaders
* that use this color mapping. As well as a set of uniforms? Now every
* renderable needs to handle this separately. (emmbr, 2023-10-13)
* \todo Also provide a small shader snippet that can be included in fragment shaders that
* use this color mapping. As well as a set of uniforms? Now every renderable needs to
* handle this separately. (emmbr, 2023-10-13)
*/
class ColorMappingComponent : public properties::PropertyOwner {
public:

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -28,6 +28,7 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/intproperty.h>
#include <openspace/properties/vector/ivec2property.h>
#include <openspace/rendering/dashboarditem.h>
#include <ghoul/glm.h>
@@ -43,6 +44,14 @@ public:
Dashboard();
virtual ~Dashboard() override = default;
/**
* Renders all of the items of this Dashboard at the provided \p penPosition. The
* position is provided in pixels with the top-left corner being located at (0,0). The
* rendering of the DashboardItems will update the \p penPosition according to where
* the next item should be placed.
*
* \param penPosition The location at which we want to render the dashboard items
*/
void render(glm::vec2& penPosition);
void addDashboardItem(std::unique_ptr<DashboardItem> item);
@@ -51,7 +60,8 @@ public:
void removeDashboardItem(const std::string& identifier);
void removeDashboardItem(int index);
void clearDashboardItems();
glm::vec2 getStartPositionOffset();
glm::ivec2 startPositionOffset();
std::vector<DashboardItem*> dashboardItems() const;
/**
* Returns the Lua library that contains all Lua functions available to affect the
@@ -62,8 +72,10 @@ public:
private:
properties::BoolProperty _isEnabled;
properties::IVec2Property _startPositionOffset;
properties::IntProperty _refreshRate;
std::vector<std::unique_ptr<DashboardItem>> _items;
std::chrono::steady_clock::time_point _lastRefresh;
};
} // openspace

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -38,18 +38,28 @@ namespace documentation { struct Documentation; }
class DashboardItem : public properties::PropertyOwner {
public:
static documentation::Documentation Documentation();
static std::unique_ptr<DashboardItem> createFromDictionary(
const ghoul::Dictionary& dictionary
);
DashboardItem(const ghoul::Dictionary& dictionary);
explicit DashboardItem(const ghoul::Dictionary& dictionary);
bool isEnabled() const;
virtual void update() = 0;
/**
* Renders this DashboardItem at the provided \p penPosition. The position indicates
* where this DashboardItem should render itself and is provided in pixel-coordinates
* with the top-left corner of the screen being at (0,0). Each derived subclass shall
* update the \p penPosition according to the items that it should render. If, for
* example, a single line of text is rendered, the \p penPosition shall be updated by
* one line's worth of vertical separation.
*
* \p penPosition The position at which this DashboardItem should be rendered
*/
virtual void render(glm::vec2& penPosition) = 0;
virtual glm::vec2 size() const = 0;
static documentation::Documentation Documentation();
protected:
properties::BoolProperty _enabled;

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -27,8 +27,8 @@
#include <openspace/rendering/dashboarditem.h>
#include <openspace/properties/misc/stringproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/stringproperty.h>
namespace ghoul { class Dictionary; }
namespace ghoul::fontrendering { class Font; }
@@ -39,16 +39,19 @@ namespace documentation { struct Documentation; }
class DashboardTextItem : public DashboardItem {
public:
static documentation::Documentation Documentation();
DashboardTextItem(const ghoul::Dictionary& dictionary, float fontSize = 10.f,
explicit DashboardTextItem(const ghoul::Dictionary& dictionary, float fontSize = 10.f,
const std::string& fontName = "Mono");
void render(glm::vec2& penPosition) override;
static documentation::Documentation Documentation();
protected:
properties::StringProperty _fontName;
properties::FloatProperty _fontSize;
std::shared_ptr<ghoul::fontrendering::Font> _font;
std::string _buffer;
};
} // openspace

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -63,6 +63,9 @@ void renderBox(const glm::vec2& position, const glm::vec2& size, const glm::vec4
void renderBox(const glm::vec2& position, const glm::vec2& size, const glm::vec4& color,
const ghoul::opengl::Texture& texture, Anchor anchor = Anchor::NW);
void renderLine(const glm::vec2& startPosition, const glm::vec2& endPosition,
const glm::vec2& size, const glm::vec4& startColor, const glm::vec4& endColor);
struct Shaders {
struct {
std::unique_ptr<ghoul::opengl::ProgramObject> program;
@@ -105,6 +108,11 @@ struct VertexObjects {
int nElements = 64;
} cone;
struct {
GLuint vao = 0;
GLuint vbo = 0;
} line;
struct {
GLuint vao = 0;
} empty;

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -127,6 +127,10 @@ private:
glm::vec2 ur = glm::vec2(0.f);
std::chrono::system_clock::time_point finishedTime;
#ifdef LOADINGSCREEN_DEBUGGING
bool exhaustedSearch = false;
#endif // LOADINGSCREEN_DEBUGGING
};
std::vector<Item> _items;
std::mutex _itemsMutex;

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -28,10 +28,10 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/rendering/fadeable.h>
#include <openspace/properties/misc/stringproperty.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/doubleproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/stringproperty.h>
#include <openspace/scene/scenegraphnode.h>
#include <ghoul/misc/managedmemoryuniqueptr.h>
#include <string_view>
@@ -45,6 +45,7 @@ namespace ghoul::opengl {
namespace openspace {
class Camera;
class Ellipsoid;
struct RenderData;
struct RendererTasks;
struct SurfacePositionHandle;
@@ -73,7 +74,7 @@ public:
static ghoul::mm_unique_ptr<Renderable> createFromDictionary(
const ghoul::Dictionary& dictionary);
Renderable(const ghoul::Dictionary& dictionary,
explicit Renderable(const ghoul::Dictionary& dictionary,
RenderableSettings settings = RenderableSettings());
virtual ~Renderable() override = default;
@@ -103,6 +104,8 @@ public:
virtual SurfacePositionHandle calculateSurfacePositionHandle(
const glm::dvec3& targetModelSpace) const;
virtual Ellipsoid ellipsoid() const;
virtual bool renderedWithDesiredData() const;
RenderBin renderBin() const;

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -27,14 +27,14 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/list/intlistproperty.h>
#include <openspace/properties/misc/optionproperty.h>
#include <openspace/properties/misc/triggerproperty.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/intproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/vector/vec3property.h>
#include <openspace/properties/vector/vec4property.h>
#include <openspace/properties/triggerproperty.h>
#include <openspace/rendering/framebufferrenderer.h>
#include <chrono>
#include <filesystem>
@@ -208,7 +208,15 @@ private:
properties::IntProperty _framerateLimit;
std::chrono::high_resolution_clock::time_point _lastFrameTime;
properties::FloatProperty _horizFieldOfView;
struct Window : properties::PropertyOwner {
Window(PropertyOwnerInfo info, size_t id);
properties::FloatProperty horizFieldOfView;
};
properties::PropertyOwner _windowing;
std::vector<std::unique_ptr<Window>> _windows;
properties::Vec3Property _globalRotation;
properties::Vec3Property _screenSpaceRotation;

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -28,7 +28,7 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/rendering/fadeable.h>
#include <openspace/properties/triggerproperty.h>
#include <openspace/properties/misc/triggerproperty.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/vector/vec3property.h>
@@ -58,7 +58,7 @@ public:
static constexpr std::string_view KeyName = "Name";
static constexpr std::string_view KeyIdentifier = "Identifier";
ScreenSpaceRenderable(const ghoul::Dictionary& dictionary);
explicit ScreenSpaceRenderable(const ghoul::Dictionary& dictionary);
virtual ~ScreenSpaceRenderable() override;
struct RenderData {
@@ -70,10 +70,10 @@ public:
};
virtual void render(const RenderData& renderData);
virtual bool initialize();
virtual bool initializeGL();
virtual bool deinitialize();
virtual bool deinitializeGL();
virtual void initialize();
virtual void initializeGL();
virtual void deinitialize();
virtual void deinitializeGL();
virtual void update();
virtual bool isReady() const;
@@ -109,7 +109,8 @@ protected:
glm::vec3 raeToCartesian(const glm::vec3& rae) const;
glm::vec3 cartesianToRae(const glm::vec3& cartesian) const;
void draw(const glm::mat4& modelTransform, const RenderData& renderData);
void draw(const glm::mat4& modelTransform, const RenderData& renderData,
bool useAcceleratedRendering = false);
virtual void bindTexture() = 0;
virtual void unbindTexture();
@@ -149,9 +150,13 @@ protected:
properties::TriggerProperty _delete;
glm::ivec2 _objectSize = glm::ivec2(0);
UniformCache(color, opacity, blackoutFactor, hue, value, saturation, mvpMatrix, tex,
backgroundColor, gamma, borderColor, borderWidth, borderFeather) _uniformCache;
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
private:
UniformCache(color, opacity, blackoutFactor, hue, value, saturation, mvpMatrix, tex,
backgroundColor, gamma, borderColor, borderWidth, borderFeather,
useAcceleratedRendering) _uniformCache;
};
} // namespace openspace

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -36,7 +36,7 @@ namespace openspace {
class TextureComponent {
public:
// nDimensions must be 1, 2, 3
TextureComponent(int nDimensions);
explicit TextureComponent(int nDimensions);
const ghoul::opengl::Texture* texture() const;
ghoul::opengl::Texture* texture();

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
@@ -40,7 +40,7 @@ class TransferFunction {
public:
using TfChangedCallback = std::function<void (const TransferFunction&)>;
TransferFunction(const std::filesystem::path& filepath,
explicit TransferFunction(const std::filesystem::path& filepath,
TfChangedCallback tfChangedCallback = TfChangedCallback());
~TransferFunction();

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* Copyright (c) 2014-2025 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *