mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 12:39:24 -05:00
Solve conflict and fixed old code that did not run on OSX due to use of depricated shader functionality.
This commit is contained in:
@@ -57,6 +57,7 @@ namespace openspace {
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
PatchRenderer::PatchRenderer(shared_ptr<Geometry> geometry)
|
||||
: _geometry(geometry)
|
||||
, _tileSet(LatLon(M_PI, M_PI * 2), LatLon(M_PI / 2, - M_PI), 0)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -90,12 +91,20 @@ namespace openspace {
|
||||
void LatLonPatchRenderer::renderPatch(
|
||||
const LatLonPatch& patch, const RenderData& data, double radius)
|
||||
{
|
||||
// activate shader
|
||||
_programObject->activate();
|
||||
|
||||
// Get the textures that should be used for rendering
|
||||
TileIndex ti = _tileSet.getTileIndex(patch);
|
||||
|
||||
renderPatch(patch, data, radius, ti);
|
||||
}
|
||||
|
||||
void LatLonPatchRenderer::renderPatch(
|
||||
const LatLonPatch& patch, const RenderData& data, double radius, const TileIndex& tileIndex)
|
||||
{
|
||||
|
||||
using namespace glm;
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO : Model transform should be fetched as a matrix directly.
|
||||
mat4 modelTransform = translate(mat4(1), data.position.vec3());
|
||||
@@ -103,21 +112,27 @@ namespace openspace {
|
||||
mat4 modelViewProjectionTransform = data.camera.projectionMatrix()
|
||||
* viewTransform * modelTransform;
|
||||
|
||||
|
||||
// activate shader
|
||||
_programObject->activate();
|
||||
|
||||
// Get the textures that should be used for rendering
|
||||
glm::ivec3 tileIndex = tileSet.getTileIndex(patch);
|
||||
LatLonPatch tilePatch = tileSet.getTilePositionAndScale(tileIndex);
|
||||
std::shared_ptr<ghoul::opengl::Texture> tile00 = tileSet.getTile(tileIndex);
|
||||
LatLonPatch tilePatch = _tileSet.getTilePositionAndScale(tileIndex);
|
||||
std::shared_ptr<ghoul::opengl::Texture> tile00 = _tileSet.getTile(tileIndex);
|
||||
glm::mat3 uvTransform = _tileSet.getUvTransformationPatchToTile(patch, tileIndex);
|
||||
|
||||
// Bind and use the texture
|
||||
ghoul::opengl::TextureUnit texUnit;
|
||||
texUnit.activate();
|
||||
tile00->bind();
|
||||
_programObject->setUniform("textureSampler", texUnit);
|
||||
|
||||
|
||||
_programObject->setUniform("uvTransformPatchToTile", uvTransform);
|
||||
|
||||
LatLon swCorner = patch.southWestCorner();
|
||||
_programObject->setUniform("modelViewProjectionTransform", modelViewProjectionTransform);
|
||||
_programObject->setUniform("minLatLon", vec2(swCorner.toLonLatVec2()));
|
||||
_programObject->setUniform("lonLatScalingFactor", 2.0f * vec2(patch.halfSize().toLonLatVec2()));
|
||||
_programObject->setUniform("lonLatScalingFactor", vec2(patch.size().toLonLatVec2()));
|
||||
_programObject->setUniform("globeRadius", float(radius));
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@@ -131,6 +146,8 @@ namespace openspace {
|
||||
_programObject->deactivate();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// CLIPMAP PATCH RENDERER //
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -171,9 +188,10 @@ namespace openspace {
|
||||
ivec2 intSnapCoord = ivec2(
|
||||
patch.center().lat / (M_PI * 2) * segmentsPerPatch * patchesToCoverGlobe.y,
|
||||
patch.center().lon / (M_PI) * segmentsPerPatch * patchesToCoverGlobe.x);
|
||||
LatLon swCorner = LatLon(
|
||||
stepSize.lat * intSnapCoord.x - halfSize.lat,
|
||||
stepSize.lon * intSnapCoord.y - halfSize.lon);
|
||||
LatLon newPatchCenter = LatLon(
|
||||
stepSize.lat * intSnapCoord.x,
|
||||
stepSize.lon * intSnapCoord.y);
|
||||
LatLonPatch newPatch(newPatchCenter, patch.halfSize());
|
||||
|
||||
ivec2 contraction = ivec2(intSnapCoord.y % 2, intSnapCoord.x % 2);
|
||||
|
||||
@@ -183,18 +201,20 @@ namespace openspace {
|
||||
|
||||
|
||||
// Get the textures that should be used for rendering
|
||||
glm::ivec3 tileIndex = tileSet.getTileIndex(patch);
|
||||
LatLonPatch tilePatch = tileSet.getTilePositionAndScale(tileIndex);
|
||||
std::shared_ptr<ghoul::opengl::Texture> tile00 = tileSet.getTile(tileIndex);
|
||||
TileIndex tileIndex = _tileSet.getTileIndex(patch);
|
||||
LatLonPatch tilePatch = _tileSet.getTilePositionAndScale(tileIndex);
|
||||
std::shared_ptr<ghoul::opengl::Texture> tile00 = _tileSet.getTile(tileIndex);
|
||||
glm::mat3 uvTransform = _tileSet.getUvTransformationPatchToTile(newPatch, tileIndex);
|
||||
|
||||
// Bind and use the texture
|
||||
ghoul::opengl::TextureUnit texUnit;
|
||||
texUnit.activate();
|
||||
tile00->bind();
|
||||
_programObject->setUniform("textureSampler", texUnit);
|
||||
_programObject->setUniform("uvTransformPatchToTile", mat3(uvTransform));
|
||||
|
||||
_programObject->setUniform("modelViewProjectionTransform", data.camera.projectionMatrix() * viewTransform * modelTransform);
|
||||
_programObject->setUniform("minLatLon", vec2(swCorner.toLonLatVec2()));
|
||||
_programObject->setUniform("minLatLon", vec2(newPatch.southWestCorner().toLonLatVec2()));
|
||||
_programObject->setUniform("lonLatScalingFactor", 2.0f * vec2(halfSize.toLonLatVec2()));
|
||||
_programObject->setUniform("globeRadius", float(radius));
|
||||
_programObject->setUniform("contraction", contraction);
|
||||
|
||||
@@ -59,15 +59,14 @@ namespace openspace {
|
||||
~PatchRenderer();
|
||||
|
||||
virtual void renderPatch(const LatLonPatch& patch, const RenderData& data, double radius) = 0;
|
||||
|
||||
void setFrustrumCuller(std::shared_ptr<FrustrumCuller> fc);
|
||||
virtual void renderPatch(const LatLonPatch& patch, const RenderData& data, double radius, const TileIndex& ti) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
unique_ptr<ProgramObject> _programObject;
|
||||
shared_ptr<Geometry> _geometry;
|
||||
|
||||
TextureTileSet tileSet;
|
||||
TextureTileSet _tileSet;
|
||||
};
|
||||
|
||||
|
||||
@@ -83,8 +82,16 @@ namespace openspace {
|
||||
const LatLonPatch& patch,
|
||||
const RenderData& data,
|
||||
double radius) override;
|
||||
|
||||
virtual void renderPatch(
|
||||
const LatLonPatch& patch,
|
||||
const RenderData& data,
|
||||
double radius,
|
||||
const TileIndex& ti) override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ClipMapPatchRenderer : public PatchRenderer {
|
||||
public:
|
||||
ClipMapPatchRenderer();
|
||||
@@ -93,6 +100,13 @@ namespace openspace {
|
||||
const LatLonPatch& patch,
|
||||
const RenderData& data,
|
||||
double radius) override;
|
||||
|
||||
virtual void renderPatch(
|
||||
const LatLonPatch& patch,
|
||||
const RenderData& data,
|
||||
double radius,
|
||||
const TileIndex& ti) { /* empty */};
|
||||
|
||||
};
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -71,9 +71,11 @@ namespace openspace {
|
||||
// Mainly for debugging purposes @AA
|
||||
addProperty(_rotation);
|
||||
|
||||
addSwitchValue(std::shared_ptr<ClipMapGlobe>(new ClipMapGlobe(dictionary)), 1e9);
|
||||
//addSwitchValue(std::shared_ptr<ChunkLodGlobe>(new ChunkLodGlobe(dictionary)), 1e9);
|
||||
//addSwitchValue(std::shared_ptr<ClipMapGlobe>(new ClipMapGlobe(dictionary)), 1e9);
|
||||
addSwitchValue(std::shared_ptr<ChunkLodGlobe>(new ChunkLodGlobe(dictionary)), 1e9);
|
||||
addSwitchValue(std::shared_ptr<GlobeMesh>(new GlobeMesh(dictionary)), 1e10);
|
||||
|
||||
|
||||
}
|
||||
|
||||
RenderableGlobe::~RenderableGlobe() {
|
||||
|
||||
@@ -23,21 +23,33 @@
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/rendering/texturetileset.h>
|
||||
|
||||
#include <ghoul/opengl/texturemanager.h>
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "TextureTileSet";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
TextureTileSet::TextureTileSet()
|
||||
{
|
||||
|
||||
TextureTileSet::TextureTileSet(LatLon sizeLevel0, LatLon offsetLevel0, int depth)
|
||||
: _sizeLevel0(sizeLevel0)
|
||||
, _offsetLevel0(offsetLevel0)
|
||||
, _depth(depth)
|
||||
{
|
||||
|
||||
// Set e texture to test
|
||||
_testTexture = std::move(ghoul::io::TextureReader::ref().loadTexture(absPath("textures/earth_bluemarble.jpg")));
|
||||
if (_testTexture) {
|
||||
LDEBUG("Loaded texture from '" << "textures/earth_bluemarble.jpg" << "'");
|
||||
@@ -48,46 +60,86 @@ namespace openspace {
|
||||
//_testTexture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap);
|
||||
_testTexture->setFilter(ghoul::opengl::Texture::FilterMode::Linear);
|
||||
}
|
||||
/*
|
||||
int dataSize = _testTexture->width() * _testTexture->height() * _testTexture->bytesPerPixel();
|
||||
GLubyte* data = new GLubyte[dataSize];
|
||||
for (size_t i = 0; i < dataSize; i++)
|
||||
{
|
||||
data[i] = unsigned char(i / float(dataSize) * 255);
|
||||
}
|
||||
_testTexture->setPixelData(data);
|
||||
_testTexture->uploadTexture();
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
TextureTileSet::~TextureTileSet()
|
||||
{
|
||||
TextureTileSet::~TextureTileSet(){
|
||||
|
||||
}
|
||||
|
||||
glm::ivec3 TextureTileSet::getTileIndex(LatLonPatch patch)
|
||||
{
|
||||
TileIndex TextureTileSet::getTileIndex(LatLonPatch patch) {
|
||||
int level = log2(static_cast<int>(glm::max(
|
||||
_sizeLevel0.lat / patch.halfSize().lat * 2,
|
||||
_sizeLevel0.lon / patch.halfSize().lon * 2)));
|
||||
Vec2 TileSize = _sizeLevel0.toLonLatVec2() / pow(2, level);
|
||||
glm::ivec2 tileIndex = -(patch.northWestCorner().toLonLatVec2() + _offsetLevel0.toLonLatVec2()) / TileSize;
|
||||
_sizeLevel0.lat / (patch.size().lat),
|
||||
_sizeLevel0.lon / (patch.size().lon))));
|
||||
level = glm::min(level, _depth);
|
||||
Vec2 tileSize = _sizeLevel0.toLonLatVec2() / pow(2, level);
|
||||
Vec2 nw = patch.northWestCorner().toLonLatVec2();
|
||||
Vec2 offset = _offsetLevel0.toLonLatVec2();
|
||||
glm::ivec2 tileIndexXY = (nw - offset) / tileSize;
|
||||
|
||||
return glm::ivec3(tileIndex, level);
|
||||
// Flip y since indices increase from top to bottom
|
||||
tileIndexXY.y *= -1;
|
||||
|
||||
TileIndex tileIndex = { tileIndexXY.x, tileIndexXY.y, level };
|
||||
return tileIndex;
|
||||
}
|
||||
|
||||
std::shared_ptr<Texture> TextureTileSet::getTile(LatLonPatch patch)
|
||||
{
|
||||
std::shared_ptr<Texture> TextureTileSet::getTile(LatLonPatch patch) {
|
||||
return getTile(getTileIndex(patch));
|
||||
}
|
||||
|
||||
std::shared_ptr<Texture> TextureTileSet::getTile(glm::ivec3 tileIndex)
|
||||
{
|
||||
std::shared_ptr<Texture> TextureTileSet::getTile(const TileIndex& tileIndex) {
|
||||
return _testTexture;
|
||||
}
|
||||
|
||||
LatLonPatch TextureTileSet::getTilePositionAndScale(glm::ivec3 tileIndex)
|
||||
{
|
||||
LatLonPatch TextureTileSet::getTilePositionAndScale(const TileIndex& tileIndex) {
|
||||
LatLon tileSize = LatLon(
|
||||
_sizeLevel0.lat / pow(2, tileIndex.z),
|
||||
_sizeLevel0.lon / pow(2, tileIndex.z));
|
||||
_sizeLevel0.lat / pow(2, tileIndex.level),
|
||||
_sizeLevel0.lon / pow(2, tileIndex.level));
|
||||
LatLon northWest = LatLon(
|
||||
_offsetLevel0.lat + tileIndex.y * tileSize.lat,
|
||||
_offsetLevel0.lon + tileIndex.x * tileSize.lon);
|
||||
|
||||
return LatLonPatch(
|
||||
LatLon(northWest.lat + tileSize.lat / 2, northWest.lon + tileSize.lon / 2),
|
||||
LatLon(northWest.lat - tileSize.lat / 2, northWest.lon + tileSize.lon / 2),
|
||||
LatLon(tileSize.lat / 2, tileSize.lon / 2));
|
||||
}
|
||||
|
||||
glm::mat3 TextureTileSet::getUvTransformationPatchToTile(
|
||||
LatLonPatch patch,
|
||||
const TileIndex& tileIndex)
|
||||
{
|
||||
LatLonPatch tile = getTilePositionAndScale(tileIndex);
|
||||
Vec2 posDiff =
|
||||
patch.southWestCorner().toLonLatVec2() -
|
||||
tile.southWestCorner().toLonLatVec2();
|
||||
|
||||
glm::mat3 invTileScale = glm::mat3(
|
||||
{1 / (tile.halfSize().lon * 2), 0, 0,
|
||||
0, 1 / (tile.halfSize().lat * 2), 0,
|
||||
0, 0, 1});
|
||||
|
||||
glm::mat3 globalTranslation = glm::mat3(
|
||||
{ 1, 0, 0,
|
||||
0, 1, 0,
|
||||
posDiff.x, posDiff.y, 1 });
|
||||
|
||||
glm::mat3 patchScale = glm::mat3(
|
||||
{ (patch.halfSize().lon * 2), 0, 0,
|
||||
0, (patch.halfSize().lat * 2), 0,
|
||||
0, 0, 1 });
|
||||
|
||||
return invTileScale * globalTranslation * patchScale;
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -29,31 +29,44 @@
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
#include <modules/globebrowsing/datastructures/latlon.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/twmstileprovider.h>
|
||||
#include <modules/globebrowsing/rendering/texturetile.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// TEXTURE TILE SET //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
namespace openspace {
|
||||
using namespace ghoul::opengl;
|
||||
|
||||
class TextureTileSet
|
||||
{
|
||||
public:
|
||||
TextureTileSet();
|
||||
TextureTileSet(LatLon sizeLevel0, LatLon offsetLevel0, int depth);
|
||||
~TextureTileSet();
|
||||
|
||||
/// Returns the index of the tile at an appropriate level.
|
||||
/// Appropriate meaning that the tile should be at as high level as possible
|
||||
/// Without the tile being smaller than the patch in lat-lon space.
|
||||
/// The tile is at least as big as the patch.
|
||||
glm::ivec3 getTileIndex(LatLonPatch patch);
|
||||
TileIndex getTileIndex(LatLonPatch patch);
|
||||
std::shared_ptr<Texture> getTile(LatLonPatch patch);
|
||||
std::shared_ptr<Texture> getTile(glm::ivec3 tileIndex);
|
||||
LatLonPatch getTilePositionAndScale(glm::ivec3 tileIndex);
|
||||
|
||||
std::shared_ptr<Texture> getTile(const TileIndex& tileIndex);
|
||||
LatLonPatch getTilePositionAndScale(const TileIndex& tileIndex);
|
||||
glm::mat3 getUvTransformationPatchToTile(LatLonPatch patch, const TileIndex& tileIndex);
|
||||
private:
|
||||
LatLon _sizeLevel0;
|
||||
LatLon _offsetLevel0;
|
||||
int _depth;
|
||||
|
||||
std::shared_ptr<Texture> _testTexture;
|
||||
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
/*
|
||||
|
||||
#include <modules/globebrowsing/rendering/twmstileprovider.h>
|
||||
|
||||
#include <openspace/engine/downloadmanager.h>
|
||||
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
|
||||
#include <sstream>
|
||||
|
||||
|
||||
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "TwmsTileProvider";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
TwmsTileProvider::TwmsTileProvider()
|
||||
: _tileCache(500) // setting cache size
|
||||
{
|
||||
int downloadApplicationVersion = 1;
|
||||
DownloadManager::initialize("../tmp_openspace_downloads/", downloadApplicationVersion);
|
||||
}
|
||||
|
||||
TwmsTileProvider::~TwmsTileProvider(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<Texture> TwmsTileProvider::getTile(const TileIndex& tileIndex) {
|
||||
HashKey hashkey = tileIndex.hashKey();
|
||||
if (_tileCache.exist(hashkey)) {
|
||||
return _tileCache.get(hashkey);
|
||||
}
|
||||
else {
|
||||
downloadTileAndPutInCache(tileIndex);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TwmsTileProvider::downloadTileAndPutInCache(const TileIndex& tileIndex) {
|
||||
// download tile
|
||||
std::stringstream ss;
|
||||
std::string baseUrl = "https://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi?TIME=2016-04-17&layer=MODIS_Terra_CorrectedReflectance_TrueColor&tilematrixset=EPSG4326_250m&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image%2Fjpeg";
|
||||
ss << baseUrl;
|
||||
ss << "&TileMatrix=" << tileIndex.level;
|
||||
ss << "&TileCol=" << tileIndex.x;
|
||||
ss << "&TileRow=" << tileIndex.y;
|
||||
std::string twmsRequestUrl = ss.str();
|
||||
|
||||
using ghoul::filesystem::File;
|
||||
|
||||
std::string filename = "tiles/tile" + twmsRequestUrl.substr(baseUrl.length()) + ".jpg";
|
||||
File localTileFile(filename);
|
||||
bool overrideFile = true;
|
||||
|
||||
|
||||
|
||||
struct OnTileDownloaded {
|
||||
HashKey key;
|
||||
LRUCache<HashKey, std::shared_ptr<Texture>> * tileCache;
|
||||
|
||||
OnTileDownloaded(HashKey key, LRUCache<HashKey, std::shared_ptr<Texture>> * tileCache)
|
||||
: key(key)
|
||||
, tileCache(tileCache)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void operator()(const DownloadManager::FileFuture& ff) const {
|
||||
LDEBUG("Download of tile with hashkey " << key << " done!");
|
||||
auto textureReader = ghoul::io::TextureReader::ref();
|
||||
std::shared_ptr<Texture> texture = std::move(textureReader.loadTexture(absPath(ff.filePath)));
|
||||
tileCache->put(key, texture);
|
||||
LDEBUG("Cache updated");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
OnTileDownloaded onTileDownloaded(tileIndex.hashKey(), &_tileCache);
|
||||
|
||||
std::shared_ptr<DownloadManager::FileFuture> ff = DownloadManager::ref().downloadFile(twmsRequestUrl, localTileFile, overrideFile, onTileDownloaded);
|
||||
|
||||
}
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
*/
|
||||
@@ -0,0 +1,80 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __TWMS_TILE_PROVIDER_H__
|
||||
#define __TWMS_TILE_PROVIDER_H__
|
||||
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// TILE INDEX //
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace openspace {
|
||||
using HashKey = unsigned long;
|
||||
|
||||
struct TileIndex {
|
||||
int x, y, level;
|
||||
|
||||
HashKey hashKey() const {
|
||||
return x ^ (y << 16) ^ (level << 21);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
#include <modules/globebrowsing/datastructures/lrucache.h>
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// TWMS TILE PROVIDER //
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*
|
||||
namespace openspace {
|
||||
using namespace ghoul::opengl;
|
||||
|
||||
class TwmsTileProvider
|
||||
{
|
||||
public:
|
||||
TwmsTileProvider();
|
||||
~TwmsTileProvider();
|
||||
|
||||
std::shared_ptr<Texture> getTile(const TileIndex& tileIndex);
|
||||
|
||||
|
||||
private:
|
||||
void downloadTileAndPutInCache(const TileIndex&);
|
||||
|
||||
LRUCache<HashKey, std::shared_ptr<Texture>> _tileCache;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
*/
|
||||
#endif // __TWMS_TILE_PROVIDER_H__
|
||||
Reference in New Issue
Block a user