From cc1e42d6efb4cc8feed6ac47ddec2d43168e6e02 Mon Sep 17 00:00:00 2001 From: Kalle Bladin Date: Mon, 25 Apr 2016 13:58:32 -0400 Subject: [PATCH] Restructure files in folders --- modules/globebrowsing/CMakeLists.txt | 84 ++++++------ .../{datastructures => geodetics}/angle.h | 2 +- .../{datastructures => geodetics}/angle.inl | 2 +- .../latlon.cpp => geodetics/geodetic2.cpp} | 125 +++++++++--------- .../latlon.h => geodetics/geodetic2.h} | 58 ++++---- modules/globebrowsing/globebrowsingmodule.cpp | 6 +- .../{rendering => globes}/chunklodglobe.cpp | 8 +- .../{rendering => globes}/chunklodglobe.h | 10 +- .../{datastructures => globes}/chunknode.cpp | 27 ++-- .../{datastructures => globes}/chunknode.h | 8 +- .../{rendering => globes}/clipmapglobe.cpp | 16 +-- .../{rendering => globes}/clipmapglobe.h | 10 +- .../{rendering => globes}/clipmappyramid.cpp | 8 +- .../{rendering => globes}/clipmappyramid.h | 8 +- .../{rendering => globes}/globemesh.cpp | 2 +- .../{rendering => globes}/globemesh.h | 6 +- .../{rendering => globes}/renderableglobe.cpp | 8 +- .../{rendering => globes}/renderableglobe.h | 6 +- .../{rendering => meshes}/basicgrid.cpp | 2 +- .../{rendering => meshes}/basicgrid.h | 2 +- .../{rendering => meshes}/clipmapgrid.cpp | 2 +- .../{rendering => meshes}/clipmapgrid.h | 2 +- .../{rendering => meshes}/grid.cpp | 2 +- .../{rendering => meshes}/grid.h | 2 +- .../{rendering => meshes}/trianglesoup.cpp | 2 +- .../{rendering => meshes}/trianglesoup.h | 0 .../{rendering => other}/distanceswitch.cpp | 2 +- .../{rendering => other}/distanceswitch.h | 0 .../{rendering => other}/frustrumculler.cpp | 4 +- .../{rendering => other}/frustrumculler.h | 5 +- .../gdaldataconverter.cpp | 2 +- .../{rendering => other}/gdaldataconverter.h | 0 .../{datastructures => other}/lrucache.h | 2 +- .../{datastructures => other}/lrucache.inl | 0 .../{rendering => other}/patchrenderer.cpp | 26 ++-- .../{rendering => other}/patchrenderer.h | 16 +-- .../{rendering => other}/texturetileset.cpp | 30 ++--- .../{rendering => other}/texturetileset.h | 24 ++-- .../{rendering => other}/twmstileprovider.cpp | 2 +- .../{rendering => other}/twmstileprovider.h | 6 +- 40 files changed, 265 insertions(+), 262 deletions(-) rename modules/globebrowsing/{datastructures => geodetics}/angle.h (99%) rename modules/globebrowsing/{datastructures => geodetics}/angle.inl (99%) rename modules/globebrowsing/{datastructures/latlon.cpp => geodetics/geodetic2.cpp} (72%) rename modules/globebrowsing/{datastructures/latlon.h => geodetics/geodetic2.h} (71%) rename modules/globebrowsing/{rendering => globes}/chunklodglobe.cpp (94%) rename modules/globebrowsing/{rendering => globes}/chunklodglobe.h (92%) rename modules/globebrowsing/{datastructures => globes}/chunknode.cpp (89%) rename modules/globebrowsing/{datastructures => globes}/chunknode.h (93%) rename modules/globebrowsing/{rendering => globes}/clipmapglobe.cpp (93%) rename modules/globebrowsing/{rendering => globes}/clipmapglobe.h (91%) rename modules/globebrowsing/{rendering => globes}/clipmappyramid.cpp (90%) rename modules/globebrowsing/{rendering => globes}/clipmappyramid.h (93%) rename modules/globebrowsing/{rendering => globes}/globemesh.cpp (99%) rename modules/globebrowsing/{rendering => globes}/globemesh.h (94%) rename modules/globebrowsing/{rendering => globes}/renderableglobe.cpp (94%) rename modules/globebrowsing/{rendering => globes}/renderableglobe.h (94%) rename modules/globebrowsing/{rendering => meshes}/basicgrid.cpp (99%) rename modules/globebrowsing/{rendering => meshes}/basicgrid.h (98%) rename modules/globebrowsing/{rendering => meshes}/clipmapgrid.cpp (99%) rename modules/globebrowsing/{rendering => meshes}/clipmapgrid.h (99%) rename modules/globebrowsing/{rendering => meshes}/grid.cpp (98%) rename modules/globebrowsing/{rendering => meshes}/grid.h (98%) rename modules/globebrowsing/{rendering => meshes}/trianglesoup.cpp (99%) rename modules/globebrowsing/{rendering => meshes}/trianglesoup.h (100%) rename modules/globebrowsing/{rendering => other}/distanceswitch.cpp (98%) rename modules/globebrowsing/{rendering => other}/distanceswitch.h (100%) rename modules/globebrowsing/{rendering => other}/frustrumculler.cpp (96%) rename modules/globebrowsing/{rendering => other}/frustrumculler.h (97%) rename modules/globebrowsing/{rendering => other}/gdaldataconverter.cpp (98%) rename modules/globebrowsing/{rendering => other}/gdaldataconverter.h (100%) rename modules/globebrowsing/{datastructures => other}/lrucache.h (97%) rename modules/globebrowsing/{datastructures => other}/lrucache.inl (100%) rename modules/globebrowsing/{rendering => other}/patchrenderer.cpp (92%) rename modules/globebrowsing/{rendering => other}/patchrenderer.h (90%) rename modules/globebrowsing/{rendering => other}/texturetileset.cpp (88%) rename modules/globebrowsing/{rendering => other}/texturetileset.h (88%) rename modules/globebrowsing/{rendering => other}/twmstileprovider.cpp (99%) rename modules/globebrowsing/{rendering => other}/twmstileprovider.h (98%) diff --git a/modules/globebrowsing/CMakeLists.txt b/modules/globebrowsing/CMakeLists.txt index cf0437fecf..a288bbebca 100644 --- a/modules/globebrowsing/CMakeLists.txt +++ b/modules/globebrowsing/CMakeLists.txt @@ -26,52 +26,54 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake) set(HEADER_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableglobe.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/distanceswitch.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableglobe.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/distanceswitch.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/trianglesoup.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/grid.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/basicgrid.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/clipmapgrid.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/globemesh.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/patchrenderer.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/clipmapglobe.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/chunklodglobe.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/frustrumculler.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/texturetileset.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/twmstileprovider.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/clipmappyramid.h - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/gdaldataconverter.h + ${CMAKE_CURRENT_SOURCE_DIR}/globes/renderableglobe.h + ${CMAKE_CURRENT_SOURCE_DIR}/globes/globemesh.h + ${CMAKE_CURRENT_SOURCE_DIR}/globes/clipmapglobe.h + ${CMAKE_CURRENT_SOURCE_DIR}/globes/clipmappyramid.h + ${CMAKE_CURRENT_SOURCE_DIR}/globes/chunklodglobe.h + ${CMAKE_CURRENT_SOURCE_DIR}/globes/chunknode.h - ${CMAKE_CURRENT_SOURCE_DIR}/datastructures/chunknode.h - ${CMAKE_CURRENT_SOURCE_DIR}/datastructures/latlon.h - ${CMAKE_CURRENT_SOURCE_DIR}/datastructures/angle.h - ${CMAKE_CURRENT_SOURCE_DIR}/datastructures/lrucache.h + ${CMAKE_CURRENT_SOURCE_DIR}/meshes/trianglesoup.h + ${CMAKE_CURRENT_SOURCE_DIR}/meshes/grid.h + ${CMAKE_CURRENT_SOURCE_DIR}/meshes/basicgrid.h + ${CMAKE_CURRENT_SOURCE_DIR}/meshes/clipmapgrid.h + + ${CMAKE_CURRENT_SOURCE_DIR}/geodetics/geodetic2.h + ${CMAKE_CURRENT_SOURCE_DIR}/geodetics/angle.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 + ${CMAKE_CURRENT_SOURCE_DIR}/other/lrucache.h ) set(SOURCE_FILES - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableglobe.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/distanceswitch.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/trianglesoup.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/grid.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/basicgrid.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/clipmapgrid.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/globemesh.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/patchrenderer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/clipmapglobe.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/chunklodglobe.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/frustrumculler.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/texturetileset.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/twmstileprovider.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/clipmappyramid.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/rendering/gdaldataconverter.cpp - - ${CMAKE_CURRENT_SOURCE_DIR}/datastructures/chunknode.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/datastructures/latlon.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/datastructures/angle.inl - ${CMAKE_CURRENT_SOURCE_DIR}/datastructures/lrucache.inl + ${CMAKE_CURRENT_SOURCE_DIR}/globes/renderableglobe.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/globes/globemesh.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/globes/clipmapglobe.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/globes/clipmappyramid.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/globes/chunklodglobe.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/globes/chunknode.cpp + + ${CMAKE_CURRENT_SOURCE_DIR}/meshes/trianglesoup.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/meshes/grid.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/meshes/basicgrid.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/meshes/clipmapgrid.cpp + + ${CMAKE_CURRENT_SOURCE_DIR}/geodetics/geodetic2.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/geodetics/angle.inl + + ${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 + ${CMAKE_CURRENT_SOURCE_DIR}/other/lrucache.inl ) source_group("Source Files" FILES ${SOURCE_FILES}) diff --git a/modules/globebrowsing/datastructures/angle.h b/modules/globebrowsing/geodetics/angle.h similarity index 99% rename from modules/globebrowsing/datastructures/angle.h rename to modules/globebrowsing/geodetics/angle.h index 8d021430ec..fc3e1a4692 100644 --- a/modules/globebrowsing/datastructures/angle.h +++ b/modules/globebrowsing/geodetics/angle.h @@ -177,7 +177,7 @@ using fAngle = Angle; -#include +#include diff --git a/modules/globebrowsing/datastructures/angle.inl b/modules/globebrowsing/geodetics/angle.inl similarity index 99% rename from modules/globebrowsing/datastructures/angle.inl rename to modules/globebrowsing/geodetics/angle.inl index f022fda1c6..d0f4f5a513 100644 --- a/modules/globebrowsing/datastructures/angle.inl +++ b/modules/globebrowsing/geodetics/angle.inl @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include diff --git a/modules/globebrowsing/datastructures/latlon.cpp b/modules/globebrowsing/geodetics/geodetic2.cpp similarity index 72% rename from modules/globebrowsing/datastructures/latlon.cpp rename to modules/globebrowsing/geodetics/geodetic2.cpp index 03627bd254..206e386c8e 100644 --- a/modules/globebrowsing/datastructures/latlon.cpp +++ b/modules/globebrowsing/geodetics/geodetic2.cpp @@ -22,11 +22,12 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include -#include -#include -#include +#include +#include + +#include #define _USE_MATH_DEFINES #include @@ -36,85 +37,89 @@ namespace { } namespace openspace { - ////////////////////////////////////////////////////////////////////////////////////////// - // LATITUDE LONGITUDE // - ////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////// + // GEODETIC2 // + ////////////////////////////////////////////////////////////////////////////////////// - LatLon::LatLon() + Geodetic2::Geodetic2() : lat(0) , lon(0) {} - LatLon::LatLon(Scalar latitude, Scalar longitude) + Geodetic2::Geodetic2(Scalar latitude, Scalar longitude) : lat(latitude) , lon(longitude) { } - LatLon::LatLon(const LatLon& p) - : LatLon(p.lat, p.lon) + Geodetic2::Geodetic2(const Geodetic2& p) + : Geodetic2(p.lat, p.lon) { } - LatLon LatLon::fromCartesian(const Vec3& v) { + Geodetic2 Geodetic2::fromCartesian(const Vec3& v) { Scalar r = glm::length(v); - return LatLon(glm::asin(v.z / r), atan2(v.y, v.x)); + return Geodetic2(glm::asin(v.z / r), atan2(v.y, v.x)); } - Vec3 LatLon::asUnitCartesian() const{ + Vec3 Geodetic2::asUnitCartesian() const{ return Vec3( glm::cos(lat) * glm::cos(lon), glm::cos(lat) * glm::sin(lon), glm::sin(lat)); } - Vec2 LatLon::toLonLatVec2() const { + Vec2 Geodetic2::toLonLatVec2() const { return Vec2(lon, lat); } - bool LatLon::operator==(const LatLon& other) const { + bool Geodetic2::operator==(const Geodetic2& other) const { return lat == other.lat && lon == other.lon; } - LatLon LatLon ::operator+(const LatLon& other) const { - return LatLon(lat - other.lat, lon - other.lon); + Geodetic2 Geodetic2 ::operator+(const Geodetic2& other) const { + return Geodetic2(lat - other.lat, lon - other.lon); } - LatLon LatLon ::operator-(const LatLon& other) const { - return LatLon(lat - other.lat, lon - other.lon); + Geodetic2 Geodetic2 ::operator-(const Geodetic2& other) const { + return Geodetic2(lat - other.lat, lon - other.lon); } - LatLon LatLon::operator*(Scalar scalar) const { - return LatLon(lat * scalar, lon * scalar); + Geodetic2 Geodetic2::operator*(Scalar scalar) const { + return Geodetic2(lat * scalar, lon * scalar); } - LatLon LatLon::operator/(Scalar scalar) const { - return LatLon(lat / scalar, lon / scalar); + Geodetic2 Geodetic2::operator/(Scalar scalar) const { + return Geodetic2(lat / scalar, lon / scalar); } - ////////////////////////////////////////////////////////////////////////////////////////// - // LATITUDE LONGITUDE PATCH // - ////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////////////// + // GEODETICPATCH // + ////////////////////////////////////////////////////////////////////////////////////// - LatLonPatch::LatLonPatch(Scalar centerLat, Scalar centerLon, Scalar halfSizeLat, Scalar halfSizeLon) - : _center(LatLon(centerLat, centerLon)) - , _halfSize(LatLon(halfSizeLat, halfSizeLon)) + GeodeticPatch::GeodeticPatch( + Scalar centerLat, + Scalar centerLon, + Scalar halfSizeLat, + Scalar halfSizeLon) + : _center(Geodetic2(centerLat, centerLon)) + , _halfSize(Geodetic2(halfSizeLat, halfSizeLon)) { } - LatLonPatch::LatLonPatch(const LatLon& center, const LatLon& halfSize) + GeodeticPatch::GeodeticPatch(const Geodetic2& center, const Geodetic2& halfSize) : _center(center) , _halfSize(halfSize) { } - LatLonPatch::LatLonPatch(const LatLonPatch& patch) + GeodeticPatch::GeodeticPatch(const GeodeticPatch& patch) : _center(patch._center) , _halfSize(patch._halfSize) { @@ -122,56 +127,56 @@ namespace openspace { } - void LatLonPatch::setCenter(const LatLon& center) { + void GeodeticPatch::setCenter(const Geodetic2& center) { _center = center; } - void LatLonPatch::setHalfSize(const LatLon& halfSize) { + void GeodeticPatch::setHalfSize(const Geodetic2& halfSize) { _halfSize = halfSize; } - Scalar LatLonPatch::minimalBoundingRadius() const { - const LatLon& cornerNearEquator = _center.lat > 0 ? southWestCorner() : northWestCorner(); + Scalar GeodeticPatch::minimalBoundingRadius() const { + const Geodetic2& cornerNearEquator = _center.lat > 0 ? southWestCorner() : northWestCorner(); return glm::length(_center.asUnitCartesian() - cornerNearEquator.asUnitCartesian()); } - Scalar LatLonPatch::unitArea() const { + Scalar GeodeticPatch::unitArea() const { Scalar deltaTheta = 2 * _halfSize.lon; Scalar phiMin = _center.lat - _halfSize.lat; Scalar phiMax = _center.lat + _halfSize.lat; return deltaTheta * (sin(phiMax) - sin(phiMin)); } - const LatLon& LatLonPatch::center() const { + const Geodetic2& GeodeticPatch::center() const { return _center; } - const LatLon& LatLonPatch::halfSize() const { + const Geodetic2& GeodeticPatch::halfSize() const { return _halfSize; } - LatLon LatLonPatch::size() const { - return LatLon(2 * _halfSize.lat, 2 * _halfSize.lon); + Geodetic2 GeodeticPatch::size() const { + return Geodetic2(2 * _halfSize.lat, 2 * _halfSize.lon); } - LatLon LatLonPatch::northWestCorner() const{ - return LatLon(_center.lat + _halfSize.lat, _center.lon - _halfSize.lon); + Geodetic2 GeodeticPatch::northWestCorner() const{ + return Geodetic2(_center.lat + _halfSize.lat, _center.lon - _halfSize.lon); } - LatLon LatLonPatch::northEastCorner() const{ - return LatLon(_center.lat + _halfSize.lat, _center.lon + _halfSize.lon); + Geodetic2 GeodeticPatch::northEastCorner() const{ + return Geodetic2(_center.lat + _halfSize.lat, _center.lon + _halfSize.lon); } - LatLon LatLonPatch::southWestCorner() const{ - return LatLon(_center.lat - _halfSize.lat, _center.lon - _halfSize.lon); + Geodetic2 GeodeticPatch::southWestCorner() const{ + return Geodetic2(_center.lat - _halfSize.lat, _center.lon - _halfSize.lon); } - LatLon LatLonPatch::southEastCorner() const{ - return LatLon(_center.lat - _halfSize.lat, _center.lon + _halfSize.lon); + Geodetic2 GeodeticPatch::southEastCorner() const{ + return Geodetic2(_center.lat - _halfSize.lat, _center.lon + _halfSize.lon); } - LatLon LatLonPatch::clamp(const LatLon& p) const { + Geodetic2 GeodeticPatch::clamp(const Geodetic2& p) const { using Ang = Angle; // Convert to Angles for normalization @@ -191,21 +196,21 @@ namespace openspace { pointLon.normalizeAround(centerLon); // get clamp bounds - LatLon max = northEastCorner(); - LatLon min = southWestCorner(); + Geodetic2 max = northEastCorner(); + Geodetic2 min = southWestCorner(); - return LatLon( + return Geodetic2( glm::clamp(pointLat.asRadians(), min.lat, max.lat), glm::clamp(pointLon.asRadians(), min.lon, max.lon) ); } - LatLon LatLonPatch::closestCorner(const LatLon& p) const { + Geodetic2 GeodeticPatch::closestCorner(const Geodetic2& p) const { using Ang = Angle; // LatLon vector from patch center to the point - LatLon centerToPoint = p - _center; + Geodetic2 centerToPoint = p - _center; // Normalize the difference angles to be centered around 0. Ang latDiff = Ang::fromRadians(centerToPoint.lat).normalizeAround(Ang::ZERO); @@ -222,11 +227,11 @@ namespace openspace { // We then assigned the corner's longitude coordinate in a similar fashion Scalar cornerLon = _center.lon + _halfSize.lon * (lonDiff > Ang::ZERO ? 1 : -1); - return LatLon(cornerLat, cornerLon); + return Geodetic2(cornerLat, cornerLon); } - LatLon LatLonPatch::closestPoint(const LatLon& p) const { + Geodetic2 GeodeticPatch::closestPoint(const Geodetic2& p) const { // This method finds the closest point on the patch, to the provided // point p. As we are deali ng with latitude-longitude patches, distance in this // context refers to great-circle distance. @@ -277,8 +282,8 @@ namespace openspace { Ang longitudeDistanceToClosestPatchEdge = centerToPointLon.abs() - Ang::fromRadians(_halfSize.lon); // get clamp bounds - LatLon max = northEastCorner(); - LatLon min = southWestCorner(); + Geodetic2 max = northEastCorner(); + Geodetic2 min = southWestCorner(); // If the longitude distance to the closest patch edge is larger than 90 deg // the latitude will have to be clamped to its closest corner, as explained in @@ -290,7 +295,7 @@ namespace openspace { // Longitude is just clamped normally Scalar clampedLon = glm::clamp(pointLon.asRadians(), min.lon, max.lon); - return LatLon(clampedLat, clampedLon); + return Geodetic2(clampedLat, clampedLon); } } // namespace openspace diff --git a/modules/globebrowsing/datastructures/latlon.h b/modules/globebrowsing/geodetics/geodetic2.h similarity index 71% rename from modules/globebrowsing/datastructures/latlon.h rename to modules/globebrowsing/geodetics/geodetic2.h index 476c2e3f13..132bd72d43 100644 --- a/modules/globebrowsing/datastructures/latlon.h +++ b/modules/globebrowsing/geodetics/geodetic2.h @@ -42,22 +42,22 @@ namespace openspace { -struct LatLon { - LatLon(); - LatLon(Scalar latitude, Scalar longitude); - LatLon(const LatLon& src); +struct Geodetic2 { + Geodetic2(); + Geodetic2(Scalar latitude, Scalar longitude); + Geodetic2(const Geodetic2& src); - static LatLon fromCartesian(const Vec3& v); + static Geodetic2 fromCartesian(const Vec3& v); Vec3 asUnitCartesian() const; Vec2 toLonLatVec2() const; - inline bool operator==(const LatLon& other) const; - inline bool operator!=(const LatLon& other) const { return !(*this == (other)); } + inline bool operator==(const Geodetic2& other) const; + inline bool operator!=(const Geodetic2& other) const { return !(*this == (other)); } - inline LatLon operator+(const LatLon& other) const; - inline LatLon operator-(const LatLon& other) const; - inline LatLon operator*(Scalar scalar) const; - inline LatLon operator/(Scalar scalar) const; + inline Geodetic2 operator+(const Geodetic2& other) const; + inline Geodetic2 operator-(const Geodetic2& other) const; + inline Geodetic2 operator*(Scalar scalar) const; + inline Geodetic2 operator/(Scalar scalar) const; Scalar lat; Scalar lon; @@ -66,15 +66,15 @@ struct LatLon { -class LatLonPatch { +class GeodeticPatch { public: - LatLonPatch(Scalar, Scalar, Scalar, Scalar); - LatLonPatch(const LatLon& center, const LatLon& halfSize); - LatLonPatch(const LatLonPatch& patch); + GeodeticPatch(Scalar, Scalar, Scalar, Scalar); + GeodeticPatch(const Geodetic2& center, const Geodetic2& halfSize); + GeodeticPatch(const GeodeticPatch& patch); - void setCenter(const LatLon&); - void setHalfSize(const LatLon&); + void setCenter(const Geodetic2&); + void setHalfSize(const Geodetic2&); /** @@ -89,35 +89,35 @@ public: Scalar unitArea() const; - LatLon northWestCorner() const; - LatLon northEastCorner() const; - LatLon southWestCorner() const; - LatLon southEastCorner() const; + Geodetic2 northWestCorner() const; + Geodetic2 northEastCorner() const; + Geodetic2 southWestCorner() const; + Geodetic2 southEastCorner() const; /** * Clamps a point to the patch region */ - LatLon clamp(const LatLon& p) const; + Geodetic2 clamp(const Geodetic2& p) const; /** * Returns the corner of the patch that is closest to the given point p */ - LatLon closestCorner(const LatLon& p) const; + Geodetic2 closestCorner(const Geodetic2& p) const; /** * Returns a point on the patch that minimizes the great-circle distance to * the given point p. */ - LatLon closestPoint(const LatLon& p) const; + Geodetic2 closestPoint(const Geodetic2& p) const; - const LatLon& center() const; - const LatLon& halfSize() const; - LatLon size() const; + const Geodetic2& center() const; + const Geodetic2& halfSize() const; + Geodetic2 size() const; private: - LatLon _center; - LatLon _halfSize; + Geodetic2 _center; + Geodetic2 _halfSize; }; diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index 78cbdee253..aaa77ca89b 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -24,9 +24,9 @@ #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/modules/globebrowsing/rendering/chunklodglobe.cpp b/modules/globebrowsing/globes/chunklodglobe.cpp similarity index 94% rename from modules/globebrowsing/rendering/chunklodglobe.cpp rename to modules/globebrowsing/globes/chunklodglobe.cpp index 5ea1e226de..1b562b91bc 100644 --- a/modules/globebrowsing/rendering/chunklodglobe.cpp +++ b/modules/globebrowsing/globes/chunklodglobe.cpp @@ -22,9 +22,9 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include -#include +#include // open space includes #include @@ -50,8 +50,8 @@ namespace { namespace openspace { - const LatLonPatch ChunkLodGlobe::LEFT_HEMISPHERE = LatLonPatch(0, -M_PI/2, M_PI/2, M_PI/2); - const LatLonPatch ChunkLodGlobe::RIGHT_HEMISPHERE = LatLonPatch(0, M_PI/2, M_PI/2, M_PI/2); + const GeodeticPatch ChunkLodGlobe::LEFT_HEMISPHERE = GeodeticPatch(0, -M_PI/2, M_PI/2, M_PI/2); + const GeodeticPatch ChunkLodGlobe::RIGHT_HEMISPHERE = GeodeticPatch(0, M_PI/2, M_PI/2, M_PI/2); ChunkLodGlobe::ChunkLodGlobe(const ghoul::Dictionary& dictionary) diff --git a/modules/globebrowsing/rendering/chunklodglobe.h b/modules/globebrowsing/globes/chunklodglobe.h similarity index 92% rename from modules/globebrowsing/rendering/chunklodglobe.h rename to modules/globebrowsing/globes/chunklodglobe.h index 419ac4c0a0..fe05305d5e 100644 --- a/modules/globebrowsing/rendering/chunklodglobe.h +++ b/modules/globebrowsing/globes/chunklodglobe.h @@ -39,9 +39,9 @@ -#include -#include -#include +#include +#include +#include namespace ghoul { namespace opengl { @@ -90,8 +90,8 @@ namespace openspace { std::unique_ptr _patchRenderer; - static const LatLonPatch LEFT_HEMISPHERE; - static const LatLonPatch RIGHT_HEMISPHERE; + static const GeodeticPatch LEFT_HEMISPHERE; + static const GeodeticPatch RIGHT_HEMISPHERE; properties::IntProperty _rotation; diff --git a/modules/globebrowsing/datastructures/chunknode.cpp b/modules/globebrowsing/globes/chunknode.cpp similarity index 89% rename from modules/globebrowsing/datastructures/chunknode.cpp rename to modules/globebrowsing/globes/chunknode.cpp index ee00247c72..7896b15282 100644 --- a/modules/globebrowsing/datastructures/chunknode.cpp +++ b/modules/globebrowsing/globes/chunknode.cpp @@ -22,13 +22,14 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ +#include + #include #include #include -#include -#include +#include @@ -41,7 +42,7 @@ namespace openspace { int ChunkNode::instanceCount = 0; int ChunkNode::renderedPatches = 0; -ChunkNode::ChunkNode(ChunkLodGlobe& owner, const LatLonPatch& patch, ChunkNode* parent) +ChunkNode::ChunkNode(ChunkLodGlobe& owner, const GeodeticPatch& patch, ChunkNode* parent) : _owner(owner) , _patch(patch) , _parent(parent) @@ -77,7 +78,7 @@ void ChunkNode::render(const RenderData& data, ChunkIndex traverseData) { // Returns true or false wether this node can be merge or not bool ChunkNode::internalUpdateChunkTree(const RenderData& data, ChunkIndex& traverseData) { using namespace glm; - LatLon center = _patch.center(); + Geodetic2 center = _patch.center(); //LDEBUG("x: " << patch.x << " y: " << patch.y << " level: " << patch.level << " lat: " << center.lat << " lon: " << center.lon); @@ -152,8 +153,8 @@ int ChunkNode::calculateDesiredLevel(const RenderData& data, const ChunkIndex& t Vec3 globeToCamera = cameraPosition - globePosition; - LatLon cameraPositionOnGlobe = LatLon::fromCartesian(globeToCamera); - LatLon closestPatchPoint = _patch.closestPoint(cameraPositionOnGlobe); + Geodetic2 cameraPositionOnGlobe = Geodetic2::fromCartesian(globeToCamera); + Geodetic2 closestPatchPoint = _patch.closestPoint(cameraPositionOnGlobe); Vec3 normalOfClosestPatchPoint = closestPatchPoint.asUnitCartesian(); Scalar cosPatchNormalNormalizedGlobeToCamera = glm::dot(normalOfClosestPatchPoint, glm::normalize(globeToCamera)); @@ -190,15 +191,15 @@ void ChunkNode::split(int depth) { if (depth > 0 && isLeaf()) { // Defining short handles for center, halfSize and quarterSize - const LatLon& c = _patch.center(); - const LatLon& hs = _patch.halfSize(); - LatLon qs = LatLon(0.5 * hs.lat, 0.5 * hs.lon); + const Geodetic2& c = _patch.center(); + const Geodetic2& hs = _patch.halfSize(); + Geodetic2 qs = Geodetic2(0.5 * hs.lat, 0.5 * hs.lon); // Subdivide bounds - LatLonPatch nwBounds = LatLonPatch(LatLon(c.lat + qs.lat, c.lon - qs.lon), qs); - LatLonPatch neBounds = LatLonPatch(LatLon(c.lat - qs.lat, c.lon - qs.lon), qs); - LatLonPatch swBounds = LatLonPatch(LatLon(c.lat + qs.lat, c.lon + qs.lon), qs); - LatLonPatch seBounds = LatLonPatch(LatLon(c.lat - qs.lat, c.lon + qs.lon), qs); + 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)); diff --git a/modules/globebrowsing/datastructures/chunknode.h b/modules/globebrowsing/globes/chunknode.h similarity index 93% rename from modules/globebrowsing/datastructures/chunknode.h rename to modules/globebrowsing/globes/chunknode.h index bb3cb9778e..26c2261e74 100644 --- a/modules/globebrowsing/datastructures/chunknode.h +++ b/modules/globebrowsing/globes/chunknode.h @@ -30,8 +30,8 @@ #include #include -#include -#include +#include +#include @@ -69,7 +69,7 @@ struct ChunkIndex { class ChunkNode { public: - ChunkNode(ChunkLodGlobe&, const LatLonPatch&, ChunkNode* parent = nullptr); + ChunkNode(ChunkLodGlobe&, const GeodeticPatch&, ChunkNode* parent = nullptr); ~ChunkNode(); @@ -99,7 +99,7 @@ private: ChunkLodGlobe& _owner; - LatLonPatch _patch; + GeodeticPatch _patch; }; diff --git a/modules/globebrowsing/rendering/clipmapglobe.cpp b/modules/globebrowsing/globes/clipmapglobe.cpp similarity index 93% rename from modules/globebrowsing/rendering/clipmapglobe.cpp rename to modules/globebrowsing/globes/clipmapglobe.cpp index 8626e39105..facd0deafc 100644 --- a/modules/globebrowsing/rendering/clipmapglobe.cpp +++ b/modules/globebrowsing/globes/clipmapglobe.cpp @@ -23,12 +23,9 @@ ****************************************************************************************/ -#define _USE_MATH_DEFINES -#include +#include -#include - -#include +#include // open space includes #include @@ -39,6 +36,9 @@ // ghoul includes #include +#define _USE_MATH_DEFINES +#include + namespace { const std::string _loggerCat = "ClipMapGlobe"; @@ -53,7 +53,7 @@ namespace { namespace openspace { ClipMapGlobe::ClipMapGlobe(const ghoul::Dictionary& dictionary) : _rotation("rotation", "Rotation", 0, 0, 360) - , _clipMapPyramid(LatLon(M_PI / 2, M_PI / 2)) + , _clipMapPyramid(Geodetic2(M_PI / 2, M_PI / 2)) { std::string name; bool success = dictionary.getValue(SceneGraphNode::KeyName, name); @@ -101,10 +101,10 @@ namespace openspace { // render patches for (size_t i = minDepth; i < maxDepth; i++) { - LatLon patchSize = _clipMapPyramid.getPatchSizeAtLevel(i); + Geodetic2 patchSize = _clipMapPyramid.getPatchSizeAtLevel(i); _outerPatchRenderer->renderPatch(patchSize, data, 6.3e6); } - LatLon patchSize = _clipMapPyramid.getPatchSizeAtLevel(maxDepth); + Geodetic2 patchSize = _clipMapPyramid.getPatchSizeAtLevel(maxDepth); _innerPatchRenderer->renderPatch(patchSize, data, 6.3e6); } diff --git a/modules/globebrowsing/rendering/clipmapglobe.h b/modules/globebrowsing/globes/clipmapglobe.h similarity index 91% rename from modules/globebrowsing/rendering/clipmapglobe.h rename to modules/globebrowsing/globes/clipmapglobe.h index 90a808d7b5..b1770555f2 100644 --- a/modules/globebrowsing/rendering/clipmapglobe.h +++ b/modules/globebrowsing/globes/clipmapglobe.h @@ -30,11 +30,11 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace ghoul { namespace opengl { diff --git a/modules/globebrowsing/rendering/clipmappyramid.cpp b/modules/globebrowsing/globes/clipmappyramid.cpp similarity index 90% rename from modules/globebrowsing/rendering/clipmappyramid.cpp rename to modules/globebrowsing/globes/clipmappyramid.cpp index 9ebf92421b..c5d7cd1907 100644 --- a/modules/globebrowsing/rendering/clipmappyramid.cpp +++ b/modules/globebrowsing/globes/clipmappyramid.cpp @@ -24,7 +24,7 @@ -#include +#include #define _USE_MATH_DEFINES #include @@ -37,7 +37,7 @@ namespace { } namespace openspace { - ClipMapPyramid::ClipMapPyramid(LatLon sizeLevel0) + ClipMapPyramid::ClipMapPyramid(Geodetic2 sizeLevel0) : _sizeLevel0(sizeLevel0) { @@ -46,9 +46,9 @@ namespace openspace { ClipMapPyramid::~ClipMapPyramid() {} - LatLon ClipMapPyramid::getPatchSizeAtLevel(int level) + Geodetic2 ClipMapPyramid::getPatchSizeAtLevel(int level) { - return LatLon(_sizeLevel0.lat / pow(2, level), _sizeLevel0.lon / pow(2, level)); + return Geodetic2(_sizeLevel0.lat / pow(2, level), _sizeLevel0.lon / pow(2, level)); } diff --git a/modules/globebrowsing/rendering/clipmappyramid.h b/modules/globebrowsing/globes/clipmappyramid.h similarity index 93% rename from modules/globebrowsing/rendering/clipmappyramid.h rename to modules/globebrowsing/globes/clipmappyramid.h index 303b825037..3b71309857 100644 --- a/modules/globebrowsing/rendering/clipmappyramid.h +++ b/modules/globebrowsing/globes/clipmappyramid.h @@ -26,7 +26,7 @@ #define __CLIPMAPPYRAMID_H__ // open space includes -#include +#include namespace openspace { @@ -37,13 +37,13 @@ namespace openspace { The parameter needs to be M_PI / pow(2, i) where i is a positive or zero valued integer. */ - ClipMapPyramid(LatLon sizeLevel0); + ClipMapPyramid(Geodetic2 sizeLevel0); ~ClipMapPyramid(); - LatLon getPatchSizeAtLevel(int level); + Geodetic2 getPatchSizeAtLevel(int level); private: - const LatLon _sizeLevel0; + const Geodetic2 _sizeLevel0; }; } // namespace openspace diff --git a/modules/globebrowsing/rendering/globemesh.cpp b/modules/globebrowsing/globes/globemesh.cpp similarity index 99% rename from modules/globebrowsing/rendering/globemesh.cpp rename to modules/globebrowsing/globes/globemesh.cpp index b0acd2d6e9..60542bf6a7 100644 --- a/modules/globebrowsing/rendering/globemesh.cpp +++ b/modules/globebrowsing/globes/globemesh.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include // open space includes #include diff --git a/modules/globebrowsing/rendering/globemesh.h b/modules/globebrowsing/globes/globemesh.h similarity index 94% rename from modules/globebrowsing/rendering/globemesh.h rename to modules/globebrowsing/globes/globemesh.h index 78275955d4..133f6a32e3 100644 --- a/modules/globebrowsing/rendering/globemesh.h +++ b/modules/globebrowsing/globes/globemesh.h @@ -31,9 +31,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace ghoul { namespace opengl { diff --git a/modules/globebrowsing/rendering/renderableglobe.cpp b/modules/globebrowsing/globes/renderableglobe.cpp similarity index 94% rename from modules/globebrowsing/rendering/renderableglobe.cpp rename to modules/globebrowsing/globes/renderableglobe.cpp index f1594d9b96..7bc4424edc 100644 --- a/modules/globebrowsing/rendering/renderableglobe.cpp +++ b/modules/globebrowsing/globes/renderableglobe.cpp @@ -22,11 +22,11 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include -#include -#include -#include +#include +#include +#include // open space includes #include diff --git a/modules/globebrowsing/rendering/renderableglobe.h b/modules/globebrowsing/globes/renderableglobe.h similarity index 94% rename from modules/globebrowsing/rendering/renderableglobe.h rename to modules/globebrowsing/globes/renderableglobe.h index d133357973..dc8ac50daa 100644 --- a/modules/globebrowsing/rendering/renderableglobe.h +++ b/modules/globebrowsing/globes/renderableglobe.h @@ -33,9 +33,9 @@ #include #include -#include -#include -#include +#include +#include +#include namespace ghoul { diff --git a/modules/globebrowsing/rendering/basicgrid.cpp b/modules/globebrowsing/meshes/basicgrid.cpp similarity index 99% rename from modules/globebrowsing/rendering/basicgrid.cpp rename to modules/globebrowsing/meshes/basicgrid.cpp index 34e2b3b06f..f9eb432b40 100644 --- a/modules/globebrowsing/rendering/basicgrid.cpp +++ b/modules/globebrowsing/meshes/basicgrid.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include namespace { const std::string _loggerCat = "BasicGrid"; diff --git a/modules/globebrowsing/rendering/basicgrid.h b/modules/globebrowsing/meshes/basicgrid.h similarity index 98% rename from modules/globebrowsing/rendering/basicgrid.h rename to modules/globebrowsing/meshes/basicgrid.h index b4621dabfd..bfa8935f53 100644 --- a/modules/globebrowsing/rendering/basicgrid.h +++ b/modules/globebrowsing/meshes/basicgrid.h @@ -28,7 +28,7 @@ #include -#include +#include #include diff --git a/modules/globebrowsing/rendering/clipmapgrid.cpp b/modules/globebrowsing/meshes/clipmapgrid.cpp similarity index 99% rename from modules/globebrowsing/rendering/clipmapgrid.cpp rename to modules/globebrowsing/meshes/clipmapgrid.cpp index b695de0bce..98b4799041 100644 --- a/modules/globebrowsing/rendering/clipmapgrid.cpp +++ b/modules/globebrowsing/meshes/clipmapgrid.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include #include diff --git a/modules/globebrowsing/rendering/clipmapgrid.h b/modules/globebrowsing/meshes/clipmapgrid.h similarity index 99% rename from modules/globebrowsing/rendering/clipmapgrid.h rename to modules/globebrowsing/meshes/clipmapgrid.h index f3e650a2cd..7f580f02fd 100644 --- a/modules/globebrowsing/rendering/clipmapgrid.h +++ b/modules/globebrowsing/meshes/clipmapgrid.h @@ -25,7 +25,7 @@ #ifndef __CLIPMAPGEOMETRY_H__ #define __CLIPMAPGEOMETRY_H__ -#include +#include #include #include diff --git a/modules/globebrowsing/rendering/grid.cpp b/modules/globebrowsing/meshes/grid.cpp similarity index 98% rename from modules/globebrowsing/rendering/grid.cpp rename to modules/globebrowsing/meshes/grid.cpp index 81db896ab2..cc3a848ce4 100644 --- a/modules/globebrowsing/rendering/grid.cpp +++ b/modules/globebrowsing/meshes/grid.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include namespace { const std::string _loggerCat = "Grid"; diff --git a/modules/globebrowsing/rendering/grid.h b/modules/globebrowsing/meshes/grid.h similarity index 98% rename from modules/globebrowsing/rendering/grid.h rename to modules/globebrowsing/meshes/grid.h index 7c99213baf..b78eddbd73 100644 --- a/modules/globebrowsing/rendering/grid.h +++ b/modules/globebrowsing/meshes/grid.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include diff --git a/modules/globebrowsing/rendering/trianglesoup.cpp b/modules/globebrowsing/meshes/trianglesoup.cpp similarity index 99% rename from modules/globebrowsing/rendering/trianglesoup.cpp rename to modules/globebrowsing/meshes/trianglesoup.cpp index 1c917925b8..99b739f64e 100644 --- a/modules/globebrowsing/rendering/trianglesoup.cpp +++ b/modules/globebrowsing/meshes/trianglesoup.cpp @@ -22,7 +22,7 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include namespace { const std::string _loggerCat = "TriangleSoup"; diff --git a/modules/globebrowsing/rendering/trianglesoup.h b/modules/globebrowsing/meshes/trianglesoup.h similarity index 100% rename from modules/globebrowsing/rendering/trianglesoup.h rename to modules/globebrowsing/meshes/trianglesoup.h diff --git a/modules/globebrowsing/rendering/distanceswitch.cpp b/modules/globebrowsing/other/distanceswitch.cpp similarity index 98% rename from modules/globebrowsing/rendering/distanceswitch.cpp rename to modules/globebrowsing/other/distanceswitch.cpp index e2fda3b1af..aa1fe9ad73 100644 --- a/modules/globebrowsing/rendering/distanceswitch.cpp +++ b/modules/globebrowsing/other/distanceswitch.cpp @@ -23,7 +23,7 @@ ****************************************************************************************/ // open space includes -#include +#include namespace { const std::string _loggerCat = "DistanceSwitch"; diff --git a/modules/globebrowsing/rendering/distanceswitch.h b/modules/globebrowsing/other/distanceswitch.h similarity index 100% rename from modules/globebrowsing/rendering/distanceswitch.h rename to modules/globebrowsing/other/distanceswitch.h diff --git a/modules/globebrowsing/rendering/frustrumculler.cpp b/modules/globebrowsing/other/frustrumculler.cpp similarity index 96% rename from modules/globebrowsing/rendering/frustrumculler.cpp rename to modules/globebrowsing/other/frustrumculler.cpp index 1b5f24bfe4..87dd03a06e 100644 --- a/modules/globebrowsing/rendering/frustrumculler.cpp +++ b/modules/globebrowsing/other/frustrumculler.cpp @@ -23,7 +23,7 @@ ****************************************************************************************/ -#include +#include namespace { const std::string _loggerCat = "FrustrumCuller"; @@ -56,7 +56,7 @@ namespace openspace { } - bool FrustrumCuller::isVisible(const RenderData& data, const LatLonPatch& patch, double radius) { + bool FrustrumCuller::isVisible(const RenderData& data, const GeodeticPatch& patch, double radius) { // An axis aligned bounding box based on the patch's minimum boudning sphere is // used for testnig diff --git a/modules/globebrowsing/rendering/frustrumculler.h b/modules/globebrowsing/other/frustrumculler.h similarity index 97% rename from modules/globebrowsing/rendering/frustrumculler.h rename to modules/globebrowsing/other/frustrumculler.h index 4974de6640..583c1c073a 100644 --- a/modules/globebrowsing/rendering/frustrumculler.h +++ b/modules/globebrowsing/other/frustrumculler.h @@ -32,8 +32,7 @@ #include -#include - +#include namespace openspace { @@ -65,7 +64,7 @@ namespace openspace { */ bool isVisible( const RenderData& data, - const LatLonPatch& patch, + const GeodeticPatch& patch, double radius); private: diff --git a/modules/globebrowsing/rendering/gdaldataconverter.cpp b/modules/globebrowsing/other/gdaldataconverter.cpp similarity index 98% rename from modules/globebrowsing/rendering/gdaldataconverter.cpp rename to modules/globebrowsing/other/gdaldataconverter.cpp index b01b679c71..b986833071 100644 --- a/modules/globebrowsing/rendering/gdaldataconverter.cpp +++ b/modules/globebrowsing/other/gdaldataconverter.cpp @@ -23,7 +23,7 @@ ****************************************************************************************/ -#include +#include namespace { const std::string _loggerCat = "GdalDataConverter"; diff --git a/modules/globebrowsing/rendering/gdaldataconverter.h b/modules/globebrowsing/other/gdaldataconverter.h similarity index 100% rename from modules/globebrowsing/rendering/gdaldataconverter.h rename to modules/globebrowsing/other/gdaldataconverter.h diff --git a/modules/globebrowsing/datastructures/lrucache.h b/modules/globebrowsing/other/lrucache.h similarity index 97% rename from modules/globebrowsing/datastructures/lrucache.h rename to modules/globebrowsing/other/lrucache.h index 3162a4ea44..bb3ccfd944 100644 --- a/modules/globebrowsing/datastructures/lrucache.h +++ b/modules/globebrowsing/other/lrucache.h @@ -65,6 +65,6 @@ namespace openspace { } // namespace openspace -#include +#include #endif // __LRU_CACHE_H__ diff --git a/modules/globebrowsing/datastructures/lrucache.inl b/modules/globebrowsing/other/lrucache.inl similarity index 100% rename from modules/globebrowsing/datastructures/lrucache.inl rename to modules/globebrowsing/other/lrucache.inl diff --git a/modules/globebrowsing/rendering/patchrenderer.cpp b/modules/globebrowsing/other/patchrenderer.cpp similarity index 92% rename from modules/globebrowsing/rendering/patchrenderer.cpp rename to modules/globebrowsing/other/patchrenderer.cpp index 6c4c23437c..ebf302e336 100644 --- a/modules/globebrowsing/rendering/patchrenderer.cpp +++ b/modules/globebrowsing/other/patchrenderer.cpp @@ -22,9 +22,9 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include -#include +#include // open space includes #include @@ -56,7 +56,7 @@ namespace openspace { // PATCH RENDERER // ////////////////////////////////////////////////////////////////////////////////////// PatchRenderer::PatchRenderer() - : _tileSet(LatLon(M_PI, M_PI * 2), LatLon(M_PI / 2, -M_PI), 0) + : _tileSet(Geodetic2(M_PI, M_PI * 2), Geodetic2(M_PI / 2, -M_PI), 0) { } @@ -89,7 +89,7 @@ namespace openspace { } void LatLonPatchRenderer::renderPatch( - const LatLonPatch& patch, const RenderData& data, double radius) + const GeodeticPatch& patch, const RenderData& data, double radius) { // Get the textures that should be used for rendering @@ -98,7 +98,7 @@ namespace openspace { renderPatch(patch, data, radius, ti); } - void LatLonPatchRenderer::renderPatch(const LatLonPatch& patch,const RenderData& data, + void LatLonPatchRenderer::renderPatch(const GeodeticPatch& patch,const RenderData& data, double radius, const TileIndex& tileIndex) { @@ -141,7 +141,7 @@ namespace openspace { _programObject->setUniform("textureSampler", texUnit); _programObject->setUniform("uvTransformPatchToTile", uvTransform); - LatLon swCorner = patch.southWestCorner(); + Geodetic2 swCorner = patch.southWestCorner(); _programObject->setUniform("segmentsPerPatch", _grid->xSegments()); _programObject->setUniform("modelViewProjectionTransform", modelViewProjectionTransform); _programObject->setUniform("minLatLon", vec2(swCorner.toLonLatVec2())); @@ -179,7 +179,7 @@ namespace openspace { } void ClipMapPatchRenderer::renderPatch( - const LatLon& patchSize, + const Geodetic2& patchSize, const RenderData& data, double radius) { @@ -194,22 +194,22 @@ namespace openspace { // Snap patch position int segmentsPerPatch = _grid->segments(); - LatLon stepSize = LatLon( + Geodetic2 stepSize = Geodetic2( patchSize.lat / segmentsPerPatch, patchSize.lon / segmentsPerPatch); ivec2 patchesToCoverGlobe = ivec2( M_PI / patchSize.lat + 0.5, M_PI * 2 / patchSize.lon + 0.5); - LatLon cameraPosLatLon = LatLon::fromCartesian(data.camera.position().dvec3()); + Geodetic2 cameraPosLatLon = Geodetic2::fromCartesian(data.camera.position().dvec3()); ivec2 intSnapCoord = ivec2( cameraPosLatLon.lat / (M_PI * 2) * segmentsPerPatch * patchesToCoverGlobe.y, cameraPosLatLon.lon / (M_PI) * segmentsPerPatch * patchesToCoverGlobe.x); - LatLon newPatchCenter = LatLon( + Geodetic2 newPatchCenter = Geodetic2( stepSize.lat * intSnapCoord.x, stepSize.lon * intSnapCoord.y); - LatLonPatch newPatch( + GeodeticPatch newPatch( newPatchCenter, - LatLon(patchSize.lat / 2, patchSize.lon / 2)); + Geodetic2(patchSize.lat / 2, patchSize.lon / 2)); ivec2 contraction = ivec2(intSnapCoord.y % 2, intSnapCoord.x % 2); @@ -220,7 +220,7 @@ namespace openspace { // Get the textures that should be used for rendering TileIndex tileIndex = _tileSet.getTileIndex(newPatch); - LatLonPatch tilePatch = _tileSet.getTilePositionAndScale(tileIndex); + GeodeticPatch tilePatch = _tileSet.getTilePositionAndScale(tileIndex); std::shared_ptr tile00 = _tileSet.getTile(tileIndex); glm::mat3 uvTransform = _tileSet.getUvTransformationPatchToTile(newPatch, tileIndex); diff --git a/modules/globebrowsing/rendering/patchrenderer.h b/modules/globebrowsing/other/patchrenderer.h similarity index 90% rename from modules/globebrowsing/rendering/patchrenderer.h rename to modules/globebrowsing/other/patchrenderer.h index e44dba9442..97da5f93a4 100644 --- a/modules/globebrowsing/rendering/patchrenderer.h +++ b/modules/globebrowsing/other/patchrenderer.h @@ -31,11 +31,11 @@ // open space includes #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include namespace ghoul { namespace opengl { @@ -75,12 +75,12 @@ namespace openspace { LatLonPatchRenderer(shared_ptr grid); void renderPatch( - const LatLonPatch& patch, + const GeodeticPatch& patch, const RenderData& data, double radius); void renderPatch( - const LatLonPatch& patch, + const GeodeticPatch& patch, const RenderData& data, double radius, const TileIndex& ti); @@ -96,7 +96,7 @@ namespace openspace { ClipMapPatchRenderer(shared_ptr grid); void renderPatch( - const LatLon& patchSize, + const Geodetic2& patchSize, const RenderData& data, double radius); private: diff --git a/modules/globebrowsing/rendering/texturetileset.cpp b/modules/globebrowsing/other/texturetileset.cpp similarity index 88% rename from modules/globebrowsing/rendering/texturetileset.cpp rename to modules/globebrowsing/other/texturetileset.cpp index b453b037c5..a867743dcc 100644 --- a/modules/globebrowsing/rendering/texturetileset.cpp +++ b/modules/globebrowsing/other/texturetileset.cpp @@ -22,9 +22,9 @@ * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * ****************************************************************************************/ -#include +#include -#include +#include #include #include @@ -43,7 +43,7 @@ namespace { namespace openspace { - TextureTileSet::TextureTileSet(LatLon sizeLevel0, LatLon offsetLevel0, int depth) + TextureTileSet::TextureTileSet(Geodetic2 sizeLevel0, Geodetic2 offsetLevel0, int depth) : _sizeLevel0(sizeLevel0) , _offsetLevel0(offsetLevel0) , _depth(depth) @@ -88,7 +88,7 @@ namespace openspace { } - TileIndex TextureTileSet::getTileIndex(LatLonPatch patch) { + TileIndex TextureTileSet::getTileIndex(GeodeticPatch patch) { // Calculate the level of the index depanding on the size of the incoming patch. // The level is as big as possible (as far down as possible) but it can't be // too big since at maximum four tiles should be used to cover a patch @@ -113,7 +113,7 @@ namespace openspace { return tileIndex; } - std::shared_ptr TextureTileSet::getTile(LatLonPatch patch) { + std::shared_ptr TextureTileSet::getTile(GeodeticPatch patch) { return getTile(getTileIndex(patch)); } @@ -121,30 +121,30 @@ namespace openspace { return _testTexture; } - LatLonPatch TextureTileSet::getTilePositionAndScale(const TileIndex& tileIndex) { - LatLon tileSize = LatLon( + GeodeticPatch TextureTileSet::getTilePositionAndScale(const TileIndex& tileIndex) { + Geodetic2 tileSize = Geodetic2( _sizeLevel0.lat / pow(2, tileIndex.level), _sizeLevel0.lon / pow(2, tileIndex.level)); - LatLon northWest = LatLon( + Geodetic2 northWest = Geodetic2( _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)); + return GeodeticPatch( + Geodetic2(northWest.lat - tileSize.lat / 2, northWest.lon + tileSize.lon / 2), + Geodetic2(tileSize.lat / 2, tileSize.lon / 2)); } glm::mat3 TextureTileSet::getUvTransformationPatchToTile( - LatLonPatch patch, + GeodeticPatch patch, const TileIndex& tileIndex) { - LatLonPatch tile = getTilePositionAndScale(tileIndex); + GeodeticPatch tile = getTilePositionAndScale(tileIndex); return getUvTransformationPatchToTile(patch, tile); } glm::mat3 TextureTileSet::getUvTransformationPatchToTile( - LatLonPatch patch, - LatLonPatch tile) + GeodeticPatch patch, + GeodeticPatch tile) { Vec2 posDiff = patch.southWestCorner().toLonLatVec2() - diff --git a/modules/globebrowsing/rendering/texturetileset.h b/modules/globebrowsing/other/texturetileset.h similarity index 88% rename from modules/globebrowsing/rendering/texturetileset.h rename to modules/globebrowsing/other/texturetileset.h index 9f65766e42..7154f21517 100644 --- a/modules/globebrowsing/rendering/texturetileset.h +++ b/modules/globebrowsing/other/texturetileset.h @@ -28,11 +28,9 @@ #include #include -#include - -#include - +#include +#include ////////////////////////////////////////////////////////////////////////////////////////// @@ -46,7 +44,7 @@ namespace openspace { class TextureTileSet { public: - TextureTileSet(LatLon sizeLevel0, LatLon offsetLevel0, int depth); + TextureTileSet(Geodetic2 sizeLevel0, Geodetic2 offsetLevel0, int depth); ~TextureTileSet(); /** @@ -55,12 +53,12 @@ namespace openspace { Without the tile being smaller than the patch in lat-lon space. The tile is at least as big as the patch. */ - TileIndex getTileIndex(LatLonPatch patch); + TileIndex getTileIndex(GeodeticPatch patch); /** Returns a texture that can be used for the specified patch */ - std::shared_ptr getTile(LatLonPatch patch); + std::shared_ptr getTile(GeodeticPatch patch); /** Returns the texture for the given tile index. The indices reaches from left @@ -73,26 +71,26 @@ namespace openspace { A tile can be defined with a tile index or a LatLonPatch which defines the position and the size of the tile. */ - LatLonPatch getTilePositionAndScale(const TileIndex& tileIndex); + GeodeticPatch getTilePositionAndScale(const TileIndex& tileIndex); /** A transformation (translation and scaling) from the texture space of a patch to the texture space of a tile. */ glm::mat3 getUvTransformationPatchToTile( - LatLonPatch patch, + GeodeticPatch patch, const TileIndex& tileIndex); /** Overloaded function */ glm::mat3 getUvTransformationPatchToTile( - LatLonPatch patch, - LatLonPatch tile); + GeodeticPatch patch, + GeodeticPatch tile); private: - LatLon _sizeLevel0; - LatLon _offsetLevel0; + Geodetic2 _sizeLevel0; + Geodetic2 _offsetLevel0; int _depth; std::shared_ptr _testTexture; diff --git a/modules/globebrowsing/rendering/twmstileprovider.cpp b/modules/globebrowsing/other/twmstileprovider.cpp similarity index 99% rename from modules/globebrowsing/rendering/twmstileprovider.cpp rename to modules/globebrowsing/other/twmstileprovider.cpp index 908a280362..ea6974abcc 100644 --- a/modules/globebrowsing/rendering/twmstileprovider.cpp +++ b/modules/globebrowsing/other/twmstileprovider.cpp @@ -23,7 +23,7 @@ ****************************************************************************************/ -#include +#include #include diff --git a/modules/globebrowsing/rendering/twmstileprovider.h b/modules/globebrowsing/other/twmstileprovider.h similarity index 98% rename from modules/globebrowsing/rendering/twmstileprovider.h rename to modules/globebrowsing/other/twmstileprovider.h index b965d128a3..6d3f740094 100644 --- a/modules/globebrowsing/rendering/twmstileprovider.h +++ b/modules/globebrowsing/other/twmstileprovider.h @@ -25,6 +25,8 @@ #ifndef __TWMS_TILE_PROVIDER_H__ #define __TWMS_TILE_PROVIDER_H__ +#include + #include #include @@ -32,7 +34,6 @@ - ////////////////////////////////////////////////////////////////////////////////////// // TILE INDEX // ////////////////////////////////////////////////////////////////////////////////////// @@ -49,9 +50,6 @@ namespace openspace { }; } -#include - - ////////////////////////////////////////////////////////////////////////////////////////// // TWMS TILE PROVIDER //