Merged with master

This commit is contained in:
GPayne
2020-02-11 13:59:51 -07:00
1168 changed files with 8474 additions and 10605 deletions
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+3 -3
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -147,8 +147,8 @@ public:
struct TileUvTransform {
glm::vec2 uvOffset;
glm::vec2 uvScale;
glm::vec2 uvOffset = glm::vec2(0.f);
glm::vec2 uvScale = glm::vec2(0.f);
};
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+2 -2
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -62,7 +62,7 @@ glm::dvec3 Ellipsoid::geodeticSurfaceProjection(const glm::dvec3& p) const {
double alpha = (1.0 - beta) * (glm::length(p) / n);
const glm::dvec3 p2 = p * p;
glm::dvec3 d;
glm::dvec3 d = glm::dvec3(0.0);
double s = 0.0;
double dSdA = 1.0;
+8 -8
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -54,7 +54,7 @@ public:
/**
* \param radii defines three radii for the Ellipsoid
*/
Ellipsoid(glm::dvec3 radii = glm::dvec3(1.0, 1.0, 1.0));
Ellipsoid(glm::dvec3 radii = glm::dvec3(1.0));
/**
* Scales a point along the geocentric normal and places it on the surface of the
@@ -95,16 +95,16 @@ public:
private:
struct EllipsoidCache {
glm::dvec3 radiiSquared;
glm::dvec3 oneOverRadiiSquared;
glm::dvec3 radiiToTheFourth;
double minimumRadius;
double maximumRadius;
glm::dvec3 radiiSquared = glm::dvec3(0.0);
glm::dvec3 oneOverRadiiSquared = glm::dvec3(0.0);
glm::dvec3 radiiToTheFourth = glm::dvec3(0.0);
double minimumRadius = 0.0;
double maximumRadius = 0.0;
} _cached;
void updateInternalCache();
glm::dvec3 _radii;
glm::dvec3 _radii = glm::dvec3(0.0);
// Eclipse shadows conf
std::vector<Ellipsoid::ShadowConfiguration> _shadowConfArray;
+1 -2
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -75,7 +75,6 @@ void GdalWrapper::create(size_t maximumCacheSize, size_t maximumMaximumCacheSize
}
void GdalWrapper::destroy() {
ghoul_assert(_singleton, "Cannot delete null");
delete _singleton;
}
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -72,10 +72,10 @@ private:
// Labels Structures
struct LabelEntry {
char feature[256];
float diameter;
float latitude;
float longitude;
glm::vec3 geoPosition;
float diameter = 0.f;
float latitude = 0.f;
float longitude = 0.f;
glm::vec3 geoPosition = glm::vec3(0.f);
};
struct Labels {
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+2 -2
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -55,7 +55,7 @@ private:
RenderableGlobe* _attachedNode = nullptr;
mutable bool _positionIsDirty = true;
mutable glm::dvec3 _position;
mutable glm::dvec3 _position = glm::dvec3(0.0);
};
} // namespace openspace::globebrowsing
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+4 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -31,6 +31,7 @@
#include <modules/globebrowsing/src/tileindex.h>
#include <modules/globebrowsing/src/tiletextureinitdata.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/profiling.h>
namespace openspace::globebrowsing {
@@ -454,6 +455,8 @@ void Layer::onChange(std::function<void(Layer*)> callback) {
}
int Layer::update() {
ZoneScoped
if (_tileProvider) {
return tileprovider::update(*_tileProvider);
}
+3 -3
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -94,8 +94,8 @@ private:
LayerRenderSettings _renderSettings;
LayerAdjustment _layerAdjustment;
glm::ivec2 _padTilePixelStartOffset;
glm::ivec2 _padTilePixelSizeDifference;
glm::ivec2 _padTilePixelStartOffset = glm::ivec2(0);
glm::ivec2 _padTilePixelSizeDifference = glm::ivec2(0);
const layergroupid::GroupID _layerGroupId;
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+8 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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,6 +27,7 @@
#include <modules/globebrowsing/src/layer.h>
#include <openspace/documentation/documentation.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/profiling.h>
namespace {
constexpr const char* _loggerCat = "LayerGroup";
@@ -81,18 +82,24 @@ void LayerGroup::setLayersFromDict(const ghoul::Dictionary& dict) {
}
void LayerGroup::initialize() {
ZoneScoped
for (const std::unique_ptr<Layer>& l : _layers) {
l->initialize();
}
}
void LayerGroup::deinitialize() {
ZoneScoped
for (const std::unique_ptr<Layer>& l : _layers) {
l->deinitialize();
}
}
int LayerGroup::update() {
ZoneScoped
int res = 0;
_activeLayers.clear();
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+19 -3
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -31,6 +31,7 @@
#include <openspace/documentation/documentation.h>
#include <openspace/documentation/verifier.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/profiling.h>
namespace openspace::globebrowsing {
@@ -53,6 +54,8 @@ documentation::Documentation LayerManager::Documentation() {
LayerManager::LayerManager() : properties::PropertyOwner({ "Layers" }) {}
void LayerManager::initialize(const ghoul::Dictionary& layerGroupsDict) {
ZoneScoped
// First create empty layer groups in case not all are specified
for (size_t i = 0; i < _layerGroups.size(); ++i) {
_layerGroups[i] = std::make_unique<LayerGroup>(layergroupid::GroupID(i));
@@ -91,6 +94,8 @@ void LayerManager::deinitialize() {
Layer* LayerManager::addLayer(layergroupid::GroupID groupId,
const ghoul::Dictionary& layerDict)
{
ZoneScoped
ghoul_assert(groupId != layergroupid::Unknown, "Layer group ID must be known");
try {
return _layerGroups[groupId]->addLayer(layerDict);
@@ -102,6 +107,8 @@ Layer* LayerManager::addLayer(layergroupid::GroupID groupId,
}
void LayerManager::deleteLayer(layergroupid::GroupID id, const std::string& layerName) {
ZoneScoped
ghoul_assert(id != layergroupid::Unknown, "Layer group ID must be known");
_layerGroups[id]->deleteLayer(layerName);
}
@@ -115,6 +122,8 @@ const LayerGroup& LayerManager::layerGroup(layergroupid::GroupID groupId) const
}
bool LayerManager::hasAnyBlendingLayersEnabled() const {
ZoneScoped
return std::any_of(
_layerGroups.begin(),
_layerGroups.end(),
@@ -124,8 +133,9 @@ bool LayerManager::hasAnyBlendingLayersEnabled() const {
);
}
std::array<LayerGroup*, LayerManager::NumLayerGroups> LayerManager::layerGroups() const
{
std::array<LayerGroup*, LayerManager::NumLayerGroups> LayerManager::layerGroups() const {
ZoneScoped
std::array<LayerGroup*, NumLayerGroups> res = {};
for (int i = 0; i < NumLayerGroups; ++i) {
res[i] = _layerGroups[i].get();
@@ -134,6 +144,8 @@ std::array<LayerGroup*, LayerManager::NumLayerGroups> LayerManager::layerGroups(
}
int LayerManager::update() {
ZoneScoped
int res = 0;
for (std::unique_ptr<LayerGroup>& layerGroup : _layerGroups) {
res += layerGroup->update();
@@ -142,6 +154,8 @@ int LayerManager::update() {
}
void LayerManager::reset(bool includeDisabled) {
ZoneScoped
for (std::unique_ptr<LayerGroup>& layerGroup : _layerGroups) {
for (Layer* layer : layerGroup->layers()) {
if (layer->enabled() || includeDisabled) {
@@ -152,6 +166,8 @@ void LayerManager::reset(bool includeDisabled) {
}
void LayerManager::onChange(std::function<void(Layer*)> callback) {
ZoneScoped
for (std::unique_ptr<LayerGroup>& layerGroup : _layerGroups) {
layerGroup->onChange(callback);
}
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+65 -15
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -42,6 +42,7 @@
#include <openspace/util/updatestructures.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/profiling.h>
#include <ghoul/opengl/texture.h>
#include <ghoul/opengl/textureunit.h>
#include <ghoul/opengl/programobject.h>
@@ -64,13 +65,13 @@ namespace {
// Shadow structure
struct ShadowRenderingStruct {
double xu;
double xp;
double rs;
double rc;
glm::dvec3 sourceCasterVec;
glm::dvec3 casterPositionVec;
bool isShadowing;
double xu = 0.0;
double xp = 0.0;
double rs = 0.0;
double rc = 0.0;
glm::dvec3 sourceCasterVec = glm::dvec3(0.0);
glm::dvec3 casterPositionVec = glm::dvec3(0.0);
bool isShadowing = false;
};
constexpr const char* KeyRadii = "Radii";
@@ -303,7 +304,7 @@ BoundingHeights boundingHeightsForChunk(const Chunk& chunk, const LayerManager&
const bool hasTileMetaData = chunkTile.tile.metaData.has_value();
if (goodTile && hasTileMetaData) {
const TileMetaData& tileMetaData = chunkTile.tile.metaData.value();
const TileMetaData& tileMetaData = *chunkTile.tile.metaData;
const float minValue = settings->performLayerSettings(
tileMetaData.minValues[HeightChannel]
@@ -517,14 +518,14 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
BoolProperty(EclipseHardShadowsInfo, false),
BoolProperty(ShadowMappingInfo, false),
FloatProperty(ZFightingPercentageInfo, 0.995f, 0.000001f, 1.f),
IntProperty(NumberShadowSamplesInfo, 5, 1, 20),
IntProperty(NumberShadowSamplesInfo, 5, 1, 7),
FloatProperty(TargetLodScaleFactorInfo, 15.f, 1.f, 50.f),
FloatProperty(CurrentLodScaleFactorInfo, 15.f, 1.f, 50.f),
FloatProperty(CameraMinHeightInfo, 100.f, 0.f, 1000.f),
FloatProperty(OrenNayarRoughnessInfo, 0.f, 0.f, 1.f),
IntProperty(NActiveLayersInfo, 0, 0, OpenGLCap.maxTextureUnits() / 3)
})
, _shadowMappingPropertyOwner({ "Shadow Mapping" })
, _shadowMappingPropertyOwner({ "ShadowMapping" })
, _debugPropertyOwner({ "Debug" })
, _grid(DefaultSkirtedGridSegments, DefaultSkirtedGridSegments)
, _leftRoot(Chunk(LeftHemisphereIndex))
@@ -565,6 +566,9 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
_shadowMappingPropertyOwner.addProperty(_generalProperties.shadowMapping);
_shadowMappingPropertyOwner.addProperty(_generalProperties.zFightingPercentage);
_shadowMappingPropertyOwner.addProperty(_generalProperties.nShadowSamples);
_generalProperties.nShadowSamples.onChange([&]() {
_shadersNeedRecompilation = true;
});
addPropertySubOwner(_shadowMappingPropertyOwner);
_generalProperties.targetLodScaleFactor.onChange([this]() {
@@ -968,6 +972,8 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&,
const ShadowComponent::ShadowMapData& shadowData,
bool renderGeomOnly)
{
ZoneScoped
if (_shadersNeedRecompilation) {
recompileShaders();
}
@@ -1165,6 +1171,8 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&,
auto traversal = [&global, &globalCount, &local, &localCount,
cutoff = _debugProperties.modelSpaceRenderingCutoffLevel](const Chunk& node)
{
ZoneScopedN("traversal")
std::vector<const Chunk*> Q;
Q.reserve(256);
@@ -1269,6 +1277,9 @@ void RenderableGlobe::renderChunkGlobally(const Chunk& chunk, const RenderData&
const ShadowComponent::ShadowMapData& shadowData,
bool renderGeomOnly)
{
ZoneScoped
TracyGpuZone("renderChunkGlobally")
//PerfMeasure("globally");
const TileIndex& tileIndex = chunk.tileIndex;
ghoul::opengl::ProgramObject& program = *_globalRenderer.program;
@@ -1330,7 +1341,6 @@ void RenderableGlobe::renderChunkGlobally(const Chunk& chunk, const RenderData&
glBindTexture(GL_TEXTURE_2D, shadowData.shadowDepthTexture);
program.setUniform("shadowMapTexture", shadowMapUnit);
program.setUniform("nShadowSamples", _generalProperties.nShadowSamples);
program.setUniform("zFightingPercentage", _generalProperties.zFightingPercentage);
}
@@ -1352,6 +1362,9 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d
const ShadowComponent::ShadowMapData& shadowData,
bool renderGeomOnly)
{
ZoneScoped
TracyGpuZone("renderChunkLocally")
//PerfMeasure("locally");
const TileIndex& tileIndex = chunk.tileIndex;
ghoul::opengl::ProgramObject& program = *_localRenderer.program;
@@ -1458,7 +1471,6 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d
glBindTexture(GL_TEXTURE_2D, shadowData.shadowDepthTexture);
program.setUniform("shadowMapTexture", shadowMapUnit);
program.setUniform("nShadowSamples", _generalProperties.nShadowSamples);
program.setUniform("zFightingPercentage", _generalProperties.zFightingPercentage);
}
@@ -1476,7 +1488,10 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d
}
void RenderableGlobe::debugRenderChunk(const Chunk& chunk, const glm::dmat4& mvp,
bool renderBounds, bool renderAABB) const {
bool renderBounds, bool renderAABB) const
{
ZoneScoped
const std::array<glm::dvec4, 8>& modelSpaceCorners = chunk.corners;
std::vector<glm::vec4> clippingSpaceCorners(8);
@@ -1515,8 +1530,10 @@ void RenderableGlobe::debugRenderChunk(const Chunk& chunk, const glm::dmat4& mvp
//////////////////////////////////////////////////////////////////////////////////////////
void RenderableGlobe::setCommonUniforms(ghoul::opengl::ProgramObject& programObject,
const Chunk& chunk, const RenderData& data)
const Chunk& chunk, const RenderData& data)
{
ZoneScoped
if (_generalProperties.useAccurateNormals &&
!_layerManager.layerGroup(layergroupid::HeightLayers).activeLayers().empty())
{
@@ -1563,6 +1580,8 @@ void RenderableGlobe::setCommonUniforms(ghoul::opengl::ProgramObject& programObj
}
void RenderableGlobe::recompileShaders() {
ZoneScoped
struct LayerShaderPreprocessingData {
struct LayerGroupPreprocessingData {
int lastLayerIdx;
@@ -1726,6 +1745,9 @@ void RenderableGlobe::recompileShaders() {
shaderDictionary.setValue(p.first, p.second);
}
// Shadow Mapping Samples
shaderDictionary.setValue("nShadowSamples", _generalProperties.nShadowSamples - 1);
//
// Create local shader
//
@@ -1794,6 +1816,8 @@ void RenderableGlobe::recompileShaders() {
SurfacePositionHandle RenderableGlobe::calculateSurfacePositionHandle(
const glm::dvec3& targetModelSpace) const
{
ZoneScoped
glm::dvec3 centerToEllipsoidSurface =
_ellipsoid.geodeticSurfaceProjection(targetModelSpace);
glm::dvec3 ellipsoidSurfaceToTarget = targetModelSpace - centerToEllipsoidSurface;
@@ -1824,6 +1848,8 @@ bool RenderableGlobe::testIfCullable(const Chunk& chunk,
const RenderData& renderData,
const BoundingHeights& heights) const
{
ZoneScoped
return (PreformHorizonCulling && isCullableByHorizon(chunk, renderData, heights)) ||
(PerformFrustumCulling && isCullableByFrustum(chunk, renderData));
}
@@ -1831,6 +1857,8 @@ bool RenderableGlobe::testIfCullable(const Chunk& chunk,
int RenderableGlobe::desiredLevel(const Chunk& chunk, const RenderData& renderData,
const BoundingHeights& heights) const
{
ZoneScoped
const int desiredLevel = _debugProperties.levelByProjectedAreaElseDistance ?
desiredLevelByProjectedArea(chunk, renderData, heights) :
desiredLevelByDistance(chunk, renderData, heights);
@@ -1846,6 +1874,8 @@ int RenderableGlobe::desiredLevel(const Chunk& chunk, const RenderData& renderDa
}
float RenderableGlobe::getHeight(const glm::dvec3& position) const {
ZoneScoped
float height = 0;
// Get the uv coordinates to sample from
@@ -1997,6 +2027,8 @@ float RenderableGlobe::getHeight(const glm::dvec3& position) const {
void RenderableGlobe::calculateEclipseShadows(ghoul::opengl::ProgramObject& programObject,
const RenderData& data, ShadowCompType stype)
{
ZoneScoped
constexpr const double KM_TO_M = 1000.0;
ghoul_assert(
@@ -2137,6 +2169,8 @@ int RenderableGlobe::desiredLevelByDistance(const Chunk& chunk,
const RenderData& data,
const BoundingHeights& heights) const
{
ZoneScoped
// Calculations are done in the reference frame of the globe
// (model space). Hence, the camera position needs to be transformed
// with the inverse model matrix
@@ -2171,6 +2205,8 @@ int RenderableGlobe::desiredLevelByProjectedArea(const Chunk& chunk,
const RenderData& data,
const BoundingHeights& heights) const
{
ZoneScoped
// Calculations are done in the reference frame of the globe
// (model space). Hence, the camera position needs to be transformed
// with the inverse model matrix
@@ -2251,6 +2287,8 @@ int RenderableGlobe::desiredLevelByProjectedArea(const Chunk& chunk,
}
int RenderableGlobe::desiredLevelByAvailableTileData(const Chunk& chunk) const {
ZoneScoped
const int currLevel = chunk.tileIndex.level;
for (size_t i = 0; i < layergroupid::NUM_LAYER_GROUPS; ++i) {
@@ -2274,6 +2312,8 @@ int RenderableGlobe::desiredLevelByAvailableTileData(const Chunk& chunk) const {
bool RenderableGlobe::isCullableByFrustum(const Chunk& chunk,
const RenderData& renderData) const
{
ZoneScoped
// Calculate the MVP matrix
const glm::dmat4 viewTransform = glm::dmat4(renderData.camera.combinedViewMatrix());
const glm::dmat4 modelViewProjectionTransform = glm::dmat4(
@@ -2299,6 +2339,8 @@ bool RenderableGlobe::isCullableByHorizon(const Chunk& chunk,
const RenderData& renderData,
const BoundingHeights& heights) const
{
ZoneScoped
// Calculations are done in the reference frame of the globe. Hence, the camera
// position needs to be transformed with the inverse model matrix
const GeodeticPatch& patch = chunk.surfacePatch;
@@ -2368,6 +2410,8 @@ bool RenderableGlobe::isCullableByHorizon(const Chunk& chunk,
//////////////////////////////////////////////////////////////////////////////////////////
void RenderableGlobe::splitChunkNode(Chunk& cn, int depth) {
ZoneScoped
if (depth > 0 && isLeaf(cn)) {
std::vector<void*> memory = _chunkPool.allocate(
static_cast<int>(cn.children.size())
@@ -2396,6 +2440,8 @@ void RenderableGlobe::splitChunkNode(Chunk& cn, int depth) {
}
void RenderableGlobe::freeChunkNode(Chunk* n) {
ZoneScoped
_chunkPool.free(n);
for (Chunk* c : n->children) {
if (c) {
@@ -2406,6 +2452,8 @@ void RenderableGlobe::freeChunkNode(Chunk* n) {
}
void RenderableGlobe::mergeChunkNode(Chunk& cn) {
ZoneScoped
for (Chunk* child : cn.children) {
if (child) {
mergeChunkNode(*child);
@@ -2416,6 +2464,8 @@ void RenderableGlobe::mergeChunkNode(Chunk& cn) {
}
bool RenderableGlobe::updateChunkTree(Chunk& cn, const RenderData& data) {
ZoneScoped
// abock: I tried turning this into a queue and use iteration, rather than recursion
// but that made the code harder to understand as the breadth-first traversal
// requires parents to be passed through the pipe twice (first to add the
+3 -3
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -253,8 +253,8 @@ private:
SkirtedGrid _grid;
LayerManager _layerManager;
glm::dmat4 _cachedModelTransform;
glm::dmat4 _cachedInverseModelTransform;
glm::dmat4 _cachedModelTransform = glm::dmat4(1.0);
glm::dmat4 _cachedInverseModelTransform = glm::dmat4(1.0);
ghoul::ReusableTypedMemoryPool<Chunk, 256> _chunkPool;
+28 -12
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -49,10 +49,12 @@
#include <locale>
namespace {
constexpr const std::array<const char*, 10> UniformNames = {
constexpr const char* _loggerCat = "RingsComponent";
constexpr const std::array<const char*, 9> UniformNames = {
"modelViewProjectionMatrix", "textureOffset", "transparency", "_nightFactor",
"sunPosition", "ringTexture", "shadowMatrix", "shadowMapTexture",
"nShadowSamples", "zFightingPercentage"
"zFightingPercentage"
};
constexpr const std::array<const char*, 3> GeomUniformNames = {
@@ -174,7 +176,7 @@ RingsComponent::RingsComponent(const ghoul::Dictionary& dictionary)
, _transparency(TransparencyInfo, 0.15f, 0.f, 1.f)
, _enabled({ "Enabled", "Enabled", "Enable/Disable Rings" }, true)
, _zFightingPercentage(ZFightingPercentageInfo, 0.995f, 0.000001f, 1.f)
, _nShadowSamples(NumberShadowSamplesInfo, 2, 1, 20)
, _nShadowSamples(NumberShadowSamplesInfo, 2, 1, 7)
, _ringsDictionary(dictionary)
{
using ghoul::filesystem::File;
@@ -243,6 +245,7 @@ void RingsComponent::initialize() {
if (_ringsDictionary.hasKey(NumberShadowSamplesInfo.identifier)) {
_nShadowSamples = _ringsDictionary.value<int>(NumberShadowSamplesInfo.identifier);
}
_nShadowSamples.onChange([this]() { compileShadowShader(); });
addProperty(_nShadowSamples);
addProperty(_transparency);
@@ -253,11 +256,7 @@ bool RingsComponent::isReady() const {
}
void RingsComponent::initializeGL() {
_shader = global::renderEngine.buildRenderProgram(
"RingsProgram",
absPath("${MODULE_GLOBEBROWSING}/shaders/rings_vs.glsl"),
absPath("${MODULE_GLOBEBROWSING}/shaders/rings_fs.glsl")
);
compileShadowShader();
_geometryOnlyShader = global::renderEngine.buildRenderProgram(
"RingsGeomOnlyProgram",
@@ -326,7 +325,6 @@ void RingsComponent::draw(const RenderData& data,
_shader->setUniform(_uniformCache.transparency, _transparency);
_shader->setUniform(_uniformCache.nightFactor, _nightFactor);
_shader->setUniform(_uniformCache.sunPosition, _sunPosition);
_shader->setUniform(_uniformCache.nShadowSamples, _nShadowSamples);
_shader->setUniform(_uniformCache.zFightingPercentage, _zFightingPercentage);
ringTextureUnit.activate();
@@ -377,8 +375,7 @@ void RingsComponent::draw(const RenderData& data,
void RingsComponent::update(const UpdateData& data) {
if (_shader->isDirty()) {
_shader->rebuildFromFile();
ghoul::opengl::updateUniformLocations(*_shader, _uniformCache, UniformNames);
compileShadowShader();
}
if (_geometryOnlyShader->isDirty()) {
@@ -474,6 +471,25 @@ void RingsComponent::createPlane() {
);
}
void RingsComponent::compileShadowShader() {
ghoul::Dictionary dict;
dict.setValue("nShadowSamples", std::to_string(_nShadowSamples - 1));
try {
global::renderEngine.removeRenderProgram(_shader.get());
_shader = global::renderEngine.buildRenderProgram(
"RingsProgram",
absPath("${MODULE_GLOBEBROWSING}/shaders/rings_vs.glsl"),
absPath("${MODULE_GLOBEBROWSING}/shaders/rings_fs.glsl"),
dict
);
}
catch (const ghoul::RuntimeError& e) {
LERROR(e.message);
}
ghoul::opengl::updateUniformLocations(*_shader, _uniformCache, UniformNames);
}
bool RingsComponent::isEnabled() const {
return _enabled;
}
+4 -4
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -77,6 +77,7 @@ public:
private:
void loadTexture();
void createPlane();
void compileShadowShader();
properties::StringProperty _texturePath;
properties::FloatProperty _size;
@@ -90,8 +91,7 @@ private:
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
std::unique_ptr<ghoul::opengl::ProgramObject> _geometryOnlyShader;
UniformCache(modelViewProjectionMatrix, textureOffset, transparency, nightFactor,
sunPosition, ringTexture, shadowMatrix, shadowMapTexture, nShadowSamples,
zFightingPercentage
sunPosition, ringTexture, shadowMatrix, shadowMapTexture, zFightingPercentage
) _uniformCache;
UniformCache(modelViewProjectionMatrix, textureOffset, ringTexture)
_geomUniformCache;
@@ -104,7 +104,7 @@ private:
GLuint _vertexPositionBuffer = 0;
bool _planeIsDirty = false;
glm::vec3 _sunPosition;
glm::vec3 _sunPosition = glm::vec3(0.f);
};
} // namespace openspace
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -166,7 +166,7 @@ documentation::Documentation ShadowComponent::Documentation() {
}
ShadowComponent::ShadowComponent(const ghoul::Dictionary& dictionary)
: properties::PropertyOwner({ "Shadows Component" })
: properties::PropertyOwner({ "ShadowsComponent" })
, _saveDepthTexture(SaveDepthTextureInfo)
, _distanceFraction(DistanceFractionInfo, 20, 1, 10000)
, _enabled({ "Enabled", "Enabled", "Enable/Disable Shadows" }, true)
+8 -11
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -108,13 +108,10 @@ private:
int _shadowDepthTextureWidth = 4096;
bool _dynamicDepthTextureRes = true;
// All of these initializations should probably be 0 since they are GLuints?
GLuint _shadowDepthTexture = -1;
GLuint _positionInLightSpaceTexture = -1;
GLuint _shadowFBO = -1;
GLuint _firstPassSubroutine = -1;
GLuint _secondPassSubroutine = 1;
GLint _defaultFBO = -1;
GLuint _shadowDepthTexture = 0;
GLuint _positionInLightSpaceTexture = 0;
GLuint _shadowFBO = 0;
GLint _defaultFBO = 0;
GLint _mViewport[4];
GLboolean _faceCulling;
@@ -130,13 +127,13 @@ private:
GLfloat _colorClearValue[4];
GLfloat _depthClearValue;
glm::vec3 _sunPosition;
glm::vec3 _sunPosition = glm::vec3(0.f);
glm::dmat4 _shadowMatrix = glm::dmat4(1.0);
glm::dvec3 _cameraPos = glm::dvec3(0.0);
glm::dvec3 _cameraFocus;
glm::dquat _cameraRotation;
glm::dvec3 _cameraFocus = glm::dvec3(0.0);
glm::dquat _cameraRotation = glm::dquat(1.0, 0.0, 0.0, 0.0);
std::stringstream _serializedCamera;
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+70 -2
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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,6 +40,7 @@
#include <ghoul/font/fontrenderer.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/profiling.h>
#include <fstream>
#include "cpl_minixml.h"
@@ -152,6 +153,8 @@ namespace temporal {
//
void initAsyncTileDataReader(DefaultTileProvider& t, TileTextureInitData initData) {
ZoneScoped
t.asyncTextureDataProvider = std::make_unique<AsyncTileDataProvider>(
t.name,
std::make_unique<RawTileDataReader>(
@@ -163,12 +166,14 @@ void initAsyncTileDataReader(DefaultTileProvider& t, TileTextureInitData initDat
}
bool initTexturesFromLoadedData(DefaultTileProvider& t) {
ZoneScoped
if (t.asyncTextureDataProvider) {
std::optional<RawTile> tile = t.asyncTextureDataProvider->popFinishedRawTile();
if (tile) {
const cache::ProviderTileKey key = { tile->tileIndex, t.uniqueIdentifier };
ghoul_assert(!t.tileCache->exist(key), "Tile must not be existing in cache");
t.tileCache->createTileAndPut(key, std::move(tile.value()));
t.tileCache->createTileAndPut(key, std::move(*tile));
return true;
}
}
@@ -181,6 +186,8 @@ bool initTexturesFromLoadedData(DefaultTileProvider& t) {
//
void initialize(TextTileProvider& t) {
ZoneScoped
t.font = global::fontManager.font("Mono", static_cast<float>(t.fontSize));
t.fontRenderer = ghoul::fontrendering::FontRenderer::createDefault();
t.fontRenderer->setFramebufferSize(glm::vec2(t.initData.dimensions));
@@ -192,6 +199,9 @@ void deinitialize(TextTileProvider& t) {
}
Tile tile(TextTileProvider& t, const TileIndex& tileIndex) {
ZoneScoped
TracyGpuZone("tile")
cache::ProviderTileKey key = { tileIndex, t.uniqueIdentifier };
Tile tile = t.tileCache->get(key);
if (!tile.texture) {
@@ -231,6 +241,8 @@ Tile tile(TextTileProvider& t, const TileIndex& tileIndex) {
}
void reset(TextTileProvider& t) {
ZoneScoped
t.tileCache->clear();
}
@@ -240,6 +252,8 @@ void reset(TextTileProvider& t) {
//
TileProvider* levelProvider(TileProviderByLevel& t, int level) {
ZoneScoped
if (!t.levelTileProviders.empty()) {
int clampedLevel = glm::clamp(
level,
@@ -296,6 +310,8 @@ std::string timeStringify(TemporalTileProvider::TimeFormatType type, const Time&
std::unique_ptr<TileProvider> initTileProvider(TemporalTileProvider& t,
const TemporalTileProvider::TimeKey& timekey)
{
ZoneScoped
static const std::vector<std::string> IgnoredTokens = {
// From: http://www.gdal.org/frmt_wms.html
"${x}",
@@ -324,6 +340,8 @@ std::unique_ptr<TileProvider> initTileProvider(TemporalTileProvider& t,
TileProvider* getTileProvider(TemporalTileProvider& t,
const TemporalTileProvider::TimeKey& timekey)
{
ZoneScoped
const auto it = t.tileProviderMap.find(timekey);
if (it != t.tileProviderMap.end()) {
return it->second.get();
@@ -339,6 +357,8 @@ TileProvider* getTileProvider(TemporalTileProvider& t,
}
TileProvider* getTileProvider(TemporalTileProvider& t, const Time& time) {
ZoneScoped
Time tCopy(time);
if (t.timeQuantizer.quantize(tCopy, true)) {
TemporalTileProvider::TimeKey timeKey = timeStringify(t.timeFormat, tCopy);
@@ -354,6 +374,8 @@ TileProvider* getTileProvider(TemporalTileProvider& t, const Time& time) {
}
void ensureUpdated(TemporalTileProvider& t) {
ZoneScoped
if (!t.currentTileProvider) {
update(t);
}
@@ -374,6 +396,8 @@ std::string xmlValue(TemporalTileProvider& t, CPLXMLNode* node, const std::strin
}
std::string consumeTemporalMetaData(TemporalTileProvider& t, const std::string& xml) {
ZoneScoped
CPLXMLNode* node = CPLParseXMLString(xml.c_str());
std::string timeStart = xmlValue(t, node, temporal::TimeStart, "2000 Jan 1");
@@ -421,6 +445,8 @@ std::string consumeTemporalMetaData(TemporalTileProvider& t, const std::string&
}
bool readFilePath(TemporalTileProvider& t) {
ZoneScoped
std::ifstream in(t.filePath.value().c_str());
std::string xml;
if (in.is_open()) {
@@ -454,6 +480,8 @@ unsigned int TileProvider::NumTileProviders = 0;
// General functions
//
void initializeDefaultTile() {
ZoneScoped
ghoul_assert(!DefaultTile.texture, "Default tile should not have been created");
using namespace ghoul::opengl;
@@ -487,6 +515,8 @@ void deinitializeDefaultTile() {
std::unique_ptr<TileProvider> createFromDictionary(layergroupid::TypeID layerTypeID,
const ghoul::Dictionary& dictionary)
{
ZoneScoped
const char* type = layergroupid::LAYER_TYPE_NAMES[static_cast<int>(layerTypeID)];
auto factory = FactoryManager::ref().factory<TileProvider>();
std::unique_ptr<TileProvider> result = factory->create(type, dictionary);
@@ -499,6 +529,8 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
: filePath(defaultprovider::FilePathInfo, "")
, tilePixelSize(defaultprovider::TilePixelSizeInfo, 32, 32, 2048)
{
ZoneScoped
type = Type::DefaultTileProvider;
tileCache = global::moduleEngine.module<GlobeBrowsingModule>()->tileCache();
@@ -560,6 +592,8 @@ DefaultTileProvider::DefaultTileProvider(const ghoul::Dictionary& dictionary)
SingleImageProvider::SingleImageProvider(const ghoul::Dictionary& dictionary)
: filePath(singleimageprovider::FilePathInfo)
{
ZoneScoped
type = Type::SingleImageTileProvider;
filePath = dictionary.value<std::string>(KeyFilePath);
@@ -576,6 +610,8 @@ TextTileProvider::TextTileProvider(TileTextureInitData initData, size_t fontSize
: initData(std::move(initData))
, fontSize(fontSize)
{
ZoneScoped
tileCache = global::moduleEngine.module<GlobeBrowsingModule>()->tileCache();
}
@@ -586,6 +622,8 @@ TextTileProvider::TextTileProvider(TileTextureInitData initData, size_t fontSize
SizeReferenceTileProvider::SizeReferenceTileProvider(const ghoul::Dictionary& dictionary)
: TextTileProvider(tileTextureInitData(layergroupid::GroupID::ColorLayers, false))
{
ZoneScoped
type = Type::SizeReferenceTileProvider;
font = global::fontManager.font("Mono", static_cast<float>(fontSize));
@@ -602,6 +640,8 @@ SizeReferenceTileProvider::SizeReferenceTileProvider(const ghoul::Dictionary& di
TileIndexTileProvider::TileIndexTileProvider(const ghoul::Dictionary&)
: TextTileProvider(tileTextureInitData(layergroupid::GroupID::ColorLayers, false))
{
ZoneScoped
type = Type::TileIndexTileProvider;
}
@@ -610,6 +650,8 @@ TileIndexTileProvider::TileIndexTileProvider(const ghoul::Dictionary&)
TileProviderByIndex::TileProviderByIndex(const ghoul::Dictionary& dictionary) {
ZoneScoped
type = Type::ByIndexTileProvider;
const ghoul::Dictionary& defaultProviderDict = dictionary.value<ghoul::Dictionary>(
@@ -678,6 +720,8 @@ TileProviderByIndex::TileProviderByIndex(const ghoul::Dictionary& dictionary) {
TileProviderByLevel::TileProviderByLevel(const ghoul::Dictionary& dictionary) {
ZoneScoped
type = Type::ByLevelTileProvider;
layergroupid::GroupID layerGroupID = dictionary.value<layergroupid::GroupID>(
@@ -754,6 +798,8 @@ TemporalTileProvider::TemporalTileProvider(const ghoul::Dictionary& dictionary)
: initDict(dictionary)
, filePath(temporal::FilePathInfo)
{
ZoneScoped
type = Type::TemporalTileProvider;
filePath = dictionary.value<std::string>(KeyFilePath);
@@ -772,6 +818,8 @@ TemporalTileProvider::TemporalTileProvider(const ghoul::Dictionary& dictionary)
bool initialize(TileProvider& tp) {
ZoneScoped
ghoul_assert(!tp.isInitialized, "TileProvider can only be initialized once.");
tp.uniqueIdentifier = TileProvider::NumTileProviders++;
@@ -822,6 +870,8 @@ bool initialize(TileProvider& tp) {
bool deinitialize(TileProvider& tp) {
ZoneScoped
switch (tp.type) {
case Type::DefaultTileProvider:
break;
@@ -861,6 +911,8 @@ bool deinitialize(TileProvider& tp) {
Tile tile(TileProvider& tp, const TileIndex& tileIndex) {
ZoneScoped
switch (tp.type) {
case Type::DefaultTileProvider: {
DefaultTileProvider& t = static_cast<DefaultTileProvider&>(tp);
@@ -974,6 +1026,8 @@ Tile tile(TileProvider& tp, const TileIndex& tileIndex) {
Tile::Status tileStatus(TileProvider& tp, const TileIndex& index) {
ZoneScoped
switch (tp.type) {
case Type::DefaultTileProvider: {
DefaultTileProvider& t = static_cast<DefaultTileProvider&>(tp);
@@ -1034,6 +1088,8 @@ Tile::Status tileStatus(TileProvider& tp, const TileIndex& index) {
TileDepthTransform depthTransform(TileProvider& tp) {
ZoneScoped
switch (tp.type) {
case Type::DefaultTileProvider: {
DefaultTileProvider& t = static_cast<DefaultTileProvider&>(tp);
@@ -1077,6 +1133,8 @@ TileDepthTransform depthTransform(TileProvider& tp) {
int update(TileProvider& tp) {
ZoneScoped
switch (tp.type) {
case Type::DefaultTileProvider: {
DefaultTileProvider& t = static_cast<DefaultTileProvider&>(tp);
@@ -1147,6 +1205,8 @@ int update(TileProvider& tp) {
void reset(TileProvider& tp) {
ZoneScoped
switch (tp.type) {
case Type::DefaultTileProvider: {
DefaultTileProvider& t = static_cast<DefaultTileProvider&>(tp);
@@ -1233,6 +1293,8 @@ void reset(TileProvider& tp) {
int maxLevel(TileProvider& tp) {
ZoneScoped
switch (tp.type) {
case Type::DefaultTileProvider: {
DefaultTileProvider& t = static_cast<DefaultTileProvider&>(tp);
@@ -1278,6 +1340,8 @@ int maxLevel(TileProvider& tp) {
float noDataValueAsFloat(TileProvider& tp) {
ZoneScoped
ghoul_assert(tp.isInitialized, "TileProvider was not initialized.");
switch (tp.type) {
case Type::DefaultTileProvider: {
@@ -1308,6 +1372,8 @@ float noDataValueAsFloat(TileProvider& tp) {
ChunkTile chunkTile(TileProvider& tp, TileIndex tileIndex, int parents, int maxParents) {
ZoneScoped
ghoul_assert(tp.isInitialized, "TileProvider was not initialized.");
auto ascendToParent = [](TileIndex& tileIndex, TileUvTransform& uv) {
@@ -1364,6 +1430,8 @@ ChunkTile chunkTile(TileProvider& tp, TileIndex tileIndex, int parents, int maxP
ChunkTilePile chunkTilePile(TileProvider& tp, TileIndex tileIndex, int pileSize) {
ZoneScoped
ghoul_assert(tp.isInitialized, "TileProvider was not initialized.");
ghoul_assert(pileSize >= 0, "pileSize must be positive");
+4 -4
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -110,11 +110,11 @@ struct TextTileProvider : public TileProvider {
std::unique_ptr<ghoul::fontrendering::FontRenderer> fontRenderer;
std::shared_ptr<ghoul::fontrendering::Font> font;
size_t fontSize;
size_t fontSize = 0;
std::string text;
glm::vec2 textPosition;
glm::vec4 textColor;
glm::vec2 textPosition = glm::vec2(0.f);
glm::vec4 textColor = glm::vec4(0.f);
GLuint fbo = 0;
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
@@ -33,9 +33,8 @@
namespace openspace::globebrowsing {
/**
* All information needed to create a texture used for a Tile.
*/
/// All information needed to create a texture used for a Tile.
class TileTextureInitData {
public:
using HashKey = uint64_t;
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *
+1 -1
View File
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* 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 *