mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-06 19:39:56 -05:00
Clean up
This commit is contained in:
@@ -25,7 +25,6 @@
|
||||
#include <modules/globebrowsing/rendering/gpu/gpulayer.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/layer/layer.h>
|
||||
#include <modules/globebrowsing/tile/tiletextureinitdata.h>
|
||||
|
||||
namespace openspace::globebrowsing {
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ glm::ivec2 Layer::tilePixelSizeDifference() const {
|
||||
}
|
||||
|
||||
glm::vec2 Layer::compensateSourceTextureSampling(glm::vec2 startOffset, glm::vec2 sizeDiff,
|
||||
glm::uvec2 resolution, glm::vec2 tileUV)
|
||||
glm::uvec2 resolution, glm::vec2 tileUV)
|
||||
{
|
||||
glm::vec2 sourceSize = glm::vec2(resolution) + sizeDiff;
|
||||
glm::vec2 currentSize = glm::vec2(resolution);
|
||||
@@ -291,7 +291,7 @@ glm::vec2 Layer::compensateSourceTextureSampling(glm::vec2 startOffset, glm::vec
|
||||
}
|
||||
|
||||
glm::vec2 Layer::TileUvToTextureSamplePosition(const TileUvTransform& uvTransform,
|
||||
glm::vec2 tileUV, glm::uvec2 resolution)
|
||||
glm::vec2 tileUV, glm::uvec2 resolution)
|
||||
{
|
||||
glm::vec2 uv = uvTransform.uvOffset + uvTransform.uvScale * tileUV;
|
||||
uv = compensateSourceTextureSampling(
|
||||
|
||||
@@ -59,7 +59,8 @@ public:
|
||||
void reset(bool includingDisabled = false);
|
||||
|
||||
static TileTextureInitData getTileTextureInitData(layergroupid::GroupID id,
|
||||
bool padTiles, size_t preferredTileSize = 0);
|
||||
bool padTiles,
|
||||
size_t preferredTileSize = 0);
|
||||
|
||||
static bool shouldPerformPreProcessingOnLayergroup(layergroupid::GroupID id);
|
||||
void onChange(std::function<void(void)> callback);
|
||||
|
||||
@@ -63,11 +63,10 @@ public:
|
||||
* \param baseDirectory, the base directory to use in future loading operations
|
||||
*/
|
||||
GdalRawTileDataReader(const std::string& filePath,
|
||||
const TileTextureInitData& initData,
|
||||
const std::string& baseDirectory = "",
|
||||
RawTileDataReader::PerformPreprocessing preprocess =
|
||||
RawTileDataReader::PerformPreprocessing::No
|
||||
);
|
||||
const TileTextureInitData& initData,
|
||||
const std::string& baseDirectory = "",
|
||||
RawTileDataReader::PerformPreprocessing preprocess =
|
||||
RawTileDataReader::PerformPreprocessing::No);
|
||||
|
||||
|
||||
virtual ~GdalRawTileDataReader() override;
|
||||
@@ -95,8 +94,8 @@ protected:
|
||||
private:
|
||||
// Private virtual function overloading
|
||||
virtual void initialize() override;
|
||||
virtual RawTile::ReadError rasterRead(
|
||||
int rasterBand, const IODescription& io, char* dst) const override;
|
||||
virtual RawTile::ReadError rasterRead(int rasterBand, const IODescription& io,
|
||||
char* dst) const override;
|
||||
|
||||
// GDAL Helper methods
|
||||
GDALDataset* openGdalDataset(const std::string& filePath);
|
||||
|
||||
@@ -56,11 +56,11 @@
|
||||
namespace openspace::globebrowsing {
|
||||
|
||||
RawTileDataReader::RawTileDataReader(const TileTextureInitData& initData,
|
||||
PerformPreprocessing preprocess)
|
||||
PerformPreprocessing preprocess)
|
||||
: _initData(initData)
|
||||
, _preprocess(preprocess)
|
||||
, _hasBeenInitialized(false)
|
||||
{}
|
||||
{ }
|
||||
|
||||
std::shared_ptr<RawTile> RawTileDataReader::defaultTileData() const {
|
||||
return std::make_shared<RawTile>(RawTile::createDefault(_initData));
|
||||
@@ -110,9 +110,9 @@ std::shared_ptr<RawTile> RawTileDataReader::readTileData(TileIndex tileIndex,
|
||||
return rawTile;
|
||||
}
|
||||
|
||||
void RawTileDataReader::readImageData(
|
||||
IODescription& io, RawTile::ReadError& worstError, char* imageDataDest) const {
|
||||
|
||||
void RawTileDataReader::readImageData(IODescription& io, RawTile::ReadError& worstError,
|
||||
char* imageDataDest) const
|
||||
{
|
||||
io = adjustIODescription(io);
|
||||
|
||||
// Only read the minimum number of rasters
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
using PerformPreprocessing = ghoul::Boolean;
|
||||
|
||||
RawTileDataReader(const TileTextureInitData& initData,
|
||||
PerformPreprocessing preprocess = PerformPreprocessing::No);
|
||||
PerformPreprocessing preprocess = PerformPreprocessing::No);
|
||||
virtual ~RawTileDataReader() = default;
|
||||
|
||||
/**
|
||||
|
||||
@@ -140,8 +140,10 @@ void DefaultTileProvider::update() {
|
||||
initTexturesFromLoadedData();
|
||||
if (_asyncTextureDataProvider->shouldBeDeleted()) {
|
||||
_asyncTextureDataProvider = nullptr;
|
||||
TileTextureInitData initData(LayerManager::getTileTextureInitData(
|
||||
_layerGroupID, _padTiles, _tilePixelSize));
|
||||
TileTextureInitData initData(
|
||||
LayerManager::getTileTextureInitData(_layerGroupID, _padTiles,
|
||||
_tilePixelSize)
|
||||
);
|
||||
initAsyncTileDataReader(initData);
|
||||
}
|
||||
}
|
||||
@@ -153,8 +155,10 @@ void DefaultTileProvider::reset() {
|
||||
_asyncTextureDataProvider->prepairToBeDeleted();
|
||||
}
|
||||
else {
|
||||
TileTextureInitData initData(LayerManager::getTileTextureInitData(
|
||||
_layerGroupID, _padTiles, _tilePixelSize));
|
||||
TileTextureInitData initData(
|
||||
LayerManager::getTileTextureInitData(_layerGroupID, _padTiles,
|
||||
_tilePixelSize)
|
||||
);
|
||||
initAsyncTileDataReader(initData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,8 @@ void TileProvider::initializeDefaultTile() {
|
||||
using namespace ghoul::opengl;
|
||||
|
||||
// Create pixel data
|
||||
TileTextureInitData initData(8, 8, GL_UNSIGNED_BYTE, Texture::Format::RGBA, false,
|
||||
TileTextureInitData initData(8, 8, GL_UNSIGNED_BYTE, Texture::Format::RGBA,
|
||||
false,
|
||||
TileTextureInitData::ShouldAllocateDataOnCPU::Yes);
|
||||
int numBytes = initData.totalNumBytes();
|
||||
char* pixels = new char[numBytes];
|
||||
|
||||
@@ -95,7 +95,7 @@ TileProviderByLevel::TileProviderByLevel(const ghoul::Dictionary& dictionary) {
|
||||
addPropertySubOwner(_levelTileProviders.back().get());
|
||||
|
||||
// Ensure we can represent the max level
|
||||
if(static_cast<int>(_providerIndices.size()) < maxLevel){
|
||||
if (static_cast<int>(_providerIndices.size()) < maxLevel) {
|
||||
_providerIndices.resize(maxLevel+1, -1);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ TileProviderByLevel::TileProviderByLevel(const ghoul::Dictionary& dictionary) {
|
||||
}
|
||||
|
||||
// Fill in the gaps (value -1) in provider indices, from back to end
|
||||
for(int i = _providerIndices.size() - 2; i >= 0; --i){
|
||||
for (int i = _providerIndices.size() - 2; i >= 0; --i) {
|
||||
if(_providerIndices[i] == -1){
|
||||
_providerIndices[i] = _providerIndices[i+1];
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ const glm::ivec2 TileTextureInitData::TilePixelStartOffset = glm::ivec2(-2);
|
||||
const glm::ivec2 TileTextureInitData::TilePixelSizeDifference = glm::ivec2(4);
|
||||
|
||||
TileTextureInitData::TileTextureInitData(size_t width, size_t height, GLenum glType,
|
||||
Format textureFormat, bool padTiles, ShouldAllocateDataOnCPU shouldAllocateDataOnCPU)
|
||||
Format textureFormat, bool padTiles,
|
||||
ShouldAllocateDataOnCPU shouldAllocateDataOnCPU)
|
||||
: _glType(glType)
|
||||
, _ghoulTextureFormat(textureFormat)
|
||||
, _padTiles(padTiles)
|
||||
|
||||
@@ -43,8 +43,8 @@ public:
|
||||
using Format = ghoul::opengl::Texture::Format;
|
||||
|
||||
TileTextureInitData(size_t width, size_t height, GLenum glType, Format textureFormat,
|
||||
bool padTiles,
|
||||
ShouldAllocateDataOnCPU shouldAllocateDataOnCPU = ShouldAllocateDataOnCPU::No);
|
||||
bool padTiles,
|
||||
ShouldAllocateDataOnCPU shouldAllocateDataOnCPU = ShouldAllocateDataOnCPU::No);
|
||||
|
||||
TileTextureInitData(const TileTextureInitData& original);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user