diff --git a/ext/ghoul b/ext/ghoul index 629a0c09be..cf5b311dda 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 629a0c09be20431077c365f6fa3ae4c21d7c1f85 +Subproject commit cf5b311ddac167c8542914afc54a9f878c7a79ce diff --git a/include/openspace/documentation/documentationengine.h b/include/openspace/documentation/documentationengine.h index 24760ed2d7..26dd0e14f9 100644 --- a/include/openspace/documentation/documentationengine.h +++ b/include/openspace/documentation/documentationengine.h @@ -105,7 +105,7 @@ public: * will just contain one item, but some modules may wish to provide * multiple templates for subtypes, etc */ - void writeDocumentationHtml(const std::string path, const std::string data); + void writeDocumentationHtml(const std::string& path, std::string data); std::string generateJson() const override; diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h index c6d5888d42..f0d8523264 100644 --- a/include/openspace/engine/openspaceengine.h +++ b/include/openspace/engine/openspaceengine.h @@ -117,7 +117,7 @@ private: //grabs json from each module to pass to the documentation engine. std::string _documentationJson; - + ShutdownInformation _shutdown; // The first frame might take some more time in the update loop, so we need to know to diff --git a/include/openspace/interaction/sessionrecording.h b/include/openspace/interaction/sessionrecording.h index 0e83b6193b..470f018fcb 100644 --- a/include/openspace/interaction/sessionrecording.h +++ b/include/openspace/interaction/sessionrecording.h @@ -283,7 +283,7 @@ private: bool _playbackActive_script = false; bool _hasHitEndOfCameraKeyframes = false; bool _setSimulationTimeWithNextCameraKeyframe = false; - + bool _saveRenderingDuringPlayback = false; double _saveRenderingDeltaTime = 1.0 / 30.0; double _saveRenderingCurrentRecordedTime; diff --git a/include/openspace/rendering/framebufferrenderer.h b/include/openspace/rendering/framebufferrenderer.h index 8a8b073759..cf954596d1 100644 --- a/include/openspace/rendering/framebufferrenderer.h +++ b/include/openspace/rendering/framebufferrenderer.h @@ -91,7 +91,7 @@ public: void update() override; void performRaycasterTasks(const std::vector& tasks); - void performDeferredTasks(const std::vector& tasks, + void performDeferredTasks(const std::vector& tasks, float blackoutFactor); void render(Scene* scene, Camera* camera, float blackoutFactor) override; diff --git a/modules/base/dashboard/dashboarditemdistance.cpp b/modules/base/dashboard/dashboarditemdistance.cpp index 584026d554..32c0453ec7 100644 --- a/modules/base/dashboard/dashboarditemdistance.cpp +++ b/modules/base/dashboard/dashboarditemdistance.cpp @@ -407,10 +407,9 @@ std::pair DashboardItemDistance::positionAndLabel( if (!anchor) { return { glm::dvec3(0.0), "Unknown" }; } - return { - global::navigationHandler.orbitalNavigator().anchorNode()->worldPosition(), - "focus" - }; + else { + return { anchor->worldPosition(), "focus" }; + } } case Type::Camera: return { global::renderEngine.scene()->camera()->positionVec3(), "camera" }; diff --git a/modules/base/rendering/renderablemodel.cpp b/modules/base/rendering/renderablemodel.cpp index def44533af..05ce3e39ce 100644 --- a/modules/base/rendering/renderablemodel.cpp +++ b/modules/base/rendering/renderablemodel.cpp @@ -197,8 +197,13 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary) , _specularIntensity(SpecularIntensityInfo, 1.f, 0.f, 1.f) , _performShading(ShadingInfo, true) , _disableFaceCulling(DisableFaceCullingInfo, false) - , _modelTransform(ModelTransformInfo, glm::dmat3(1.0), glm::dmat3(-1.0), glm::dmat3(1.0)) - , _rotationVec(RotationVecInfo, glm::dvec3(0), glm::dvec3(0), glm::dvec3(360)) + , _modelTransform( + ModelTransformInfo, + glm::dmat3(1.0), + glm::dmat3(-1.0), + glm::dmat3(1.0) + ) + , _rotationVec(RotationVecInfo, glm::dvec3(0.0), glm::dvec3(0.0), glm::dvec3(360.0)) , _lightSourcePropertyOwner({ "LightSources", "Light Sources" }) { documentation::testSpecificationAndThrow( @@ -274,10 +279,12 @@ RenderableModel::RenderableModel(const ghoul::Dictionary& dictionary) _rotationVec.onChange([this]() { glm::vec3 degreeVector = _rotationVec; - glm::vec3 radianVector = glm::vec3(glm::radians(degreeVector.x), - glm::radians(degreeVector.y), glm::radians(degreeVector.z)); - _modelTransform = glm::mat4_cast( - glm::quat(radianVector)); + glm::vec3 radianVector = glm::vec3( + glm::radians(degreeVector.x), + glm::radians(degreeVector.y), + glm::radians(degreeVector.z) + ); + _modelTransform = glm::mat4_cast(glm::quat(radianVector)); }); } @@ -405,13 +412,13 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) { if (_disableFaceCulling) { glDisable(GL_CULL_FACE); } - + _geometry->render(); if (_disableFaceCulling) { glEnable(GL_CULL_FACE); } - + _program->deactivate(); } diff --git a/modules/base/rendering/renderableplaneimagelocal.cpp b/modules/base/rendering/renderableplaneimagelocal.cpp index 5ae93c4221..170282cf89 100644 --- a/modules/base/rendering/renderableplaneimagelocal.cpp +++ b/modules/base/rendering/renderableplaneimagelocal.cpp @@ -42,7 +42,7 @@ namespace { "This value specifies an image that is loaded from disk and is used as a texture " "that is applied to this plane. This image has to be square." }; - + constexpr openspace::properties::Property::PropertyInfo RenderableTypeInfo = { "RenderableType", "RenderableType", diff --git a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp index 9e0fd2793a..171625c4e3 100644 --- a/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp +++ b/modules/digitaluniverse/rendering/renderablebillboardscloud.cpp @@ -747,7 +747,7 @@ void RenderableBillboardsCloud::renderBillboards(const RenderData& data, glEnablei(GL_BLEND, 0); glBlendFunc(GL_SRC_ALPHA, GL_ONE); - + _program->activate(); const glm::dmat4 projMatrix = glm::dmat4(data.camera.projectionMatrix()); diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index 58189ce3d7..e17d676b3e 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -183,10 +183,14 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) { _wmsCacheLocation = dict.value(WMSCacheLocationInfo.identifier); } if (dict.hasKeyAndValue(WMSCacheSizeInfo.identifier)) { - _wmsCacheSizeMB = static_cast(dict.value(WMSCacheSizeInfo.identifier)); + _wmsCacheSizeMB = static_cast( + dict.value(WMSCacheSizeInfo.identifier) + ); } if (dict.hasKeyAndValue(TileCacheSizeInfo.identifier)) { - _tileCacheSizeMB = static_cast(dict.value(TileCacheSizeInfo.identifier)); + _tileCacheSizeMB = static_cast( + dict.value(TileCacheSizeInfo.identifier) + ); } // Sanity check @@ -207,7 +211,9 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) { // Initialize global::callback::initializeGL.emplace_back([&]() { - _tileCache = std::make_unique(_tileCacheSizeMB); + _tileCache = std::make_unique( + _tileCacheSizeMB + ); addPropertySubOwner(*_tileCache); tileprovider::initializeDefaultTile(); @@ -486,9 +492,10 @@ void GlobeBrowsingModule::goToGeodetic2(Camera& camera, globebrowsing::Geodetic2 return; } - const glm::dvec3 cameraPosition = global::navigationHandler.camera()->positionVec3(); + interaction::NavigationHandler& nav = global::navigationHandler; + const glm::dvec3 cameraPosition = nav.camera()->positionVec3(); const glm::dmat4 inverseModelTransform = - global::navigationHandler.orbitalNavigator().anchorNode()->inverseModelTransform(); + nav.orbitalNavigator().anchorNode()->inverseModelTransform(); const glm::dvec3 cameraPositionModelSpace = glm::dvec3(inverseModelTransform * glm::dvec4(cameraPosition, 1.0)); const SurfacePositionHandle posHandle = globe->calculateSurfacePositionHandle( diff --git a/modules/globebrowsing/globebrowsingmodule_lua.inl b/modules/globebrowsing/globebrowsingmodule_lua.inl index a8e6e0d654..b9928a119f 100644 --- a/modules/globebrowsing/globebrowsingmodule_lua.inl +++ b/modules/globebrowsing/globebrowsingmodule_lua.inl @@ -207,7 +207,7 @@ int getGeoPositionForCamera(lua_State* L) { } const glm::dvec3 cameraPosition = global::navigationHandler.camera()->positionVec3(); - const SceneGraphNode* anchor = + const SceneGraphNode* anchor = global::navigationHandler.orbitalNavigator().anchorNode(); const glm::dmat4 inverseModelTransform = anchor->inverseModelTransform(); const glm::dvec3 cameraPositionModelSpace = diff --git a/modules/globebrowsing/src/globelabelscomponent.cpp b/modules/globebrowsing/src/globelabelscomponent.cpp index 3ccbc52e99..864b85d6c7 100644 --- a/modules/globebrowsing/src/globelabelscomponent.cpp +++ b/modules/globebrowsing/src/globelabelscomponent.cpp @@ -306,7 +306,7 @@ GlobeLabelsComponent::GlobeLabelsComponent() addProperty(_labelAlignmentOption); } -void GlobeLabelsComponent::initialize(const ghoul::Dictionary& dictionary, +void GlobeLabelsComponent::initialize(const ghoul::Dictionary& dictionary, globebrowsing::RenderableGlobe* globe) { documentation::testSpecificationAndThrow( @@ -314,7 +314,7 @@ void GlobeLabelsComponent::initialize(const ghoul::Dictionary& dictionary, dictionary, "GlobeLabelsComponent" ); - + _globe = globe; // Reads labels' file and build cache file if necessary @@ -339,7 +339,7 @@ void GlobeLabelsComponent::initialize(const ghoul::Dictionary& dictionary, // enables the label automatically. _labelsEnabled = true; } - + if (dictionary.hasKey(LabelsFontSizeInfo.identifier)) { _labelsFontSize = dictionary.value(LabelsFontSizeInfo.identifier); _labelsFontSize.onChange([this]() { initializeFonts(); }); @@ -475,7 +475,7 @@ bool GlobeLabelsComponent::readLabelsFile(const std::string& file) { if (!csvLabelFile.is_open()) { return false; } - + _labels.labelsArray.clear(); std::string sline; @@ -488,14 +488,14 @@ bool GlobeLabelsComponent::readLabelsFile(const std::string& file) { std::istringstream iss(sline); std::string token; std::getline(iss, token, ','); - + // First line is just the Header if (token == "Feature_Name") { continue; } LabelEntry lEntry; - + // Non-ascii characters aren't displayed correctly by the text // rendering (We don't have the non-ascii character in the texture // atlas) @@ -516,16 +516,16 @@ bool GlobeLabelsComponent::readLabelsFile(const std::string& file) { } std::getline(iss, token, ','); // Target is not used - + std::getline(iss, token, ','); // Diameter lEntry.diameter = std::stof(token); - + std::getline(iss, token, ','); // Latitude lEntry.latitude = std::stof(token); - + std::getline(iss, token, ','); // Longitude lEntry.longitude = std::stof(token); - + std::getline(iss, token, ','); // Coord System std::string coordinateSystem(token); std::size_t found = coordinateSystem.find("West"); @@ -552,7 +552,7 @@ bool GlobeLabelsComponent::readLabelsFile(const std::string& file) { _labels.labelsArray.push_back(lEntry); } - + return true; } catch (const std::fstream::failure& e) { @@ -623,9 +623,9 @@ void GlobeLabelsComponent::draw(const RenderData& data) { viewTransform; glm::dmat4 mvp = vp * _globe->modelTransform(); - glm::dvec3 globePositionWorld = glm::dvec3(_globe->modelTransform() * + glm::dvec3 globePositionWorld = glm::dvec3(_globe->modelTransform() * glm::vec4(0.f, 0.f, 0.f, 1.f)); - glm::dvec3 cameraToGlobeDistanceWorld = globePositionWorld - + glm::dvec3 cameraToGlobeDistanceWorld = globePositionWorld - data.camera.positionVec3(); double distanceCameraGlobeWorld = glm::length(cameraToGlobeDistanceWorld); @@ -667,7 +667,7 @@ void GlobeLabelsComponent::draw(const RenderData& data) { } void GlobeLabelsComponent::renderLabels(const RenderData& data, - const glm::dmat4& modelViewProjectionMatrix, + const glm::dmat4& modelViewProjectionMatrix, float distToCamera, float fadeInVariable ) { @@ -682,7 +682,7 @@ void GlobeLabelsComponent::renderLabels(const RenderData& data, glm::dvec4 cameraPosWorld = invCombinedView * glm::dvec4(0.0, 0.0, 0.0, 1.0); glm::dvec3 cameraPosObj = glm::dvec3(invMP * cameraPosWorld); - glm::dvec4 cameraUpVecWorld = glm::dvec4(data.camera.lookUpVectorWorldSpace(), 0.0); + glm::dvec4 cameraUpVecWorld = glm::dvec4(data.camera.lookUpVectorWorldSpace(), 0.0); glm::dvec3 cameraLookUpObj = glm::dvec3(invMP * cameraUpVecWorld); glm::dmat4 VP = glm::dmat4(data.camera.sgctInternal.projectionMatrix()) * diff --git a/modules/globebrowsing/src/globelabelscomponent.h b/modules/globebrowsing/src/globelabelscomponent.h index 23c02ea239..ed6727edcd 100644 --- a/modules/globebrowsing/src/globelabelscomponent.h +++ b/modules/globebrowsing/src/globelabelscomponent.h @@ -41,7 +41,7 @@ namespace ghoul::opengl { class ProgramObject; } namespace openspace { struct RenderData; - + namespace documentation { struct Documentation; } namespace globebrowsing { class RenderableGlobe; } diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index b783849db8..6361670ee6 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -475,10 +475,10 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) addProperty(_generalProperties.useAccurateNormals); addProperty(_generalProperties.eclipseShadowsEnabled); addProperty(_generalProperties.eclipseHardShadows); - _generalProperties.targetLodScaleFactor.onChange([this]() { + _generalProperties.targetLodScaleFactor.onChange([this]() { float sf = _generalProperties.targetLodScaleFactor; _generalProperties.currentLodScaleFactor = sf; - _lodScaleFactorDirty = true; + _lodScaleFactorDirty = true; }); addProperty(_generalProperties.targetLodScaleFactor); addProperty(_generalProperties.currentLodScaleFactor); @@ -2197,7 +2197,6 @@ bool RenderableGlobe::updateChunkTree(Chunk& cn, const RenderData& data) { if (isLeaf(cn)) { updateChunk(cn, data); - if (cn.status == Chunk::Status::WantSplit) { splitChunkNode(cn, 1); } diff --git a/modules/globebrowsing/src/renderableglobe.h b/modules/globebrowsing/src/renderableglobe.h index 66b2cc51c0..93022b532c 100644 --- a/modules/globebrowsing/src/renderableglobe.h +++ b/modules/globebrowsing/src/renderableglobe.h @@ -271,7 +271,7 @@ private: size_t _iterationsOfUnavailableData = 0; Layer* _lastChangedLayer = nullptr; - // Labels + // Labels GlobeLabelsComponent _globeLabelsComponent; ghoul::Dictionary _labelsDictionary; }; diff --git a/modules/server/src/topics/timetopic.cpp b/modules/server/src/topics/timetopic.cpp index 71b1ae79cb..4710d13c4f 100644 --- a/modules/server/src/topics/timetopic.cpp +++ b/modules/server/src/topics/timetopic.cpp @@ -80,7 +80,7 @@ void TimeTopic::handleJson(const nlohmann::json& json) { sendCurrentTime(); } }); - + _deltaTimeCallbackHandle = global::timeManager.addDeltaTimeChangeCallback([this]() { // Throttle by last update, // but force update if pause state or target delta changes. diff --git a/modules/space/rendering/renderablestars.cpp b/modules/space/rendering/renderablestars.cpp index bcc808e2d1..891ee0efb8 100644 --- a/modules/space/rendering/renderablestars.cpp +++ b/modules/space/rendering/renderablestars.cpp @@ -54,10 +54,10 @@ namespace { constexpr const char* KeyStaticFilterReplacement = "StaticFilterReplacement"; constexpr const std::array UniformNames = { - "modelMatrix", "cameraUp", "cameraViewProjectionMatrix", - "colorOption", "magnitudeExponent", "eyePosition", "psfParamConf", - "lumCent", "radiusCent", "brightnessCent", "colorTexture", - "alphaValue", "psfTexture", "otherDataTexture", "otherDataRange", + "modelMatrix", "cameraUp", "cameraViewProjectionMatrix", + "colorOption", "magnitudeExponent", "eyePosition", "psfParamConf", + "lumCent", "radiusCent", "brightnessCent", "colorTexture", + "alphaValue", "psfTexture", "otherDataTexture", "otherDataRange", "filterOutOfRange" }; @@ -96,7 +96,7 @@ namespace { "Speck File", "The speck file that is loaded to get the data for rendering these stars." }; - + static const openspace::properties::Property::PropertyInfo ColorTextureInfo = { "ColorMap", "ColorBV Texture", @@ -172,7 +172,7 @@ namespace { "Stars closer than this distance are given full opacity. " "Farther away, stars dim proportionally to the logarithm of their distance." }; - + constexpr openspace::properties::Property::PropertyInfo RenderMethodOptionInfo = { "RenderMethod", "Render Method", @@ -214,7 +214,7 @@ namespace { constexpr openspace::properties::Property::PropertyInfo LumPercentInfo = { "LumPercent", "Luminosity Contribution", - "Luminosity Contribution." + "Luminosity Contribution." }; constexpr openspace::properties::Property::PropertyInfo RadiusPercentInfo = { @@ -398,8 +398,14 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary) , _filterOutOfRange(FilterOutOfRangeInfo, false) , _pointSpreadFunctionTexturePath(PsfTextureInfo) , _alphaValue(TransparencyInfo, 1.f, 0.f, 1.f) - , _psfMethodOption(PSFMethodOptionInfo, properties::OptionProperty::DisplayType::Dropdown) - , _psfMultiplyOption(SizeCompositionOptionInfo, properties::OptionProperty::DisplayType::Dropdown) + , _psfMethodOption( + PSFMethodOptionInfo, + properties::OptionProperty::DisplayType::Dropdown + ) + , _psfMultiplyOption( + SizeCompositionOptionInfo, + properties::OptionProperty::DisplayType::Dropdown + ) , _lumCent(LumPercentInfo, 0.5f, 0.f, 3.f) , _radiusCent(RadiusPercentInfo, 0.5f, 0.f, 3.f) , _brightnessCent(BrightnessPercentInfo, 0.5f, 0.f, 3.f) @@ -447,7 +453,7 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary) dictionary.value(OtherDataColorMapInfo.identifier) ); } - + _colorOption.addOptions({ { ColorOption::Color, "Color" }, { ColorOption::Velocity, "Velocity" }, @@ -475,7 +481,7 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary) addProperty(_colorOption); _colorTexturePath.onChange([&] { _colorTextureIsDirty = true; }); - _colorTextureFile->setCallback([&](const File&) { + _colorTextureFile->setCallback([&](const File&) { _colorTextureIsDirty = true; }); addProperty(_colorTexturePath); @@ -520,10 +526,10 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary) "Point Spread Function Based" ); _renderingMethodOption.addOption(RenderOptionTexture, "Textured Based"); - addProperty(_renderingMethodOption); + addProperty(_renderingMethodOption); if (dictionary.hasKey(RenderMethodOptionInfo.identifier)) { - std::string renderingMethod = + std::string renderingMethod = dictionary.value(RenderMethodOptionInfo.identifier); if (renderingMethod == "PSF") { _renderingMethodOption = RenderOptionPointSpreadFunction; @@ -540,14 +546,14 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary) PsfTextureInfo.identifier )); _pointSpreadFunctionFile = std::make_unique(_pointSpreadFunctionTexturePath); - _pointSpreadFunctionTexturePath.onChange([&]() { - _pointSpreadFunctionTextureIsDirty = true; + _pointSpreadFunctionTexturePath.onChange([&]() { + _pointSpreadFunctionTextureIsDirty = true; }); - _pointSpreadFunctionFile->setCallback([&](const File&) { + _pointSpreadFunctionFile->setCallback([&](const File&) { _pointSpreadFunctionTextureIsDirty = true; }); _userProvidedTextureOwner.addProperty(_pointSpreadFunctionTexturePath); - + if (dictionary.hasKey(TransparencyInfo.identifier)) { _alphaValue = static_cast( dictionary.value(TransparencyInfo.identifier) @@ -569,9 +575,9 @@ RenderableStars::RenderableStars(const ghoul::Dictionary& dictionary) _psfMultiplyOption.addOption(5, "Distance Modulus"); if (dictionary.hasKey(MagnitudeExponentInfo.identifier)) { - std::string sizeCompositionOption = + std::string sizeCompositionOption = dictionary.value(SizeCompositionOptionInfo.identifier); - + if (sizeCompositionOption == "App Brightness") { _psfMultiplyOption = 0; } else if (sizeCompositionOption == "Lum and Size") { @@ -782,9 +788,9 @@ void RenderableStars::renderPSFToTexture() { glBindFramebuffer(GL_FRAMEBUFFER, psfFBO); GLenum drawBuffers[1] = { GL_COLOR_ATTACHMENT0 }; glDrawBuffers(1, drawBuffers); - + glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, _psfTexture, 0); - + glViewport(0, 0, _psfTextureSize, _psfTextureSize); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -812,7 +818,7 @@ void RenderableStars::renderPSFToTexture() { glBindVertexArray(_psfVao); glDrawArrays(GL_TRIANGLES, 0, 6); glBindVertexArray(0); - + program->deactivate(); // JCC: Convolution is disabled while FFT is not enabled @@ -824,9 +830,9 @@ void RenderableStars::renderPSFToTexture() { //glDrawBuffers(1, drawBuffers); //glFramebufferTexture( - // GL_FRAMEBUFFER, - // GL_COLOR_ATTACHMENT0, - // _convolvedTexture, + // GL_FRAMEBUFFER, + // GL_COLOR_ATTACHMENT0, + // _convolvedTexture, // 0 //); @@ -853,7 +859,7 @@ void RenderableStars::renderPSFToTexture() { //programConvolve->setUniform("psfTextureSize", _psfTextureSize); //programConvolve->setUniform( - // "convolvedfTextureSize", + // "convolvedfTextureSize", // _convolvedfTextureSize //); @@ -884,7 +890,7 @@ void RenderableStars::render(const RenderData& data, RendererTasks&) { if (_fullData.empty()) { return; } - + // Saving current OpenGL state GLenum blendEquationRGB; GLenum blendEquationAlpha; @@ -934,14 +940,14 @@ void RenderableStars::render(const RenderData& data, RendererTasks&) { ); _program->setUniform(_uniformCache.colorOption, _colorOption); _program->setUniform(_uniformCache.magnitudeExponent, _magnitudeExponent); - + _program->setUniform(_uniformCache.psfParamConf, _psfMultiplyOption.value()); _program->setUniform(_uniformCache.lumCent, _lumCent); _program->setUniform(_uniformCache.radiusCent, _radiusCent); _program->setUniform(_uniformCache.brightnessCent, _brightnessCent); _program->setUniform(_uniformCache.alphaValue, _alphaValue); - + ghoul::opengl::TextureUnit psfUnit; psfUnit.activate(); @@ -1361,7 +1367,7 @@ void RenderableStars::readSpeckFile() { // +3 because the position x, y, z if (name == "lum") { - _lumArrayPos = _nValuesPerStar + 3; + _lumArrayPos = _nValuesPerStar + 3; } else if (name == "absmag") { _absMagArrayPos = _nValuesPerStar + 3; @@ -1404,9 +1410,9 @@ void RenderableStars::readSpeckFile() { break; } } - minLumValue = values[_lumArrayPos] < minLumValue ? + minLumValue = values[_lumArrayPos] < minLumValue ? values[_lumArrayPos] : minLumValue; - maxLumValue = values[_lumArrayPos] > maxLumValue ? + maxLumValue = values[_lumArrayPos] > maxLumValue ? values[_lumArrayPos] : maxLumValue; if (!nullArray) { _fullData.insert(_fullData.end(), values.begin(), values.end()); @@ -1415,7 +1421,7 @@ void RenderableStars::readSpeckFile() { // Normalize Luminosity: for (size_t i = 0; i < _fullData.size(); i += _nValuesPerStar) { - _fullData[i + _lumArrayPos] = + _fullData[i + _lumArrayPos] = (_fullData[i + _lumArrayPos] - minLumValue) / (maxLumValue - minLumValue); } } @@ -1494,7 +1500,7 @@ void RenderableStars::saveCachedFile(const std::string& file) const { fileStream.write(reinterpret_cast(&_appMagArrayPos), sizeof(int32_t)); fileStream.write(reinterpret_cast(&_bvColorArrayPos), sizeof(int32_t)); fileStream.write(reinterpret_cast(&_velocityArrayPos), sizeof(int32_t)); - fileStream.write(reinterpret_cast(&_speedArrayPos), sizeof(int32_t)); + fileStream.write(reinterpret_cast(&_speedArrayPos), sizeof(int32_t)); // -3 as we don't want to save the xyz values that are in the beginning of the file for (int i = 0; i < _nValuesPerStar - 3; ++i) { @@ -1516,7 +1522,11 @@ void RenderableStars::createDataSlice(ColorOption option) { ); for (size_t i = 0; i < _fullData.size(); i += _nValuesPerStar) { - glm::vec3 position = glm::vec3(_fullData[i + 0], _fullData[i + 1], _fullData[i + 2]); + glm::vec3 position = glm::vec3( + _fullData[i + 0], + _fullData[i + 1], + _fullData[i + 2] + ); position *= openspace::distanceconstants::Parsec; switch (option) { @@ -1606,8 +1616,8 @@ void RenderableStars::createDataSlice(ColorOption option) { layout.value.position = { { position[0], position[1], position[2] } }; int index = _otherDataOption.value(); - // plus 3 because of the position - layout.value.value = _fullData[i + index + 3]; + // plus 3 because of the position + layout.value.value = _fullData[i + index + 3]; if (_staticFilterValue.has_value() && layout.value.value == _staticFilterValue) diff --git a/modules/space/rendering/renderablestars.h b/modules/space/rendering/renderablestars.h index 908db9ef6b..986fd5682f 100644 --- a/modules/space/rendering/renderablestars.h +++ b/modules/space/rendering/renderablestars.h @@ -93,8 +93,8 @@ private: //properties::StringProperty _shapeTexturePath; //std::unique_ptr _shapeTexture; //std::unique_ptr _shapeTextureFile; - - properties::OptionProperty _colorOption; + + properties::OptionProperty _colorOption; properties::OptionProperty _otherDataOption; properties::StringProperty _otherDataColorMapPath; properties::Vec2Property _otherDataRange; @@ -103,7 +103,7 @@ private: properties::StringProperty _pointSpreadFunctionTexturePath; std::unique_ptr _pointSpreadFunctionTexture; std::unique_ptr _pointSpreadFunctionFile; - + properties::FloatProperty _alphaValue; properties::OptionProperty _psfMethodOption; properties::OptionProperty _psfMultiplyOption; @@ -126,13 +126,13 @@ private: std::unique_ptr _program; UniformCache( - modelMatrix, cameraUp, cameraViewProjectionMatrix, - colorOption, magnitudeExponent, eyePosition, psfParamConf, - lumCent, radiusCent, brightnessCent, colorTexture, - alphaValue, psfTexture, otherDataTexture, otherDataRange, + modelMatrix, cameraUp, cameraViewProjectionMatrix, + colorOption, magnitudeExponent, eyePosition, psfParamConf, + lumCent, radiusCent, brightnessCent, colorTexture, + alphaValue, psfTexture, otherDataTexture, otherDataRange, filterOutOfRange ) _uniformCache; - + bool _speckFileIsDirty = true; bool _pointSpreadFunctionTextureIsDirty = true; bool _colorTextureIsDirty = true; @@ -145,7 +145,7 @@ private: std::vector _slicedData; std::vector _fullData; - + int _nValuesPerStar = 0; std::string _queuedOtherData; std::vector _dataNames; diff --git a/src/documentation/core_registration.cpp b/src/documentation/core_registration.cpp index 74448d18d6..3d7e026b94 100644 --- a/src/documentation/core_registration.cpp +++ b/src/documentation/core_registration.cpp @@ -69,8 +69,9 @@ void registerCoreClasses(documentation::DocumentationEngine& engine) { engine.addDocumentation(LightSource::Documentation()); } -//NOTE: should this be in the documentation/core_reg.cpp file? Seems to be here just because it has the same -//method name (and similar implementaiton) as the documentation version. +// NOTE: should this be in the documentation/core_reg.cpp file? Seems to be here just +// because it has the same method name (and similar implementaiton) as the +// documentation version. void registerCoreClasses(scripting::ScriptEngine& engine) { engine.addLibrary(Dashboard::luaLibrary()); engine.addLibrary(MissionManager::luaLibrary()); diff --git a/src/documentation/documentationengine.cpp b/src/documentation/documentationengine.cpp index 635855c0ea..4192a0c243 100644 --- a/src/documentation/documentationengine.cpp +++ b/src/documentation/documentationengine.cpp @@ -178,16 +178,21 @@ void DocumentationEngine::addDocumentation(Documentation documentation) { } } -void DocumentationEngine::addHandlebarTemplates(std::vector templates) { - _handlebarTemplates.insert(std::end(_handlebarTemplates), std::begin(templates), std::end(templates)); +void DocumentationEngine::addHandlebarTemplates(std::vector templates) +{ + _handlebarTemplates.insert( + std::end(_handlebarTemplates), + std::begin(templates), std::end(templates) + ); } std::vector DocumentationEngine::documentations() const { return _documentations; } -void DocumentationEngine::writeDocumentationHtml(const std::string path, const std::string data) { - +void DocumentationEngine::writeDocumentationHtml(const std::string& path, + std::string data) +{ std::ifstream handlebarsInput; handlebarsInput.exceptions(~std::ofstream::goodbit); handlebarsInput.open(absPath(HandlebarsFilename)); @@ -285,7 +290,7 @@ void DocumentationEngine::writeDocumentationHtml(const std::string path, const s file << " " << "" << '\n'; diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 02cf4cc09f..52a268ca12 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -921,7 +921,7 @@ void OpenSpaceEngine::loadFonts() { } void OpenSpaceEngine::writeSceneDocumentation() { - // Write documentation to json files if config file supplies path for doc files to be placed. + // Write documentation to json files if config file supplies path for doc files std::string path = global::configuration.documentation.path; if (!path.empty()) { diff --git a/src/interaction/externinteraction.cpp b/src/interaction/externinteraction.cpp index dc2ab5e2a2..c6e08760cf 100644 --- a/src/interaction/externinteraction.cpp +++ b/src/interaction/externinteraction.cpp @@ -105,30 +105,28 @@ void ExternInteraction::scriptInteraction(datamessagestructures::ScriptMessage s } datamessagestructures::CameraKeyframe ExternInteraction::generateCameraKeyframe() { + interaction::NavigationHandler& navHandler = global::navigationHandler; datamessagestructures::CameraKeyframe kf; - const SceneGraphNode* focusNode = - global::navigationHandler.orbitalNavigator().anchorNode(); + const SceneGraphNode* focusNode = navHandler.orbitalNavigator().anchorNode(); if (!focusNode) { return kf; } //kf._position = global::navigationHandler.camera()->positionVec3(); - kf._position = global::navigationHandler.orbitalNavigator().anchorNodeToCameraVector(); + kf._position = navHandler.orbitalNavigator().anchorNodeToCameraVector(); - kf._followNodeRotation = - global::navigationHandler.orbitalNavigator().followingNodeRotation(); + kf._followNodeRotation = navHandler.orbitalNavigator().followingNodeRotation(); if (kf._followNodeRotation) { kf._position = glm::inverse(focusNode->worldRotationMatrix()) * kf._position; - kf._rotation = - global::navigationHandler.orbitalNavigator().anchorNodeToCameraRotation(); + kf._rotation = navHandler.orbitalNavigator().anchorNodeToCameraRotation(); } else { - kf._rotation = global::navigationHandler.camera()->rotationQuaternion(); + kf._rotation = navHandler.camera()->rotationQuaternion(); } kf._focusNode = focusNode->identifier(); - kf._scale = global::navigationHandler.camera()->scaling(); + kf._scale = navHandler.camera()->scaling(); // Timestamp as current runtime of OpenSpace instance kf._timestamp = global::windowDelegate.applicationTime(); diff --git a/src/interaction/sessionrecording.cpp b/src/interaction/sessionrecording.cpp index ddee47d53a..d9ae6b1849 100644 --- a/src/interaction/sessionrecording.cpp +++ b/src/interaction/sessionrecording.cpp @@ -48,7 +48,9 @@ namespace { constexpr const bool UsingTimeKeyframes = false; const std::string FileHeaderTitle = "OpenSpace_record/playback"; constexpr const size_t FileHeaderVersionLength = 5; - constexpr const char FileHeaderVersion[FileHeaderVersionLength] = { '0', '0', '.', '8', '5' }; + constexpr const char FileHeaderVersion[FileHeaderVersionLength] = { + '0', '0', '.', '8', '5' + }; constexpr const char DataFormatAsciiTag = 'A'; constexpr const char DataFormatBinaryTag = 'B'; @@ -203,7 +205,10 @@ bool SessionRecording::startPlayback(const std::string& filename, // Open in ASCII first _playbackFile.open(_playbackFilename, std::ifstream::in); // Read header - std::string readBackHeaderString = readHeaderElement(_playbackFile, FileHeaderTitle.length()); + std::string readBackHeaderString = readHeaderElement( + _playbackFile, + FileHeaderTitle.length() + ); if (readBackHeaderString != FileHeaderTitle) { LERROR("Specified playback file does not contain expected header."); cleanUpPlayback(); @@ -764,7 +769,7 @@ double SessionRecording::fixedDeltaTimeDuringFrameOutput() const { } else { return 0; - } + } } void SessionRecording::playbackCamera() { @@ -1022,7 +1027,7 @@ void SessionRecording::moveAheadInTime() { if (!focusRenderable || focusRenderable->renderedWithDesiredData()) { _saveRenderingCurrentRecordedTime += _saveRenderingDeltaTime; global::renderEngine.takeScreenShot(); - } + } } } diff --git a/src/network/parallelpeer.cpp b/src/network/parallelpeer.cpp index 9ca8f5fb27..cef58ee498 100644 --- a/src/network/parallelpeer.cpp +++ b/src/network/parallelpeer.cpp @@ -585,29 +585,29 @@ const std::string& ParallelPeer::hostName() { } void ParallelPeer::sendCameraKeyframe() { + interaction::NavigationHandler& navHandler = global::navigationHandler; + const SceneGraphNode* focusNode = - global::navigationHandler.orbitalNavigator().anchorNode(); + navHandler.orbitalNavigator().anchorNode(); if (!focusNode) { return; } // Create a keyframe with current position and orientation of camera datamessagestructures::CameraKeyframe kf; - kf._position = global::navigationHandler.orbitalNavigator().anchorNodeToCameraVector(); + kf._position = navHandler.orbitalNavigator().anchorNodeToCameraVector(); - kf._followNodeRotation = - global::navigationHandler.orbitalNavigator().followingNodeRotation(); + kf._followNodeRotation = navHandler.orbitalNavigator().followingNodeRotation(); if (kf._followNodeRotation) { kf._position = glm::inverse(focusNode->worldRotationMatrix()) * kf._position; - kf._rotation = - global::navigationHandler.orbitalNavigator().anchorNodeToCameraRotation(); + kf._rotation = navHandler.orbitalNavigator().anchorNodeToCameraRotation(); } else { - kf._rotation = global::navigationHandler.camera()->rotationQuaternion(); + kf._rotation = navHandler.camera()->rotationQuaternion(); } kf._focusNode = focusNode->identifier(); - kf._scale = global::navigationHandler.camera()->scaling(); + kf._scale = navHandler.camera()->scaling(); // Timestamp as current runtime of OpenSpace instance kf._timestamp = global::windowDelegate.applicationTime(); diff --git a/src/scene/scene_lua.inl b/src/scene/scene_lua.inl index 2e14e14658..e137ddedb6 100644 --- a/src/scene/scene_lua.inl +++ b/src/scene/scene_lua.inl @@ -555,7 +555,7 @@ int removeSceneGraphNode(lua_State* L) { } // Add all the children - std::function&)> markNode = + std::function&)> markNode = [&markNode](SceneGraphNode* node, std::vector& markedList) { std::vector children = node->children(); diff --git a/src/util/versionchecker.cpp b/src/util/versionchecker.cpp index 1eede81ca6..223f2e695d 100644 --- a/src/util/versionchecker.cpp +++ b/src/util/versionchecker.cpp @@ -55,7 +55,7 @@ void VersionChecker::requestLatestVersion(const std::string& url) { bool VersionChecker::hasLatestVersionInfo() { if (_latestVersion.has_value()) { - return true; + return true; } if (_request) { if (_request->hasSucceeded()) {