Code Cleanup (#2191)

* constexpr const -> constexpr
* const char* -> std::string_view
This commit is contained in:
Alexander Bock
2022-07-25 15:57:45 +02:00
committed by GitHub
parent ea1f4bbf40
commit 9cc4c595a8
267 changed files with 1425 additions and 1565 deletions
@@ -68,9 +68,9 @@
#include <fstream>
namespace {
constexpr const char* _loggerCat = "AtmosphereDeferredcaster";
constexpr std::string_view _loggerCat = "AtmosphereDeferredcaster";
constexpr const std::array<const char*, 27> UniformNames = {
constexpr std::array<const char*, 27> UniformNames = {
"cullAtmosphere", "Rg", "Rt", "groundRadianceEmission", "HR", "betaRayleigh",
"HM", "betaMieExtinction", "mieG", "sunRadiance", "ozoneLayerEnabled", "HO",
"betaOzoneExtinction", "SAMPLES_R", "SAMPLES_MU", "SAMPLES_MU_S", "SAMPLES_NU",
@@ -80,8 +80,8 @@ namespace {
"inscatterTexture"
};
constexpr const float ATM_EPS = 2000.f;
constexpr const float KM_TO_M = 1000.f;
constexpr float ATM_EPS = 2000.f;
constexpr float KM_TO_M = 1000.f;
template <GLenum colorBufferAttachment = GL_COLOR_ATTACHMENT0>
void saveTextureFile(const std::filesystem::path& fileName, const glm::ivec2& size) {
@@ -287,7 +287,7 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData& data, const Deferred
// Number of planet radii to use as distance threshold for culling
prg.setUniform(_uniformCache.cullAtmosphere, 1);
constexpr const double DistanceCullingRadii = 5000;
constexpr double DistanceCullingRadii = 5000;
glm::dmat4 MV = glm::dmat4(data.camera.sgctInternal.projectionMatrix()) *
data.camera.combinedViewMatrix();
if (distance <= scaledRadius * DistanceCullingRadii &&
@@ -564,7 +564,7 @@ void AtmosphereDeferredcaster::calculateTransmittance() {
program->setUniform("HO", _ozoneHeightScale);
program->setUniform("betaOzoneExtinction", _ozoneExtinctionCoeff);
constexpr const float Black[] = { 0.f, 0.f, 0.f, 0.f };
constexpr float Black[] = { 0.f, 0.f, 0.f, 0.f };
glClearBufferfv(GL_COLOR, 0, Black);
glDrawArrays(GL_TRIANGLES, 0, 6);
if (_saveCalculationTextures) {
@@ -35,7 +35,7 @@
#include <math.h>
namespace {
constexpr const float KM_TO_M = 1000.f;
constexpr float KM_TO_M = 1000.f;
constexpr openspace::properties::Property::PropertyInfo AtmosphereHeightInfo = {
"AtmosphereHeight",
@@ -318,8 +318,7 @@ void DashboardItemAngle::render(glm::vec2& penPosition) {
glm::vec2 DashboardItemAngle::size() const {
ZoneScoped
constexpr const double Angle = 120;
constexpr double Angle = 120;
return _font->boundingBox("Angle: " + std::to_string(Angle));
}
@@ -105,8 +105,8 @@ namespace {
openspace::DistanceUnits.begin(),
openspace::DistanceUnits.end(),
res.begin(),
[](openspace::DistanceUnit unit) -> std::string {
return nameForDistanceUnit(unit);
[](openspace::DistanceUnit unit) {
return std::string(nameForDistanceUnit(unit));
}
);
return res;
@@ -257,7 +257,10 @@ DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary
addProperty(_doSimplification);
for (DistanceUnit u : DistanceUnits) {
_requestedUnit.addOption(static_cast<int>(u), nameForDistanceUnit(u));
_requestedUnit.addOption(
static_cast<int>(u),
std::string(nameForDistanceUnit(u))
);
}
_requestedUnit = static_cast<int>(DistanceUnit::Meter);
if (p.requestedUnit.has_value()) {
@@ -344,7 +347,7 @@ void DashboardItemDistance::render(glm::vec2& penPosition) {
);
const double d = glm::length(sourceInfo.first - destinationInfo.first);
std::pair<double, std::string> dist;
std::pair<double, std::string_view> dist;
if (_doSimplification) {
dist = simplifyDistance(d);
}
@@ -129,7 +129,7 @@ void DashboardItemMission::render(glm::vec2& penPosition) {
using PhaseWithDepth = std::pair<const MissionPhase*, int>;
std::stack<PhaseWithDepth> S;
constexpr const int PixelIndentation = 20;
constexpr int PixelIndentation = 20;
S.push({ &mission, 0 });
while (!S.empty()) {
const MissionPhase* phase = S.top().first;
@@ -63,8 +63,8 @@ void DashboardItemParallelConnection::render(glm::vec2& penPosition) {
int nClients = static_cast<int>(nConnections);
if (status == ParallelConnection::Status::Host) {
nClients--;
constexpr const char* Singular = "Hosting session with {} client";
constexpr const char* Plural = "Hosting session with {} clients";
constexpr std::string_view Singular = "Hosting session with {} client";
constexpr std::string_view Plural = "Hosting session with {} clients";
connectionInfo =
(nClients == 1) ?
@@ -85,11 +85,11 @@ void DashboardItemParallelConnection::render(glm::vec2& penPosition) {
connectionInfo += "\n";
if (nClients > 2) {
constexpr const char* Plural = "You and {} more clients are tuned in";
constexpr std::string_view Plural = "You and {} more clients are tuned in";
connectionInfo += fmt::format(Plural, nClients - 1);
}
else if (nClients == 2) {
constexpr const char* Singular = "You and {} more client are tuned in";
constexpr std::string_view Singular = "You and {} more client are tuned in";
connectionInfo += fmt::format(Singular, nClients - 1);
}
else if (nClients == 1) {
@@ -136,11 +136,11 @@ glm::vec2 DashboardItemParallelConnection::size() const {
{
connectionInfo += "\n";
if (nClients > 2) {
constexpr const char* Plural = "You and {} more clients are tuned in";
constexpr std::string_view Plural = "You and {} more clients are tuned in";
connectionInfo += fmt::format(Plural, nClients);
}
else if (nClients == 2) {
constexpr const char* Singular = "You and {} more client are tuned in";
constexpr std::string_view Singular = "You and {} more client are tuned in";
connectionInfo += fmt::format(Singular, nClients - 1);
}
else if (nClients == 1) {
@@ -77,7 +77,9 @@ namespace {
openspace::TimeUnits.begin(),
openspace::TimeUnits.end(),
res.begin(),
[](openspace::TimeUnit unit) -> std::string { return nameForTimeUnit(unit); }
[](openspace::TimeUnit unit) -> std::string {
return std::string(nameForTimeUnit(unit));
}
);
return res;
}
@@ -131,7 +133,7 @@ DashboardItemSimulationIncrement::DashboardItemSimulationIncrement(
addProperty(_doSimplification);
for (TimeUnit u : TimeUnits) {
_requestedUnit.addOption(static_cast<int>(u), nameForTimeUnit(u));
_requestedUnit.addOption(static_cast<int>(u), std::string(nameForTimeUnit(u)));
}
_requestedUnit = static_cast<int>(TimeUnit::Second);
if (p.requestedUnit.has_value()) {
@@ -165,11 +167,17 @@ void DashboardItemSimulationIncrement::render(glm::vec2& penPosition) {
const TimeUnit unit = static_cast<TimeUnit>(_requestedUnit.value());
const double convTarget = convertTime(targetDt, TimeUnit::Second, unit);
targetDeltaTime = { convTarget, nameForTimeUnit(unit, convTarget != 1.0) };
targetDeltaTime = {
convTarget,
std::string(nameForTimeUnit(unit, convTarget != 1.0))
};
if (targetDt != currentDt) {
const double convCurrent = convertTime(currentDt, TimeUnit::Second, unit);
currentDeltaTime = { convCurrent, nameForTimeUnit(unit, convCurrent != 1.0) };
currentDeltaTime = {
convCurrent,
std::string(nameForTimeUnit(unit, convCurrent != 1.0))
};
}
}
@@ -217,7 +225,10 @@ glm::vec2 DashboardItemSimulationIncrement::size() const {
else {
TimeUnit unit = static_cast<TimeUnit>(_requestedUnit.value());
double convertedT = convertTime(t, TimeUnit::Second, unit);
deltaTime = { convertedT, nameForTimeUnit(unit, convertedT != 1.0) };
deltaTime = {
convertedT,
std::string(nameForTimeUnit(unit, convertedT != 1.0))
};
}
return _font->boundingBox(
@@ -61,8 +61,8 @@ namespace {
openspace::DistanceUnits.begin(),
openspace::DistanceUnits.end(),
res.begin(),
[](openspace::DistanceUnit unit) -> std::string {
return nameForDistanceUnit(unit);
[](openspace::DistanceUnit unit) {
return std::string(nameForDistanceUnit(unit));
}
);
return res;
@@ -105,7 +105,10 @@ DashboardItemVelocity::DashboardItemVelocity(const ghoul::Dictionary& dictionary
addProperty(_doSimplification);
for (DistanceUnit u : DistanceUnits) {
_requestedUnit.addOption(static_cast<int>(u), nameForDistanceUnit(u));
_requestedUnit.addOption(
static_cast<int>(u),
std::string(nameForDistanceUnit(u))
);
}
_requestedUnit = static_cast<int>(DistanceUnit::Meter);
if (p.requestedUnit.has_value()) {
@@ -127,7 +130,7 @@ void DashboardItemVelocity::render(glm::vec2& penPosition) {
const double speedPerSecond = speedPerFrame / secondsPerFrame;
std::pair<double, std::string> dist;
std::pair<double, std::string_view> dist;
if (_doSimplification) {
dist = simplifyDistance(speedPerSecond);
}
@@ -153,7 +156,7 @@ glm::vec2 DashboardItemVelocity::size() const {
ZoneScoped
const double d = glm::length(1e20);
std::pair<double, std::string> dist;
std::pair<double, std::string_view> dist;
if (_doSimplification) {
dist = simplifyDistance(d);
}
@@ -36,8 +36,6 @@
#include <ghoul/opengl/programobject.h>
namespace {
constexpr const char* ProgramName = "GridProgram";
constexpr openspace::properties::Property::PropertyInfo ColorInfo = {
"Color",
"Color",
@@ -104,10 +102,10 @@ bool RenderableBoxGrid::isReady() const {
void RenderableBoxGrid::initializeGL() {
_gridProgram = BaseModule::ProgramObjectManager.request(
ProgramName,
"GridProgram",
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
return global::renderEngine->buildRenderProgram(
ProgramName,
"GridProgram",
absPath("${MODULE_BASE}/shaders/grid_vs.glsl"),
absPath("${MODULE_BASE}/shaders/grid_fs.glsl")
);
@@ -131,7 +129,7 @@ void RenderableBoxGrid::deinitializeGL() {
_vBufferID = 0;
BaseModule::ProgramObjectManager.release(
ProgramName,
"GridProgram",
[](ghoul::opengl::ProgramObject* p) {
global::renderEngine->removeRenderProgram(p);
}
@@ -36,8 +36,6 @@
#include <ghoul/opengl/programobject.h>
namespace {
constexpr const char* ProgramName = "GridProgram";
constexpr openspace::properties::Property::PropertyInfo ColorInfo = {
"Color",
"Color",
@@ -120,10 +118,10 @@ bool RenderableGrid::isReady() const {
void RenderableGrid::initializeGL() {
_gridProgram = BaseModule::ProgramObjectManager.request(
ProgramName,
"GridProgram",
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
return global::renderEngine->buildRenderProgram(
ProgramName,
"GridProgram",
absPath("${MODULE_BASE}/shaders/grid_vs.glsl"),
absPath("${MODULE_BASE}/shaders/grid_fs.glsl")
);
@@ -147,7 +145,7 @@ void RenderableGrid::deinitializeGL() {
_vBufferID = 0;
BaseModule::ProgramObjectManager.release(
ProgramName,
"GridProgram",
[](ghoul::opengl::ProgramObject* p) {
global::renderEngine->removeRenderProgram(p);
}
@@ -37,8 +37,6 @@
#include <optional>
namespace {
constexpr const char* ProgramName = "GridProgram";
constexpr openspace::properties::Property::PropertyInfo ColorInfo = {
"Color",
"Color",
@@ -144,10 +142,10 @@ bool RenderableRadialGrid::isReady() const {
void RenderableRadialGrid::initializeGL() {
_gridProgram = BaseModule::ProgramObjectManager.request(
ProgramName,
"GridProgram",
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
return global::renderEngine->buildRenderProgram(
ProgramName,
"GridProgram",
absPath("${MODULE_BASE}/shaders/grid_vs.glsl"),
absPath("${MODULE_BASE}/shaders/grid_fs.glsl")
);
@@ -157,7 +155,7 @@ void RenderableRadialGrid::initializeGL() {
void RenderableRadialGrid::deinitializeGL() {
BaseModule::ProgramObjectManager.release(
ProgramName,
"GridProgram",
[](ghoul::opengl::ProgramObject* p) {
global::renderEngine->removeRenderProgram(p);
}
@@ -36,8 +36,6 @@
#include <optional>
namespace {
constexpr const char* ProgramName = "GridProgram";
constexpr openspace::properties::Property::PropertyInfo ColorInfo = {
"Color",
"Color",
@@ -116,10 +114,10 @@ bool RenderableSphericalGrid::isReady() const {
void RenderableSphericalGrid::initializeGL() {
_gridProgram = BaseModule::ProgramObjectManager.request(
ProgramName,
"GridProgram",
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
return global::renderEngine->buildRenderProgram(
ProgramName,
"GridProgram",
absPath("${MODULE_BASE}/shaders/grid_vs.glsl"),
absPath("${MODULE_BASE}/shaders/grid_fs.glsl")
);
@@ -148,7 +146,7 @@ void RenderableSphericalGrid::deinitializeGL() {
_iBufferID = 0;
BaseModule::ProgramObjectManager.release(
ProgramName,
"GridProgram",
[](ghoul::opengl::ProgramObject* p) {
global::renderEngine->removeRenderProgram(p);
}
@@ -37,9 +37,6 @@
#include <optional>
namespace {
constexpr const char* ProgramName = "CartesianAxesProgram";
const int NVertexIndices = 6;
constexpr openspace::properties::Property::PropertyInfo XColorInfo = {
"XColor",
"X Color",
@@ -107,10 +104,10 @@ bool RenderableCartesianAxes::isReady() const {
void RenderableCartesianAxes::initializeGL() {
_program = BaseModule::ProgramObjectManager.request(
ProgramName,
"CartesianAxesProgram",
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
return global::renderEngine->buildRenderProgram(
ProgramName,
"CartesianAxesProgram",
absPath("${MODULE_BASE}/shaders/axes_vs.glsl"),
absPath("${MODULE_BASE}/shaders/axes_fs.glsl")
);
@@ -167,7 +164,7 @@ void RenderableCartesianAxes::deinitializeGL() {
_iBufferId = 0;
BaseModule::ProgramObjectManager.release(
ProgramName,
"CartesianAxesProgram",
[](ghoul::opengl::ProgramObject* p) {
global::renderEngine->removeRenderProgram(p);
}
@@ -200,7 +197,7 @@ void RenderableCartesianAxes::render(const RenderData& data, RendererTasks&){
glLineWidth(3.0);
glBindVertexArray(_vaoId);
glDrawElements(GL_LINES, NVertexIndices, GL_UNSIGNED_INT, nullptr);
glDrawElements(GL_LINES, 6, GL_UNSIGNED_INT, nullptr);
glBindVertexArray(0);
_program->deactivate();
+1 -1
View File
@@ -39,7 +39,7 @@
#include <optional>
namespace {
constexpr const std::array<const char*, 4> UniformNames = {
constexpr std::array<const char*, 4> UniformNames = {
"modelViewProjectionTransform", "opacity", "width", "colorTexture"
};
+25 -26
View File
@@ -32,7 +32,6 @@
#include <openspace/scene/scenegraphnode.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/glm.h>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -50,18 +49,18 @@
#include <optional>
namespace {
constexpr const char* MeterUnit = "m";
constexpr const char* KilometerUnit = "Km";
constexpr const char* MegameterUnit = "Mm";
constexpr const char* GigameterUnit = "Gm";
constexpr const char* AstronomicalUnitUnit = "au";
constexpr const char* TerameterUnit = "Tm";
constexpr const char* PetameterUnit = "Pm";
constexpr const char* ParsecUnit = "pc";
constexpr const char* KiloparsecUnit = "Kpc";
constexpr const char* MegaparsecUnit = "Mpc";
constexpr const char* GigaparsecUnit = "Gpc";
constexpr const char* GigalightyearUnit = "Gly";
constexpr std::string_view MeterUnit = "m";
constexpr std::string_view KilometerUnit = "Km";
constexpr std::string_view MegameterUnit = "Mm";
constexpr std::string_view GigameterUnit = "Gm";
constexpr std::string_view AstronomicalUnitUnit = "au";
constexpr std::string_view TerameterUnit = "Tm";
constexpr std::string_view PetameterUnit = "Pm";
constexpr std::string_view ParsecUnit = "pc";
constexpr std::string_view KiloparsecUnit = "Kpc";
constexpr std::string_view MegaparsecUnit = "Mpc";
constexpr std::string_view GigaparsecUnit = "Gpc";
constexpr std::string_view GigalightyearUnit = "Gly";
enum BlendMode {
Normal = 0,
@@ -329,18 +328,18 @@ RenderableLabels::RenderableLabels(const ghoul::Dictionary& dictionary)
_enableFadingEffect = p.enableFading.value_or(_enableFadingEffect);
addProperty(_enableFadingEffect);
_fadeUnitOption.addOption(Meter, MeterUnit);
_fadeUnitOption.addOption(Kilometer, KilometerUnit);
_fadeUnitOption.addOption(Megameter, MegameterUnit);
_fadeUnitOption.addOption(Gigameter, GigameterUnit);
_fadeUnitOption.addOption(AstronomicalUnit, AstronomicalUnitUnit);
_fadeUnitOption.addOption(Terameter, TerameterUnit);
_fadeUnitOption.addOption(Petameter, PetameterUnit);
_fadeUnitOption.addOption(Parsec, ParsecUnit);
_fadeUnitOption.addOption(KiloParsec, KiloparsecUnit);
_fadeUnitOption.addOption(MegaParsec, MegaparsecUnit);
_fadeUnitOption.addOption(GigaParsec, GigaparsecUnit);
_fadeUnitOption.addOption(GigaLightyear, GigalightyearUnit);
_fadeUnitOption.addOption(Meter, std::string(MeterUnit));
_fadeUnitOption.addOption(Kilometer, std::string(KilometerUnit));
_fadeUnitOption.addOption(Megameter, std::string(MegameterUnit));
_fadeUnitOption.addOption(Gigameter, std::string(GigameterUnit));
_fadeUnitOption.addOption(AstronomicalUnit, std::string(AstronomicalUnitUnit));
_fadeUnitOption.addOption(Terameter, std::string(TerameterUnit));
_fadeUnitOption.addOption(Petameter, std::string(PetameterUnit));
_fadeUnitOption.addOption(Parsec, std::string(ParsecUnit));
_fadeUnitOption.addOption(KiloParsec, std::string(KiloparsecUnit));
_fadeUnitOption.addOption(MegaParsec, std::string(MegaparsecUnit));
_fadeUnitOption.addOption(GigaParsec, std::string(GigaparsecUnit));
_fadeUnitOption.addOption(GigaLightyear, std::string(GigalightyearUnit));
if (p.fadeUnit.has_value()) {
_fadeUnitOption = codegen::map<Unit>(*p.fadeUnit);
@@ -506,7 +505,7 @@ float RenderableLabels::unit(int unit) const {
}
}
std::string RenderableLabels::toString(int unit) const {
std::string_view RenderableLabels::toString(int unit) const {
switch (static_cast<Unit>(unit)) {
case Meter: return MeterUnit;
case Kilometer: return KilometerUnit;
+1 -1
View File
@@ -75,7 +75,7 @@ protected:
float unit(int unit) const;
std::string toString(int unit) const;
std::string_view toString(int unit) const;
// Data may require some type of transformation prior the spice transformation being
// applied
+11 -11
View File
@@ -45,14 +45,14 @@
#include <optional>
namespace {
constexpr const char* _loggerCat = "RenderableModel";
constexpr const char* ProgramName = "ModelProgram";
constexpr std::string_view _loggerCat = "RenderableModel";
constexpr std::string_view ProgramName = "ModelProgram";
constexpr const int DefaultBlending = 0;
constexpr const int AdditiveBlending = 1;
constexpr const int PointsAndLinesBlending = 2;
constexpr const int PolygonBlending = 3;
constexpr const int ColorAddingBlending = 4;
constexpr int DefaultBlending = 0;
constexpr int AdditiveBlending = 1;
constexpr int PointsAndLinesBlending = 2;
constexpr int PolygonBlending = 3;
constexpr int ColorAddingBlending = 4;
std::map<std::string, int> BlendingMapping = {
{ "Default", DefaultBlending },
@@ -68,7 +68,7 @@ namespace {
"Enable or disable the animation for the model if it has any"
};
constexpr const std::array<const char*, 12> UniformNames = {
constexpr std::array<const char*, 12> UniformNames = {
"opacity", "nLightSources", "lightDirectionsViewSpace", "lightIntensities",
"modelViewTransform", "normalTransform", "projectionTransform",
"performShading", "ambientIntensity", "diffuseIntensity",
@@ -509,7 +509,7 @@ void RenderableModel::initialize() {
void RenderableModel::initializeGL() {
ZoneScoped
std::string program = ProgramName;
std::string program = std::string(ProgramName);
if (!_vertexShaderPath.empty()) {
program += "|vs=" + _vertexShaderPath;
}
@@ -528,7 +528,7 @@ void RenderableModel::initializeGL() {
absPath("${MODULE_BASE}/shaders/model_fs.glsl") :
std::filesystem::path(_fragmentShaderPath);
return global::renderEngine->buildRenderProgram(ProgramName, vs, fs);
return global::renderEngine->buildRenderProgram(program, vs, fs);
}
);
// We don't really know what kind of shader the user provides us with, so we can't
@@ -547,7 +547,7 @@ void RenderableModel::deinitializeGL() {
_geometry->deinitialize();
_geometry.reset();
std::string program = ProgramName;
std::string program = std::string(ProgramName);
if (!_vertexShaderPath.empty()) {
program += "|vs=" + _vertexShaderPath;
}
@@ -39,9 +39,6 @@
#include <ghoul/opengl/programobject.h>
namespace {
constexpr const char* ProgramName = "NodeLineProgram";
constexpr const char* Root = "Root";
constexpr openspace::properties::Property::PropertyInfo StartNodeInfo = {
"StartNode",
"Start Node",
@@ -108,8 +105,8 @@ documentation::Documentation RenderableNodeLine::Documentation() {
RenderableNodeLine::RenderableNodeLine(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _start(StartNodeInfo, Root)
, _end(EndNodeInfo, Root)
, _start(StartNodeInfo, "Root")
, _end(EndNodeInfo, "Root")
, _lineColor(LineColorInfo, glm::vec3(1.f), glm::vec3(0.f), glm::vec3(1.f))
, _lineWidth(LineWidthInfo, 2.f, 1.f, 20.f)
{
@@ -145,10 +142,10 @@ std::string RenderableNodeLine::end() const {
void RenderableNodeLine::initializeGL() {
_program = BaseModule::ProgramObjectManager.request(
ProgramName,
"NodeLineProgram",
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
return global::renderEngine->buildRenderProgram(
ProgramName,
"NodeLineProgram",
absPath("${MODULE_BASE}/shaders/line_vs.glsl"),
absPath("${MODULE_BASE}/shaders/line_fs.glsl")
);
@@ -175,7 +172,7 @@ void RenderableNodeLine::deinitializeGL() {
_vBufferId = 0;
BaseModule::ProgramObjectManager.release(
ProgramName,
"NodeLineProgram",
[](ghoul::opengl::ProgramObject* p) {
global::renderEngine->removeRenderProgram(p);
}
+3 -5
View File
@@ -43,8 +43,6 @@
#include <optional>
namespace {
constexpr const char* ProgramName = "Plane";
enum BlendMode {
Normal = 0,
Additive
@@ -184,10 +182,10 @@ void RenderablePlane::initializeGL() {
createPlane();
_shader = BaseModule::ProgramObjectManager.request(
ProgramName,
"Plane",
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
return global::renderEngine->buildRenderProgram(
ProgramName,
"Plane",
absPath("${MODULE_BASE}/shaders/plane_vs.glsl"),
absPath("${MODULE_BASE}/shaders/plane_fs.glsl")
);
@@ -205,7 +203,7 @@ void RenderablePlane::deinitializeGL() {
_vertexPositionBuffer = 0;
BaseModule::ProgramObjectManager.release(
ProgramName,
"Plane",
[](ghoul::opengl::ProgramObject* p) {
global::renderEngine->removeRenderProgram(p);
}
@@ -38,8 +38,8 @@
#include <optional>
namespace {
constexpr const char* KeyLazyLoading = "LazyLoading";
constexpr const char* _loggerCat = "RenderablePlaneTimeVaryingImage";
constexpr std::string_view KeyLazyLoading = "LazyLoading";
constexpr std::string_view _loggerCat = "RenderablePlaneTimeVaryingImage";
constexpr openspace::properties::Property::PropertyInfo SourceFolderInfo = {
"SourceFolder",
+1 -1
View File
@@ -36,7 +36,7 @@
#include <optional>
namespace {
constexpr const std::array<const char*, 2> UniformNames = {
constexpr std::array<const char*, 2> UniformNames = {
"modelViewProjectionTransform", "vs_color"
};
+4 -6
View File
@@ -41,9 +41,7 @@
#include <optional>
namespace {
constexpr const char* ProgramName = "Sphere";
constexpr const std::array<const char*, 5> UniformNames = {
constexpr std::array<const char*, 5> UniformNames = {
"opacity", "modelViewProjection", "modelViewRotation", "colorTexture",
"mirrorTexture"
};
@@ -228,10 +226,10 @@ void RenderableSphere::initializeGL() {
_sphere->initialize();
_shader = BaseModule::ProgramObjectManager.request(
ProgramName,
"Sphere",
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
return global::renderEngine->buildRenderProgram(
ProgramName,
"Sphere",
absPath("${MODULE_BASE}/shaders/sphere_vs.glsl"),
absPath("${MODULE_BASE}/shaders/sphere_fs.glsl")
);
@@ -247,7 +245,7 @@ void RenderableSphere::deinitializeGL() {
_texture = nullptr;
BaseModule::ProgramObjectManager.release(
ProgramName,
"Sphere",
[](ghoul::opengl::ProgramObject* p) {
global::renderEngine->removeRenderProgram(p);
}
@@ -43,9 +43,7 @@
#include <optional>
namespace {
constexpr const char* ProgramName = "Timevarying Sphere";
constexpr const std::array<const char*, 5> UniformNames = {
constexpr std::array<const char*, 5> UniformNames = {
"opacity", "modelViewProjection", "modelViewRotation", "colorTexture",
"mirrorTexture"
};
@@ -222,10 +220,10 @@ void RenderableTimeVaryingSphere::initializeGL() {
_sphere->initialize();
_shader = BaseModule::ProgramObjectManager.request(
ProgramName,
"Timevarying Sphere",
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
return global::renderEngine->buildRenderProgram(
ProgramName,
"Timevarying Sphere",
absPath("${MODULE_BASE}/shaders/sphere_vs.glsl"),
absPath("${MODULE_BASE}/shaders/sphere_fs.glsl")
);
@@ -245,7 +243,7 @@ void RenderableTimeVaryingSphere::deinitializeGL() {
_texture = nullptr;
BaseModule::ProgramObjectManager.release(
ProgramName,
"Timevarying Sphere",
[](ghoul::opengl::ProgramObject* p) {
global::renderEngine->removeRenderProgram(p);
}
+6 -9
View File
@@ -39,17 +39,14 @@
#include <optional>
namespace {
constexpr const char* ProgramName = "EphemerisProgram";
constexpr const char* KeyTranslation = "Translation";
#ifdef __APPLE__
constexpr const std::array<const char*, 12> UniformNames = {
constexpr std::array<const char*, 12> UniformNames = {
"opacity", "modelViewTransform", "projectionTransform", "color", "useLineFade",
"lineFade", "vertexSortingMethod", "idOffset", "nVertices", "stride", "pointSize",
"renderPhase"
};
#else
constexpr const std::array<const char*, 14> UniformNames = {
constexpr std::array<const char*, 14> UniformNames = {
"opacity", "modelViewTransform", "projectionTransform", "color", "useLineFade",
"lineFade", "vertexSortingMethod", "idOffset", "nVertices", "stride", "pointSize",
"renderPhase", "viewport", "lineWidth"
@@ -200,7 +197,7 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
addProperty(_opacity);
_translation = Translation::createFromDictionary(
dictionary.value<ghoul::Dictionary>(KeyTranslation)
dictionary.value<ghoul::Dictionary>("Translation")
);
addPropertySubOwner(_translation.get());
@@ -248,10 +245,10 @@ void RenderableTrail::initializeGL() {
);
#else
_programObject = BaseModule::ProgramObjectManager.request(
ProgramName,
"EphemerisProgram",
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
return global::renderEngine->buildRenderProgram(
ProgramName,
"EphemerisProgram",
absPath("${MODULE_BASE}/shaders/renderabletrail_vs.glsl"),
absPath("${MODULE_BASE}/shaders/renderabletrail_fs.glsl")
);
@@ -264,7 +261,7 @@ void RenderableTrail::initializeGL() {
void RenderableTrail::deinitializeGL() {
BaseModule::ProgramObjectManager.release(
ProgramName,
"EphemerisProgram",
[](ghoul::opengl::ProgramObject* p) {
global::renderEngine->removeRenderProgram(p);
}
@@ -361,7 +361,7 @@ RenderableTrailOrbit::UpdateReport RenderableTrailOrbit::updateTrails(
}
constexpr const double Epsilon = 1e-7;
constexpr double Epsilon = 1e-7;
// When time stands still (at the iron hill), we don't need to perform any work
if (std::abs(data.time.j2000Seconds() - _previousTime) < Epsilon) {
return { false, false, 0 };
+18 -27
View File
@@ -37,7 +37,7 @@
#include <variant>
namespace {
constexpr const openspace::properties::Property::PropertyInfo EnableInfo = {
constexpr openspace::properties::Property::PropertyInfo EnableInfo = {
"Enable",
"Enabled",
"If this value is 'true', all the machinery of this rotation is used, of it is "
@@ -45,7 +45,7 @@ namespace {
"undefined behavior."
};
constexpr const openspace::properties::Property::PropertyInfo XAxisTypeInfo = {
constexpr openspace::properties::Property::PropertyInfo XAxisTypeInfo = {
"xAxisType",
"xAxis: Specification Type",
"This value specifies how this axis is being specified, that is whether it is "
@@ -54,7 +54,7 @@ namespace {
"vectors."
};
constexpr const openspace::properties::Property::PropertyInfo YAxisTypeInfo = {
constexpr openspace::properties::Property::PropertyInfo YAxisTypeInfo = {
"yAxisType",
"yAxis: Specification Type",
"This value specifies how this axis is being specified, that is whether it is "
@@ -63,7 +63,7 @@ namespace {
"vectors."
};
constexpr const openspace::properties::Property::PropertyInfo ZAxisTypeInfo = {
constexpr openspace::properties::Property::PropertyInfo ZAxisTypeInfo = {
"zAxisType",
"zAxis: Specification Type",
"This value specifies how this axis is being specified, that is whether it is "
@@ -72,7 +72,7 @@ namespace {
"vectors."
};
constexpr const openspace::properties::Property::PropertyInfo XAxisObjectInfo = {
constexpr openspace::properties::Property::PropertyInfo XAxisObjectInfo = {
"xAxisObject",
"xAxis: Focus Object",
"This is the object that the axis will focus on. This object must name an "
@@ -80,7 +80,7 @@ namespace {
"stay fixed to the current position of that object."
};
constexpr const openspace::properties::Property::PropertyInfo YAxisObjectInfo = {
constexpr openspace::properties::Property::PropertyInfo YAxisObjectInfo = {
"yAxisObject",
"yAxis: Focus Object",
"This is the object that the axis will focus on. This object must name an "
@@ -88,7 +88,7 @@ namespace {
"stay fixed to the current position of that object."
};
constexpr const openspace::properties::Property::PropertyInfo ZAxisObjectInfo = {
constexpr openspace::properties::Property::PropertyInfo ZAxisObjectInfo = {
"zAxisObject",
"zAxis: Focus Object",
"This is the object that the axis will focus on. This object must name an "
@@ -96,8 +96,7 @@ namespace {
"stay fixed to the current position of that object."
};
constexpr const openspace::properties::Property::PropertyInfo XAxisInvertObjectInfo =
{
constexpr openspace::properties::Property::PropertyInfo XAxisInvertObjectInfo = {
"xAxisInvertObject",
"xAxis: Invert Object Point Direction",
"If this value is set to 'true', and the type is set to 'Object', the inverse of "
@@ -105,8 +104,7 @@ namespace {
"referenced object."
};
constexpr const openspace::properties::Property::PropertyInfo YAxisInvertObjectInfo =
{
constexpr openspace::properties::Property::PropertyInfo YAxisInvertObjectInfo = {
"yAxisInvertObject",
"yAxis: Invert Object Point Direction",
"If this value is set to 'true', and the type is set to 'Object', the inverse of "
@@ -114,8 +112,7 @@ namespace {
"referenced object."
};
constexpr const openspace::properties::Property::PropertyInfo ZAxisInvertObjectInfo =
{
constexpr openspace::properties::Property::PropertyInfo ZAxisInvertObjectInfo = {
"zAxisInvertObject",
"zAxis: Invert Object Point Direction",
"If this value is set to 'true', and the type is set to 'Object', the inverse of "
@@ -123,30 +120,28 @@ namespace {
"referenced object."
};
constexpr const openspace::properties::Property::PropertyInfo XAxisVectorInfo = {
constexpr openspace::properties::Property::PropertyInfo XAxisVectorInfo = {
"xAxisVector",
"xAxis: Direction vector",
"This value specifies a static direction vector that is used for a fixed "
"rotation."
};
constexpr const openspace::properties::Property::PropertyInfo YAxisVectorInfo = {
constexpr openspace::properties::Property::PropertyInfo YAxisVectorInfo = {
"yAxisVector",
"yAxis: Direction vector",
"This value specifies a static direction vector that is used for a fixed "
"rotation."
};
constexpr const openspace::properties::Property::PropertyInfo ZAxisVectorInfo = {
constexpr openspace::properties::Property::PropertyInfo ZAxisVectorInfo = {
"zAxisVector",
"zAxis: Direction vector",
"This value specifies a static direction vector that is used for a fixed "
"rotation."
};
constexpr const openspace::properties::Property::PropertyInfo
XAxisOrthogonalVectorInfo =
{
constexpr openspace::properties::Property::PropertyInfo XAxisOrthogonalVectorInfo = {
"xAxisOrthogonal",
"xAxis: Vector is orthogonal",
"This value determines whether the vector specified is used directly, or whether "
@@ -154,9 +149,7 @@ namespace {
"construct an orthogonal vector instead."
};
constexpr const openspace::properties::Property::PropertyInfo
YAxisOrthogonalVectorInfo =
{
constexpr openspace::properties::Property::PropertyInfo YAxisOrthogonalVectorInfo = {
"yAxisOrthogonal",
"yAxis: Vector is orthogonal",
"This value determines whether the vector specified is used directly, or whether "
@@ -164,9 +157,7 @@ namespace {
"construct an orthogonal vector instead."
};
constexpr const openspace::properties::Property::PropertyInfo
ZAxisOrthogonalVectorInfo =
{
constexpr openspace::properties::Property::PropertyInfo ZAxisOrthogonalVectorInfo = {
"zAxisOrthogonal",
"zAxis: Vector is orthogonal",
"This value determines whether the vector specified is used directly, or whether "
@@ -174,7 +165,7 @@ namespace {
"construct an orthogonal vector instead."
};
constexpr const openspace::properties::Property::PropertyInfo AttachedInfo = {
constexpr openspace::properties::Property::PropertyInfo AttachedInfo = {
"Attached",
"Attached Node",
"This is the name of the node that this rotation is attached to, this value is "
@@ -508,7 +499,7 @@ glm::dmat3 FixedRotation::matrix(const UpdateData&) const {
const glm::vec3 y = yAxis();
const glm::vec3 z = zAxis();
constexpr const float Epsilon = 1e-3f;
constexpr float Epsilon = 1e-3f;
if (glm::dot(x, y) > 1.f - Epsilon ||
glm::dot(y, z) > 1.f - Epsilon ||
+4 -4
View File
@@ -31,25 +31,25 @@
#include <optional>
namespace {
constexpr const openspace::properties::Property::PropertyInfo HasStartInfo = {
constexpr openspace::properties::Property::PropertyInfo HasStartInfo = {
"HasStart",
"Has Start",
"If enabled, this TimeFrame will be inactive before the Start"
};
constexpr const openspace::properties::Property::PropertyInfo StartInfo = {
constexpr openspace::properties::Property::PropertyInfo StartInfo = {
"Start",
"Start",
"Specifies the time when this TimeFrame becomes active"
};
constexpr const openspace::properties::Property::PropertyInfo HasEndInfo = {
constexpr openspace::properties::Property::PropertyInfo HasEndInfo = {
"HasEnd",
"Has End",
"If enabled, this TimeFrame will be inactive after the End"
};
constexpr const openspace::properties::Property::PropertyInfo EndInfo = {
constexpr openspace::properties::Property::PropertyInfo EndInfo = {
"End",
"End",
"Specifies the time when this TimeFrame becomes inactive"
+1 -1
View File
@@ -31,7 +31,7 @@
#include <openspace/util/time.h>
namespace {
constexpr const openspace::properties::Property::PropertyInfo TimeFramesInfo = {
constexpr openspace::properties::Property::PropertyInfo TimeFramesInfo = {
"TimeFrames",
"Time Frames",
"A vector of time frames to combine into one. "
+1 -1
View File
@@ -31,7 +31,7 @@
#include <ghoul/opengl/textureunit.h>
namespace {
constexpr const char* _loggerCat = "WebGUI:RenderHandler";
constexpr std::string_view _loggerCat = "WebGUI:RenderHandler";
} // namespace
namespace openspace {
+2 -2
View File
@@ -28,8 +28,8 @@ constexpr const char RenderedPathIdentifier[] = "CurrentCameraPath";
constexpr const char RenderedPointsIdentifier[] = "CurrentPathControlPoints";
constexpr const char DebuggingGuiPath[] = "/Debugging";
constexpr const glm::vec3 PathColor = { 1.0, 1.0, 0.0 };
constexpr const glm::vec3 OrientationLineColor = { 0.0, 1.0, 1.0 };
constexpr glm::vec3 PathColor = { 1.0, 1.0, 0.0 };
constexpr glm::vec3 OrientationLineColor = { 0.0, 1.0, 1.0 };
// Conver the input string to a format that is valid as an identifier
std::string makeIdentifier(std::string s) {
@@ -32,7 +32,7 @@
#include <ghoul/opengl/programobject.h>
namespace {
constexpr const char* _loggerCat = "DebugRenderer";
constexpr std::string_view _loggerCat = "DebugRenderer";
} // namespace
namespace openspace {
@@ -31,7 +31,6 @@
#include <openspace/engine/windowdelegate.h>
#include <openspace/util/updatestructures.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -55,11 +54,9 @@
#include <string>
namespace {
constexpr const char* _loggerCat = "RenderableBillboardsCloud";
constexpr const char* ProgramObjectName = "RenderableBillboardsCloud";
constexpr const char* RenderToPolygonProgram = "RenderableBillboardsCloud_Polygon";
constexpr std::string_view _loggerCat = "RenderableBillboardsCloud";
constexpr const std::array<const char*, 21> UniformNames = {
constexpr std::array<const char*, 21> UniformNames = {
"cameraViewProjectionMatrix", "modelMatrix", "cameraPosition", "cameraLookUp",
"renderOption", "minBillboardSize", "maxBillboardSize",
"correctionSizeEndDistance", "correctionSizeFactor", "color", "alphaValue",
@@ -594,10 +591,10 @@ void RenderableBillboardsCloud::initializeGL() {
ZoneScoped
_program = DigitalUniverseModule::ProgramObjectManager.request(
ProgramObjectName,
"RenderableBillboardsCloud",
[]() {
return global::renderEngine->buildRenderProgram(
ProgramObjectName,
"RenderableBillboardsCloud",
absPath("${MODULE_DIGITALUNIVERSE}/shaders/billboard_vs.glsl"),
absPath("${MODULE_DIGITALUNIVERSE}/shaders/billboard_fs.glsl"),
absPath("${MODULE_DIGITALUNIVERSE}/shaders/billboard_gs.glsl")
@@ -606,10 +603,10 @@ void RenderableBillboardsCloud::initializeGL() {
);
_renderToPolygonProgram = DigitalUniverseModule::ProgramObjectManager.request(
RenderToPolygonProgram,
"RenderableBillboardsCloud_Polygon",
[]() {
return ghoul::opengl::ProgramObject::Build(
RenderToPolygonProgram,
"RenderableBillboardsCloud_Polygon",
absPath("${MODULE_DIGITALUNIVERSE}/shaders/billboardpolygon_vs.glsl"),
absPath("${MODULE_DIGITALUNIVERSE}/shaders/billboardpolygon_fs.glsl"),
absPath("${MODULE_DIGITALUNIVERSE}/shaders/billboardpolygon_gs.glsl")
@@ -643,14 +640,16 @@ void RenderableBillboardsCloud::deinitializeGL() {
_vao = 0;
DigitalUniverseModule::ProgramObjectManager.release(
ProgramObjectName,
"RenderableBillboardsCloud",
[](ghoul::opengl::ProgramObject* p) {
global::renderEngine->removeRenderProgram(p);
}
);
_program = nullptr;
DigitalUniverseModule::ProgramObjectManager.release(RenderToPolygonProgram);
DigitalUniverseModule::ProgramObjectManager.release(
"RenderableBillboardsCloud_Polygon"
);
_renderToPolygonProgram = nullptr;
DigitalUniverseModule::TextureManager.release(_spriteTexture);
@@ -1200,7 +1199,7 @@ void RenderableBillboardsCloud::loadPolygonGeometryForRendering() {
glBindVertexArray(_polygonVao);
glBindBuffer(GL_ARRAY_BUFFER, _polygonVbo);
constexpr const std::array<GLfloat, 4> VertexData = {
constexpr std::array<GLfloat, 4> VertexData = {
// x y z w
0.f, 0.f, 0.f, 1.f,
};
@@ -1221,7 +1220,7 @@ void RenderableBillboardsCloud::renderPolygonGeometry(GLuint vao) {
);
program->activate();
constexpr const glm::vec4 Black = glm::vec4(0.f, 0.f, 0.f, 0.f);
constexpr glm::vec4 Black = glm::vec4(0.f, 0.f, 0.f, 0.f);
glClearBufferfv(GL_COLOR, 0, glm::value_ptr(Black));
program->setUniform("sides", _polygonSides);
@@ -49,15 +49,14 @@
#include <optional>
namespace {
constexpr const char* _loggerCat = "RenderableDUMeshes";
constexpr const char* ProgramObjectName = "RenderableDUMeshes";
constexpr std::string_view _loggerCat = "RenderableDUMeshes";
constexpr const std::array<const char*, 4> UniformNames = {
constexpr std::array<const char*, 4> UniformNames = {
"modelViewTransform", "projectionTransform", "alphaValue", "color"
};
constexpr const int RenderOptionViewDirection = 0;
constexpr const int RenderOptionPositionNormal = 1;
constexpr int RenderOptionViewDirection = 0;
constexpr int RenderOptionPositionNormal = 1;
constexpr openspace::properties::Property::PropertyInfo TextColorInfo = {
"TextColor",
@@ -258,7 +257,7 @@ bool RenderableDUMeshes::isReady() const {
void RenderableDUMeshes::initializeGL() {
_program = DigitalUniverseModule::ProgramObjectManager.request(
ProgramObjectName,
"RenderableDUMeshes",
[]() {
return global::renderEngine->buildRenderProgram(
"RenderableDUMeshes",
@@ -279,7 +278,7 @@ void RenderableDUMeshes::initializeGL() {
if (_hasLabel) {
if (!_font) {
constexpr const int FontSize = 50;
constexpr int FontSize = 50;
_font = global::fontManager->font(
"Mono",
static_cast<float>(FontSize),
@@ -299,7 +298,7 @@ void RenderableDUMeshes::deinitializeGL() {
}
DigitalUniverseModule::ProgramObjectManager.release(
ProgramObjectName,
"RenderableDUMeshes",
[](ghoul::opengl::ProgramObject* p) {
global::renderEngine->removeRenderProgram(p);
}
@@ -30,7 +30,6 @@
#include <openspace/engine/globals.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -48,10 +47,9 @@
#include <string>
namespace {
constexpr const char* _loggerCat = "RenderablePlanesCloud";
constexpr const char* ProgramObjectName = "RenderablePlanesCloud";
constexpr std::string_view _loggerCat = "RenderablePlanesCloud";
constexpr const int PlanesVertexDataSize = 36;
constexpr int PlanesVertexDataSize = 36;
constexpr std::array<const char*, 4> UniformNames = {
"modelViewProjectionTransform", "alphaValue", "fadeInValue", "galaxyTexture"
@@ -390,7 +388,7 @@ void RenderablePlanesCloud::initializeGL() {
ZoneScoped
_program = DigitalUniverseModule::ProgramObjectManager.request(
ProgramObjectName,
"RenderablePlanesCloud",
[]() -> std::unique_ptr<ghoul::opengl::ProgramObject> {
return global::renderEngine->buildRenderProgram(
"RenderablePlanesCloud",
@@ -407,7 +405,7 @@ void RenderablePlanesCloud::initializeGL() {
if (_hasLabel) {
if (!_font) {
constexpr const int FontSize = 30;
constexpr int FontSize = 30;
_font = global::fontManager->font(
"Mono",
static_cast<float>(FontSize),
@@ -431,7 +429,7 @@ void RenderablePlanesCloud::deinitializeGL() {
deleteDataGPUAndCPU();
DigitalUniverseModule::ProgramObjectManager.release(
ProgramObjectName,
"RenderablePlanesCloud",
[](ghoul::opengl::ProgramObject* p) {
global::renderEngine->removeRenderProgram(p);
}
@@ -30,7 +30,6 @@
#include <openspace/engine/globals.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/logging/logmanager.h>
@@ -48,9 +47,9 @@
#include <optional>
namespace {
constexpr const char* _loggerCat = "RenderablePoints";
constexpr std::string_view _loggerCat = "RenderablePoints";
constexpr const std::array<const char*, 7> UniformNames = {
constexpr std::array<const char*, 7> UniformNames = {
"modelViewProjectionTransform", "color", "sides", "alphaValue", "scaleFactor",
"spriteTexture", "hasColorMap"
};
+2 -2
View File
@@ -38,8 +38,8 @@
#include <sstream>
namespace {
constexpr const char* _loggerCat = "ExoplanetsModule";
}
constexpr std::string_view _loggerCat = "ExoplanetsModule";
} // namespace
namespace openspace::exoplanets {
+14 -24
View File
@@ -51,98 +51,88 @@
#include "exoplanetsmodule_lua.inl"
namespace {
constexpr const openspace::properties::Property::PropertyInfo EnabledInfo = {
constexpr openspace::properties::Property::PropertyInfo EnabledInfo = {
"Enabled",
"Enabled",
"Decides if the GUI for this module should be enabled."
};
constexpr const openspace::properties::Property::PropertyInfo DataFolderInfo = {
constexpr openspace::properties::Property::PropertyInfo DataFolderInfo = {
"DataFolder",
"Data Folder",
"The path to the folder containing the exoplanets data and lookup table"
};
constexpr const openspace::properties::Property::PropertyInfo BvColorMapInfo = {
constexpr openspace::properties::Property::PropertyInfo BvColorMapInfo = {
"BvColormap",
"B-V Colormap",
"The path to a cmap file that maps a B-V color index to an RGB color"
};
constexpr const openspace::properties::Property::PropertyInfo StarTextureInfo = {
constexpr openspace::properties::Property::PropertyInfo StarTextureInfo = {
"StarTexture",
"Star Texture",
"The path to a grayscale image that is used for the host star surfaces"
};
constexpr const openspace::properties::Property::PropertyInfo StarGlareTextureInfo = {
constexpr openspace::properties::Property::PropertyInfo StarGlareTextureInfo = {
"StarGlareTexture",
"Star Glare Texture",
"The path to a grayscale image that is used for the glare effect of the "
"host stars"
};
constexpr const openspace::properties::Property::PropertyInfo NoDataTextureInfo = {
constexpr openspace::properties::Property::PropertyInfo NoDataTextureInfo = {
"NoDataTexture",
"No Data Star Texture",
"A path to a texture that is used to represent that there is missing data about "
"the star. For example no color information"
};
constexpr const openspace::properties::Property::PropertyInfo OrbitDiscTextureInfo =
{
constexpr openspace::properties::Property::PropertyInfo OrbitDiscTextureInfo = {
"OrbitDiscTexture",
"Orbit Disc Texture",
"A path to a 1-dimensional image used as a transfer function for the "
"exoplanets' orbit uncertainty disc"
};
constexpr const openspace::properties::Property::PropertyInfo
HabitableZoneTextureInfo =
{
constexpr openspace::properties::Property::PropertyInfo HabitableZoneTextureInfo = {
"HabitableZoneTexture",
"Habitable Zone Texture",
"A path to a 1-dimensional image used as a transfer function for the "
"habitable zone disc"
};
constexpr const openspace::properties::Property::PropertyInfo
ShowComparisonCircleInfo =
{
constexpr openspace::properties::Property::PropertyInfo ShowComparisonCircleInfo = {
"ShowComparisonCircle",
"Show Comparison Circle",
"If true, the 1 AU size comparison circle is enabled per default when an "
"exoplanet system is created"
};
constexpr const openspace::properties::Property::PropertyInfo
ShowHabitableZoneInfo =
{
constexpr openspace::properties::Property::PropertyInfo ShowHabitableZoneInfo = {
"ShowHabitableZone",
"Show Habitable Zone",
"If true, the habitable zone disc is enabled per default when an "
"exoplanet system is created"
};
constexpr const openspace::properties::Property::PropertyInfo UseOptimisticZoneInfo =
{
constexpr openspace::properties::Property::PropertyInfo UseOptimisticZoneInfo = {
"UseOptimisticZone",
"Use Optimistic Zone Boundaries",
"If true, the habitable zone is computed with optimistic boundaries per default "
"when an exoplanet system is created"
};
constexpr const openspace::properties::Property::PropertyInfo
HabitableZoneOpacityInfo =
{
constexpr openspace::properties::Property::PropertyInfo HabitableZoneOpacityInfo = {
"HabitableZoneOpacity",
"Habitable Zone Opacity",
"The opacity value used for the habitable zone renderable for a created "
"exoplanet system"
};
constexpr const char ExoplanetsDataFileName[] = "exoplanets_data.bin";
constexpr const char LookupTableFileName[] = "lookup.txt";
constexpr std::string_view ExoplanetsDataFileName = "exoplanets_data.bin";
constexpr std::string_view LookupTableFileName = "lookup.txt";
struct [[codegen::Dictionary(ExoplanetsModule)]] Parameters {
// [[codegen::verbatim(EnabledInfo.description)]]
+6 -6
View File
@@ -24,9 +24,9 @@
namespace {
constexpr const char _loggerCat[] = "ExoplanetsModule";
constexpr std::string_view _loggerCat = "ExoplanetsModule";
constexpr const char ExoplanetsGuiPath[] = "/Milky Way/Exoplanets/Exoplanet Systems/";
constexpr std::string_view ExoplanetsGuiPath = "/Milky Way/Exoplanets/Exoplanet Systems/";
// Lua cannot handle backslashes, so replace these with forward slashes
std::string formatPathToLua(const std::string& path) {
@@ -124,7 +124,7 @@ void createExoplanetSystem(const std::string& starName) {
std::string sanitizedStarName = starName;
sanitizeNameString(sanitizedStarName);
const std::string guiPath = ExoplanetsGuiPath + sanitizedStarName;
const std::string guiPath = fmt::format("{}{}", ExoplanetsGuiPath, sanitizedStarName);
SceneGraphNode* existingStarNode = sceneGraphNode(starIdentifier);
if (existingStarNode) {
@@ -445,7 +445,7 @@ void createExoplanetSystem(const std::string& starName) {
bool hasLuminosity = !std::isnan(system.starData.luminosity);
if (hasTeff && hasLuminosity) {
constexpr const char* description =
constexpr std::string_view description =
"The habitable zone is the region around a star in which an Earth-like "
"planet can potentially have liquid water on its surface."
"<br><br>"
@@ -486,7 +486,7 @@ void createExoplanetSystem(const std::string& starName) {
"GUI = {"
"Name = '" + starName + " Habitable Zone',"
"Path = '" + guiPath + "',"
"Description = '" + description + "'"
"Description = '" + std::string(description) + "'"
"}"
"}";
@@ -504,7 +504,7 @@ void createExoplanetSystem(const std::string& starName) {
// magnitude or star luminosity, but for now this looks good enough.
double size = 59.0 * radiusInMeter;
if (hasTeff) {
constexpr const float sunTeff = 5780.f;
constexpr float sunTeff = 5780.f;
size *= std::pow(system.starData.teff / sunTeff, 2.0);
}
@@ -40,32 +40,32 @@
#include <optional>
namespace {
constexpr const std::array<const char*, 6> UniformNames = {
constexpr std::array<const char*, 6> UniformNames = {
"modelViewProjectionTransform", "offset", "opacity",
"discTexture", "eccentricity", "semiMajorAxis"
};
static const openspace::properties::Property::PropertyInfo TextureInfo = {
constexpr openspace::properties::Property::PropertyInfo TextureInfo = {
"Texture",
"Texture",
"This value is the path to a texture on disk that contains a one-dimensional "
"texture which is used for the color."
};
static const openspace::properties::Property::PropertyInfo SizeInfo = {
constexpr openspace::properties::Property::PropertyInfo SizeInfo = {
"Size",
"Size",
"This value specifies the semi-major axis of the orbit, in meter."
};
static const openspace::properties::Property::PropertyInfo EccentricityInfo = {
constexpr openspace::properties::Property::PropertyInfo EccentricityInfo = {
"Eccentricity",
"Eccentricity",
"This value determines the eccentricity, that is the deviation from a perfect "
"sphere, for this orbit."
};
static const openspace::properties::Property::PropertyInfo OffsetInfo = {
constexpr openspace::properties::Property::PropertyInfo OffsetInfo = {
"Offset",
"Offset",
"This property determines the width of the disc. The values specify the lower "
@@ -38,7 +38,7 @@
#include <fstream>
namespace {
constexpr const char* _loggerCat = "ExoplanetsDataPreparationTask";
constexpr std::string_view _loggerCat = "ExoplanetsDataPreparationTask";
struct [[codegen::Dictionary(ExoplanetsDataPreparationTask)]] Parameters {
// The csv file to extract data from
@@ -37,48 +37,46 @@
#include <fstream>
namespace {
constexpr const char* _loggerCat = "RenderableFieldlines";
constexpr std::string_view _loggerCat = "RenderableFieldlines";
constexpr const float DefaultFieldlineStepSize = 0.5f;
constexpr float DefaultFieldlineStepSize = 0.5f;
const glm::vec4 DefaultFieldlineColor = glm::vec4(1.f, 0.f, 0.f, 1.f);
constexpr const char* KeyVectorField = "VectorField";
constexpr const char* KeyVectorFieldType = "Type";
constexpr const char* KeyVectorFieldFile = "File";
constexpr const char* KeyVectorFieldVolumeModel = "Model";
constexpr const char* KeyVectorFieldVolumeVariable = "Variables";
constexpr std::string_view KeyVectorField = "VectorField";
constexpr std::string_view KeyVectorFieldType = "Type";
constexpr std::string_view KeyVectorFieldFile = "File";
constexpr std::string_view KeyVectorFieldVolumeModel = "Model";
constexpr std::string_view KeyVectorFieldVolumeVariable = "Variables";
constexpr const char* KeyFieldlines = "Fieldlines";
constexpr const char* KeyFieldlinesStepSize = "Stepsize";
constexpr const char* KeyFieldlinesClassification = "Classification";
constexpr const char* KeyFieldlinesColor = "Color";
constexpr std::string_view KeyFieldlines = "Fieldlines";
constexpr std::string_view KeyFieldlinesColor = "Color";
constexpr const char* KeySeedPoints = "SeedPoints";
constexpr const char* KeySeedPointsType = "Type";
constexpr const char* KeySeedPointsFile = "File";
constexpr const char* KeySeedPointsTable = "SeedPoints";
constexpr std::string_view KeySeedPoints = "SeedPoints";
constexpr std::string_view KeySeedPointsType = "Type";
constexpr std::string_view KeySeedPointsFile = "File";
constexpr std::string_view KeySeedPointsTable = "SeedPoints";
constexpr const char* SeedPointsSourceFile = "File";
constexpr const char* SeedPointsSourceTable = "Table";
constexpr std::string_view SeedPointsSourceFile = "File";
constexpr std::string_view SeedPointsSourceTable = "Table";
constexpr const char* VectorFieldTypeVolumeKameleon = "VolumeKameleon";
constexpr std::string_view VectorFieldTypeVolumeKameleon = "VolumeKameleon";
constexpr const char* VectorFieldKameleonModelBATSRUS = "BATSRUS";
constexpr std::string_view VectorFieldKameleonModelBATSRUS = "BATSRUS";
constexpr const char* VectorFieldKameleonVariableLorentz = "Lorentz";
constexpr std::string_view VectorFieldKameleonVariableLorentz = "Lorentz";
constexpr const int SeedPointSourceFile = 0;
constexpr const int SeedPointSourceTable = 1;
constexpr int SeedPointSourceFile = 0;
constexpr int SeedPointSourceTable = 1;
constexpr openspace::properties::Property::PropertyInfo StepSizeInfo = {
KeyFieldlinesStepSize,
"Stepsize",
//"StepSize",
"Fieldline Step Size",
"" // @TODO Missing documentation
};
constexpr openspace::properties::Property::PropertyInfo Classification = {
KeyFieldlinesClassification,
"Classification",
"Fieldline Classification",
"" // @TODO Missing documentation
};
@@ -170,13 +168,13 @@ RenderableFieldlines::RenderableFieldlines(const ghoul::Dictionary& dictionary)
}
void RenderableFieldlines::initializeDefaultPropertyValues() {
if (_fieldlineInfo.hasKey(KeyFieldlinesStepSize)) {
if (_fieldlineInfo.hasKey("Stepsize")) {
_stepSize = static_cast<float>(
_fieldlineInfo.value<double>(KeyFieldlinesStepSize)
_fieldlineInfo.value<double>("Stepsize")
);
}
if (_fieldlineInfo.hasKey(KeyFieldlinesClassification)) {
_classification = _fieldlineInfo.value<bool>(KeyFieldlinesClassification);
if (_fieldlineInfo.hasKey("Classification")) {
_classification = _fieldlineInfo.value<bool>("Classification");
}
if (_fieldlineInfo.hasKey(KeyFieldlinesColor)) {
_fieldlineColor = _fieldlineInfo.value<glm::dvec4>(KeyFieldlinesColor);
@@ -33,7 +33,7 @@
#include <fstream>
namespace {
constexpr const char* DefaultTransferfunctionSource =
constexpr std::string_view DefaultTransferfunctionSource =
R"(
width 5
lower 0.0
@@ -46,7 +46,7 @@
#include <thread>
namespace {
constexpr const char* _loggerCat = "RenderableFieldlinesSequence";
constexpr std::string_view _loggerCat = "RenderableFieldlinesSequence";
constexpr openspace::properties::Property::PropertyInfo ColorMethodInfo = {
"ColorMethod",
@@ -764,9 +764,9 @@ void RenderableFieldlinesSequence::setModelDependentConstants() {
// Requires files to be named as such: 'YYYY-MM-DDTHH-MM-SS-XXX.osfls'
void RenderableFieldlinesSequence::extractTriggerTimesFromFileNames() {
// number of characters in filename (excluding '.osfls')
constexpr const int FilenameSize = 23;
constexpr int FilenameSize = 23;
// size(".osfls")
constexpr const int ExtSize = 6;
constexpr int ExtSize = 6;
for (const std::string& filePath : _sourceFiles) {
const size_t strLength = filePath.size();
+3 -3
View File
@@ -38,9 +38,9 @@ enum class Model : int {
Model stringToModel(const std::string& s);
constexpr const float AuToMeter = 149597870700.f; // Astronomical Units
constexpr const float ReToMeter = 6371000.f; // Earth radius
constexpr const float RsToMeter = 695700000.f; // Sun radius
constexpr float AuToMeter = 149597870700.f; // Astronomical Units
constexpr float ReToMeter = 6371000.f; // Earth radius
constexpr float RsToMeter = 695700000.f; // Sun radius
} // namespace openspace::fls
@@ -32,8 +32,8 @@
#include <iomanip>
namespace {
constexpr const char* _loggerCat = "FieldlinesState";
constexpr const int CurrentVersion = 0;
constexpr std::string_view _loggerCat = "FieldlinesState";
constexpr int CurrentVersion = 0;
using json = nlohmann::json;
} // namespace
@@ -50,12 +50,12 @@
#endif // OPENSPACE_MODULE_KAMELEON_ENABLED
namespace {
constexpr const char* _loggerCat = "FieldlinesSequence[ Kameleon ]";
constexpr std::string_view _loggerCat = "FieldlinesSequence[ Kameleon ]";
constexpr const char* TAsPOverRho = "T = p/rho";
constexpr const char* JParallelB = "Current: mag(J||B)";
constexpr std::string_view TAsPOverRho = "T = p/rho";
constexpr std::string_view JParallelB = "Current: mag(J||B)";
// [nPa]/[amu/cm^3] * ToKelvin => Temperature in Kelvin
constexpr const float ToKelvin = 72429735.6984f;
constexpr float ToKelvin = 72429735.6984f;
} // namespace
namespace openspace::fls {
@@ -318,8 +318,8 @@ void prepareStateAndKameleonForExtras(ccmc::Kameleon* kameleon,
"BATSRUS doesn't contain variable T for temperature. Trying to calculate "
"it using the ideal gas law: T = pressure/density"
);
constexpr const char* p = "p";
constexpr const char* r = "rho";
constexpr const char p[] = "p";
constexpr const char r[] = "rho";
success = kameleon->doesVariableExist(p) && kameleon->loadVariable(p) &&
kameleon->doesVariableExist(r) && kameleon->loadVariable(r);
str = TAsPOverRho;
@@ -47,7 +47,7 @@
using namespace CCfits;
namespace {
constexpr const char* _loggerCat = "FitsFileReader";
constexpr std::string_view _loggerCat = "FitsFileReader";
} // namespace
namespace openspace {
+1 -1
View File
@@ -33,7 +33,7 @@
#include <thread>
namespace {
constexpr const char* _loggerCat = "OctreeManager";
constexpr std::string_view _loggerCat = "OctreeManager";
} // namespace
namespace openspace {
@@ -48,7 +48,7 @@
#include <cstdint>
namespace {
constexpr const char* _loggerCat = "RenderableGaiaStars";
constexpr std::string_view _loggerCat = "RenderableGaiaStars";
constexpr size_t PositionSize = 3;
constexpr size_t ColorSize = 2;
+1 -1
View File
@@ -35,7 +35,7 @@
#include <thread>
namespace {
constexpr const char* _loggerCat = "ConstructOctreeTask";
constexpr std::string_view _loggerCat = "ConstructOctreeTask";
struct [[codegen::Dictionary(ConstructOctreeTask)]] Parameters {
// If SingleFileInput is set to true then this specifies the path to a single BIN
+2 -2
View File
@@ -30,8 +30,8 @@
#include <ghoul/fmt.h>
namespace {
constexpr const char* _loggerCat = "ReadFileJob";
}
constexpr std::string_view _loggerCat = "ReadFileJob";
} // namespace
namespace openspace::gaia {
+2 -2
View File
@@ -38,9 +38,9 @@
#include <optional>
namespace {
constexpr const char* KeyFilterColumnNames = "FilterColumnNames";
constexpr std::string_view KeyFilterColumnNames = "FilterColumnNames";
constexpr const char* _loggerCat = "ReadFitsTask";
constexpr std::string_view _loggerCat = "ReadFitsTask";
struct [[codegen::Dictionary(ReadFitsTask)]] Parameters {
// If SingleFileProcess is set to true then this specifies the path to a single
+1 -1
View File
@@ -34,7 +34,7 @@
#include <fstream>
namespace {
constexpr const char* _loggerCat = "ReadSpeckTask";
constexpr std::string_view _loggerCat = "ReadSpeckTask";
struct [[codegen::Dictionary(ReadSpeckTask)]] Parameters {
// The path to the SPECK file that are to be read
+6 -6
View File
@@ -33,11 +33,11 @@
#include <ghoul/opengl/texture.h>
namespace {
constexpr const char* GlslRaycastPath =
constexpr std::string_view GlslRaycastPath =
"${MODULES}/galaxy/shaders/galaxyraycast.glsl";
constexpr const char* GlslBoundsVsPath =
constexpr std::string_view GlslBoundsVsPath =
"${MODULES}/galaxy/shaders/raycasterbounds_vs.glsl";
constexpr const char* GlslBoundsFsPath =
constexpr std::string_view GlslBoundsFsPath =
"${MODULES}/galaxy/shaders/raycasterbounds_fs.glsl";
} // namespace
@@ -141,15 +141,15 @@ bool GalaxyRaycaster::isCameraInside(const RenderData& data, glm::vec3& localPos
}
std::string GalaxyRaycaster::boundsVertexShaderPath() const {
return GlslBoundsVsPath;
return std::string(GlslBoundsVsPath);
}
std::string GalaxyRaycaster::boundsFragmentShaderPath() const {
return GlslBoundsFsPath;
return std::string(GlslBoundsFsPath);
}
std::string GalaxyRaycaster::raycasterPath() const {
return GlslRaycastPath;
return std::string(GlslRaycastPath);
}
std::string GalaxyRaycaster::helperPath() const {
@@ -56,19 +56,19 @@
namespace {
constexpr int8_t CurrentCacheVersion = 1;
constexpr const char* _loggerCat = "RenderableGalaxy";
constexpr std::string_view _loggerCat = "RenderableGalaxy";
enum StarRenderingMethod {
Points,
Billboards
};
constexpr const std::array<const char*, 4> UniformNamesPoints = {
constexpr std::array<const char*, 4> UniformNamesPoints = {
"modelMatrix", "viewProjectionMatrix", "eyePosition",
"opacityCoefficient"
};
constexpr const std::array<const char*, 5> UniformNamesBillboards = {
constexpr std::array<const char*, 5> UniformNamesBillboards = {
"modelMatrix", "viewProjectionMatrix",
"cameraUp", "eyePosition", "psfTexture"
};
@@ -35,12 +35,12 @@
#include <ghoul/misc/dictionary.h>
namespace {
constexpr const char* KeyInFilenamePrefix = "InFilenamePrefix";
constexpr const char* KeyInFilenameSuffix = "InFilenameSuffix";
constexpr const char* KeyInFirstIndex = "InFirstIndex";
constexpr const char* KeyInNSlices = "InNSlices";
constexpr const char* KeyOutFilename = "OutFilename";
constexpr const char* KeyOutDimensions = "OutDimensions";
constexpr std::string_view KeyInFilenamePrefix = "InFilenamePrefix";
constexpr std::string_view KeyInFilenameSuffix = "InFilenameSuffix";
constexpr std::string_view KeyInFirstIndex = "InFirstIndex";
constexpr std::string_view KeyInNSlices = "InNSlices";
constexpr std::string_view KeyOutFilename = "OutFilename";
constexpr std::string_view KeyOutDimensions = "OutDimensions";
} // namespace
namespace openspace {
+44 -37
View File
@@ -89,17 +89,16 @@
#include "globebrowsingmodule_lua.inl"
namespace {
constexpr const char _loggerCat[] = "GlobeBrowsingModule";
constexpr const char _factoryName[] = "TileProvider";
constexpr std::string_view _loggerCat = "GlobeBrowsingModule";
constexpr const openspace::properties::Property::PropertyInfo WMSCacheEnabledInfo = {
constexpr openspace::properties::Property::PropertyInfo WMSCacheEnabledInfo = {
"WMSCacheEnabled",
"WMS Cache Enabled",
"Determines whether automatic caching of WMS servers is enabled. Changing the "
"value of this property will not affect already created WMS datasets."
};
constexpr const openspace::properties::Property::PropertyInfo OfflineModeInfo = {
constexpr openspace::properties::Property::PropertyInfo OfflineModeInfo = {
"OfflineMode",
"Offline Mode",
"Determines whether loaded WMS servers should be used in offline mode, that is "
@@ -109,21 +108,21 @@ namespace {
"already created WMS datasets."
};
constexpr const openspace::properties::Property::PropertyInfo WMSCacheLocationInfo = {
constexpr openspace::properties::Property::PropertyInfo WMSCacheLocationInfo = {
"WMSCacheLocation",
"WMS Cache Location",
"The location of the cache folder for WMS servers. Changing the value of this "
"property will not affect already created WMS datasets."
};
constexpr const openspace::properties::Property::PropertyInfo WMSCacheSizeInfo = {
constexpr openspace::properties::Property::PropertyInfo WMSCacheSizeInfo = {
"WMSCacheSize",
"WMS Cache Size",
"The maximum size of the cache for each WMS server. Changing the value of this "
"property will not affect already created WMS datasets."
};
constexpr const openspace::properties::Property::PropertyInfo TileCacheSizeInfo = {
constexpr openspace::properties::Property::PropertyInfo TileCacheSizeInfo = {
"TileCacheSize",
"Tile Cache Size",
"The maximum size of the MemoryAwareTileCache, on the CPU and GPU."
@@ -301,7 +300,7 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
ghoul_assert(fRotation, "Rotation factory was not created");
fRotation->registerClass<globebrowsing::GlobeRotation>("GlobeRotation");
FactoryManager::ref().addFactory<TileProvider>(_factoryName);
FactoryManager::ref().addFactory<TileProvider>("TileProvider");
ghoul::TemplateFactory<TileProvider>* fTileProvider =
FactoryManager::ref().factory<TileProvider>();
@@ -309,33 +308,32 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
{
using namespace layergroupid;
fTileProvider->registerClass<DefaultTileProvider>(
fTileProvider->registerClass<DefaultTileProvider>(std::string(
LAYER_TYPE_NAMES[static_cast<int>(TypeID::DefaultTileLayer)]
);
fTileProvider->registerClass<SingleImageProvider>(
LAYER_TYPE_NAMES[static_cast<int>(TypeID::SingleImageTileLayer)]
);
fTileProvider->registerClass<ImageSequenceTileProvider>(
));
fTileProvider->registerClass<SingleImageProvider>(std::string(LAYER_TYPE_NAMES[static_cast<int>(TypeID::SingleImageTileLayer)]
));
fTileProvider->registerClass<ImageSequenceTileProvider>(std::string(
LAYER_TYPE_NAMES[static_cast<int>(TypeID::ImageSequenceTileLayer)]
);
fTileProvider->registerClass<SpoutImageProvider>(
));
fTileProvider->registerClass<SpoutImageProvider>(std::string(
LAYER_TYPE_NAMES[static_cast<int>(TypeID::SpoutImageTileLayer)]
);
fTileProvider->registerClass<TemporalTileProvider>(
));
fTileProvider->registerClass<TemporalTileProvider>(std::string(
LAYER_TYPE_NAMES[static_cast<int>(TypeID::TemporalTileLayer)]
);
fTileProvider->registerClass<TileIndexTileProvider>(
));
fTileProvider->registerClass<TileIndexTileProvider>(std::string(
LAYER_TYPE_NAMES[static_cast<int>(TypeID::TileIndexTileLayer)]
);
fTileProvider->registerClass<SizeReferenceTileProvider>(
));
fTileProvider->registerClass<SizeReferenceTileProvider>(std::string(
LAYER_TYPE_NAMES[static_cast<int>(TypeID::SizeReferenceTileLayer)]
);
fTileProvider->registerClass<TileProviderByLevel>(
));
fTileProvider->registerClass<TileProviderByLevel>(std::string(
LAYER_TYPE_NAMES[static_cast<int>(TypeID::ByLevelTileLayer)]
);
fTileProvider->registerClass<TileProviderByIndex>(
));
fTileProvider->registerClass<TileProviderByIndex>(std::string(
LAYER_TYPE_NAMES[static_cast<int>(TypeID::ByIndexTileLayer)]
);
));
}
ghoul::TemplateFactory<DashboardItem>* fDashboard =
@@ -601,27 +599,36 @@ GlobeBrowsingModule::castFocusNodeRenderableToGlobe()
std::string GlobeBrowsingModule::layerGroupNamesList() {
std::string listLayerGroups;
for (int i = 0; i < globebrowsing::layergroupid::NUM_LAYER_GROUPS - 1; ++i) {
listLayerGroups += globebrowsing::layergroupid::LAYER_GROUP_IDENTIFIERS[i] +
std::string(", ");
listLayerGroups += fmt::format(
"{}, ", globebrowsing::layergroupid::LAYER_GROUP_IDENTIFIERS[i]
);
}
listLayerGroups += std::string(" and ") +
return fmt::format(
"{} and {}",
listLayerGroups,
globebrowsing::layergroupid::LAYER_GROUP_IDENTIFIERS[
globebrowsing::layergroupid::NUM_LAYER_GROUPS - 1
];
return listLayerGroups;
]
);
}
std::string GlobeBrowsingModule::layerTypeNamesList() {
std::string listLayerTypes;
for (int i = 0; i < globebrowsing::layergroupid::NUM_LAYER_TYPES - 1; ++i) {
listLayerTypes += std::string(globebrowsing::layergroupid::LAYER_TYPE_NAMES[i]) +
", ";
listLayerTypes += fmt::format(
"{}, ",
globebrowsing::layergroupid::LAYER_TYPE_NAMES[i]
);
}
listLayerTypes += std::string(" and ") +
return fmt::format(
"{} and {}",
listLayerTypes,
globebrowsing::layergroupid::LAYER_TYPE_NAMES[
globebrowsing::layergroupid::NUM_LAYER_TYPES - 1
];
return listLayerTypes;
]
);
}
void GlobeBrowsingModule::loadWMSCapabilities(std::string name, std::string globe,
@@ -313,7 +313,7 @@ namespace {
const glm::dvec3 currentPosModelCoords =
glm::inverse(gl->modelTransform()) * glm::dvec4(currentPosW, 1.0);
constexpr const double LengthEpsilon = 10.0; // meters
constexpr double LengthEpsilon = 10.0; // meters
if (glm::distance(currentPosModelCoords, positionModelCoords) < LengthEpsilon) {
LINFOC("GlobeBrowsing", "flyToGeo: Already at the requested position");
return;
@@ -326,7 +326,7 @@ namespace {
instruction.setValue("PathType", std::string("ZoomOutOverview"));
if (duration.has_value()) {
constexpr const double Epsilon = 1e-5;
constexpr double Epsilon = 1e-5;
if (*duration <= Epsilon) {
throw ghoul::lua::LuaError("Duration must be larger than zero");
}
@@ -36,7 +36,7 @@
namespace openspace::globebrowsing {
namespace {
constexpr const char* _loggerCat = "AsyncTileDataProvider";
constexpr std::string_view _loggerCat = "AsyncTileDataProvider";
} // namespace
AsyncTileDataProvider::AsyncTileDataProvider(std::string name,
@@ -42,9 +42,6 @@
#include <ghoul/misc/profiling.h>
namespace {
constexpr const char* KeyFontMono = "Mono";
constexpr const float DefaultFontSize = 10.f;
constexpr openspace::properties::Property::PropertyInfo FontNameInfo = {
"FontName",
"Font Name",
@@ -100,11 +97,11 @@ documentation::Documentation DashboardItemGlobeLocation::Documentation() {
DashboardItemGlobeLocation::DashboardItemGlobeLocation(
const ghoul::Dictionary& dictionary)
: DashboardItem(dictionary)
, _fontName(FontNameInfo, KeyFontMono)
, _fontSize(FontSizeInfo, DefaultFontSize, 10.f, 144.f, 1.f)
, _fontName(FontNameInfo, "Mono")
, _fontSize(FontSizeInfo, 10.f, 10.f, 144.f, 1.f)
, _displayFormat(DisplayFormatInfo)
, _significantDigits(SignificantDigitsInfo, 4, 1, 12)
, _font(global::fontManager->font(KeyFontMono, 10))
, _font(global::fontManager->font("Mono", 10))
{
const Parameters p = codegen::bake<Parameters>(dictionary);
@@ -181,7 +178,7 @@ void DashboardItemGlobeLocation::render(glm::vec2& penPosition) {
double lon = position.y;
double altitude = position.z;
std::pair<double, std::string> dist = simplifyDistance(altitude);
std::pair<double, std::string_view> dist = simplifyDistance(altitude);
std::fill(_buffer.begin(), _buffer.end(), char(0));
char* end = nullptr;
+1 -1
View File
@@ -30,7 +30,7 @@
#include <vector>
namespace {
constexpr const size_t MaxIterations = 8;
constexpr size_t MaxIterations = 8;
} // namespace
namespace openspace::globebrowsing {
+1 -1
View File
@@ -35,7 +35,7 @@
#include <gdal.h>
namespace {
constexpr const char* _loggerCat = "GdalWrapper";
constexpr std::string_view _loggerCat = "GdalWrapper";
constexpr openspace::properties::Property::PropertyInfo LogGdalErrorInfo = {
"LogGdalErrors",
@@ -48,10 +48,10 @@
#include <optional>
namespace {
constexpr const char* _loggerCat = "GlobeLabels";
constexpr std::string_view _loggerCat = "GlobeLabels";
constexpr const double LabelFadeOutLimitAltitudeMeters = 25000.0;
constexpr const float MinOpacityValueConst = 0.009f;
constexpr double LabelFadeOutLimitAltitudeMeters = 25000.0;
constexpr float MinOpacityValueConst = 0.009f;
enum LabelRenderingAlignmentType {
Horizontally = 0,
@@ -677,8 +677,7 @@ bool GlobeLabelsComponent::isLabelInFrustum(const glm::dmat4& MVMatrix,
farNormal *= invMagFar;
// farDistance *= invMagFar;
constexpr const float Radius = 1.0;
constexpr float Radius = 1.0;
if ((glm::dot(leftNormal, position) + leftDistance) < -Radius) {
return false;
}
+1 -1
View File
@@ -223,7 +223,7 @@ glm::dmat3 GlobeRotation::matrix(const UpdateData&) const {
}
yAxis = glm::normalize(yAxis);
constexpr const glm::dvec3 n = glm::dvec3(0.0, 0.0, 1.0);
constexpr glm::dvec3 n = glm::dvec3(0.0, 0.0, 1.0);
glm::dvec3 zAxis = glm::dvec3(
zAxis.x = yAxis.y * n.z - yAxis.z * n.y,
zAxis.y = yAxis.z * n.x - yAxis.x * n.z,
+2 -2
View File
@@ -116,7 +116,7 @@ void GPULayerGroup::setValue(ghoul::opengl::ProgramObject& program,
}
void GPULayerGroup::bind(ghoul::opengl::ProgramObject& p,
const LayerGroup& layerGroup, const std::string& nameBase,
const LayerGroup& layerGroup, std::string_view nameBase,
int category)
{
const std::vector<Layer*>& activeLayers = layerGroup.activeLayers();
@@ -126,7 +126,7 @@ void GPULayerGroup::bind(ghoul::opengl::ProgramObject& p,
GPULayer& gal = _gpuActiveLayers[i];
auto& galuc = gal.uniformCache;
const Layer& al = *activeLayers[i];
std::string name = nameBase + "[" + std::to_string(i) + "].";
std::string name = fmt::format("{}[{}].", nameBase, i);
if (category == layergroupid::GroupID::HeightLayers) {
gal.isHeightLayer = true;
+1 -1
View File
@@ -63,7 +63,7 @@ public:
* After this method has been called, users may invoke setValue.
*/
void bind(ghoul::opengl::ProgramObject& programObject,
const LayerGroup& layerGroup, const std::string& nameBase, int category);
const LayerGroup& layerGroup, std::string_view nameBase, int category);
/**
* Deactivates any <code>TextureUnit</code>s assigned by this object.
+12 -9
View File
@@ -36,13 +36,13 @@
namespace openspace::globebrowsing {
namespace {
constexpr const char* _loggerCat = "Layer";
constexpr std::string_view _loggerCat = "Layer";
constexpr const char* KeyIdentifier = "Identifier";
constexpr const char* KeyName = "Name";
constexpr const char* KeyDesc = "Description";
constexpr const char* KeyLayerGroupID = "LayerGroupID";
constexpr const char* KeyAdjustment = "Adjustment";
constexpr std::string_view KeyIdentifier = "Identifier";
constexpr std::string_view KeyName = "Name";
constexpr std::string_view KeyDesc = "Description";
constexpr std::string_view KeyLayerGroupID = "LayerGroupID";
constexpr std::string_view KeyAdjustment = "Adjustment";
constexpr openspace::properties::Property::PropertyInfo TypeInfo = {
"Type",
@@ -244,13 +244,13 @@ Layer::Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict,
// Add options to option properties
for (int i = 0; i < layergroupid::NUM_LAYER_TYPES; ++i) {
_typeOption.addOption(i, layergroupid::LAYER_TYPE_NAMES[i]);
_typeOption.addOption(i, std::string(layergroupid::LAYER_TYPE_NAMES[i]));
}
_typeOption.setValue(static_cast<int>(typeID));
_type = static_cast<layergroupid::TypeID>(_typeOption.value());
for (int i = 0; i < layergroupid::NUM_BLEND_MODES; ++i) {
_blendModeOption.addOption(i, layergroupid::BLEND_MODE_NAMES[i]);
_blendModeOption.addOption(i, std::string(layergroupid::BLEND_MODE_NAMES[i]));
}
// Initialize blend mode
@@ -480,7 +480,10 @@ void Layer::initializeBasedOnType(layergroupid::TypeID id, ghoul::Dictionary ini
case layergroupid::TypeID::ByLevelTileLayer: {
// We add the id to the dictionary since it needs to be known by
// the tile provider
initDict.setValue(KeyLayerGroupID, static_cast<int>(_layerGroupId));
initDict.setValue(
std::string(KeyLayerGroupID),
static_cast<int>(_layerGroupId)
);
if (initDict.hasKey(KeyName) && initDict.hasValue<std::string>(KeyName)) {
std::string name = initDict.value<std::string>(KeyName);
LDEBUG("Initializing tile provider for layer: '" + name + "'");
@@ -81,7 +81,7 @@ LayerAdjustment::LayerAdjustment()
{
// Add options to option properties
for (int i = 0; i < layergroupid::NUM_ADJUSTMENT_TYPES; ++i) {
_typeOption.addOption(i, layergroupid::ADJUSTMENT_TYPE_NAMES[i]);
_typeOption.addOption(i, std::string(layergroupid::ADJUSTMENT_TYPE_NAMES[i]));
}
_typeOption.setValue(static_cast<int>(layergroupid::AdjustmentTypeID::None));
_type = static_cast<layergroupid::AdjustmentTypeID>(_typeOption.value());
+3 -3
View File
@@ -33,7 +33,7 @@
#include <ghoul/misc/profiling.h>
namespace {
constexpr const char* _loggerCat = "LayerGroup";
constexpr std::string_view _loggerCat = "LayerGroup";
constexpr openspace::properties::Property::PropertyInfo BlendTileInfo = {
"BlendTileLevels",
@@ -49,8 +49,8 @@ namespace openspace::globebrowsing {
LayerGroup::LayerGroup(layergroupid::GroupID id)
: properties::PropertyOwner({
layergroupid::LAYER_GROUP_IDENTIFIERS[id],
layergroupid::LAYER_GROUP_NAMES[id]
std::string(layergroupid::LAYER_GROUP_IDENTIFIERS[id]),
std::string(layergroupid::LAYER_GROUP_NAMES[id])
})
, _groupId(id)
, _levelBlendingEnabled(BlendTileInfo, true)
+7 -7
View File
@@ -30,8 +30,8 @@
namespace openspace::globebrowsing::layergroupid {
static constexpr const int NUM_LAYER_GROUPS = 5;
static constexpr const char* LAYER_GROUP_IDENTIFIERS[NUM_LAYER_GROUPS] = {
static constexpr int NUM_LAYER_GROUPS = 5;
static constexpr std::string_view LAYER_GROUP_IDENTIFIERS[NUM_LAYER_GROUPS] = {
"HeightLayers",
"ColorLayers",
"Overlays",
@@ -39,7 +39,7 @@ static constexpr const char* LAYER_GROUP_IDENTIFIERS[NUM_LAYER_GROUPS] = {
"WaterMasks"
};
static constexpr const char* LAYER_GROUP_NAMES[NUM_LAYER_GROUPS] = {
static constexpr std::string_view LAYER_GROUP_NAMES[NUM_LAYER_GROUPS] = {
"Height Layers",
"Color Layers",
"Overlays",
@@ -56,8 +56,8 @@ enum GroupID {
Unknown
};
static constexpr const int NUM_LAYER_TYPES = 10;
static constexpr const char* LAYER_TYPE_NAMES[NUM_LAYER_TYPES] = {
static constexpr int NUM_LAYER_TYPES = 10;
static constexpr std::string_view LAYER_TYPE_NAMES[NUM_LAYER_TYPES] = {
"DefaultTileLayer",
"SingleImageTileLayer",
"ImageSequenceTileLayer",
@@ -88,7 +88,7 @@ enum class TypeID {
};
static constexpr int NUM_ADJUSTMENT_TYPES = 3;
static constexpr const char* ADJUSTMENT_TYPE_NAMES[NUM_ADJUSTMENT_TYPES] = {
static constexpr std::string_view ADJUSTMENT_TYPE_NAMES[NUM_ADJUSTMENT_TYPES] = {
"None",
"ChromaKey",
"TransferFunction",
@@ -104,7 +104,7 @@ enum class AdjustmentTypeID {
};
static constexpr int NUM_BLEND_MODES = 5;
static constexpr const char* BLEND_MODE_NAMES[NUM_BLEND_MODES] = {
static constexpr std::string_view BLEND_MODE_NAMES[NUM_BLEND_MODES] = {
"Normal",
"Multiply",
"Add",
@@ -32,7 +32,7 @@
#include <numeric>
namespace {
constexpr const char* _loggerCat = "MemoryAwareTileCache";
constexpr std::string_view _loggerCat = "MemoryAwareTileCache";
constexpr openspace::properties::Property::PropertyInfo CpuAllocatedDataInfo = {
"CpuAllocatedTileData",
+18 -22
View File
@@ -65,9 +65,9 @@ namespace std {
namespace {
// Global flags to modify the RenderableGlobe
constexpr const bool LimitLevelByAvailableData = true;
constexpr const bool PerformFrustumCulling = true;
constexpr const bool PreformHorizonCulling = true;
constexpr bool LimitLevelByAvailableData = true;
constexpr bool PerformFrustumCulling = true;
constexpr bool PreformHorizonCulling = true;
// Shadow structure
struct ShadowRenderingStruct {
@@ -84,7 +84,7 @@ namespace {
glm::vec3(-1.f, -1.f, 0.f),
glm::vec3( 1.f, 1.f, 1e35f)
};
constexpr const float DefaultHeight = 0.f;
constexpr float DefaultHeight = 0.f;
// I tried reducing this to 16, but it left the rendering with artifacts when the
// atmosphere was enabled. The best guess to the circular artifacts are due to the
@@ -93,8 +93,8 @@ namespace {
// raycaster. We tried a simple solution that uses two grids and switches between
// them at a cutoff level, and I think this might still be the best solution for the
// time being. --abock 2018-10-30
constexpr const int DefaultSkirtedGridSegments = 64;
constexpr const int UnknownDesiredLevel = -1;
constexpr int DefaultSkirtedGridSegments = 64;
constexpr int UnknownDesiredLevel = -1;
const openspace::globebrowsing::GeodeticPatch Coverage =
openspace::globebrowsing::GeodeticPatch(0, 0, 90, 180);
@@ -976,11 +976,10 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&,
_layerManager.layerGroups();
for (size_t i = 0; i < layerGroups.size(); ++i) {
const std::string& nameBase = layergroupid::LAYER_GROUP_IDENTIFIERS[i];
_globalRenderer.gpuLayerGroups[i].bind(
*_globalRenderer.program,
*layerGroups[i],
nameBase,
layergroupid::LAYER_GROUP_IDENTIFIERS[i],
static_cast<int>(i)
);
}
@@ -1001,11 +1000,10 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&,
_layerManager.layerGroups();
for (size_t i = 0; i < layerGroups.size(); ++i) {
const std::string& nameBase = layergroupid::LAYER_GROUP_IDENTIFIERS[i];
_localRenderer.gpuLayerGroups[i].bind(
*_localRenderer.program,
*layerGroups[i],
nameBase,
layergroupid::LAYER_GROUP_IDENTIFIERS[i],
static_cast<int>(i)
);
}
@@ -1531,7 +1529,7 @@ void RenderableGlobe::setCommonUniforms(ghoul::opengl::ProgramObject& programObj
// If it does not it will still produce "correct" normals. If the resolution is
// higher the shadows will be softer, if it is lower, pixels will be visible.
// Since default is 64 this will most likely work fine.
constexpr const float TileDelta = 1.f / DefaultSkirtedGridSegments;
constexpr float TileDelta = 1.f / DefaultSkirtedGridSegments;
const glm::vec3 deltaTheta0 = modelViewTransformMat3 *
(glm::vec3(corner10 - corner00) * TileDelta);
const glm::vec3 deltaTheta1 = modelViewTransformMat3 *
@@ -1645,7 +1643,7 @@ void RenderableGlobe::recompileShaders() {
for (size_t i = 0; i < preprocessingData.layeredTextureInfo.size(); i++) {
// lastLayerIndex must be at least 0 for the shader to compile,
// the layer type is inactivated by setting use to false
const std::string& groupName = layergroupid::LAYER_GROUP_IDENTIFIERS[i];
std::string groupName = std::string(layergroupid::LAYER_GROUP_IDENTIFIERS[i]);
shaderDictionary.setValue(
"lastLayerIndex" + groupName,
glm::max(preprocessingData.layeredTextureInfo[i].lastLayerIdx, 0)
@@ -1991,7 +1989,7 @@ void RenderableGlobe::calculateEclipseShadows(ghoul::opengl::ProgramObject& prog
{
ZoneScoped
constexpr const double KM_TO_M = 1000.0;
constexpr double KM_TO_M = 1000.0;
ghoul_assert(
!_ellipsoid.shadowConfigurationArray().empty(),
@@ -2103,16 +2101,14 @@ void RenderableGlobe::calculateEclipseShadows(ghoul::opengl::ProgramObject& prog
const std::string uniformVarName("shadowDataArray[");
unsigned int counter = 0;
for (const ShadowRenderingStruct& sd : shadowDataArray) {
constexpr const char* NameIsShadowing = "shadowDataArray[{}].isShadowing";
constexpr const char* NameXp = "shadowDataArray[{}].xp";
constexpr const char* NameXu = "shadowDataArray[{}].xu";
constexpr const char* NameRc = "shadowDataArray[{}].rc";
constexpr const char* NameSource = "shadowDataArray[{}].sourceCasterVec";
constexpr const char* NamePos = "shadowDataArray[{}].casterPositionVec";
constexpr std::string_view NameIsShadowing = "shadowDataArray[{}].isShadowing";
constexpr std::string_view NameXp = "shadowDataArray[{}].xp";
constexpr std::string_view NameXu = "shadowDataArray[{}].xu";
constexpr std::string_view NameRc = "shadowDataArray[{}].rc";
constexpr std::string_view NameSource = "shadowDataArray[{}].sourceCasterVec";
constexpr std::string_view NamePos = "shadowDataArray[{}].casterPositionVec";
programObject.setUniform(
fmt::format(NameIsShadowing, counter), sd.isShadowing
);
programObject.setUniform(fmt::format(NameIsShadowing, counter), sd.isShadowing);
if (sd.isShadowing) {
programObject.setUniform(fmt::format(NameXp, counter), sd.xp);
+4 -5
View File
@@ -34,7 +34,6 @@
#include <openspace/rendering/renderengine.h>
#include <openspace/scene/scene.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/font/fontmanager.h>
#include <ghoul/font/fontrenderer.h>
@@ -52,15 +51,15 @@
#include <locale>
namespace {
constexpr const char* _loggerCat = "RingsComponent";
constexpr std::string_view _loggerCat = "RingsComponent";
constexpr const std::array<const char*, 9> UniformNames = {
constexpr std::array<const char*, 9> UniformNames = {
"modelViewProjectionMatrix", "textureOffset", "colorFilterValue", "nightFactor",
"sunPosition", "ringTexture", "shadowMatrix", "shadowMapTexture",
"zFightingPercentage"
};
constexpr const std::array<const char*, 15> UniformNamesAdvancedRings = {
constexpr std::array<const char*, 15> UniformNamesAdvancedRings = {
"modelViewProjectionMatrix", "textureOffset", "colorFilterValue", "nightFactor",
"sunPosition", "sunPositionObj", "camPositionObj", "ringTextureFwrd",
"ringTextureBckwrd", "ringTextureUnlit", "ringTextureColor",
@@ -68,7 +67,7 @@ namespace {
"zFightingPercentage"
};
constexpr const std::array<const char*, 3> GeomUniformNames = {
constexpr std::array<const char*, 3> GeomUniformNames = {
"modelViewProjectionMatrix", "textureOffset", "ringTexture"
};
@@ -35,7 +35,6 @@
#include <openspace/rendering/renderengine.h>
#include <openspace/scene/scene.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/io/texture/texturereader.h>
@@ -53,7 +52,7 @@
#include <locale>
namespace {
constexpr const char* _loggerCat = "ShadowComponent";
constexpr std::string_view _loggerCat = "ShadowComponent";
constexpr openspace::properties::Property::PropertyInfo SaveDepthTextureInfo = {
"SaveDepthTextureInfo",
@@ -74,7 +73,7 @@ namespace {
"The depth map size in pixels. You must entry the width and height values."
};
constexpr const GLfloat ShadowBorder[] = { 1.f, 1.f, 1.f, 1.f };
constexpr GLfloat ShadowBorder[] = { 1.f, 1.f, 1.f, 1.f };
void checkFrameBufferState(const std::string& codePosition) {
if (glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
@@ -44,7 +44,7 @@
#include <sstream>
namespace {
constexpr const char* TimePlaceholder = "${OpenSpaceTimeId}";
constexpr std::string_view TimePlaceholder = "${OpenSpaceTimeId}";
constexpr openspace::properties::Property::PropertyInfo UseFixedTimeInfo = {
"UseFixedTime",
@@ -134,7 +134,7 @@ namespace {
std::string_view timeStringify(const std::string& format, const openspace::Time& t) {
ZoneScoped
constexpr const int BufferSize = 64;
constexpr int BufferSize = 64;
ghoul_assert(format.size() < BufferSize, "Format string too long");
using namespace openspace;
@@ -562,7 +562,7 @@ TemporalTileProvider::tileProvider<TemporalTileProvider::Mode::Prototype, true>(
// if the images are for each hour
if (_prototyped.temporalResolution == "1h") {
constexpr const int Hour = 60 * 60;
constexpr int Hour = 60 * 60;
// the second tile to interpolate between
nextTile.advanceTime(Hour);
// the tile after the second tile
@@ -576,7 +576,7 @@ TemporalTileProvider::tileProvider<TemporalTileProvider::Mode::Prototype, true>(
}
// if the images are for each month
if (_prototyped.temporalResolution == "1M") {
constexpr const int Day = 24 * 60 * 60;
constexpr int Day = 24 * 60 * 60;
// the second tile to interpolate between
nextTile.advanceTime(32 * Day);
@@ -75,7 +75,7 @@ std::unique_ptr<TileProvider> TileProvider::createFromDictionary(
{
ZoneScoped
const char* type = layergroupid::LAYER_TYPE_NAMES[static_cast<int>(layerTypeID)];
std::string_view type = layergroupid::LAYER_TYPE_NAMES[static_cast<int>(layerTypeID)];
ghoul::TemplateFactory<TileProvider>* factory =
FactoryManager::ref().factory<TileProvider>();
+9 -9
View File
@@ -152,12 +152,12 @@ DateTime::DateTime(std::string_view initDateTime) {
void DateTime::setTime(std::string_view input) {
// Indices into an ISO8601 YYYY-MM-ddTHH:mm:ss string
constexpr const size_t IndexYear = 0;
constexpr const size_t IndexMonth = 5;
constexpr const size_t IndexDay = 8;
constexpr const size_t IndexHour = 11;
constexpr const size_t IndexMinute = 14;
constexpr const size_t IndexSecond = 17;
constexpr size_t IndexYear = 0;
constexpr size_t IndexMonth = 5;
constexpr size_t IndexDay = 8;
constexpr size_t IndexHour = 11;
constexpr size_t IndexMinute = 14;
constexpr size_t IndexSecond = 17;
std::from_chars(input.data() + IndexYear, input.data() + IndexYear + 4, _year);
std::from_chars(input.data() + IndexMonth, input.data() + IndexMonth + 2, _month);
@@ -482,7 +482,7 @@ bool TimeQuantizer::quantize(Time& t, bool clamp) {
ZoneScoped
constexpr const char Format[] = "YYYY-MM-DDTHR:MN:SC.###";
constexpr const int BufferSize = sizeof(Format);
constexpr int BufferSize = sizeof(Format);
char unquantizedString[BufferSize];
std::memset(unquantizedString, 0, BufferSize);
SpiceManager::ref().dateFromEphemerisTime(
@@ -493,8 +493,8 @@ bool TimeQuantizer::quantize(Time& t, bool clamp) {
DateTime unquantized(std::string_view(unquantizedString, BufferSize));
// resolutionFraction helps to improve iteration performance
constexpr const double ResolutionFraction = 0.7;
constexpr const int IterationLimit = 50;
constexpr double ResolutionFraction = 0.7;
constexpr int IterationLimit = 50;
if (_timerange.includes(t)) {
int iterations = 0;
+4 -4
View File
@@ -44,13 +44,13 @@
// #define SHOW_IMGUI_HELPERS
namespace {
constexpr const char* _loggerCat = "GUI";
constexpr const char* GuiFont = "${FONTS}/arimo/Arimo-Regular.ttf";
constexpr const float FontSize = 14.f;
constexpr std::string_view _loggerCat = "GUI";
constexpr std::string_view GuiFont = "${FONTS}/arimo/Arimo-Regular.ttf";
constexpr float FontSize = 14.f;
ImFont* captionFont = nullptr;
constexpr const std::array<const char*, 2> UniformNames = { "tex", "ortho" };
constexpr std::array<const char*, 2> UniformNames = { "tex", "ortho" };
constexpr openspace::properties::Property::PropertyInfo EnabledInfo = {
"Enabled",
@@ -225,7 +225,7 @@ void GuiGlobeBrowsingComponent::render() {
}
if (ImGui::BeginPopup("globebrowsing_add_server")) {
constexpr const int InputBufferSize = 512;
constexpr int InputBufferSize = 512;
static char NameInputBuffer[InputBufferSize];
ImGui::InputText("Server Name", NameInputBuffer, InputBufferSize);
@@ -276,7 +276,7 @@ void GuiGlobeBrowsingComponent::render() {
ImGui::Columns(6, nullptr, false);
const float width = ImGui::GetWindowWidth();
constexpr const float ButtonWidth = 60.f;
constexpr float ButtonWidth = 60.f;
ImGui::SetColumnOffset(5, width - 1.5f * ButtonWidth);
ImGui::SetColumnOffset(4, width - 2.5f * ButtonWidth);
ImGui::SetColumnOffset(3, width - 3.5f * ButtonWidth);
+4 -3
View File
@@ -59,9 +59,10 @@ namespace {
}
}
constexpr const char* AnchorProperty = "NavigationHandler.OrbitalNavigator.Anchor";
constexpr std::string_view AnchorProperty =
"NavigationHandler.OrbitalNavigator.Anchor";
constexpr const char* RetargetAnchorProperty =
constexpr std::string_view RetargetAnchorProperty =
"NavigationHandler.OrbitalNavigator.RetargetAnchor";
} // namespace
@@ -347,7 +348,7 @@ void GuiSpaceTimeComponent::render() {
openspace::TimeUnits.end(),
std::string(""),
[](const std::string& a, const openspace::TimeUnit& unit) {
return a + nameForTimeUnit(unit, true) + " / second" + '\0';
return fmt::format("{}{} / second\0", a, nameForTimeUnit(unit, true));
}
);
+2 -2
View File
@@ -36,8 +36,8 @@
#include <fstream>
namespace {
constexpr const char* _loggerCat = "DataCygnet";
constexpr const int MaxTextures = 6;
constexpr std::string_view _loggerCat = "DataCygnet";
constexpr int MaxTextures = 6;
constexpr openspace::properties::Property::PropertyInfo DataOptionsInfo = {
"DataOptions",
+1 -1
View File
@@ -28,7 +28,7 @@
#include <ghoul/logging/logmanager.h>
namespace {
constexpr const char* _loggerCat = "IswaBaseGroup";
constexpr std::string_view _loggerCat = "IswaBaseGroup";
using json = nlohmann::json;
constexpr openspace::properties::Property::PropertyInfo EnabledInfo = {
+1 -1
View File
@@ -40,7 +40,7 @@
#include <ghoul/opengl/texture.h>
namespace {
constexpr const char* _loggerCat = "IswaCygnet";
constexpr std::string_view _loggerCat = "IswaCygnet";
constexpr openspace::properties::Property::PropertyInfo DeleteInfo = {
"Delete",
+1 -1
View File
@@ -35,7 +35,7 @@
#include <ghoul/logging/logmanager.h>
namespace {
constexpr const char* _loggerCat = "IswaDataGroup";
constexpr std::string_view _loggerCat = "IswaDataGroup";
using json = nlohmann::json;
constexpr openspace::properties::Property::PropertyInfo UseLogInfo = {
+1 -1
View File
@@ -32,7 +32,7 @@
#include <fstream>
namespace {
constexpr const char* _loggerCat = "IswaDataGroup";
constexpr std::string_view _loggerCat = "IswaDataGroup";
using json = nlohmann::json;
constexpr openspace::properties::Property::PropertyInfo ResolutionInfo = {
+1 -1
View File
@@ -41,7 +41,7 @@
namespace {
using json = nlohmann::json;
constexpr const char* _loggerCat = "KameleonPlane";
constexpr std::string_view _loggerCat = "KameleonPlane";
constexpr openspace::properties::Property::PropertyInfo FieldLineSeedsInfo = {
"FieldlineSeedsIndexFile",
+1 -1
View File
@@ -30,7 +30,7 @@
#include <ghoul/opengl/texture.h>
namespace {
constexpr const char* _loggerCat = "TextureCygnet";
constexpr std::string_view _loggerCat = "TextureCygnet";
} // namespace
namespace openspace {
+2 -2
View File
@@ -47,13 +47,13 @@ std::vector<std::string> DataProcessorText::readMetadata(const std::string& data
//# x y z N V_x B_x
// The string where the interesting data begins
constexpr const char* info = "# Output data: field with ";
constexpr std::string_view info = "# Output data: field with ";
std::vector<std::string> options;
std::string line;
std::stringstream memorystream(data);
while (getline(memorystream, line)) {
if (line.find(info) == 0) {
line = line.substr(strlen(info));
line = line.substr(info.size());
std::stringstream ss(line);
std::string token;
+16 -16
View File
@@ -64,26 +64,26 @@
#endif // OPENSPACE_MODULE_KAMELEON_ENABLED
constexpr const char* monthNumber(const char* month) {
if (ghoul::equal(month, "JAN")) return "01";
else if (ghoul::equal(month, "FEB")) return "02";
else if (ghoul::equal(month, "MAR")) return "03";
else if (ghoul::equal(month, "APR")) return "04";
else if (ghoul::equal(month, "MAY")) return "05";
else if (ghoul::equal(month, "JUN")) return "06";
else if (ghoul::equal(month, "JUL")) return "07";
else if (ghoul::equal(month, "AUG")) return "08";
else if (ghoul::equal(month, "SEP")) return "09";
else if (ghoul::equal(month, "OCT")) return "10";
else if (ghoul::equal(month, "NOV")) return "11";
else if (ghoul::equal(month, "DEC")) return "12";
else return "";
constexpr std::string_view monthNumber(std::string_view month) {
if (month == "JAN") return "01";
else if (month == "FEB") return "02";
else if (month == "MAR") return "03";
else if (month == "APR") return "04";
else if (month == "MAY") return "05";
else if (month == "JUN") return "06";
else if (month == "JUL") return "07";
else if (month == "AUG") return "08";
else if (month == "SEP") return "09";
else if (month == "OCT") return "10";
else if (month == "NOV") return "11";
else if (month == "DEC") return "12";
else return "";
}
namespace {
using json = nlohmann::json;
constexpr const char* _loggerCat = "IswaManager";
constexpr std::string_view _loggerCat = "IswaManager";
void createScreenSpace(int id) {
std::string idStr = std::to_string(id);
@@ -278,7 +278,7 @@ std::string IswaManager::iswaUrl(int id, double timestamp, const std::string& ty
std::getline(ss, token, ' ');
url += token + "-";
std::getline(ss, token, ' ');
url = url + monthNumber(token.c_str()) + "-";
url = fmt::format("{}{}-", url, monthNumber(token));
std::getline(ss, token, 'T');
url += token + "%20";
std::getline(ss, token, '.');
+1 -1
View File
@@ -42,7 +42,7 @@
namespace {
constexpr const char* _loggerCat = "KameleonHelper";
constexpr std::string_view _loggerCat = "KameleonHelper";
} // namespace
namespace openspace::kameleonHelper {
+7 -7
View File
@@ -50,8 +50,8 @@
#endif // WIN32
namespace {
constexpr const char* _loggerCat = "KameleonWrapper";
constexpr const float RE_TO_METER = 6371000;
constexpr std::string_view _loggerCat = "KameleonWrapper";
constexpr float RE_TO_METER = 6371000;
} // namespace
namespace openspace {
@@ -200,7 +200,7 @@ float* KameleonWrapper::uniformSampledValues(const std::string& var,
LDEBUG(fmt::format("{} Max: {}", var, varMax));
// HISTOGRAM
constexpr const int NBins = 200;
constexpr int NBins = 200;
std::vector<int> histogram(NBins, 0);
// Explicitly mentioning the capture list provides either an error on MSVC (if NBins)
// is not specified or a warning on Clang if it is specified. Sigh...
@@ -301,7 +301,7 @@ float* KameleonWrapper::uniformSampledValues(const std::string& var,
int sum = 0;
int stop = 0;
constexpr const float TruncationLimit = 0.9f;
constexpr float TruncationLimit = 0.9f;
const int upperLimit = static_cast<int>(size * TruncationLimit);
for (int i = 0; i < NBins; ++i) {
sum += histogram[i];
@@ -473,7 +473,7 @@ float* KameleonWrapper::uniformSampledVectorValues(const std::string& xVar,
zVar
));
constexpr const int NumChannels = 4;
constexpr int NumChannels = 4;
const size_t size = NumChannels * outDimensions.x * outDimensions.y * outDimensions.z;
float* data = new float[size];
@@ -786,7 +786,7 @@ KameleonWrapper::TraceLine KameleonWrapper::traceCartesianFieldline(
TraceDirection direction,
FieldlineEnd& end) const
{
constexpr const int MaxSteps = 5000;
constexpr int MaxSteps = 5000;
_model->loadVariable(xVar);
const long int xID = _model->getVariableID(xVar);
@@ -876,7 +876,7 @@ KameleonWrapper::TraceLine KameleonWrapper::traceLorentzTrajectory(
float stepsize,
float eCharge) const
{
constexpr const int MaxSteps = 5000;
constexpr int MaxSteps = 5000;
glm::vec3 step = glm::vec3(stepsize);
@@ -53,7 +53,7 @@
#endif // WIN32
namespace {
constexpr const char* _loggerCat = "KameleonVolumeReader";
constexpr std::string_view _loggerCat = "KameleonVolumeReader";
template <typename T>
T globalAttribute(ccmc::Model&, const std::string&) {
@@ -48,22 +48,22 @@
#include <filesystem>
namespace {
constexpr const char* _loggerCat = "RenderableKameleonVolume";
constexpr std::string_view _loggerCat = "RenderableKameleonVolume";
constexpr const char* KeyDimensions = "Dimensions";
constexpr const char* KeyStepSize = "StepSize";
constexpr const char* KeyTransferFunction = "TransferFunction";
constexpr const char* KeySource = "Source";
constexpr const char* KeyVariable = "Variable";
constexpr const char* KeyLowerDomainBound = "LowerDomainBound";
constexpr const char* KeyUpperDomainBound = "UpperDomainBound";
constexpr const char* KeyDomainScale = "DomainScale";
constexpr const char* KeyLowerValueBound = "LowerValueBound";
constexpr const char* KeyUpperValueBound = "UpperValueBound";
constexpr const char* KeyClipPlanes = "ClipPlanes";
constexpr const char* KeyCache = "Cache";
constexpr const char* KeyGridType = "GridType";
constexpr const char* ValueSphericalGridType = "Spherical";
constexpr std::string_view KeyDimensions = "Dimensions";
constexpr std::string_view KeyStepSize = "StepSize";
constexpr std::string_view KeyTransferFunction = "TransferFunction";
constexpr std::string_view KeySource = "Source";
constexpr std::string_view KeyVariable = "Variable";
constexpr std::string_view KeyLowerDomainBound = "LowerDomainBound";
constexpr std::string_view KeyUpperDomainBound = "UpperDomainBound";
constexpr std::string_view KeyDomainScale = "DomainScale";
constexpr std::string_view KeyLowerValueBound = "LowerValueBound";
constexpr std::string_view KeyUpperValueBound = "UpperValueBound";
constexpr std::string_view KeyClipPlanes = "ClipPlanes";
constexpr std::string_view KeyCache = "Cache";
constexpr std::string_view KeyGridType = "GridType";
constexpr std::string_view ValueSphericalGridType = "Spherical";
constexpr openspace::properties::Property::PropertyInfo DimensionsInfo = {
"Dimensions",
@@ -33,11 +33,12 @@
#include <fstream>
namespace {
constexpr const char* MainTemplateFilename = "${WEB}/kameleondocumentation/main.hbs";
constexpr const char* HandlebarsFilename = "${WEB}/common/handlebars-v4.0.5.js";
constexpr const char* JsFilename = "${WEB}/kameleondocumentation/script.js";
constexpr const char* BootstrapFilename = "${WEB}/common/bootstrap.min.css";
constexpr const char* CssFilename = "${WEB}/common/style.css";
constexpr std::string_view MainTemplateFilename =
"${WEB}/kameleondocumentation/main.hbs";
constexpr std::string_view HandlebarsFilename = "${WEB}/common/handlebars-v4.0.5.js";
constexpr std::string_view JsFilename = "${WEB}/kameleondocumentation/script.js";
constexpr std::string_view BootstrapFilename = "${WEB}/common/bootstrap.min.css";
constexpr std::string_view CssFilename = "${WEB}/common/style.css";
struct [[codegen::Dictionary(KameleonDocumentationTask)]] Parameters {
// The CDF file to extract data from
@@ -35,16 +35,6 @@
#include <optional>
namespace {
constexpr const char* KeyDimensions = "Dimensions";
constexpr const char* KeyTime = "Time";
constexpr const char* KeyLowerDomainBound = "LowerDomainBound";
constexpr const char* KeyUpperDomainBound = "UpperDomainBound";
constexpr const char* KeyMinValue = "MinValue";
constexpr const char* KeyMaxValue = "MaxValue";
constexpr const char* KeyVisUnit = "VisUnit";
struct [[codegen::Dictionary(KameleonVolumeToRawTask)]] Parameters {
// The cdf file to extract data from
std::filesystem::path input;
@@ -157,14 +147,14 @@ void KameleonVolumeToRawTask::perform(const Task::ProgressCallback& progressCall
time.pop_back();
}
outputMetadata.setValue(KeyTime, time);
outputMetadata.setValue(KeyDimensions, glm::dvec3(_dimensions));
outputMetadata.setValue(KeyLowerDomainBound, glm::dvec3(_lowerDomainBound));
outputMetadata.setValue(KeyUpperDomainBound, glm::dvec3(_upperDomainBound));
outputMetadata.setValue("Time", time);
outputMetadata.setValue("Dimensions", glm::dvec3(_dimensions));
outputMetadata.setValue("LowerDomainBound", glm::dvec3(_lowerDomainBound));
outputMetadata.setValue("UpperDomainBound", glm::dvec3(_upperDomainBound));
outputMetadata.setValue(KeyMinValue, reader.minValue(_variable));
outputMetadata.setValue(KeyMaxValue, reader.maxValue(_variable));
outputMetadata.setValue(KeyVisUnit, reader.getVisUnit(_variable));
outputMetadata.setValue("MinValue", reader.minValue(_variable));
outputMetadata.setValue("MaxValue", reader.maxValue(_variable));
outputMetadata.setValue("VisUnit", reader.getVisUnit(_variable));
std::string metadataString = ghoul::formatLua(outputMetadata);
@@ -31,7 +31,7 @@
#include <glm/gtx/std_based_type.hpp>
namespace {
constexpr const char* _loggerCat = "BrickManager";
constexpr std::string_view _loggerCat = "BrickManager";
} // namespace
namespace openspace {
@@ -30,7 +30,7 @@
#include <ghoul/fmt.h>
namespace {
constexpr const char* _loggerCat = "LocalErrorHistogramManager";
constexpr std::string_view _loggerCat = "LocalErrorHistogramManager";
} // namespace
namespace openspace {
@@ -33,13 +33,13 @@
#include <ghoul/opengl/texture.h>
namespace {
constexpr const char* GlslRaycastPath =
constexpr std::string_view GlslRaycastPath =
"${MODULES}/multiresvolume/shaders/raycast.glsl";
constexpr const char* GlslHelperPath =
constexpr std::string_view GlslHelperPath =
"${MODULES}/multiresvolume/shaders/helper.glsl";
constexpr const char* GlslBoundsVsPath =
constexpr std::string_view GlslBoundsVsPath =
"${MODULES}/multiresvolume/shaders/boundsVs.glsl";
constexpr const char* GlslBoundsFsPath =
constexpr std::string_view GlslBoundsFsPath =
"${MODULES}/multiresvolume/shaders/boundsFs.glsl";
} // namespace
@@ -174,19 +174,19 @@ void MultiresVolumeRaycaster::postRaycast(const RaycastData&,
}
std::string MultiresVolumeRaycaster::boundsVertexShaderPath() const {
return GlslBoundsVsPath;
return std::string(GlslBoundsVsPath);
}
std::string MultiresVolumeRaycaster::boundsFragmentShaderPath() const {
return GlslBoundsFsPath;
return std::string(GlslBoundsFsPath);
}
std::string MultiresVolumeRaycaster::raycasterPath() const {
return GlslRaycastPath;
return std::string(GlslRaycastPath);
}
std::string MultiresVolumeRaycaster::helperPath() const {
return GlslHelperPath; // no helper file
return std::string(GlslHelperPath); // no helper file
}
void MultiresVolumeRaycaster::setModelTransform(glm::mat4 transform) {
@@ -59,14 +59,14 @@
#include <iterator>
namespace {
constexpr const char* _loggerCat = "RenderableMultiresVolume";
constexpr const char* KeyDataSource = "Source";
constexpr const char* KeyErrorHistogramsSource = "ErrorHistogramsSource";
constexpr const char* KeyTransferFunction = "TransferFunction";
constexpr std::string_view _loggerCat = "RenderableMultiresVolume";
constexpr std::string_view KeyDataSource = "Source";
constexpr std::string_view KeyErrorHistogramsSource = "ErrorHistogramsSource";
constexpr std::string_view KeyTransferFunction = "TransferFunction";
constexpr const char* KeyBrickSelector = "BrickSelector";
constexpr const char* KeyStartTime = "StartTime";
constexpr const char* KeyEndTime = "EndTime";
constexpr std::string_view KeyBrickSelector = "BrickSelector";
constexpr std::string_view KeyStartTime = "StartTime";
constexpr std::string_view KeyEndTime = "EndTime";
constexpr openspace::properties::Property::PropertyInfo StepSizeCoefficientInfo = {
"StepSizeCoefficient",
@@ -32,14 +32,13 @@
#include <algorithm>
namespace {
constexpr const char* _loggerCat = "SimpleTfBrickSelector";
constexpr std::string_view _loggerCat = "SimpleTfBrickSelector";
bool compareSplitPoints(const openspace::BrickSelection& a,
const openspace::BrickSelection& b)
{
return a.splitPoints < b.splitPoints;
}
} // namespace
namespace openspace {

Some files were not shown because too many files have changed in this diff Show More