diff --git a/include/openspace/scripting/systemcapabilitiesbinding.h b/include/openspace/scripting/systemcapabilitiesbinding.h index c470140a86..107b97b5c3 100644 --- a/include/openspace/scripting/systemcapabilitiesbinding.h +++ b/include/openspace/scripting/systemcapabilitiesbinding.h @@ -22,8 +22,8 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#ifndef __OPENSPACE_CORE___SYSTEMCAPABLITIESBINDING___H__ -#define __OPENSPACE_CORE___SYSTEMCAPABLITIESBINDING___H__ +#ifndef __OPENSPACE_CORE___SYSTEMCAPABILITIESBINDING___H__ +#define __OPENSPACE_CORE___SYSTEMCAPABILITIESBINDING___H__ #include @@ -36,4 +36,4 @@ LuaLibrary openglSystemCapabilities(); } // namespace scripting } // namespace openspace -#endif // __OPENSPACE_CORE___SYSTEMCAPABLITIESBINDING___H__ +#endif // __OPENSPACE_CORE___SYSTEMCAPABILITIESBINDING___H__ diff --git a/include/openspace/util/gpudata.h b/include/openspace/util/gpudata.h index 2a3af70d21..31b7ff8e03 100644 --- a/include/openspace/util/gpudata.h +++ b/include/openspace/util/gpudata.h @@ -34,9 +34,6 @@ namespace openspace { -using namespace ghoul::opengl; - - /** * Very simple class maintaining a uniform location. */ @@ -47,7 +44,7 @@ public: * Updates the uniform location of the uniform variable named * in the provided shader program. */ - void bind(ProgramObject* program, const std::string& name); + void bind(ghoul::opengl::ProgramObject* program, const std::string& name); protected: GLint _uniformLocation = -1; @@ -67,7 +64,7 @@ public: * Sets the value of T to its corresponding GPU value. * OBS! Users must ensure bind has been called before using this method */ - void setValue(ProgramObject* program, T val){ + void setValue(ghoul::opengl::ProgramObject* program, T val){ program->setUniform(_uniformLocation, val); } @@ -86,8 +83,8 @@ public: * program. * OBS! Users must ensure bind has been called before using this method. */ - void setValue(ProgramObject* program, std::shared_ptr texture){ - _texUnit = std::make_unique(); + void setValue(ghoul::opengl::ProgramObject* program, std::shared_ptr texture){ + _texUnit = std::make_unique(); _texUnit->activate(); texture->bind(); program->setUniform(_uniformLocation, *_texUnit); @@ -99,7 +96,7 @@ public: private: - std::unique_ptr _texUnit; + std::unique_ptr _texUnit; }; diff --git a/modules/globebrowsing/rendering/chunkrenderer.cpp b/modules/globebrowsing/rendering/chunkrenderer.cpp index 05af587eec..d7296db626 100644 --- a/modules/globebrowsing/rendering/chunkrenderer.cpp +++ b/modules/globebrowsing/rendering/chunkrenderer.cpp @@ -112,7 +112,7 @@ ghoul::opengl::ProgramObject* ChunkRenderer::getActivatedProgramWithTileData( std::to_string(Chunk::DEFAULT_HEIGHT))); // Now the shader program can be accessed - ProgramObject* programObject = + ghoul::opengl::ProgramObject* programObject = layeredShaderManager->programObject( layeredTexturePreprocessingData); @@ -143,7 +143,7 @@ ghoul::opengl::ProgramObject* ChunkRenderer::getActivatedProgramWithTileData( void ChunkRenderer::renderChunkGlobally(const Chunk& chunk, const RenderData& data){ - ProgramObject* programObject = getActivatedProgramWithTileData( + ghoul::opengl::ProgramObject* programObject = getActivatedProgramWithTileData( _globalLayerShaderManager, _globalGpuLayerManager, chunk); @@ -217,7 +217,7 @@ void ChunkRenderer::renderChunkGlobally(const Chunk& chunk, const RenderData& da void ChunkRenderer::renderChunkLocally(const Chunk& chunk, const RenderData& data) { - ProgramObject* programObject = getActivatedProgramWithTileData( + ghoul::opengl::ProgramObject* programObject = getActivatedProgramWithTileData( _localLayerShaderManager, _localGpuLayerManager, chunk); diff --git a/modules/globebrowsing/rendering/gpu/gpuchunktile.cpp b/modules/globebrowsing/rendering/gpu/gpuchunktile.cpp index 4467241bfa..b5a92339b7 100644 --- a/modules/globebrowsing/rendering/gpu/gpuchunktile.cpp +++ b/modules/globebrowsing/rendering/gpu/gpuchunktile.cpp @@ -30,12 +30,16 @@ namespace openspace { namespace globebrowsing { -void GPUChunkTile::setValue(ProgramObject* programObject, const ChunkTile& chunkTile) { +void GPUChunkTile::setValue(ghoul::opengl::ProgramObject* programObject, + const ChunkTile& chunkTile) +{ gpuTexture.setValue(programObject, chunkTile.tile.texture); gpuTileUvTransform.setValue(programObject, chunkTile.uvTransform); } -void GPUChunkTile::bind(ProgramObject* programObject, const std::string& nameBase) { +void GPUChunkTile::bind(ghoul::opengl::ProgramObject* programObject, + const std::string& nameBase) +{ gpuTexture.bind(programObject, nameBase + "textureSampler"); gpuTileUvTransform.bind(programObject, nameBase + "uvTransform."); } diff --git a/modules/globebrowsing/rendering/gpu/gpuchunktile.h b/modules/globebrowsing/rendering/gpu/gpuchunktile.h index 4a85ab13ad..490c7a81bd 100644 --- a/modules/globebrowsing/rendering/gpu/gpuchunktile.h +++ b/modules/globebrowsing/rendering/gpu/gpuchunktile.h @@ -51,14 +51,15 @@ public: * GPU struct. OBS! Users must ensure bind has been * called before setting using this method. */ - void setValue(ProgramObject* programObject, const ChunkTile& chunkTile); + void setValue(ghoul::opengl::ProgramObject* programObject, + const ChunkTile& chunkTile); /** * Binds GLSL variables with identifiers starting with * nameBase within the provided shader program with this object. * After this method has been called, users may invoke setValue. */ - void bind(ProgramObject* programObject, const std::string& nameBase); + void bind(ghoul::opengl::ProgramObject* programObject, const std::string& nameBase); /** * Deactivates any TextureUnits assigned by this object. diff --git a/modules/globebrowsing/rendering/gpu/gpuchunktilepile.cpp b/modules/globebrowsing/rendering/gpu/gpuchunktilepile.cpp index 52562ac90a..a07cd46857 100644 --- a/modules/globebrowsing/rendering/gpu/gpuchunktilepile.cpp +++ b/modules/globebrowsing/rendering/gpu/gpuchunktilepile.cpp @@ -28,31 +28,31 @@ namespace openspace { namespace globebrowsing { -void GPUChunkTilePile::setValue(ProgramObject* programObject, +void GPUChunkTilePile::setValue(ghoul::opengl::ProgramObject* programObject, const ChunkTilePile& chunkTilePile) { ghoul_assert( - gpuChunkTiles.size() == chunkTilePile.size(), + _gpuChunkTiles.size() == chunkTilePile.size(), "GPU and CPU ChunkTilePile must have same size!" ); - for (size_t i = 0; i < gpuChunkTiles.size(); ++i) { - gpuChunkTiles[i].setValue(programObject, chunkTilePile[i]); + for (size_t i = 0; i < _gpuChunkTiles.size(); ++i) { + _gpuChunkTiles[i].setValue(programObject, chunkTilePile[i]); } } -void GPUChunkTilePile::bind(ProgramObject* programObject, const std::string& nameBase, - int pileSize) +void GPUChunkTilePile::bind(ghoul::opengl::ProgramObject* programObject, + const std::string& nameBase, int pileSize) { - gpuChunkTiles.resize(pileSize); - for (size_t i = 0; i < gpuChunkTiles.size(); ++i) { + _gpuChunkTiles.resize(pileSize); + for (size_t i = 0; i < _gpuChunkTiles.size(); ++i) { std::string nameExtension = "chunkTile" + std::to_string(i) + "."; - gpuChunkTiles[i].bind(programObject, nameBase + nameExtension); + _gpuChunkTiles[i].bind(programObject, nameBase + nameExtension); } } void GPUChunkTilePile::deactivate() { - for (auto& gpuChunkTile : gpuChunkTiles) { - gpuChunkTile.deactivate(); + for (auto& t : _gpuChunkTiles) { + t.deactivate(); } } diff --git a/modules/globebrowsing/rendering/gpu/gpuchunktilepile.h b/modules/globebrowsing/rendering/gpu/gpuchunktilepile.h index 76d34ac1b9..e09b516370 100644 --- a/modules/globebrowsing/rendering/gpu/gpuchunktilepile.h +++ b/modules/globebrowsing/rendering/gpu/gpuchunktilepile.h @@ -51,15 +51,16 @@ public: * GPU struct. OBS! Users must ensure bind has been * called before setting using this method. */ - void setValue(ProgramObject* programObject, const ChunkTilePile& chunkTilePile); + void setValue(ghoul::opengl::ProgramObject* programObject, + const ChunkTilePile& chunkTilePile); /** * Binds this object with GLSL variables with identifiers starting * with nameBase within the provided shader program. * After this method has been called, users may invoke setValue. */ - void bind(ProgramObject* programObject, const std::string& nameBase, - int pileSize); + void bind(ghoul::opengl::ProgramObject* programObject, const std::string& nameBase, + int pileSize); /** * Deactivates any TextureUnits assigned by this object. * This method should be called after the OpenGL draw call. @@ -67,7 +68,7 @@ public: void deactivate(); private: - std::vector gpuChunkTiles; + std::vector _gpuChunkTiles; }; } // namespace globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gpuheightlayer.cpp b/modules/globebrowsing/rendering/gpu/gpuheightlayer.cpp index 2db24d540f..5b77c34f9b 100644 --- a/modules/globebrowsing/rendering/gpu/gpuheightlayer.cpp +++ b/modules/globebrowsing/rendering/gpu/gpuheightlayer.cpp @@ -33,18 +33,19 @@ namespace openspace { namespace globebrowsing { -void GPUHeightLayer::setValue(ProgramObject* programObject, const Layer& layer, - const TileIndex& tileIndex, int pileSize) +void GPUHeightLayer::setValue(ghoul::opengl::ProgramObject* programObject, + const Layer& layer, const TileIndex& tileIndex, + int pileSize) { GPULayer::setValue(programObject, layer, tileIndex, pileSize); - gpuDepthTransform.setValue(programObject, layer.tileProvider()->depthTransform()); + _gpuDepthTransform.setValue(programObject, layer.tileProvider()->depthTransform()); } -void GPUHeightLayer::bind(ProgramObject* programObject, const Layer& layer, +void GPUHeightLayer::bind(ghoul::opengl::ProgramObject* programObject, const Layer& layer, const std::string& nameBase, int pileSize) { GPULayer::bind(programObject, layer, nameBase, pileSize); - gpuDepthTransform.bind(programObject, nameBase + "depthTransform."); + _gpuDepthTransform.bind(programObject, nameBase + "depthTransform."); } diff --git a/modules/globebrowsing/rendering/gpu/gpuheightlayer.h b/modules/globebrowsing/rendering/gpu/gpuheightlayer.h index 466fb0909f..d2fca786cf 100644 --- a/modules/globebrowsing/rendering/gpu/gpuheightlayer.h +++ b/modules/globebrowsing/rendering/gpu/gpuheightlayer.h @@ -53,19 +53,19 @@ public: * GPU struct. OBS! Users must ensure bind has been * called before setting using this method. */ - virtual void setValue(ProgramObject* programObject, const Layer& layer, - const TileIndex& tileIndex, int pileSize); + virtual void setValue(ghoul::opengl::ProgramObject* programObject, const Layer& layer, + const TileIndex& tileIndex, int pileSize); /** * Binds this object with GLSL variables with identifiers starting * with nameBase within the provided shader program. * After this method has been called, users may invoke setValue. */ - virtual void bind(ProgramObject* programObject, const Layer& layer, - const std::string& nameBase, int pileSize); + virtual void bind(ghoul::opengl::ProgramObject* programObject, const Layer& layer, + const std::string& nameBase, int pileSize); private: - GPUTileDepthTransform gpuDepthTransform; + GPUTileDepthTransform _gpuDepthTransform; }; } // namespace globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gpulayer.cpp b/modules/globebrowsing/rendering/gpu/gpulayer.cpp index b54d9586f8..99fb35e915 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayer.cpp +++ b/modules/globebrowsing/rendering/gpu/gpulayer.cpp @@ -29,7 +29,7 @@ namespace openspace { namespace globebrowsing { -void GPULayer::setValue(ProgramObject* programObject, const Layer& layer, +void GPULayer::setValue(ghoul::opengl::ProgramObject* programObject, const Layer& layer, const TileIndex& tileIndex, int pileSize) { ChunkTilePile chunkTilePile = layer.getChunkTilePile(tileIndex, pileSize); @@ -37,7 +37,7 @@ void GPULayer::setValue(ProgramObject* programObject, const Layer& layer, gpuRenderSettings.setValue(programObject, layer.renderSettings()); } -void GPULayer::bind(ProgramObject* programObject, const Layer& layer, +void GPULayer::bind(ghoul::opengl::ProgramObject* programObject, const Layer& layer, const std::string& nameBase, int pileSize) { gpuChunkTilePile.bind(programObject, nameBase + "pile.", pileSize); diff --git a/modules/globebrowsing/rendering/gpu/gpulayer.h b/modules/globebrowsing/rendering/gpu/gpulayer.h index bd07af9d6b..7fb7f2914c 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayer.h +++ b/modules/globebrowsing/rendering/gpu/gpulayer.h @@ -51,16 +51,16 @@ public: * GPU struct. OBS! Users must ensure bind has been * called before setting using this method. */ - virtual void setValue(ProgramObject* programObject, const Layer& layer, - const TileIndex& tileIndex, int pileSize); + virtual void setValue(ghoul::opengl::ProgramObject* programObject, const Layer& layer, + const TileIndex& tileIndex, int pileSize); /** * Binds this object with GLSL variables with identifiers starting * with nameBase within the provided shader program. * After this method has been called, users may invoke setValue. */ - virtual void bind(ProgramObject* programObject, const Layer& layer, - const std::string& nameBase, int pileSize); + virtual void bind(ghoul::opengl::ProgramObject* programObject, const Layer& layer, + const std::string& nameBase, int pileSize); /** * Deactivates any TextureUnits assigned by this object. diff --git a/modules/globebrowsing/rendering/gpu/gpulayergroup.cpp b/modules/globebrowsing/rendering/gpu/gpulayergroup.cpp index 0a14a317b5..f18d21e52c 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayergroup.cpp +++ b/modules/globebrowsing/rendering/gpu/gpulayergroup.cpp @@ -31,16 +31,16 @@ namespace openspace { namespace globebrowsing { -void GPULayerGroup::setValue(ProgramObject* programObject, const LayerGroup& layerGroup, - const TileIndex& tileIndex) +void GPULayerGroup::setValue(ghoul::opengl::ProgramObject* programObject, + const LayerGroup& layerGroup, const TileIndex& tileIndex) { auto& activeLayers = layerGroup.activeLayers(); ghoul_assert( - activeLayers.size() == gpuActiveLayers.size(), + activeLayers.size() == _gpuActiveLayers.size(), "GPU and CPU active layers must have same size!" ); for (int i = 0; i < activeLayers.size(); ++i) { - gpuActiveLayers[i]->setValue( + _gpuActiveLayers[i]->setValue( programObject, *activeLayers[i], tileIndex, @@ -49,19 +49,20 @@ void GPULayerGroup::setValue(ProgramObject* programObject, const LayerGroup& lay } } -void GPULayerGroup::bind(ProgramObject* programObject, const LayerGroup& layerGroup, - const std::string& nameBase, int category) +void GPULayerGroup::bind(ghoul::opengl::ProgramObject* programObject, + const LayerGroup& layerGroup, const std::string& nameBase, + int category) { auto activeLayers = layerGroup.activeLayers(); - gpuActiveLayers.resize(activeLayers.size()); + _gpuActiveLayers.resize(activeLayers.size()); int pileSize = layerGroup.pileSize(); - for (size_t i = 0; i < gpuActiveLayers.size(); ++i) { + for (size_t i = 0; i < _gpuActiveLayers.size(); ++i) { // should maybe a proper GPULayer factory - gpuActiveLayers[i] = (category == LayerManager::HeightLayers) ? + _gpuActiveLayers[i] = (category == LayerManager::HeightLayers) ? std::make_unique() : std::make_unique(); std::string nameExtension = "[" + std::to_string(i) + "]."; - gpuActiveLayers[i]->bind( + _gpuActiveLayers[i]->bind( programObject, *activeLayers[i], nameBase + nameExtension, @@ -71,8 +72,8 @@ void GPULayerGroup::bind(ProgramObject* programObject, const LayerGroup& layerGr } void GPULayerGroup::deactivate() { - for (size_t i = 0; i < gpuActiveLayers.size(); ++i) { - gpuActiveLayers[i]->deactivate(); + for (std::unique_ptr& l : _gpuActiveLayers) { + l->deactivate(); } } diff --git a/modules/globebrowsing/rendering/gpu/gpulayergroup.h b/modules/globebrowsing/rendering/gpu/gpulayergroup.h index 8d93755b3f..753cd6a6e5 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayergroup.h +++ b/modules/globebrowsing/rendering/gpu/gpulayergroup.h @@ -59,16 +59,16 @@ public: * GPU struct. OBS! Users must ensure bind has been * called before setting using this method. */ - virtual void setValue(ProgramObject* programObject, const LayerGroup& layerGroup, - const TileIndex& tileIndex); + virtual void setValue(ghoul::opengl::ProgramObject* programObject, + const LayerGroup& layerGroup, const TileIndex& tileIndex); /** * Binds this object with GLSL variables with identifiers starting * with nameBase within the provided shader program. * After this method has been called, users may invoke setValue. */ - virtual void bind(ProgramObject* programObject, const LayerGroup& layerGroup, - const std::string& nameBase, int category); + virtual void bind(ghoul::opengl::ProgramObject* programObject, + const LayerGroup& layerGroup, const std::string& nameBase, int category); /** * Deactivates any TextureUnits assigned by this object. @@ -77,7 +77,7 @@ public: virtual void deactivate(); private: - std::vector> gpuActiveLayers; + std::vector> _gpuActiveLayers; }; } // namespace globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gpulayermanager.cpp b/modules/globebrowsing/rendering/gpu/gpulayermanager.cpp index ab68ae2bec..0f908031a6 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayermanager.cpp +++ b/modules/globebrowsing/rendering/gpu/gpulayermanager.cpp @@ -29,35 +29,36 @@ namespace openspace { namespace globebrowsing { -void GPULayerManager::setValue(ProgramObject* programObject, +void GPULayerManager::setValue(ghoul::opengl::ProgramObject* programObject, const LayerManager& layerManager, const TileIndex& tileIndex) { auto layerGroups = layerManager.layerGroups(); for (size_t i = 0; i < layerGroups.size(); ++i) { - gpuLayerGroups[i]->setValue(programObject, *layerGroups[i], tileIndex); + _gpuLayerGroups[i]->setValue(programObject, *layerGroups[i], tileIndex); } } -void GPULayerManager::bind(ProgramObject* programObject, const LayerManager& layerManager) +void GPULayerManager::bind(ghoul::opengl::ProgramObject* programObject, + const LayerManager& layerManager) { auto layerGroups = layerManager.layerGroups(); - if (gpuLayerGroups.size() != layerGroups.size()) { - gpuLayerGroups.resize(layerGroups.size()); - for (auto& gpuLayerGroup : gpuLayerGroups){ + if (_gpuLayerGroups.size() != layerGroups.size()) { + _gpuLayerGroups.resize(layerGroups.size()); + for (auto& gpuLayerGroup : _gpuLayerGroups){ gpuLayerGroup = std::make_unique(); } } for (size_t i = 0; i < layerGroups.size(); ++i) { std::string nameBase = LayerManager::LAYER_GROUP_NAMES[i]; - gpuLayerGroups[i]->bind(programObject, *layerGroups[i], nameBase, i); + _gpuLayerGroups[i]->bind(programObject, *layerGroups[i], nameBase, i); } } void GPULayerManager::deactivate() { - for (size_t i = 0; i < gpuLayerGroups.size(); ++i) { - gpuLayerGroups[i]->deactivate(); + for (std::unique_ptr& l : _gpuLayerGroups) { + l->deactivate(); } } diff --git a/modules/globebrowsing/rendering/gpu/gpulayermanager.h b/modules/globebrowsing/rendering/gpu/gpulayermanager.h index 6da1c15160..ee065e8f2f 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayermanager.h +++ b/modules/globebrowsing/rendering/gpu/gpulayermanager.h @@ -49,15 +49,16 @@ public: * GPU struct. OBS! Users must ensure bind has been * called before setting using this method. */ - virtual void setValue(ProgramObject* programObject, const LayerManager& layerManager, - const TileIndex& tileIndex); + virtual void setValue(ghoul::opengl::ProgramObject* programObject, + const LayerManager& layerManager, const TileIndex& tileIndex); /** * Binds this object with GLSL variables with identifiers starting * with nameBase within the provided shader program. * After this method has been called, users may invoke setValue. */ - virtual void bind(ProgramObject* programObject, const LayerManager& layerManager); + virtual void bind(ghoul::opengl::ProgramObject* programObject, + const LayerManager& layerManager); /** * Deactivates any TextureUnits assigned by this object. @@ -66,7 +67,7 @@ public: virtual void deactivate(); private: - std::vector> gpuLayerGroups; + std::vector> _gpuLayerGroups; }; } // namespace globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.cpp b/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.cpp index 6edbabb209..f849df1c20 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.cpp +++ b/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.cpp @@ -29,7 +29,7 @@ namespace openspace { namespace globebrowsing { -void GPULayerRenderSettings::setValue(ProgramObject* programObject, +void GPULayerRenderSettings::setValue(ghoul::opengl::ProgramObject* programObject, const LayerRenderSettings& layerSettings) { gpuOpacity.setValue(programObject, layerSettings.opacity.value()); @@ -37,7 +37,7 @@ void GPULayerRenderSettings::setValue(ProgramObject* programObject, gpuMultiplier.setValue(programObject, layerSettings.multiplier.value()); } -void GPULayerRenderSettings::bind(ProgramObject* programObject, +void GPULayerRenderSettings::bind(ghoul::opengl::ProgramObject* programObject, const std::string& nameBase) { gpuOpacity.bind(programObject, nameBase + "opacity"); diff --git a/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.h b/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.h index deee12bbc6..53ba536b42 100644 --- a/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.h +++ b/modules/globebrowsing/rendering/gpu/gpulayerrendersettings.h @@ -48,14 +48,15 @@ public: * GPU struct. OBS! Users must ensure bind has been * called before setting using this method. */ - void setValue(ProgramObject* programObject, const LayerRenderSettings& layerSettings); + void setValue(ghoul::opengl::ProgramObject* programObject, + const LayerRenderSettings& layerSettings); /** * Binds this object with GLSL variables with identifiers starting * with nameBase within the provided shader program. * After this method has been called, users may invoke setValue. */ - void bind(ProgramObject* programObject, const std::string& nameBase); + void bind(ghoul::opengl::ProgramObject* programObject, const std::string& nameBase); private: GPUData gpuOpacity; diff --git a/modules/globebrowsing/rendering/gpu/gputiledepthtransform.cpp b/modules/globebrowsing/rendering/gpu/gputiledepthtransform.cpp index 9ae18d0191..deb14fabc7 100644 --- a/modules/globebrowsing/rendering/gpu/gputiledepthtransform.cpp +++ b/modules/globebrowsing/rendering/gpu/gputiledepthtransform.cpp @@ -29,18 +29,18 @@ namespace openspace { namespace globebrowsing { -void GPUTileDepthTransform::setValue(ProgramObject* programObject, +void GPUTileDepthTransform::setValue(ghoul::opengl::ProgramObject* programObject, const TileDepthTransform& depthTransform) { - gpuDepthOffset.setValue(programObject, depthTransform.depthOffset); - gpuDepthScale.setValue(programObject, depthTransform.depthScale); + _gpuDepthOffset.setValue(programObject, depthTransform.depthOffset); + _gpuDepthScale.setValue(programObject, depthTransform.depthScale); } -void GPUTileDepthTransform::bind(ProgramObject* programObject, +void GPUTileDepthTransform::bind(ghoul::opengl::ProgramObject* programObject, const std::string& nameBase) { - gpuDepthOffset.bind(programObject, nameBase + "depthOffset"); - gpuDepthScale.bind(programObject, nameBase + "depthScale"); + _gpuDepthOffset.bind(programObject, nameBase + "depthOffset"); + _gpuDepthScale.bind(programObject, nameBase + "depthScale"); } } // namespace globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gputiledepthtransform.h b/modules/globebrowsing/rendering/gpu/gputiledepthtransform.h index 8f1c943cc1..4e16940280 100644 --- a/modules/globebrowsing/rendering/gpu/gputiledepthtransform.h +++ b/modules/globebrowsing/rendering/gpu/gputiledepthtransform.h @@ -48,18 +48,20 @@ public: * GPU struct. OBS! Users must ensure bind has been * called before setting using this method. */ - void setValue(ProgramObject* programObject, const TileDepthTransform& depthTransform); + void setValue(ghoul::opengl::ProgramObject* programObject, + const TileDepthTransform& depthTransform); /** * Binds GLSL variables with identifiers starting with * nameBase within the provided shader program with this object. * After this method has been called, users may invoke setValue. */ - void bind(ProgramObject* programObject, const std::string& nameBase); + void bind(ghoul::opengl::ProgramObject* programObject, + const std::string& nameBase); private: - GPUData gpuDepthOffset; - GPUData gpuDepthScale; + GPUData _gpuDepthOffset; + GPUData _gpuDepthScale; }; } // namespace globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gputileuvtransform.cpp b/modules/globebrowsing/rendering/gpu/gputileuvtransform.cpp index ab9e3cd51d..477b02b75b 100644 --- a/modules/globebrowsing/rendering/gpu/gputileuvtransform.cpp +++ b/modules/globebrowsing/rendering/gpu/gputileuvtransform.cpp @@ -33,16 +33,18 @@ namespace openspace { namespace globebrowsing { -void GPUTileUvTransform::setValue(ProgramObject* programObject, +void GPUTileUvTransform::setValue(ghoul::opengl::ProgramObject* programObject, const TileUvTransform& tileUvTransform) { - gpuUvOffset.setValue(programObject, tileUvTransform.uvOffset); - gpuUvScale.setValue(programObject, tileUvTransform.uvScale); + _gpuUvOffset.setValue(programObject, tileUvTransform.uvOffset); + _gpuUvScale.setValue(programObject, tileUvTransform.uvScale); } -void GPUTileUvTransform::bind(ProgramObject* programObject, const std::string& nameBase) { - gpuUvOffset.bind(programObject, nameBase + "uvOffset"); - gpuUvScale.bind(programObject, nameBase + "uvScale"); +void GPUTileUvTransform::bind(ghoul::opengl::ProgramObject* programObject, + const std::string& nameBase) +{ + _gpuUvOffset.bind(programObject, nameBase + "uvOffset"); + _gpuUvScale.bind(programObject, nameBase + "uvScale"); } } // namespace globebrowsing diff --git a/modules/globebrowsing/rendering/gpu/gputileuvtransform.h b/modules/globebrowsing/rendering/gpu/gputileuvtransform.h index df7b838e17..066eebfc47 100644 --- a/modules/globebrowsing/rendering/gpu/gputileuvtransform.h +++ b/modules/globebrowsing/rendering/gpu/gputileuvtransform.h @@ -48,18 +48,20 @@ public: * GPU struct. OBS! Users must ensure bind has been * called before setting using this method. */ - void setValue(ProgramObject* programObject, const TileUvTransform& uvTransform); + void setValue(ghoul::opengl::ProgramObject* programObject, + const TileUvTransform& uvTransform); /** * Binds GLSL variables with identifiers starting with * nameBase within the provided shader program with this object. * After this method has been called, users may invoke setValue. */ - void bind(ProgramObject* programObject, const std::string& nameBase); + void bind(ghoul::opengl::ProgramObject* programObject, + const std::string& nameBase); private: - GPUData gpuUvOffset; - GPUData gpuUvScale; + GPUData _gpuUvOffset; + GPUData _gpuUvScale; }; } // namespace globebrowsing diff --git a/modules/globebrowsing/tile/tileprovider/singleimageprovider.cpp b/modules/globebrowsing/tile/tileprovider/singleimageprovider.cpp index 5157f60072..a2beeb5fe9 100644 --- a/modules/globebrowsing/tile/tileprovider/singleimageprovider.cpp +++ b/modules/globebrowsing/tile/tileprovider/singleimageprovider.cpp @@ -76,7 +76,9 @@ void SingleImageProvider::update() { void SingleImageProvider::reset() { _tile = Tile(); - _tile.texture = std::shared_ptr(ghoul::io::TextureReader::ref().loadTexture(_imagePath).release()); + _tile.texture = std::shared_ptr( + std::move(ghoul::io::TextureReader::ref().loadTexture(_imagePath)) + ); _tile.status = _tile.texture != nullptr ? Tile::Status::OK : Tile::Status::IOError; _tile.metaData = nullptr; diff --git a/modules/globebrowsing/tile/tileprovider/singleimageprovider.h b/modules/globebrowsing/tile/tileprovider/singleimageprovider.h index 0f79d4ace9..eacf9d63d8 100644 --- a/modules/globebrowsing/tile/tileprovider/singleimageprovider.h +++ b/modules/globebrowsing/tile/tileprovider/singleimageprovider.h @@ -31,8 +31,6 @@ namespace openspace { namespace globebrowsing { namespace tileprovider { -using namespace ghoul::opengl; - class SingleImageProvider : public TileProvider { public: SingleImageProvider(const ghoul::Dictionary& dictionary); diff --git a/src/util/gpudata.cpp b/src/util/gpudata.cpp index be4d438942..b362bb2dc6 100644 --- a/src/util/gpudata.cpp +++ b/src/util/gpudata.cpp @@ -28,7 +28,8 @@ namespace openspace { -void UniformLocation::bind(ProgramObject* program, const std::string& name){ +void UniformLocation::bind(ghoul::opengl::ProgramObject* program, const std::string& name) +{ _uniformLocation = program->uniformLocation(name); } diff --git a/support/coding/check_style_guide.py b/support/coding/check_style_guide.py index aed2d9720f..ead3bb69dc 100644 --- a/support/coding/check_style_guide.py +++ b/support/coding/check_style_guide.py @@ -240,6 +240,14 @@ def check_core_dependency(lines, component): else: return '' +def check_using_namespace(lines): + index = [i for i,s in enumerate(lines) if "using namespace" in s.strip()] + + if len(index) > 0: + return lines[index[0]] + else: + return '' + previousSymbols = {} def check_header_file(file, component): @@ -300,7 +308,11 @@ def check_header_file(file, component): core_dependency = check_core_dependency(lines, component) if core_dependency: - print(file, '\t' 'Wrong core dependency', core_dependency) + print(file, '\t', 'Wrong dependency (core depends on module)', core_dependency) + + using_namespaces = check_using_namespace(lines) + if using_namespaces: + print(file, '\t', 'Using namespace found in header file') def check_source_file(file, component):