Define interface for TextureTileSet.

This commit is contained in:
Kalle Bladin
2016-04-15 10:38:40 -04:00
parent 56f9db60bc
commit 0f88b922f7
4 changed files with 19 additions and 4 deletions

View File

@@ -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());

View File

@@ -71,8 +71,8 @@ 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);
}

View File

@@ -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

View File

@@ -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: