diff --git a/modules/globebrowsing/CMakeLists.txt b/modules/globebrowsing/CMakeLists.txt index 46a14e7063..53d75f875a 100644 --- a/modules/globebrowsing/CMakeLists.txt +++ b/modules/globebrowsing/CMakeLists.txt @@ -42,9 +42,10 @@ set(HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/geodetics/angle.h ${CMAKE_CURRENT_SOURCE_DIR}/geodetics/ellipsoid.h + ${CMAKE_CURRENT_SOURCE_DIR}/rendering/patchrenderer.h + ${CMAKE_CURRENT_SOURCE_DIR}/rendering/frustumculler.h + ${CMAKE_CURRENT_SOURCE_DIR}/other/distanceswitch.h - ${CMAKE_CURRENT_SOURCE_DIR}/other/patchrenderer.h - ${CMAKE_CURRENT_SOURCE_DIR}/other/frustrumculler.h ${CMAKE_CURRENT_SOURCE_DIR}/other/texturetileset.h ${CMAKE_CURRENT_SOURCE_DIR}/other/twmstileprovider.h ${CMAKE_CURRENT_SOURCE_DIR}/other/gdaldataconverter.h @@ -69,9 +70,10 @@ set(SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/geodetics/angle.inl ${CMAKE_CURRENT_SOURCE_DIR}/geodetics/ellipsoid.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/rendering/patchrenderer.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/rendering/frustumculler.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/other/distanceswitch.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/other/patchrenderer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/other/frustrumculler.cpp ${CMAKE_CURRENT_SOURCE_DIR}/other/texturetileset.cpp ${CMAKE_CURRENT_SOURCE_DIR}/other/twmstileprovider.cpp ${CMAKE_CURRENT_SOURCE_DIR}/other/gdaldataconverter.cpp diff --git a/modules/globebrowsing/globes/chunklodglobe.cpp b/modules/globebrowsing/globes/chunklodglobe.cpp index a944809263..6d1cf21151 100644 --- a/modules/globebrowsing/globes/chunklodglobe.cpp +++ b/modules/globebrowsing/globes/chunklodglobe.cpp @@ -94,7 +94,7 @@ namespace openspace { _patchRenderer.reset(new LatLonPatchRenderer(geometry)); - _frustrumCuller = std::shared_ptr(new FrustrumCuller()); + _frustumCuller = std::shared_ptr(new FrustumCuller()); } @@ -119,8 +119,8 @@ namespace openspace { return *_patchRenderer; } - FrustrumCuller& ChunkLodGlobe::getFrustrumCuller() { - return *_frustrumCuller; + FrustumCuller& ChunkLodGlobe::getFrustumCuller() { + return *_frustumCuller; } diff --git a/modules/globebrowsing/globes/chunklodglobe.h b/modules/globebrowsing/globes/chunklodglobe.h index 8aeba868e9..b5350a2385 100644 --- a/modules/globebrowsing/globes/chunklodglobe.h +++ b/modules/globebrowsing/globes/chunklodglobe.h @@ -40,7 +40,7 @@ #include #include -#include +#include #include namespace ghoul { @@ -58,7 +58,7 @@ namespace openspace { ~ChunkLodGlobe(); LatLonPatchRenderer& getPatchRenderer(); - FrustrumCuller& getFrustrumCuller(); + FrustumCuller& getFrustumCuller(); bool initialize() override; bool deinitialize() override; @@ -85,7 +85,7 @@ namespace openspace { std::unique_ptr _rightRoot; // Frustrum culler - std::shared_ptr _frustrumCuller; + std::shared_ptr _frustumCuller; // the patch used for actual rendering std::unique_ptr _patchRenderer; diff --git a/modules/globebrowsing/globes/chunknode.cpp b/modules/globebrowsing/globes/chunknode.cpp index ec32e33fb8..554780139d 100644 --- a/modules/globebrowsing/globes/chunknode.cpp +++ b/modules/globebrowsing/globes/chunknode.cpp @@ -30,11 +30,11 @@ #include #include - +#include namespace { - const std::string _loggerCat = "ChunkNode"; + const std::string _loggerCat = "ChunkNode"; } namespace openspace { @@ -46,148 +46,150 @@ ChunkNode::ChunkNode(ChunkLodGlobe& owner, const GeodeticPatch& patch, ChunkNode : _owner(owner) , _patch(patch) , _parent(parent) +, _isVisible(true) { - _children[0] = nullptr; - _children[1] = nullptr; - _children[2] = nullptr; - _children[3] = nullptr; - instanceCount++; + _children[0] = nullptr; + _children[1] = nullptr; + _children[2] = nullptr; + _children[3] = nullptr; + instanceCount++; } ChunkNode::~ChunkNode() { - instanceCount--; + instanceCount--; } bool ChunkNode::isRoot() const { - return _parent == nullptr; + return _parent == nullptr; } bool ChunkNode::isLeaf() const { - return _children[0] == nullptr; + return _children[0] == nullptr; } void ChunkNode::render(const RenderData& data, ChunkIndex traverseData) { - ghoul_assert(isRoot(), "this method should only be invoked on root"); - //LDEBUG("-------------"); - internalUpdateChunkTree(data, traverseData); - internalRender(data, traverseData); + ghoul_assert(isRoot(), "this method should only be invoked on root"); + //LDEBUG("-------------"); + internalUpdateChunkTree(data, traverseData); + internalRender(data, traverseData); } // Returns true or false wether this node can be merge or not bool ChunkNode::internalUpdateChunkTree(const RenderData& data, ChunkIndex& traverseData) { - using namespace glm; - Geodetic2 center = _patch.center(); + using namespace glm; + Geodetic2 center = _patch.center(); + //LDEBUG("x: " << patch.x << " y: " << patch.y << " level: " << patch.level << " lat: " << center.lat << " lon: " << center.lon); - //LDEBUG("x: " << patch.x << " y: " << patch.y << " level: " << patch.level << " lat: " << center.lat << " lon: " << center.lon); + if (isLeaf()) { - if (isLeaf()) { - int desiredLevel = calculateDesiredLevel(data, traverseData); - desiredLevel = glm::clamp(desiredLevel, _owner.minSplitDepth, _owner.maxSplitDepth); - if (desiredLevel > traverseData.level) { - split(); - } - else if(desiredLevel < traverseData.level){ - return true; // request a merge from parent - } - return false; - } - else { - - int requestedMergeMask = 0; - std::vector childIndices = traverseData.childIndices(); - for (int i = 0; i < 4; ++i) { - if (_children[i]->internalUpdateChunkTree(data, childIndices[i])) { - requestedMergeMask |= (1 << i); - } - } + int desiredLevel = calculateDesiredLevelAndUpdateIsVisible(data, traverseData); + desiredLevel = glm::clamp(desiredLevel, _owner.minSplitDepth, _owner.maxSplitDepth); + if (desiredLevel > traverseData.level) { + split(); + } + else if(desiredLevel < traverseData.level){ + return true; // request a merge from parent + } + return false; + } + else { + + int requestedMergeMask = 0; + std::vector childIndices = traverseData.childIndices(); + for (int i = 0; i < 4; ++i) { + if (_children[i]->internalUpdateChunkTree(data, childIndices[i])) { + requestedMergeMask |= (1 << i); + } + } - // check if all children requested merge - if (requestedMergeMask == 0xf) { - merge(); + // check if all children requested merge + if (requestedMergeMask == 0xf) { + merge(); - // re-run this method on this, now that this is a leaf node - return internalUpdateChunkTree(data, traverseData); - } - return false; - } + // re-run this method on this, now that this is a leaf node + return internalUpdateChunkTree(data, traverseData); + } + return false; + } } void ChunkNode::internalRender(const RenderData& data, ChunkIndex& traverseData) { - if (isLeaf()) { + if (isLeaf()) { + if (_isVisible) { + TileIndex ti = { traverseData.x, traverseData.y, traverseData.level }; - TileIndex ti = { traverseData.x, traverseData.y, traverseData.level }; + LatLonPatchRenderer& patchRenderer = _owner.getPatchRenderer(); - LatLonPatchRenderer& patchRenderer = _owner.getPatchRenderer(); - - patchRenderer.renderPatch(_patch, data, _owner.ellipsoid(), ti); - ChunkNode::renderedPatches++; - - } - else { - std::vector childIndices = traverseData.childIndices(); - for (int i = 0; i < 4; ++i) { - _children[i]->internalRender(data, childIndices[i]); - } - } + patchRenderer.renderPatch(_patch, data, _owner.ellipsoid(), ti); + ChunkNode::renderedPatches++; + } + } + else { + std::vector childIndices = traverseData.childIndices(); + for (int i = 0; i < 4; ++i) { + _children[i]->internalRender(data, childIndices[i]); + } + } } -int ChunkNode::calculateDesiredLevel( +int ChunkNode::calculateDesiredLevelAndUpdateIsVisible( const RenderData& data, const ChunkIndex& traverseData) { - - - Vec3 globePosition = data.position.dvec3(); - //Vec3 patchNormal = _patch.center().asUnitCartesian(); + _isVisible = true; + Vec3 globePosition = data.position.dvec3(); Vec3 patchPosition = globePosition + _owner.ellipsoid().geodetic2ToCartesian(_patch.center()); - Vec3 cameraPosition = data.camera.position().dvec3(); - Vec3 cameraDirection = Vec3(data.camera.viewDirection()); - Vec3 cameraToChunk = patchPosition - cameraPosition; + Vec3 cameraPosition = data.camera.position().dvec3(); + Vec3 cameraDirection = Vec3(data.camera.viewDirection()); + Vec3 cameraToChunk = patchPosition - cameraPosition; - // if camera points at same direction as latlon patch normal, - // we see the back side and dont have to split it - //Scalar cosNormalCameraDirection = glm::dot(patchNormal, cameraDirection); + // if camera points at same direction as latlon patch normal, + // we see the back side and dont have to split it + //Scalar cosNormalCameraDirection = glm::dot(patchNormal, cameraDirection); - Vec3 globeToCamera = cameraPosition - globePosition; + Vec3 globeToCamera = cameraPosition - globePosition; - Geodetic2 cameraPositionOnGlobe = _owner.ellipsoid().cartesianToGeodetic2(globeToCamera); + Geodetic2 cameraPositionOnGlobe = + _owner.ellipsoid().cartesianToGeodetic2(globeToCamera); Geodetic2 closestPatchPoint = _patch.closestPoint(cameraPositionOnGlobe); - Vec3 normalOfClosestPatchPoint = _owner.ellipsoid().geodeticSurfaceNormal(closestPatchPoint); - Scalar cosPatchNormalNormalizedGlobeToCamera = glm::dot(normalOfClosestPatchPoint, glm::normalize(globeToCamera)); + Vec3 normalOfClosestPatchPoint = + _owner.ellipsoid().geodeticSurfaceNormal(closestPatchPoint); + Scalar cosPatchNormalNormalizedGlobeToCamera = + glm::dot(normalOfClosestPatchPoint, glm::normalize(globeToCamera)); - //LDEBUG(cosPatchNormalCameraDirection); + //LDEBUG(cosPatchNormalCameraDirection); // Get the minimum radius from the ellipsoid. The closer the ellipsoid is to a // sphere, the better this will make the splitting. Using the minimum radius to // be safe. This means that if the ellipsoid has high difference between radii, // splitting might accur even though it is not needed. Scalar minimumGlobeRadius = _owner.ellipsoid().minimumRadius(); - double cosAngleToHorizon = minimumGlobeRadius / glm::length(globeToCamera); + if (cosPatchNormalNormalizedGlobeToCamera < cosAngleToHorizon) { + _isVisible = false; + return traverseData.level - 1; + } - if (cosPatchNormalNormalizedGlobeToCamera < cosAngleToHorizon) { - return traverseData.level - 1; - } - - - // Do frustrum culling - FrustrumCuller& culler = _owner.getFrustrumCuller(); + // Do frustrum culling + FrustumCuller& culler = _owner.getFrustumCuller(); if (!culler.isVisible(data, _patch, _owner.ellipsoid())) { + _isVisible = false; return traverseData.level - 1; } - // Calculate desired level based on distance - Scalar distance = glm::length(cameraToChunk); - _owner.minDistToCamera = fmin(_owner.minDistToCamera, distance); + + // Calculate desired level based on distance + Scalar distance = glm::length(cameraToChunk); + _owner.minDistToCamera = fmin(_owner.minDistToCamera, distance); Scalar scaleFactor = 100 * minimumGlobeRadius; Scalar projectedScaleFactor = scaleFactor / distance; @@ -198,44 +200,44 @@ int ChunkNode::calculateDesiredLevel( void ChunkNode::split(int depth) { - if (depth > 0 && isLeaf()) { + if (depth > 0 && isLeaf()) { - // Defining short handles for center, halfSize and quarterSize - const Geodetic2& c = _patch.center(); - const Geodetic2& hs = _patch.halfSize(); - Geodetic2 qs = Geodetic2(0.5 * hs.lat, 0.5 * hs.lon); + // Defining short handles for center, halfSize and quarterSize + const Geodetic2& c = _patch.center(); + const Geodetic2& hs = _patch.halfSize(); + Geodetic2 qs = Geodetic2(0.5 * hs.lat, 0.5 * hs.lon); - // Subdivide bounds - GeodeticPatch nwBounds = GeodeticPatch(Geodetic2(c.lat + qs.lat, c.lon - qs.lon), qs); - GeodeticPatch neBounds = GeodeticPatch(Geodetic2(c.lat - qs.lat, c.lon - qs.lon), qs); - GeodeticPatch swBounds = GeodeticPatch(Geodetic2(c.lat + qs.lat, c.lon + qs.lon), qs); - GeodeticPatch seBounds = GeodeticPatch(Geodetic2(c.lat - qs.lat, c.lon + qs.lon), qs); + // Subdivide bounds + GeodeticPatch nwBounds = GeodeticPatch(Geodetic2(c.lat + qs.lat, c.lon - qs.lon), qs); + GeodeticPatch neBounds = GeodeticPatch(Geodetic2(c.lat - qs.lat, c.lon - qs.lon), qs); + GeodeticPatch swBounds = GeodeticPatch(Geodetic2(c.lat + qs.lat, c.lon + qs.lon), qs); + GeodeticPatch seBounds = GeodeticPatch(Geodetic2(c.lat - qs.lat, c.lon + qs.lon), qs); - // Create new chunk nodes - _children[Quad::NORTH_WEST] = std::unique_ptr(new ChunkNode(_owner, nwBounds, this)); - _children[Quad::NORTH_EAST] = std::unique_ptr(new ChunkNode(_owner, neBounds, this)); - _children[Quad::SOUTH_WEST] = std::unique_ptr(new ChunkNode(_owner, swBounds, this)); - _children[Quad::SOUTH_EAST] = std::unique_ptr(new ChunkNode(_owner, seBounds, this)); - } + // Create new chunk nodes + _children[Quad::NORTH_WEST] = std::unique_ptr(new ChunkNode(_owner, nwBounds, this)); + _children[Quad::NORTH_EAST] = std::unique_ptr(new ChunkNode(_owner, neBounds, this)); + _children[Quad::SOUTH_WEST] = std::unique_ptr(new ChunkNode(_owner, swBounds, this)); + _children[Quad::SOUTH_EAST] = std::unique_ptr(new ChunkNode(_owner, seBounds, this)); + } - if (depth - 1 > 0) { - for (int i = 0; i < 4; ++i) { - _children[i]->split(depth - 1); - } - } + if (depth - 1 > 0) { + for (int i = 0; i < 4; ++i) { + _children[i]->split(depth - 1); + } + } } void ChunkNode::merge() { - for (int i = 0; i < 4; ++i) { - if (_children[i] != nullptr) { - _children[i]->merge(); - } - _children[i] = nullptr; - } + for (int i = 0; i < 4; ++i) { + if (_children[i] != nullptr) { + _children[i]->merge(); + } + _children[i] = nullptr; + } } const ChunkNode& ChunkNode::getChild(Quad quad) const { - return *_children[quad]; + return *_children[quad]; } diff --git a/modules/globebrowsing/globes/chunknode.h b/modules/globebrowsing/globes/chunknode.h index 16a78cac7f..5468fb367f 100644 --- a/modules/globebrowsing/globes/chunknode.h +++ b/modules/globebrowsing/globes/chunknode.h @@ -31,66 +31,66 @@ #include #include -#include +#include // forward declaration namespace openspace { - class ChunkLodGlobe; + class ChunkLodGlobe; } namespace openspace { enum Quad { - NORTH_WEST, - NORTH_EAST, - SOUTH_WEST, - SOUTH_EAST + NORTH_WEST, + NORTH_EAST, + SOUTH_WEST, + SOUTH_EAST }; struct ChunkIndex { - int x, y, level; - - std::vector childIndices() const { - return { - { 2 * x + 0, 2 * y + 0, level + 1 }, - { 2 * x + 1, 2 * y + 0, level + 1 }, - { 2 * x + 0, 2 * y + 1, level + 1 }, - { 2 * x + 1, 2 * y + 1, level + 1 }, - }; - } + int x, y, level; + std::vector childIndices() const { + return { + { 2 * x + 0, 2 * y + 0, level + 1 }, + { 2 * x + 1, 2 * y + 0, level + 1 }, + { 2 * x + 0, 2 * y + 1, level + 1 }, + { 2 * x + 1, 2 * y + 1, level + 1 }, + }; + } }; class ChunkNode { public: - ChunkNode(ChunkLodGlobe&, const GeodeticPatch&, ChunkNode* parent = nullptr); - ~ChunkNode(); + ChunkNode(ChunkLodGlobe&, const GeodeticPatch&, ChunkNode* parent = nullptr); + ~ChunkNode(); - void split(int depth = 1); - void merge(); + void split(int depth = 1); + void merge(); - bool isRoot() const; - bool isLeaf() const; - - const ChunkNode& getChild(Quad quad) const; + bool isRoot() const; + bool isLeaf() const; + + + const ChunkNode& getChild(Quad quad) const; - void render(const RenderData& data, ChunkIndex); + void render(const RenderData& data, ChunkIndex); - static int instanceCount; - static int renderedPatches; + static int instanceCount; + static int renderedPatches; private: void internalRender(const RenderData& data, ChunkIndex&); - bool internalUpdateChunkTree(const RenderData& data, ChunkIndex&); + bool internalUpdateChunkTree(const RenderData& data, ChunkIndex& traverseData); /** Uses horizon culling, frustum culling and distance to camera to determine a @@ -101,16 +101,16 @@ private: be safe. This means that if the ellipsoid has high difference between radii, splitting might accur even though it is not needed. */ - int calculateDesiredLevel(const RenderData& data, const ChunkIndex& traverseData); + int calculateDesiredLevelAndUpdateIsVisible( + const RenderData& data, + const ChunkIndex& traverseData); ChunkNode* _parent; - std::unique_ptr _children[4]; - - ChunkLodGlobe& _owner; - - GeodeticPatch _patch; - + std::unique_ptr _children[4]; + ChunkLodGlobe& _owner; + GeodeticPatch _patch; + bool _isVisible; }; } // namespace openspace diff --git a/modules/globebrowsing/globes/clipmapglobe.h b/modules/globebrowsing/globes/clipmapglobe.h index f55efc2ee5..1b318d9ac4 100644 --- a/modules/globebrowsing/globes/clipmapglobe.h +++ b/modules/globebrowsing/globes/clipmapglobe.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include namespace ghoul { diff --git a/modules/globebrowsing/other/patchrenderer.h b/modules/globebrowsing/other/patchrenderer.h deleted file mode 100644 index f329f6c38d..0000000000 --- a/modules/globebrowsing/other/patchrenderer.h +++ /dev/null @@ -1,109 +0,0 @@ -/***************************************************************************************** -* * -* 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 __LATLONPATCH_H__ -#define __LATLONPATCH_H__ - -#include -#include - -// open space includes -#include - -#include -#include -#include -#include -#include -#include - -namespace ghoul { -namespace opengl { - class ProgramObject; -} -} - - -namespace openspace { - - class LonLatPatch; - class TriangleSoup; - - using std::shared_ptr; - using std::unique_ptr; - using ghoul::opengl::ProgramObject; - - class PatchRenderer { - public: - - PatchRenderer(); - ~PatchRenderer(); - - protected: - - unique_ptr _programObject; - TextureTileSet _tileSet; - }; - - - ////////////////////////////////////////////////////////////////////////////////////// - // PATCH RENDERER SUBCLASSES // - ////////////////////////////////////////////////////////////////////////////////////// - - class LatLonPatchRenderer : public PatchRenderer { - public: - LatLonPatchRenderer(shared_ptr grid); - - void renderPatch( - const GeodeticPatch& patch, - const RenderData& data, - const Ellipsoid& ellipsoid); - - void renderPatch( - const GeodeticPatch& patch, - const RenderData& data, - const Ellipsoid& ellipsoid, - const TileIndex& ti); - private: - shared_ptr _grid; - TwmsTileProvider tileProvider; - }; - - - - class ClipMapPatchRenderer : public PatchRenderer { - public: - ClipMapPatchRenderer(shared_ptr grid); - - void renderPatch( - const Geodetic2& patchSize, - const RenderData& data, - const Ellipsoid& ellipsoid); - private: - shared_ptr _grid; - }; - -} // namespace openspace - -#endif // __LATLONPATCH_H__ \ No newline at end of file diff --git a/modules/globebrowsing/other/twmstileprovider.cpp b/modules/globebrowsing/other/twmstileprovider.cpp index ea6974abcc..79f65c6761 100644 --- a/modules/globebrowsing/other/twmstileprovider.cpp +++ b/modules/globebrowsing/other/twmstileprovider.cpp @@ -68,7 +68,7 @@ namespace openspace { std::string fileName = _fileFutureCache.get(hashkey)->filePath; std::string filePath = "tiles/" + fileName; std::shared_ptr texture = loadAndInitTextureDisk(filePath); - LDEBUG("Downloaded " << fileName); + //LDEBUG("Downloaded " << fileName); _tileCache.put(hashkey, texture); } } diff --git a/modules/globebrowsing/other/frustrumculler.cpp b/modules/globebrowsing/rendering/frustumculler.cpp similarity index 91% rename from modules/globebrowsing/other/frustrumculler.cpp rename to modules/globebrowsing/rendering/frustumculler.cpp index c8ba94a51a..87fb06c39b 100644 --- a/modules/globebrowsing/other/frustrumculler.cpp +++ b/modules/globebrowsing/rendering/frustumculler.cpp @@ -23,7 +23,7 @@ ****************************************************************************************/ -#include +#include #include @@ -36,17 +36,17 @@ namespace openspace { ////////////////////////////////////////////////////////////////////////////////////// // PATCH RENDERER // ////////////////////////////////////////////////////////////////////////////////////// - FrustrumCuller::FrustrumCuller() + FrustumCuller::FrustumCuller() { } - FrustrumCuller::~FrustrumCuller() { + FrustumCuller::~FrustumCuller() { } - bool FrustrumCuller::isVisible(const RenderData& data, const vec3& point, const glm::vec2& marginScreenSpace) { + bool FrustumCuller::isVisible(const RenderData& data, const vec3& point, const glm::vec2& marginScreenSpace) { mat4 modelTransform = translate(mat4(1), data.position.vec3()); mat4 viewTransform = data.camera.combinedViewMatrix(); @@ -58,7 +58,7 @@ namespace openspace { } - bool FrustrumCuller::isVisible( + bool FrustumCuller::isVisible( const RenderData& data, const GeodeticPatch& patch, const Ellipsoid& ellipsoid) { @@ -90,7 +90,7 @@ namespace openspace { - bool FrustrumCuller::testPoint(const glm::vec2& pointScreenSpace, + bool FrustumCuller::testPoint(const glm::vec2& pointScreenSpace, const glm::vec2& marginScreenSpace) const { @@ -102,7 +102,7 @@ namespace openspace { } - glm::vec2 FrustrumCuller::transformToScreenSpace(const vec3& point, + glm::vec2 FrustumCuller::transformToScreenSpace(const vec3& point, const mat4x4& modelViewProjection) const { vec4 pointProjectionSpace = modelViewProjection * vec4(point, 1.0f); diff --git a/modules/globebrowsing/other/frustrumculler.h b/modules/globebrowsing/rendering/frustumculler.h similarity index 98% rename from modules/globebrowsing/other/frustrumculler.h rename to modules/globebrowsing/rendering/frustumculler.h index dba186577a..d851835a0b 100644 --- a/modules/globebrowsing/other/frustrumculler.h +++ b/modules/globebrowsing/rendering/frustumculler.h @@ -42,11 +42,11 @@ namespace openspace { using namespace glm; - class FrustrumCuller { + class FrustumCuller { public: - FrustrumCuller(); - ~FrustrumCuller(); + FrustumCuller(); + ~FrustumCuller(); /** Returns true if the point is inside the view frustrum defined in RenderData. diff --git a/modules/globebrowsing/other/patchrenderer.cpp b/modules/globebrowsing/rendering/patchrenderer.cpp similarity index 99% rename from modules/globebrowsing/other/patchrenderer.cpp rename to modules/globebrowsing/rendering/patchrenderer.cpp index 931078ea9c..05f922acdd 100644 --- a/modules/globebrowsing/other/patchrenderer.cpp +++ b/modules/globebrowsing/rendering/patchrenderer.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include #include diff --git a/modules/globebrowsing/rendering/patchrenderer.h b/modules/globebrowsing/rendering/patchrenderer.h index feeda0bb6c..ed500421ba 100644 --- a/modules/globebrowsing/rendering/patchrenderer.h +++ b/modules/globebrowsing/rendering/patchrenderer.h @@ -31,11 +31,12 @@ // open space includes #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include namespace ghoul { namespace opengl { @@ -47,7 +48,7 @@ namespace opengl { namespace openspace { class LonLatPatch; - class Geometry; + class TriangleSoup; using std::shared_ptr; using std::unique_ptr; @@ -63,7 +64,6 @@ namespace openspace { unique_ptr _programObject; TextureTileSet _tileSet; - }; @@ -76,20 +76,18 @@ namespace openspace { LatLonPatchRenderer(shared_ptr grid); void renderPatch( - const LatLonPatch& patch, + const GeodeticPatch& patch, const RenderData& data, - double radius); + const Ellipsoid& ellipsoid); void renderPatch( - const LatLonPatch& patch, + const GeodeticPatch& patch, const RenderData& data, - double radius, + const Ellipsoid& ellipsoid, const TileIndex& ti); - private: - TwmsTileProvider tileProvider; shared_ptr _grid; - + TwmsTileProvider tileProvider; }; @@ -99,12 +97,13 @@ namespace openspace { ClipMapPatchRenderer(shared_ptr grid); void renderPatch( - const LatLon& patchSize, + const Geodetic2& patchSize, const RenderData& data, - double radius); - private: + const Ellipsoid& ellipsoid); + private: shared_ptr _grid; }; + } // namespace openspace #endif // __LATLONPATCH_H__ \ No newline at end of file diff --git a/src/engine/downloadmanager.cpp b/src/engine/downloadmanager.cpp index 5b6b9c79bc..2f2048d97d 100644 --- a/src/engine/downloadmanager.cpp +++ b/src/engine/downloadmanager.cpp @@ -145,7 +145,7 @@ std::shared_ptr DownloadManager::downloadFile( FILE* fp = fopen(file.path().c_str(), "wb"); // write binary ghoul_assert(fp != nullptr, "Could not open/create file:\n" << file.path().c_str() << " \nerrno: " << errno); - LDEBUG("Start downloading file: '" << url << "' into file '" << file.path() << "'"); + //LDEBUG("Start downloading file: '" << url << "' into file '" << file.path() << "'"); auto downloadFunction = [url, finishedCallback, progressCallback, future, fp]() { CURL* curl = curl_easy_init(); diff --git a/tests/main.cpp b/tests/main.cpp index ce2c656228..95e1200112 100644 --- a/tests/main.cpp +++ b/tests/main.cpp @@ -36,15 +36,13 @@ //#include //#include //#include -#include - //#include //#include //#include //#include //#include -//#include +#include #include #include diff --git a/tests/test_gdalwms.inl b/tests/test_gdalwms.inl index b7561bbf55..80d522a963 100644 --- a/tests/test_gdalwms.inl +++ b/tests/test_gdalwms.inl @@ -45,7 +45,11 @@ class GdalWmsTest : public testing::Test {}; TEST_F(GdalWmsTest, Simple) { GDALDataset *poDataset; GDALAllRegister(); + + std::string res = GDALVersionInfo("format"); + + std::string testFile = absPath("../data/scene/debugglobe/map_service_configs/TERRA_CR_B143_2016-04-12.wms"); poDataset = (GDALDataset *)GDALOpen(testFile.c_str(), GA_ReadOnly);