diff --git a/modules/globebrowsing/rendering/patchrenderer.cpp b/modules/globebrowsing/rendering/patchrenderer.cpp index b3da920666..3f7aba2706 100644 --- a/modules/globebrowsing/rendering/patchrenderer.cpp +++ b/modules/globebrowsing/rendering/patchrenderer.cpp @@ -161,7 +161,7 @@ namespace openspace { _programObject->activate(); using namespace glm; - const mat4& viewTransform = data.camera.combinedViewMatrix(); + mat4 viewTransform = data.camera.combinedViewMatrix(); // TODO : Model transform should be fetched as a matrix directly. mat4 modelTransform = translate(mat4(1), data.position.vec3()); diff --git a/modules/globebrowsing/rendering/renderableglobe.cpp b/modules/globebrowsing/rendering/renderableglobe.cpp index 2a7ab9a3f1..c22f8d8490 100644 --- a/modules/globebrowsing/rendering/renderableglobe.cpp +++ b/modules/globebrowsing/rendering/renderableglobe.cpp @@ -71,8 +71,8 @@ namespace openspace { // Mainly for debugging purposes @AA addProperty(_rotation); - //addSwitchValue(std::shared_ptr(new ClipMapGlobe(dictionary)), 1e9); - addSwitchValue(std::shared_ptr(new ChunkLodGlobe(dictionary)), 1e9); + addSwitchValue(std::shared_ptr(new ClipMapGlobe(dictionary)), 1e9); + //addSwitchValue(std::shared_ptr(new ChunkLodGlobe(dictionary)), 1e9); addSwitchValue(std::shared_ptr(new GlobeMesh(dictionary)), 1e10); } diff --git a/modules/globebrowsing/rendering/texturetileset.cpp b/modules/globebrowsing/rendering/texturetileset.cpp index 5b7ef25526..a3119c8570 100644 --- a/modules/globebrowsing/rendering/texturetileset.cpp +++ b/modules/globebrowsing/rendering/texturetileset.cpp @@ -45,6 +45,11 @@ namespace openspace { return glm::ivec3(tileIndex, level); } + TextureTile TextureTileSet::getTile(LatLonPatch patch) + { + return getTile(getTileIndex(patch)); + } + TextureTile TextureTileSet::getTile(glm::ivec3 tileIndex) { return TextureTile(); @@ -52,7 +57,16 @@ namespace openspace { LatLonPatch TextureTileSet::getTilePositionAndScale(glm::ivec3 tileIndex) { - return LatLonPatch(LatLon(), LatLon()); + LatLon tileSize = LatLon( + sizeLevel0.lat / pow(2, tileIndex.z), + sizeLevel0.lon / pow(2, tileIndex.z)); + 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(tileSize.lat / 2, tileSize.lon / 2)); } } // namespace openspace diff --git a/modules/globebrowsing/rendering/texturetileset.h b/modules/globebrowsing/rendering/texturetileset.h index a59683273e..2549a6fcf4 100644 --- a/modules/globebrowsing/rendering/texturetileset.h +++ b/modules/globebrowsing/rendering/texturetileset.h @@ -43,6 +43,7 @@ namespace openspace { /// Without the tile being smaller than the patch in lat-lon space. /// The tile needs to be at least as big as the patch. glm::ivec3 getTileIndex(LatLonPatch patch); + TextureTile getTile(LatLonPatch patch); TextureTile getTile(glm::ivec3 tileIndex); LatLonPatch getTilePositionAndScale(glm::ivec3 tileIndex); private: