mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-05 19:19:39 -06:00
- Add check in style guide that prevents ‘using namespace’ in header files
- Remove using namespace ghoul::opengl from Globebrowsing and adjust
This commit is contained in:
@@ -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 <openspace/scripting/lualibrary.h>
|
||||
|
||||
@@ -36,4 +36,4 @@ LuaLibrary openglSystemCapabilities();
|
||||
} // namespace scripting
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___SYSTEMCAPABLITIESBINDING___H__
|
||||
#endif // __OPENSPACE_CORE___SYSTEMCAPABILITIESBINDING___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 <name>
|
||||
* 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> texture){
|
||||
_texUnit = std::make_unique<TextureUnit>();
|
||||
void setValue(ghoul::opengl::ProgramObject* program, std::shared_ptr<ghoul::opengl::Texture> texture){
|
||||
_texUnit = std::make_unique<ghoul::opengl::TextureUnit>();
|
||||
_texUnit->activate();
|
||||
texture->bind();
|
||||
program->setUniform(_uniformLocation, *_texUnit);
|
||||
@@ -99,7 +96,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
std::unique_ptr<TextureUnit> _texUnit;
|
||||
std::unique_ptr<ghoul::opengl::TextureUnit> _texUnit;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
@@ -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 <code>TextureUnit</code>s assigned by this object.
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 <code>TextureUnit</code>s assigned by this object.
|
||||
* This method should be called after the OpenGL draw call.
|
||||
@@ -67,7 +68,7 @@ public:
|
||||
void deactivate();
|
||||
|
||||
private:
|
||||
std::vector<GPUChunkTile> gpuChunkTiles;
|
||||
std::vector<GPUChunkTile> _gpuChunkTiles;
|
||||
};
|
||||
|
||||
} // namespace globebrowsing
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 <code>TextureUnit</code>s assigned by this object.
|
||||
|
||||
@@ -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<GPUHeightLayer>() :
|
||||
std::make_unique<GPULayer>();
|
||||
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<GPULayer>& l : _gpuActiveLayers) {
|
||||
l->deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 <code>TextureUnit</code>s assigned by this object.
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
virtual void deactivate();
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<GPULayer>> gpuActiveLayers;
|
||||
std::vector<std::unique_ptr<GPULayer>> _gpuActiveLayers;
|
||||
};
|
||||
|
||||
} // namespace globebrowsing
|
||||
|
||||
@@ -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<GPULayerGroup>();
|
||||
}
|
||||
}
|
||||
|
||||
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<GPULayerGroup>& l : _gpuLayerGroups) {
|
||||
l->deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 <code>TextureUnit</code>s assigned by this object.
|
||||
@@ -66,7 +67,7 @@ public:
|
||||
virtual void deactivate();
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<GPULayerGroup>> gpuLayerGroups;
|
||||
std::vector<std::unique_ptr<GPULayerGroup>> _gpuLayerGroups;
|
||||
};
|
||||
|
||||
} // namespace globebrowsing
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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<float> gpuOpacity;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<float> gpuDepthOffset;
|
||||
GPUData<float> gpuDepthScale;
|
||||
GPUData<float> _gpuDepthOffset;
|
||||
GPUData<float> _gpuDepthScale;
|
||||
};
|
||||
|
||||
} // namespace globebrowsing
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<glm::vec2> gpuUvOffset;
|
||||
GPUData<glm::vec2> gpuUvScale;
|
||||
GPUData<glm::vec2> _gpuUvOffset;
|
||||
GPUData<glm::vec2> _gpuUvScale;
|
||||
};
|
||||
|
||||
} // namespace globebrowsing
|
||||
|
||||
@@ -76,7 +76,9 @@ void SingleImageProvider::update() {
|
||||
|
||||
void SingleImageProvider::reset() {
|
||||
_tile = Tile();
|
||||
_tile.texture = std::shared_ptr<Texture>(ghoul::io::TextureReader::ref().loadTexture(_imagePath).release());
|
||||
_tile.texture = std::shared_ptr<ghoul::opengl::Texture>(
|
||||
std::move(ghoul::io::TextureReader::ref().loadTexture(_imagePath))
|
||||
);
|
||||
_tile.status = _tile.texture != nullptr ? Tile::Status::OK : Tile::Status::IOError;
|
||||
_tile.metaData = nullptr;
|
||||
|
||||
|
||||
@@ -31,8 +31,6 @@ namespace openspace {
|
||||
namespace globebrowsing {
|
||||
namespace tileprovider {
|
||||
|
||||
using namespace ghoul::opengl;
|
||||
|
||||
class SingleImageProvider : public TileProvider {
|
||||
public:
|
||||
SingleImageProvider(const ghoul::Dictionary& dictionary);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user