mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-24 04:58:59 -05:00
General pass for code cleanup
This commit is contained in:
@@ -102,7 +102,7 @@ Dataset loadCsvFile(std::filesystem::path filePath, std::optional<DataMapping> s
|
||||
skipColumns.reserve((*specs).excludeColumns.size());
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < columns.size(); ++i) {
|
||||
for (size_t i = 0; i < columns.size(); i++) {
|
||||
const std::string& col = columns[i];
|
||||
|
||||
if (isPositionColumn(col, specs)) {
|
||||
@@ -151,7 +151,7 @@ Dataset loadCsvFile(std::filesystem::path filePath, std::optional<DataMapping> s
|
||||
Dataset::Entry entry;
|
||||
entry.data.reserve(nDataColumns);
|
||||
|
||||
for (size_t i = 0; i < row.size(); ++i) {
|
||||
for (size_t i = 0; i < row.size(); i++) {
|
||||
// Check if column should be exluded. Note that list of indices is sorted
|
||||
// so we can do a binary search
|
||||
if (hasExcludeColumns &&
|
||||
|
||||
@@ -331,7 +331,7 @@ ghoul::Dictionary Configuration::createDictionary() {
|
||||
res.setValue("PropertyVisibility", static_cast<int>(propertyVisibility));
|
||||
|
||||
ghoul::Dictionary globalCustomizationScriptsDict;
|
||||
for (size_t i = 0; i < globalCustomizationScripts.size(); ++i) {
|
||||
for (size_t i = 0; i < globalCustomizationScripts.size(); i++) {
|
||||
globalCustomizationScriptsDict.setValue(
|
||||
std::to_string(i),
|
||||
globalCustomizationScripts[i]
|
||||
@@ -340,7 +340,7 @@ ghoul::Dictionary Configuration::createDictionary() {
|
||||
res.setValue("GlobalCustomizationScripts", globalCustomizationScriptsDict);
|
||||
|
||||
ghoul::Dictionary fontsDict;
|
||||
for (auto it = fonts.begin(); it != fonts.end(); ++it) {
|
||||
for (auto it = fonts.begin(); it != fonts.end(); it++) {
|
||||
fontsDict.setValue(it->first, it->second);
|
||||
}
|
||||
res.setValue("Fonts", fontsDict);
|
||||
@@ -363,7 +363,7 @@ ghoul::Dictionary Configuration::createDictionary() {
|
||||
loggingDict.setValue("CapabilitiesVerbosity", logging.capabilitiesVerbosity);
|
||||
|
||||
ghoul::Dictionary logsDict;
|
||||
for (size_t i = 0; i < logging.logs.size(); ++i) {
|
||||
for (size_t i = 0; i < logging.logs.size(); i++) {
|
||||
logsDict.setValue(std::to_string(i), logging.logs[i]);
|
||||
}
|
||||
loggingDict.setValue("Logs", logsDict);
|
||||
@@ -413,7 +413,7 @@ ghoul::Dictionary Configuration::createDictionary() {
|
||||
res.setValue("LayerServer", layerServerToString(layerServer));
|
||||
|
||||
ghoul::Dictionary moduleConfigurationsDict;
|
||||
for (auto it = moduleConfigurations.begin(); it != moduleConfigurations.end(); ++it) {
|
||||
for (auto it = moduleConfigurations.begin(); it != moduleConfigurations.end(); it++) {
|
||||
moduleConfigurationsDict.setValue(it->first, it->second);
|
||||
}
|
||||
res.setValue("ModuleConfigurations", moduleConfigurationsDict);
|
||||
@@ -431,7 +431,7 @@ ghoul::Dictionary Configuration::createDictionary() {
|
||||
);
|
||||
|
||||
ghoul::Dictionary identifierFiltersDict;
|
||||
for (size_t i = 0; i < openGLDebugContext.severityFilters.size(); ++i) {
|
||||
for (size_t i = 0; i < openGLDebugContext.severityFilters.size(); i++) {
|
||||
{
|
||||
ghoul::Dictionary identifierFilterDict;
|
||||
identifierFilterDict.setValue(
|
||||
@@ -453,7 +453,7 @@ ghoul::Dictionary Configuration::createDictionary() {
|
||||
openGLDebugContextDict.setValue("IdentifierFilters", identifierFiltersDict);
|
||||
|
||||
ghoul::Dictionary severityFiltersDict;
|
||||
for (size_t i = 0; i < openGLDebugContext.severityFilters.size(); ++i) {
|
||||
for (size_t i = 0; i < openGLDebugContext.severityFilters.size(); i++) {
|
||||
severityFiltersDict.setValue(
|
||||
std::to_string(i),
|
||||
openGLDebugContext.severityFilters[i]
|
||||
|
||||
@@ -134,13 +134,6 @@ namespace {
|
||||
openspace::properties::Property::Visibility::Always
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo ShowHiddenSceneInfo = {
|
||||
"ShowHiddenSceneGraphNodes",
|
||||
"Show Hidden Scene Graph Nodes",
|
||||
"If checked, hidden scene graph nodes are visible in the UI",
|
||||
openspace::properties::Property::Visibility::AdvancedUser
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo FadeDurationInfo = {
|
||||
"FadeDuration",
|
||||
"Fade Duration (seconds)",
|
||||
@@ -172,6 +165,28 @@ namespace {
|
||||
global::renderEngine->renderingResolution()
|
||||
);
|
||||
}
|
||||
|
||||
void resetPropertyChangeFlagsOfSubowners(openspace::properties::PropertyOwner* po) {
|
||||
using namespace openspace;
|
||||
|
||||
for (properties::PropertyOwner* subOwner : po->propertySubOwners()) {
|
||||
resetPropertyChangeFlagsOfSubowners(subOwner);
|
||||
}
|
||||
for (properties::Property* p : po->properties()) {
|
||||
p->resetToUnchanged();
|
||||
}
|
||||
}
|
||||
|
||||
void resetPropertyChangeFlags() {
|
||||
ZoneScoped;
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes =
|
||||
openspace::global::renderEngine->scene()->allSceneGraphNodes();
|
||||
for (openspace::SceneGraphNode* n : nodes) {
|
||||
resetPropertyChangeFlagsOfSubowners(n);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -182,7 +197,6 @@ OpenSpaceEngine::OpenSpaceEngine()
|
||||
: properties::PropertyOwner({ "OpenSpaceEngine", "OpenSpace Engine" })
|
||||
, _printEvents(PrintEventsInfo, false)
|
||||
, _visibility(VisibilityInfo)
|
||||
, _showHiddenSceneGraphNodes(ShowHiddenSceneInfo, false)
|
||||
, _fadeOnEnableDuration(FadeDurationInfo, 1.f, 0.f, 5.f)
|
||||
, _disableAllMouseInputs(DisableMouseInputInfo, false)
|
||||
{
|
||||
@@ -202,7 +216,6 @@ OpenSpaceEngine::OpenSpaceEngine()
|
||||
});
|
||||
addProperty(_visibility);
|
||||
|
||||
addProperty(_showHiddenSceneGraphNodes);
|
||||
addProperty(_fadeOnEnableDuration);
|
||||
addProperty(_disableAllMouseInputs);
|
||||
}
|
||||
@@ -1012,11 +1025,10 @@ void OpenSpaceEngine::preSynchronization() {
|
||||
|
||||
global::syncEngine->preSynchronization(SyncEngine::IsMaster(master));
|
||||
if (master) {
|
||||
double dt = global::windowDelegate->deltaTime();
|
||||
|
||||
if (global::sessionRecording->isSavingFramesDuringPlayback()) {
|
||||
dt = global::sessionRecording->fixedDeltaTimeDuringFrameOutput();
|
||||
}
|
||||
const double dt =
|
||||
global::sessionRecording->isSavingFramesDuringPlayback() ?
|
||||
global::sessionRecording->fixedDeltaTimeDuringFrameOutput() :
|
||||
global::windowDelegate->deltaTime();
|
||||
|
||||
global::timeManager->preSynchronization(dt);
|
||||
|
||||
@@ -1210,25 +1222,6 @@ void OpenSpaceEngine::postDraw() {
|
||||
LTRACE("OpenSpaceEngine::postDraw(end)");
|
||||
}
|
||||
|
||||
void OpenSpaceEngine::resetPropertyChangeFlags() {
|
||||
ZoneScoped;
|
||||
|
||||
std::vector<SceneGraphNode*> nodes =
|
||||
global::renderEngine->scene()->allSceneGraphNodes();
|
||||
for (SceneGraphNode* n : nodes) {
|
||||
resetPropertyChangeFlagsOfSubowners(n);
|
||||
}
|
||||
}
|
||||
|
||||
void OpenSpaceEngine::resetPropertyChangeFlagsOfSubowners(properties::PropertyOwner* po) {
|
||||
for (properties::PropertyOwner* subOwner : po->propertySubOwners()) {
|
||||
resetPropertyChangeFlagsOfSubowners(subOwner);
|
||||
}
|
||||
for (properties::Property* p : po->properties()) {
|
||||
p->resetToUnchanged();
|
||||
}
|
||||
}
|
||||
|
||||
void OpenSpaceEngine::keyboardCallback(Key key, KeyModifier mod, KeyAction action,
|
||||
IsGuiWindow isGuiWindow)
|
||||
{
|
||||
@@ -1256,8 +1249,7 @@ void OpenSpaceEngine::keyboardCallback(Key key, KeyModifier mod, KeyAction actio
|
||||
return;
|
||||
}
|
||||
|
||||
using F = global::callback::KeyboardCallback;
|
||||
for (const F& func : *global::callback::keyboard) {
|
||||
for (const global::callback::KeyboardCallback& func : *global::callback::keyboard) {
|
||||
const bool isConsumed = func(key, mod, action, isGuiWindow);
|
||||
if (isConsumed) {
|
||||
return;
|
||||
@@ -1285,8 +1277,7 @@ void OpenSpaceEngine::charCallback(unsigned int codepoint, KeyModifier modifier,
|
||||
{
|
||||
ZoneScoped;
|
||||
|
||||
using F = global::callback::CharacterCallback;
|
||||
for (const F& func : *global::callback::character) {
|
||||
for (const global::callback::CharacterCallback& func : *global::callback::character) {
|
||||
bool isConsumed = func(codepoint, modifier, isGuiWindow);
|
||||
if (isConsumed) {
|
||||
return;
|
||||
@@ -1315,7 +1306,7 @@ void OpenSpaceEngine::mouseButtonCallback(MouseButton button, MouseAction action
|
||||
|
||||
using F = global::callback::MouseButtonCallback;
|
||||
for (const F& func : *global::callback::mouseButton) {
|
||||
bool isConsumed = func(button, action, mods, isGuiWindow);
|
||||
const bool isConsumed = func(button, action, mods, isGuiWindow);
|
||||
if (isConsumed) {
|
||||
// If the mouse was released, we still want to forward it to the navigation
|
||||
// handler in order to reliably terminate a rotation or zoom, or to the other
|
||||
@@ -1475,14 +1466,10 @@ void OpenSpaceEngine::decode(std::vector<std::byte> data) {
|
||||
global::syncEngine->decodeSyncables(std::move(data));
|
||||
}
|
||||
|
||||
properties::Property::Visibility openspace::OpenSpaceEngine::visibility() const {
|
||||
properties::Property::Visibility OpenSpaceEngine::visibility() const {
|
||||
return static_cast<properties::Property::Visibility>(_visibility.value());
|
||||
}
|
||||
|
||||
bool openspace::OpenSpaceEngine::showHiddenSceneGraphNodes() const {
|
||||
return _showHiddenSceneGraphNodes;
|
||||
}
|
||||
|
||||
void OpenSpaceEngine::toggleShutdownMode() {
|
||||
if (_shutdown.inShutdown) {
|
||||
// If we are already in shutdown mode, we want to disable it
|
||||
@@ -1535,7 +1522,7 @@ void OpenSpaceEngine::resetMode() {
|
||||
}
|
||||
|
||||
OpenSpaceEngine::CallbackHandle OpenSpaceEngine::addModeChangeCallback(
|
||||
ModeChangeCallback cb)
|
||||
ModeChangeCallback cb)
|
||||
{
|
||||
CallbackHandle handle = _nextCallbackHandle++;
|
||||
_modeChangeCallbacks.emplace_back(handle, std::move(cb));
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace {
|
||||
ghoul::filesystem::FileSystem::Override::Yes
|
||||
);
|
||||
|
||||
global::windowDelegate->setScreenshotFolder(folder.string());
|
||||
global::windowDelegate->setScreenshotFolder(std::move(folder));
|
||||
}
|
||||
|
||||
// Adds a Tag to a SceneGraphNode identified by the provided uri
|
||||
|
||||
@@ -74,7 +74,7 @@ void JoystickCameraStates::updateStateFromInput(
|
||||
int nAxes = joystickInputStates.numAxes(joystickInputState.name);
|
||||
for (int i = 0;
|
||||
i < std::min(nAxes, static_cast<int>(joystick->axisMapping.size()));
|
||||
++i)
|
||||
i++)
|
||||
{
|
||||
AxisInformation t = joystick->axisMapping[i];
|
||||
if (t.type == AxisType::None) {
|
||||
@@ -177,9 +177,9 @@ void JoystickCameraStates::updateStateFromInput(
|
||||
}
|
||||
|
||||
int nButtons = joystickInputStates.numButtons(joystickInputState.name);
|
||||
for (int i = 0; i < nButtons; ++i) {
|
||||
for (int i = 0; i < nButtons; i++) {
|
||||
auto itRange = joystick->buttonMapping.equal_range(i);
|
||||
for (auto it = itRange.first; it != itRange.second; ++it) {
|
||||
for (auto it = itRange.first; it != itRange.second; it++) {
|
||||
bool active = global::joystickInputStates->button(
|
||||
joystickInputState.name,
|
||||
i,
|
||||
@@ -378,7 +378,7 @@ void JoystickCameraStates::clearButtonCommand(const std::string& joystickName,
|
||||
it = joystick->buttonMapping.erase(it);
|
||||
}
|
||||
else {
|
||||
++it;
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -394,7 +394,7 @@ std::vector<std::string> JoystickCameraStates::buttonCommand(
|
||||
}
|
||||
|
||||
auto itRange = joystick->buttonMapping.equal_range(button);
|
||||
for (auto it = itRange.first; it != itRange.second; ++it) {
|
||||
for (auto it = itRange.first; it != itRange.second; it++) {
|
||||
result.push_back(it->second.command);
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace openspace::interaction {
|
||||
int JoystickInputStates::numAxes(const std::string& joystickName) const {
|
||||
if (joystickName.empty()) {
|
||||
int maxNumAxes = -1;
|
||||
for (auto it = begin(); it < end(); ++it) {
|
||||
for (auto it = begin(); it < end(); it++) {
|
||||
if (it->nAxes > maxNumAxes) {
|
||||
maxNumAxes = it->nAxes;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ int JoystickInputStates::numAxes(const std::string& joystickName) const {
|
||||
return maxNumAxes;
|
||||
}
|
||||
|
||||
for (auto it = begin(); it < end(); ++it) {
|
||||
for (auto it = begin(); it < end(); it++) {
|
||||
if (it->name == joystickName) {
|
||||
return it->nAxes;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ int JoystickInputStates::numAxes(const std::string& joystickName) const {
|
||||
int JoystickInputStates::numButtons(const std::string& joystickName) const {
|
||||
if (joystickName.empty()) {
|
||||
int maxNumButtons = -1;
|
||||
for (auto it = begin(); it < end(); ++it) {
|
||||
for (auto it = begin(); it < end(); it++) {
|
||||
if (it->nButtons > maxNumButtons) {
|
||||
maxNumButtons = it->nButtons;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ int JoystickInputStates::numButtons(const std::string& joystickName) const {
|
||||
return maxNumButtons;
|
||||
}
|
||||
|
||||
for (auto it = begin(); it < end(); ++it) {
|
||||
for (auto it = begin(); it < end(); it++) {
|
||||
if (it->name == joystickName) {
|
||||
return it->nButtons;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ float JoystickInputStates::axis(const std::string& joystickName, int axis) const
|
||||
}
|
||||
|
||||
const JoystickInputState* state = nullptr;
|
||||
for (auto it = begin(); it < end(); ++it) {
|
||||
for (auto it = begin(); it < end(); it++) {
|
||||
if (it->name == joystickName) {
|
||||
state = &(*it);
|
||||
}
|
||||
@@ -124,7 +124,7 @@ bool JoystickInputStates::button(const std::string& joystickName, int button,
|
||||
}
|
||||
|
||||
const JoystickInputState* state = nullptr;
|
||||
for (auto it = begin(); it < end(); ++it) {
|
||||
for (auto it = begin(); it < end(); it++) {
|
||||
if (it->name == joystickName) {
|
||||
state = &(*it);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ void KeybindingManager::keyboardCallback(Key key, KeyModifier modifier, KeyActio
|
||||
if (action == KeyAction::Press || action == KeyAction::Repeat) {
|
||||
// iterate over key bindings
|
||||
auto ret = _keyLua.equal_range({ key, modifier });
|
||||
for (auto it = ret.first; it != ret.second; ++it) {
|
||||
for (auto it = ret.first; it != ret.second; it++) {
|
||||
ghoul_assert(!it->second.empty(), "Action must not be empty");
|
||||
if (!global::actionManager->hasAction(it->second)) {
|
||||
// Silently ignoring the unknown action as the user might have intended to
|
||||
@@ -93,7 +93,7 @@ void KeybindingManager::removeKeyBinding(const KeyWithModifier& key) {
|
||||
}
|
||||
else {
|
||||
// If it is not, we continue iteration
|
||||
++it;
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ std::vector<std::pair<KeyWithModifier, std::string>> KeybindingManager::keyBindi
|
||||
std::vector<std::pair<KeyWithModifier, std::string>> result;
|
||||
|
||||
auto itRange = _keyLua.equal_range(key);
|
||||
for (auto it = itRange.first; it != itRange.second; ++it) {
|
||||
for (auto it = itRange.first; it != itRange.second; it++) {
|
||||
result.emplace_back(it->first, it->second);
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -49,7 +49,7 @@ void WebsocketCameraStates::updateStateFromInput(
|
||||
std::pair<bool, glm::dvec2> localRotation = std::pair(false, glm::dvec2(0.0));
|
||||
|
||||
if (!websocketInputStates.empty()) {
|
||||
for (int i = 0; i < WebsocketInputState::MaxAxes; ++i) {
|
||||
for (int i = 0; i < WebsocketInputState::MaxAxes; i++) {
|
||||
AxisInformation t = _axisMapping[i];
|
||||
if (t.type == AxisType::None) {
|
||||
continue;
|
||||
@@ -198,7 +198,7 @@ void WebsocketCameraStates::clearButtonCommand(int button) {
|
||||
it = _buttonMapping.erase(it);
|
||||
}
|
||||
else {
|
||||
++it;
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,7 +206,7 @@ void WebsocketCameraStates::clearButtonCommand(int button) {
|
||||
std::vector<std::string> WebsocketCameraStates::buttonCommand(int button) const {
|
||||
std::vector<std::string> result;
|
||||
auto itRange = _buttonMapping.equal_range(button);
|
||||
for (auto it = itRange.first; it != itRange.second; ++it) {
|
||||
for (auto it = itRange.first; it != itRange.second; it++) {
|
||||
result.push_back(it->second.command);
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -104,7 +104,7 @@ void PathCurve::initializeParameterData() {
|
||||
double sStart = _lengthSums[i];
|
||||
_parameterSamples.push_back({ uStart, sStart });
|
||||
// Intermediate sampels
|
||||
for (int j = 1; j < Steps; ++j) {
|
||||
for (int j = 1; j < Steps; j++) {
|
||||
double u = uStart + j * uStep;
|
||||
double s = sStart + arcLength(uStart, u);
|
||||
// Identify samples that are indistinguishable due to precision limitations
|
||||
@@ -185,7 +185,7 @@ double PathCurve::curveParameter(double s) const {
|
||||
double lower = uMin;
|
||||
double upper = uMax;
|
||||
|
||||
for (int i = 0; i < maxIterations; ++i) {
|
||||
for (int i = 0; i < maxIterations; i++) {
|
||||
double F = arcLength(uMin, u) - segmentS;
|
||||
|
||||
// The error we tolerate, in meters. Note that distances are very large
|
||||
|
||||
@@ -139,7 +139,7 @@ void AvoidCollisionCurve::removeCollisions(int step) {
|
||||
}
|
||||
|
||||
const int nSegments = static_cast<int>(_points.size() - 3);
|
||||
for (int i = 0; i < nSegments; ++i) {
|
||||
for (int i = 0; i < nSegments; i++) {
|
||||
const glm::dvec3 lineStart = _points[i + 1];
|
||||
const glm::dvec3 lineEnd = _points[i + 2];
|
||||
|
||||
|
||||
@@ -737,7 +737,7 @@ void ParallelPeer::sendTimeTimeline() {
|
||||
timelineMessage._keyframes.reserve(timeline.nKeyframes());
|
||||
|
||||
// Case 1: Copy all keyframes from the native timeline
|
||||
for (size_t i = 0; i < timeline.nKeyframes(); ++i) {
|
||||
for (size_t i = 0; i < timeline.nKeyframes(); i++) {
|
||||
const Keyframe<TimeKeyframeData>& kf = keyframes.at(i);
|
||||
|
||||
datamessagestructures::TimeKeyframe kfMessage;
|
||||
|
||||
@@ -84,7 +84,7 @@ void OptionProperty::addOptions(std::vector<std::pair<int, std::string>> options
|
||||
}
|
||||
|
||||
void OptionProperty::addOptions(std::vector<std::string> options) {
|
||||
for (int i = 0; i < static_cast<int>(options.size()); ++i) {
|
||||
for (int i = 0; i < static_cast<int>(options.size()); i++) {
|
||||
addOption(i, std::move(options[i]));
|
||||
}
|
||||
}
|
||||
@@ -96,7 +96,7 @@ void OptionProperty::clearOptions() {
|
||||
|
||||
void OptionProperty::setValue(int value) {
|
||||
// Check if the passed value belongs to any option
|
||||
for (size_t i = 0; i < _options.size(); ++i) {
|
||||
for (size_t i = 0; i < _options.size(); i++) {
|
||||
const Option& o = _options[i];
|
||||
if (o.value == value) {
|
||||
// If it does, set it by calling the superclasses setValue method
|
||||
@@ -156,7 +156,7 @@ std::string OptionProperty::generateAdditionalJsonDescription() const {
|
||||
// @REFACTOR from selectionproperty.cpp, possible refactoring? ---abock
|
||||
std::string result =
|
||||
"{ \"" + OptionsKey + "\": [";
|
||||
for (size_t i = 0; i < _options.size(); ++i) {
|
||||
for (size_t i = 0; i < _options.size(); i++) {
|
||||
const Option& o = _options[i];
|
||||
std::string v = std::to_string(o.value);
|
||||
std::string vSan = escapedJson(v);
|
||||
|
||||
@@ -160,7 +160,7 @@ bool SelectionProperty::removeInvalidKeys(std::set<std::string>& keys) {
|
||||
changed = true;
|
||||
}
|
||||
else {
|
||||
++it;
|
||||
it++;
|
||||
}
|
||||
}
|
||||
return changed;
|
||||
|
||||
@@ -280,7 +280,7 @@ ColorMappingComponent::ColorMappingComponent(const ghoul::Dictionary& dictionary
|
||||
std::vector<Parameters::ColorMapParameter> opts = *p.parameterOptions;
|
||||
|
||||
_colorRangeData.reserve(opts.size());
|
||||
for (size_t i = 0; i < opts.size(); ++i) {
|
||||
for (size_t i = 0; i < opts.size(); i++) {
|
||||
dataColumn.addOption(static_cast<int>(i), opts[i].key);
|
||||
// Add the provided range or an empty range. We will fill it later on,
|
||||
// when the dataset is loaded, if it is empty
|
||||
@@ -464,7 +464,7 @@ void ColorMappingComponent::initializeParameterData(const dataloader::Dataset& d
|
||||
}
|
||||
else {
|
||||
// Otherwise, check if the selected columns exist
|
||||
for (size_t i = 0; i < dataColumn.options().size(); ++i) {
|
||||
for (size_t i = 0; i < dataColumn.options().size(); i++) {
|
||||
std::string o = dataColumn.options()[i].description;
|
||||
|
||||
bool found = false;
|
||||
|
||||
@@ -157,7 +157,7 @@ void FramebufferRenderer::initialize() {
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexPositionBuffer);
|
||||
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertexData), vertexData, GL_STATIC_DRAW);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 2, nullptr);
|
||||
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(GLfloat), nullptr);
|
||||
glEnableVertexAttribArray(0);
|
||||
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_defaultFBO);
|
||||
@@ -970,7 +970,7 @@ void FramebufferRenderer::updateRaycastData() {
|
||||
|
||||
try {
|
||||
_exitPrograms[raycaster] = ghoul::opengl::ProgramObject::Build(
|
||||
"Volume " + std::to_string(data.id) + " exit",
|
||||
fmt::format("Volume {} exit", data.id),
|
||||
absPath(vsPath),
|
||||
absPath(ExitFragmentShaderPath),
|
||||
dict
|
||||
@@ -983,7 +983,7 @@ void FramebufferRenderer::updateRaycastData() {
|
||||
ghoul::Dictionary outsideDict = dict;
|
||||
outsideDict.setValue("getEntryPath", std::string(GetEntryOutsidePath));
|
||||
_raycastPrograms[raycaster] = ghoul::opengl::ProgramObject::Build(
|
||||
"Volume " + std::to_string(data.id) + " raycast",
|
||||
fmt::format("Volume {} raycast", data.id),
|
||||
absPath(vsPath),
|
||||
absPath(RaycastFragmentShaderPath),
|
||||
outsideDict
|
||||
@@ -996,7 +996,7 @@ void FramebufferRenderer::updateRaycastData() {
|
||||
ghoul::Dictionary insideDict = dict;
|
||||
insideDict.setValue("getEntryPath", std::string(GetEntryInsidePath));
|
||||
_insideRaycastPrograms[raycaster] = ghoul::opengl::ProgramObject::Build(
|
||||
"Volume " + std::to_string(data.id) + " inside raycast",
|
||||
fmt::format("Volume {} inside raycast", data.id),
|
||||
absPath("${SHADERS}/framebuffer/resolveframebuffer.vert"),
|
||||
absPath(RaycastFragmentShaderPath),
|
||||
insideDict
|
||||
@@ -1037,7 +1037,7 @@ void FramebufferRenderer::updateDeferredcastData() {
|
||||
|
||||
try {
|
||||
_deferredcastPrograms[caster] = ghoul::opengl::ProgramObject::Build(
|
||||
"Deferred " + std::to_string(data.id) + " raycast",
|
||||
fmt::format("Deferred {} raycast", data.id),
|
||||
vsPath,
|
||||
fsPath,
|
||||
dict
|
||||
@@ -1045,7 +1045,7 @@ void FramebufferRenderer::updateDeferredcastData() {
|
||||
|
||||
caster->initializeCachedVariables(*_deferredcastPrograms[caster]);
|
||||
}
|
||||
catch (ghoul::RuntimeError& e) {
|
||||
catch (const ghoul::RuntimeError& e) {
|
||||
LERRORC(e.component, e.message);
|
||||
}
|
||||
}
|
||||
@@ -1476,20 +1476,15 @@ void FramebufferRenderer::setGamma(float gamma) {
|
||||
_gamma = std::move(gamma);
|
||||
}
|
||||
|
||||
void FramebufferRenderer::setHue(float hue) {
|
||||
void FramebufferRenderer::setHueValueSaturation(float hue, float value, float saturation)
|
||||
{
|
||||
_hue = std::move(hue);
|
||||
}
|
||||
|
||||
void FramebufferRenderer::setValue(float value) {
|
||||
_value = std::move(value);
|
||||
}
|
||||
|
||||
void FramebufferRenderer::setSaturation(float sat) {
|
||||
_saturation = std::move(sat);
|
||||
_saturation = std::move(saturation);
|
||||
}
|
||||
|
||||
void FramebufferRenderer::enableFXAA(bool enable) {
|
||||
_enableFXAA = std::move(enable);
|
||||
_enableFXAA = enable;
|
||||
}
|
||||
|
||||
void FramebufferRenderer::updateRendererData() {
|
||||
|
||||
@@ -524,7 +524,7 @@ std::vector<Vertex> createRing(int nSegments, float radius, glm::vec4 colors) {
|
||||
const int nVertices = nSegments + 1;
|
||||
std::vector<Vertex> vertices(nVertices);
|
||||
|
||||
for (int i = 0; i <= nSegments; ++i) {
|
||||
for (int i = 0; i <= nSegments; i++) {
|
||||
vertices[i] = computeCircleVertex(i, nSegments, radius, colors);
|
||||
}
|
||||
return vertices;
|
||||
@@ -534,7 +534,7 @@ std::vector<VertexXYZ> createRingXYZ(int nSegments, float radius) {
|
||||
const int nVertices = nSegments + 1;
|
||||
std::vector<VertexXYZ> vertices(nVertices);
|
||||
|
||||
for (int i = 0; i <= nSegments; ++i) {
|
||||
for (int i = 0; i <= nSegments; i++) {
|
||||
Vertex fullVertex = computeCircleVertex(i, nSegments, radius);
|
||||
vertices[i] = { fullVertex.xyz[0], fullVertex.xyz[1], fullVertex.xyz[2] };
|
||||
}
|
||||
@@ -696,7 +696,7 @@ VertexIndexListCombo<VertexXYZNormal> createConicalCylinder(unsigned int nSegmen
|
||||
GLushort botCenterIndex = 0;
|
||||
GLushort topCenterIndex = static_cast<GLushort>(vertices.size()) - 1;
|
||||
|
||||
for (unsigned int i = 0; i < nSegments; ++i) {
|
||||
for (unsigned int i = 0; i < nSegments; i++) {
|
||||
bool isLast = (i == nSegments - 1);
|
||||
GLushort v0, v1, v2, v3;
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ void LoadingScreen::exec(AssetManager& manager, Scene& scene) {
|
||||
LoadingScreen::ItemStatus::Started,
|
||||
progressInfo
|
||||
);
|
||||
++it;
|
||||
it++;
|
||||
}
|
||||
else if ((*it)->isRejected()) {
|
||||
updateItem(
|
||||
@@ -239,7 +239,7 @@ void LoadingScreen::exec(AssetManager& manager, Scene& scene) {
|
||||
LoadingScreen::ItemStatus::Failed,
|
||||
LoadingScreen::ProgressInfo()
|
||||
);
|
||||
++it;
|
||||
it++;
|
||||
}
|
||||
else {
|
||||
LoadingScreen::ProgressInfo progressInfo;
|
||||
@@ -407,7 +407,7 @@ void LoadingScreen::render() {
|
||||
glm::vec2 ll = glm::vec2(0.f);
|
||||
glm::vec2 ur = glm::vec2(0.f);
|
||||
int i = 0;
|
||||
for (; i < MaxNumberLocationSamples; ++i) {
|
||||
for (; i < MaxNumberLocationSamples; i++) {
|
||||
std::uniform_int_distribution<int> distX(
|
||||
15,
|
||||
static_cast<int>(res.x - b.x - 15)
|
||||
|
||||
@@ -210,7 +210,7 @@ void LuaConsole::initialize() {
|
||||
int64_t nCommands;
|
||||
file.read(reinterpret_cast<char*>(&nCommands), sizeof(int64_t));
|
||||
|
||||
for (int64_t i = 0; i < nCommands; ++i) {
|
||||
for (int64_t i = 0; i < nCommands; i++) {
|
||||
int64_t length;
|
||||
file.read(reinterpret_cast<char*>(&length), sizeof(int64_t));
|
||||
|
||||
@@ -500,7 +500,7 @@ bool LuaConsole::keyboardCallback(Key key, KeyModifier modifier, KeyAction actio
|
||||
_autoCompleteInfo.hasInitialValue = true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < static_cast<int>(allCommands.size()); ++i) {
|
||||
for (int i = 0; i < static_cast<int>(allCommands.size()); i++) {
|
||||
const std::string& command = allCommands[i];
|
||||
|
||||
// Check if the command has enough length (we don't want crashes here)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
@@ -376,13 +375,16 @@ RenderEngine::RenderEngine()
|
||||
_gamma.onChange([this]() { _renderer.setGamma(_gamma); });
|
||||
addProperty(_gamma);
|
||||
|
||||
_hue.onChange([this]() { _renderer.setHue(_hue / 360.f); });
|
||||
auto setHueValueSaturation = [this]() {
|
||||
_renderer.setHueValueSaturation(_hue / 360.f, _value, _saturation);
|
||||
};
|
||||
_hue.onChange(setHueValueSaturation);
|
||||
addProperty(_hue);
|
||||
|
||||
_saturation.onChange([this]() { _renderer.setSaturation(_saturation); });
|
||||
_saturation.onChange(setHueValueSaturation);
|
||||
addProperty(_saturation);
|
||||
|
||||
_value.onChange([this]() { _renderer.setValue(_value); });
|
||||
_value.onChange(setHueValueSaturation);
|
||||
addProperty(_value);
|
||||
|
||||
addProperty(_globalBlackOutFactor);
|
||||
@@ -429,7 +431,7 @@ RenderEngine::RenderEngine()
|
||||
ghoul::filesystem::FileSystem::Override::Yes
|
||||
);
|
||||
}
|
||||
global::windowDelegate->setScreenshotFolder(absPath("${SCREENSHOTS}").string());
|
||||
global::windowDelegate->setScreenshotFolder(absPath("${SCREENSHOTS}"));
|
||||
});
|
||||
addProperty(_screenshotUseDate);
|
||||
|
||||
@@ -448,10 +450,10 @@ RenderEngine::RenderEngine()
|
||||
addProperty(_masterRotation);
|
||||
addProperty(_disableMasterRendering);
|
||||
|
||||
_enabledFontColor.setViewOption(openspace::properties::Property::ViewOptions::Color);
|
||||
_enabledFontColor.setViewOption(properties::Property::ViewOptions::Color);
|
||||
addProperty(_enabledFontColor);
|
||||
|
||||
_disabledFontColor.setViewOption(openspace::properties::Property::ViewOptions::Color);
|
||||
_disabledFontColor.setViewOption(properties::Property::ViewOptions::Color);
|
||||
addProperty(_disabledFontColor);
|
||||
}
|
||||
|
||||
@@ -492,7 +494,7 @@ void RenderEngine::initialize() {
|
||||
if (global::versionChecker->hasLatestVersionInfo()) {
|
||||
VersionChecker::SemanticVersion latest = global::versionChecker->latestVersion();
|
||||
|
||||
VersionChecker::SemanticVersion current{
|
||||
VersionChecker::SemanticVersion current {
|
||||
OPENSPACE_VERSION_MAJOR,
|
||||
OPENSPACE_VERSION_MINOR,
|
||||
OPENSPACE_VERSION_PATCH
|
||||
@@ -755,7 +757,7 @@ void RenderEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& viewMat
|
||||
ssrs.begin(),
|
||||
ssrs.end(),
|
||||
[](ScreenSpaceRenderable* lhs, ScreenSpaceRenderable* rhs) {
|
||||
// Render back to front.
|
||||
// Render back to front
|
||||
return lhs->depth() > rhs->depth();
|
||||
}
|
||||
);
|
||||
@@ -1180,8 +1182,8 @@ void RenderEngine::renderCameraInformation() {
|
||||
return;
|
||||
}
|
||||
|
||||
const glm::vec4 EnabledColor = _enabledFontColor.value();
|
||||
const glm::vec4 DisabledColor = _disabledFontColor.value();
|
||||
const glm::vec4 EnabledColor = _enabledFontColor;
|
||||
const glm::vec4 DisabledColor = _disabledFontColor;
|
||||
|
||||
const glm::vec2 rotationBox = _fontCameraInfo->boundingBox("Rotation");
|
||||
|
||||
@@ -1356,7 +1358,7 @@ void RenderEngine::renderScreenLog() {
|
||||
std::string_view message = std::string_view(it.message).substr(0, MessageLength);
|
||||
nRows += std::count(message.begin(), message.end(), '\n');
|
||||
|
||||
const glm::vec4 white(0.9f, 0.9f, 0.9f, alpha);
|
||||
const glm::vec4 white = glm::vec4(0.9f, 0.9f, 0.9f, alpha);
|
||||
|
||||
std::array<char, 15 + 1 + CategoryLength + 3> buf;
|
||||
{
|
||||
|
||||
@@ -130,7 +130,7 @@ void TransferFunction::setTextureFromTxt() {
|
||||
float intensity;
|
||||
glm::vec4 rgba = glm::vec4(0.f);
|
||||
iss >> intensity;
|
||||
for(int i = 0; i < 4; ++i) {
|
||||
for(int i = 0; i < 4; i++) {
|
||||
iss >> rgba[i];
|
||||
}
|
||||
mappingKeys.emplace_back(intensity, rgba);
|
||||
@@ -152,7 +152,7 @@ void TransferFunction::setTextureFromTxt() {
|
||||
|
||||
// allocate new float array with zeros
|
||||
float* transferFunction = new float[width * 4];
|
||||
for (int i = 0; i < 4 * width; ++i) {
|
||||
for (int i = 0; i < 4 * width; i++) {
|
||||
transferFunction[i] = 0.f;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ void TransferFunction::setTextureFromTxt() {
|
||||
auto currentKey = prevKey + 1;
|
||||
auto lastKey = mappingKeys.end() -1;
|
||||
|
||||
for (size_t i = lowerIndex; i <= upperIndex; ++i) {
|
||||
for (size_t i = lowerIndex; i <= upperIndex; i++) {
|
||||
const float fpos = static_cast<float>(i) / static_cast<float>(width-1);
|
||||
if (fpos > currentKey->position) {
|
||||
prevKey = currentKey;
|
||||
|
||||
@@ -169,7 +169,7 @@ void AssetManager::update() {
|
||||
|
||||
// Initialize all assets that have been loaded and synchronized but that not yet
|
||||
// initialized
|
||||
for (auto it = _toBeInitialized.cbegin(); it != _toBeInitialized.cend(); ++it) {
|
||||
for (auto it = _toBeInitialized.cbegin(); it != _toBeInitialized.cend(); it++) {
|
||||
ZoneScopedN("Initializing queued assets");
|
||||
Asset* a = *it;
|
||||
|
||||
@@ -297,7 +297,7 @@ void AssetManager::update() {
|
||||
it = _unfinishedSynchronizations.erase(it);
|
||||
}
|
||||
else {
|
||||
++it;
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -575,7 +575,7 @@ void convertVersion10to11(nlohmann::json& profile) {
|
||||
|
||||
std::vector<version10::Keybinding> kbs =
|
||||
profile.at("keybindings").get<std::vector<version10::Keybinding>>();
|
||||
for (size_t i = 0; i < kbs.size(); ++i) {
|
||||
for (size_t i = 0; i < kbs.size(); i++) {
|
||||
version10::Keybinding& kb = kbs[i];
|
||||
std::string identifier = fmt::format("profile.keybind.{}", i);
|
||||
|
||||
|
||||
@@ -580,7 +580,7 @@ void ScriptEngine::decode(SyncBuffer* syncBuffer) {
|
||||
size_t nScripts;
|
||||
syncBuffer->decode(nScripts);
|
||||
|
||||
for (size_t i = 0; i < nScripts; ++i) {
|
||||
for (size_t i = 0; i < nScripts; i++) {
|
||||
std::string script;
|
||||
syncBuffer->decode(script);
|
||||
_clientScriptQueue.push(std::move(script));
|
||||
|
||||
@@ -150,7 +150,7 @@ void ScriptScheduler::clearSchedule(std::optional<int> group) {
|
||||
it = _scripts.erase(it);
|
||||
}
|
||||
else {
|
||||
++it;
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ std::vector<std::string> ScriptScheduler::progressTo(double newTime) {
|
||||
// Construct result
|
||||
for (auto iter = _scripts.begin() + prevIndex;
|
||||
iter < (_scripts.begin() + _currentIndex);
|
||||
++iter)
|
||||
iter++)
|
||||
{
|
||||
std::string script = iter->universalScript.empty() ?
|
||||
iter->forwardScript :
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace {
|
||||
);
|
||||
|
||||
std::vector<scripting::ScriptScheduler::ScheduledScript> scripts;
|
||||
for (size_t i = 1; i <= scriptsDict.size(); ++i) {
|
||||
for (size_t i = 1; i <= scriptsDict.size(); i++) {
|
||||
ghoul::Dictionary d = scriptsDict.value<ghoul::Dictionary>(std::to_string(i));
|
||||
|
||||
scripting::ScriptScheduler::ScheduledScript script =
|
||||
|
||||
@@ -42,7 +42,7 @@ Histogram::Histogram(float minValue, float maxValue, int numBins, float* data)
|
||||
{
|
||||
if (!data) {
|
||||
_data = new float[numBins];
|
||||
for (int i = 0; i < numBins; ++i) {
|
||||
for (int i = 0; i < numBins; i++) {
|
||||
_data[i] = 0.0;
|
||||
}
|
||||
}
|
||||
@@ -268,7 +268,7 @@ float Histogram::equalize(float value) const {
|
||||
|
||||
float Histogram::entropy() {
|
||||
float entropy = 0.f;
|
||||
for (int i = 0; i < _numBins; ++i) {
|
||||
for (int i = 0; i < _numBins; i++) {
|
||||
if (_data[i] != 0) {
|
||||
entropy -= (_data[i] / static_cast<float>(_numValues)) *
|
||||
(log2(_data[i]) / static_cast<float>(_numValues));
|
||||
|
||||
+2
-2
@@ -90,8 +90,8 @@ Sphere::Sphere(glm::vec3 radius, int segments)
|
||||
|
||||
nr = 0;
|
||||
// define indices for all triangles
|
||||
for (int i = 1; i <= segments; ++i) {
|
||||
for (int j = 0; j < segments; ++j) {
|
||||
for (int i = 1; i <= segments; i++) {
|
||||
for (int j = 0; j < segments; j++) {
|
||||
const int t = segments + 1;
|
||||
_iarray[nr] = t * (i - 1) + j + 0; //1
|
||||
++nr;
|
||||
|
||||
@@ -973,7 +973,7 @@ SpiceManager::FieldOfViewResult SpiceManager::fieldOfView(int instrument) const
|
||||
}
|
||||
|
||||
res.bounds.reserve(nrReturned);
|
||||
for (int i = 0; i < nrReturned; ++i) {
|
||||
for (int i = 0; i < nrReturned; i++) {
|
||||
res.bounds.emplace_back(boundsArr[i][0], boundsArr[i][1], boundsArr[i][2]);
|
||||
}
|
||||
|
||||
@@ -1060,7 +1060,7 @@ void SpiceManager::findCkCoverage(const std::string& path) {
|
||||
throwSpiceError("Error finding Ck Coverage");
|
||||
}
|
||||
|
||||
for (SpiceInt i = 0; i < card_c(&ids); ++i) {
|
||||
for (SpiceInt i = 0; i < card_c(&ids); i++) {
|
||||
const SpiceInt frame = SPICE_CELL_ELEM_I(&ids, i);
|
||||
|
||||
#if defined __clang__
|
||||
@@ -1078,7 +1078,7 @@ void SpiceManager::findCkCoverage(const std::string& path) {
|
||||
// Get the number of intervals in the coverage window.
|
||||
const SpiceInt numberOfIntervals = wncard_c(&cover);
|
||||
|
||||
for (SpiceInt j = 0; j < numberOfIntervals; ++j) {
|
||||
for (SpiceInt j = 0; j < numberOfIntervals; j++) {
|
||||
// Get the endpoints of the jth interval.
|
||||
SpiceDouble b, e;
|
||||
wnfetd_c(&cover, j, &b, &e);
|
||||
@@ -1119,7 +1119,7 @@ void SpiceManager::findSpkCoverage(const std::string& path) {
|
||||
throwSpiceError("Error finding Spk ID for coverage");
|
||||
}
|
||||
|
||||
for (SpiceInt i = 0; i < card_c(&ids); ++i) {
|
||||
for (SpiceInt i = 0; i < card_c(&ids); i++) {
|
||||
const SpiceInt obj = SPICE_CELL_ELEM_I(&ids, i);
|
||||
|
||||
#if defined __clang__
|
||||
@@ -1137,7 +1137,7 @@ void SpiceManager::findSpkCoverage(const std::string& path) {
|
||||
// Get the number of intervals in the coverage window.
|
||||
const SpiceInt numberOfIntervals = wncard_c(&cover);
|
||||
|
||||
for (SpiceInt j = 0; j < numberOfIntervals; ++j) {
|
||||
for (SpiceInt j = 0; j < numberOfIntervals; j++) {
|
||||
//Get the endpoints of the jth interval.
|
||||
SpiceDouble b, e;
|
||||
wnfetd_c(&cover, j, &b, &e);
|
||||
|
||||
@@ -57,7 +57,7 @@ void Worker::operator()() {
|
||||
}
|
||||
|
||||
ThreadPool::ThreadPool(size_t numThreads) : stop(false) {
|
||||
for (size_t i = 0; i < numThreads; ++i) {
|
||||
for (size_t i = 0; i < numThreads; i++) {
|
||||
workers.emplace_back(std::thread(Worker(*this)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -523,7 +523,7 @@ void TimeManager::addDeltaTimesKeybindings() {
|
||||
|
||||
// For each key, add upp to three keybinds (no modifier, then SHIFT and then CTRL),
|
||||
// plus inverted version of each time step one using the ALT modifier
|
||||
for (int i = 0; i < nSteps; ++i) {
|
||||
for (int i = 0; i < nSteps; i++) {
|
||||
const Key key = Keys[i % nKeys];
|
||||
const double deltaTimeStep = steps[i];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user