Tiny coding style fixups

This commit is contained in:
Alexander Bock
2021-03-27 23:49:02 +01:00
parent 6aad31000f
commit e88650f22c
28 changed files with 54 additions and 60 deletions

View File

@@ -53,4 +53,4 @@ protected:
} // openspace
#endif // __OPENSPACE_CORE___DASHBOARDITEM___H__
#endif // __OPENSPACE_CORE___DASHBOARDTEXTITEM___H__

View File

@@ -179,7 +179,8 @@ namespace {
// A list of objects that cast light on this atmosphere
std::vector<CasterElement> casters;
};
// Declares shadow groups, meaning which nodes are considered in shadow calculations
// Declares shadow groups, meaning which nodes are considered in shadow
// calculations
std::optional<ShadowGroup> shadowGroup;
// [[codegen::verbatim(AtmosphereHeightInfo.description)]]
@@ -360,7 +361,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
_mieScatteringExtinctionPropCoefficient.onChange(updateWithCalculation);
addProperty(_mieScatteringExtinctionPropCoefficient);
if (p.debug.has_value()) {
_preCalculatedTexturesScale =
p.debug->preCalculatedTextureScale.value_or(_preCalculatedTexturesScale);

View File

@@ -55,7 +55,7 @@ namespace {
struct [[codegen::Dictionary(DashboardItemDate)]] Parameters {
// [[codegen::verbatim(FormatStringInfo.description)]]
std::optional<std::string> formatString;
// [[codegen::verbatim(TimeFormatInfo.description)]]
std::optional<std::string> timeFormat;
};

View File

@@ -132,7 +132,8 @@ namespace {
DtAvg [[codegen::key("Average Deltatime")]],
DtExtremes [[codegen::key("Deltatime extremes")]],
DtStandardDeviation [[codegen::key("Deltatime standard deviation")]],
DtCoefficientOfVariation [[codegen::key("Deltatime coefficient of variation")]],
DtCoefficientOfVariation
[[codegen::key("Deltatime coefficient of variation")]],
FPS [[codegen::key("Frames per second")]],
FPSAvg [[codegen::key("Average frames per second")]]
};
@@ -187,7 +188,8 @@ DashboardItemFramerate::DashboardItemFramerate(const ghoul::Dictionary& dictiona
_frametimeType = static_cast<int>(FrametimeType::DtStandardDeviation);
break;
case Parameters::Type::DtCoefficientOfVariation:
_frametimeType = static_cast<int>(FrametimeType::DtCoefficientOfVariation);
_frametimeType =
static_cast<int>(FrametimeType::DtCoefficientOfVariation);
break;
case Parameters::Type::FPS:
_frametimeType = static_cast<int>(FrametimeType::FPS);

View File

@@ -185,7 +185,7 @@ namespace {
struct [[codegen::Dictionary(FixedRotation)]] Parameters {
// This value specifies the direction of the new X axis. If this value is not
// specified, it will be computed by completing a right handed coordinate system
// from the Y and Z axis, which must be specified instead. If this value is a
// from the Y and Z axis, which must be specified instead. If this value is a
// string, it is interpreted as the identifier of another scenegraph node. If this
// value is a 3-vector, it is interpreted as a direction vector
std::optional<std::variant<std::string, glm::vec3>> xAxis;

View File

@@ -56,7 +56,8 @@ namespace openspace::exoplanets::luascriptfunctions {
constexpr const float AU = static_cast<float>(distanceconstants::AstronomicalUnit);
constexpr const float SolarRadius = static_cast<float>(distanceconstants::SolarRadius);
constexpr const float JupiterRadius = static_cast<float>(distanceconstants::JupiterRadius);
constexpr const float JupiterRadius =
static_cast<float>(distanceconstants::JupiterRadius);
ExoplanetSystem findExoplanetSystemInData(std::string_view starName) {
const ExoplanetsModule* module = global::moduleEngine->module<ExoplanetsModule>();

View File

@@ -126,7 +126,7 @@ RenderableFieldlines::RenderableFieldlines(const ghoul::Dictionary& dictionary)
else {
_vectorFieldInfo = dictionary.value<ghoul::Dictionary>(KeyVectorField);
}
if (!dictionary.hasValue<ghoul::Dictionary>(KeyFieldlines)) {
LERROR(fmt::format("Renderable does not contain a key for '{}'", KeyFieldlines));
}

View File

@@ -949,7 +949,8 @@ TileMetaData RawTileDataReader::tileMetaData(RawTile& rawTile,
bool allIsMissing = true;
for (int y = 0; y < region.numPixels.y; ++y) {
const size_t yi = (static_cast<unsigned long long>(region.numPixels.y) - 1 - y) * bytesPerLine;
const size_t yi =
(static_cast<unsigned long long>(region.numPixels.y) - 1 - y) * bytesPerLine;
size_t i = 0;
for (int x = 0; x < region.numPixels.x; ++x) {
for (size_t raster = 0; raster < _initData.nRasters; ++raster) {

View File

@@ -1487,7 +1487,7 @@ void RenderableGlobe::renderChunkLocally(const Chunk& chunk, const RenderData& d
program.setUniform("shadowMapTexture", shadowMapUnit);
program.setUniform("zFightingPercentage", _generalProperties.zFightingPercentage);
}
}
else if (_generalProperties.shadowMapping) {
shadowMapUnit.activate();
// JCC: Avoiding a to recompiling the shaders or having more than one

View File

@@ -296,7 +296,7 @@ void RingsComponent::initialize() {
addProperty(_texturePath);
_textureFile->setCallback([&](const File&) { _textureIsDirty = true; });
}
if (_ringsDictionary.hasKey(TextureFwrdInfo.identifier)) {
_textureFwrdPath = absPath(
_ringsDictionary.value<std::string>(TextureFwrdInfo.identifier)
@@ -306,7 +306,7 @@ void RingsComponent::initialize() {
addProperty(_textureFwrdPath);
_textureFileForwards->setCallback([&](const File&) { _textureIsDirty = true; });
}
if (_ringsDictionary.hasKey(TextureBckwrdInfo.identifier)) {
_textureBckwrdPath = absPath(
_ringsDictionary.value<std::string>(TextureBckwrdInfo.identifier)
@@ -476,7 +476,7 @@ void RingsComponent::draw(const RenderData& data,
_shader->setUniform(_uniformCacheAdvancedRings.colorFilterValue, _colorFilter);
_shader->setUniform(_uniformCacheAdvancedRings.nightFactor, _nightFactor);
_shader->setUniform(_uniformCacheAdvancedRings.sunPosition, _sunPosition);
const glm::dmat4 inverseModelTransform = glm::inverse(modelTransform);
glm::vec3 sunPositionObjectSpace = glm::normalize(
@@ -614,7 +614,7 @@ void RingsComponent::draw(const RenderData& data,
else {
_texture->bind();
}
_geometryOnlyShader->setUniform(_geomUniformCache.ringTexture, ringTextureUnit);
}
@@ -673,7 +673,7 @@ void RingsComponent::loadTexture() {
using namespace ghoul::opengl;
if (!_texturePath.value().empty()) {
std::unique_ptr<Texture> texture = TextureReader::ref().loadTexture(
absPath(_texturePath)
);

View File

@@ -98,7 +98,7 @@ private:
) _uniformCache;
UniformCache(modelViewProjectionMatrix, textureOffset, colorFilterValue, nightFactor,
sunPosition, sunPositionObj, camPositionObj, ringTextureFwrd, ringTextureBckwrd,
ringTextureUnlit, ringTextureColor, ringTextureTransparency, shadowMatrix,
ringTextureUnlit, ringTextureColor, ringTextureTransparency, shadowMatrix,
shadowMapTexture, zFightingPercentage
) _uniformCacheAdvancedRings;
UniformCache(modelViewProjectionMatrix, textureOffset, ringTexture

View File

@@ -323,7 +323,7 @@ RenderData ShadowComponent::begin(const RenderData& data) {
// Saves current state
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_currentFBO);
global::renderEngine->openglStateCache().viewport(_mViewport);
glBindFramebuffer(GL_FRAMEBUFFER, _shadowFBO);
GLenum drawBuffers[] = { GL_COLOR_ATTACHMENT0, GL_NONE, GL_NONE };
glDrawBuffers(3, drawBuffers);

View File

@@ -184,7 +184,8 @@ void IswaCygnet::render(const RenderData& data, RendererTasks&) {
_data.spatialScale.x * _data.offset,
_data.spatialScale.w
);
glm::vec3 position = glm::vec3(pposition) * static_cast<float>(pow(10.f, pposition.w));
glm::vec3 position =
glm::vec3(pposition) * static_cast<float>(pow(10.f, pposition.w));
// Activate shader
_shader->activate();

View File

@@ -22,8 +22,8 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_MODULE_EXOPLANETS___RENDERABLEHABITABLEZONE___H__
#define __OPENSPACE_MODULE_EXOPLANETS___RENDERABLEHABITABLEZONE___H__
#ifndef __OPENSPACE_MODULE_SPACE___RENDERABLEHABITABLEZONE___H__
#define __OPENSPACE_MODULE_SPACE___RENDERABLEHABITABLEZONE___H__
#include <modules/base/rendering/renderabledisc.h>
#include <openspace/properties/scalar/boolproperty.h>
@@ -72,4 +72,4 @@ private:
} // namespace openspace
#endif // __OPENSPACE_MODULE_EXOPLANETS___RENDERABLEHABITABLEZONE___H__
#endif // __OPENSPACE_MODULE_SPACE___RENDERABLEHABITABLEZONE___H__

View File

@@ -307,7 +307,8 @@ namespace {
};
struct [[codegen::Dictionary(RenderableStars)]] Parameters {
// The path to the SPECK file containing information about the stars being rendered
// The path to the SPECK file containing information about the stars being
// rendered
std::filesystem::path speckFile [[codegen::key("File")]];
// [[codegen::verbatim(ColorTextureInfo.description)]]
@@ -336,8 +337,8 @@ namespace {
// loading. This can be used to trim the dataset's automatic value range
std::optional<float> staticFilter;
// This is the value that is used to replace statically filtered values. Setting this
// value only makes sense if 'StaticFilter' is 'true', as well
// This is the value that is used to replace statically filtered values. Setting
// this value only makes sense if 'StaticFilter' is 'true', as well
std::optional<float> staticFilterReplacement;
// [[codegen::verbatim(MagnitudeExponentInfo.description)]]

View File

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

View File

@@ -140,21 +140,6 @@ namespace openspace::documentation {
const std::string DocumentationEntry::Wildcard = "*";
//std::string concatenate(const std::vector<TestResult::Offense>& offenses) {
// std::string result = "Error in specification (";
// for (const TestResult::Offense& o : offenses) {
// if (o.explanation.empty()) {
// result += fmt::format("{} ({}), ", o.offender, ghoul::to_string(o.reason));
// }
// else {
// result += fmt::format("{} ({}: {}), ", o.offender, ghoul::to_string(o.reason), o.explanation);
// }
// }
// result.pop_back();
// result.back() = ')';
// return result;
//}
SpecificationError::SpecificationError(TestResult res, std::string comp)
: ghoul::RuntimeError("Error in specification", std::move(comp))
, result(std::move(res))

View File

@@ -312,7 +312,7 @@ TestResult Color4Verifier::operator()(const ghoul::Dictionary& dictionary,
res.success = false;
res.offenses.push_back({ key + ".a", TestResult::Offense::Reason::Verification });
}
return res;
}

View File

@@ -60,7 +60,7 @@ namespace {
std::optional<std::vector<std::string>> globalCustomizationScripts;
// A list of paths that are automatically registered with the file system. If a
// key X is used in the table, it is then useable by referencing ${X} in all other
// key X is used in the table, it is then useable by referencing ${X} in all other
// configuration files or scripts
std::map<std::string, std::string> paths;
@@ -277,7 +277,7 @@ namespace {
// errors easier. This defaults to 'false'
std::optional<bool> checkOpenGLState;
// Determines whether each OpenGL call that happens should be logged using the
// Determines whether each OpenGL call that happens should be logged using the
// 'TRACE' loglevel. This will bring the rendering to a crawl but provides useful
// debugging features for the order in which OpenGL calls occur. This defaults to
// 'false'
@@ -312,7 +312,7 @@ namespace {
// bar that gives an estimate of the loading progression
std::optional<bool> showProgressbar;
};
// Values in this table describe the behavior of the loading screen that is
// Values in this table describe the behavior of the loading screen that is
// displayed while the scene graph is created and initialized
std::optional<LoadingScreen> loadingScreen;
@@ -458,7 +458,7 @@ void parseLuaState(Configuration& configuration) {
}
}
}
if (p.documentation.has_value()) {
c.documentation.path = p.documentation->path.value_or(c.documentation.path);
}

View File

@@ -63,7 +63,6 @@ void ModuleEngine::initialize(
m->initialize(configuration);
}
catch (const documentation::SpecificationError& e) {
//LFATALC(e.component, e.message);
for (const documentation::TestResult::Offense& o : e.result.offenses) {
LERRORC(e.component, o.offender + ": " + ghoul::to_string(o.reason));
}

View File

@@ -306,11 +306,10 @@ int createSingleColorImage(lua_State* L) {
// @TODO (emmbr 2020-12-18) Verify that the input dictionary is a vec3
// Would like to clean this up with a more direct use of the Verifier in the future
using namespace openspace::documentation;
const std::string& key = "color";
ghoul::Dictionary colorDict;
colorDict.setValue(key, d);
TestResult res = Color3Verifier()(colorDict, key);
documentation::TestResult res = documentation::Color3Verifier()(colorDict, key);
if (!res.success) {
return ghoul::lua::luaError(

View File

@@ -89,7 +89,7 @@ DashboardItem::DashboardItem(const ghoul::Dictionary& dictionary)
, _isEnabled(EnabledInfo, true)
{
const Parameters p = codegen::bake<Parameters>(dictionary);
setIdentifier(p.identifier);
if (p.guiName.has_value()) {
setGuiName(*p.guiName);

View File

@@ -129,7 +129,7 @@ Renderable::Renderable(const ghoul::Dictionary& dictionary)
registerUpdateRenderBinFromOpacity();
const Parameters p = codegen::bake<Parameters>(dictionary);
if (p.tag.has_value()) {
if (std::holds_alternative<std::string>(*p.tag)) {
if (!std::get<std::string>(*p.tag).empty()) {

View File

@@ -586,7 +586,7 @@ std::string SpiceManager::dateFromEphemerisTime(double ephemerisTime, const char
ephemerisTime, format
));
}
return std::string(Buffer);
}

View File

@@ -3,7 +3,7 @@
"""
OpenSpace
Copyright (c) 2014-2020
Copyright (c) 2014-2021
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
@@ -59,7 +59,7 @@ import os
import re
import sys
current_year = '2020'
current_year = '2021'
is_strict_mode = False
is_silent_mode = False
@@ -659,19 +659,23 @@ if not is_silent_mode:
check_files(
[basePath + 'src/**/*.cpp'],
[],
[basePath + 'src/**/*_codegen.cpp'],
'openspace_core',
check_source_file
)
check_files(
[basePath + 'apps/**/*.cpp'],
[basePath + 'apps/**/ext/**/*.cpp'],
[basePath + 'apps/**/ext/**/*.cpp', basePath + 'apps/**/*_codegen.cpp'],
'openspace_app',
check_source_file
)
check_files(
[basePath + 'modules/**/*.cpp'],
[basePath + 'modules/**/ext/**/*.cpp', basePath + 'modules/**/node_modules/**/*.cpp'],
[
basePath + 'modules/**/ext/**/*.cpp',
basePath + 'modules/**/node_modules/**/*.cpp',
basePath + 'modules/**/*_codegen.cpp'
],
'openspace_module',
check_source_file
)