mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-18 02:49:03 -06:00
Restructure files in folders
This commit is contained in:
@@ -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})
|
||||
|
||||
@@ -177,7 +177,7 @@ using fAngle = Angle<float>;
|
||||
|
||||
|
||||
|
||||
#include <modules/globebrowsing/datastructures/angle.inl>
|
||||
#include <modules/globebrowsing/geodetics/angle.inl>
|
||||
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/datastructures/angle.h>
|
||||
#include <modules/globebrowsing/geodetics/angle.h>
|
||||
|
||||
|
||||
|
||||
@@ -22,11 +22,12 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <ghoul/misc/assert.h>
|
||||
#include <modules/globebrowsing/geodetics/geodetic2.h>
|
||||
|
||||
#include <modules/globebrowsing/datastructures/chunknode.h>
|
||||
#include <modules/globebrowsing/datastructures/latlon.h>
|
||||
#include <modules/globebrowsing/datastructures/angle.h>
|
||||
#include <modules/globebrowsing/globes/chunknode.h>
|
||||
#include <modules/globebrowsing/geodetics/angle.h>
|
||||
|
||||
#include <ghoul/misc/assert.h>
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
@@ -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<Scalar>;
|
||||
|
||||
// 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<Scalar>;
|
||||
|
||||
// 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
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
|
||||
#include <modules/globebrowsing/globebrowsingmodule.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/renderableglobe.h>
|
||||
#include <modules/globebrowsing/rendering/distanceswitch.h>
|
||||
#include <modules/globebrowsing/rendering/globemesh.h>
|
||||
#include <modules/globebrowsing/globes/renderableglobe.h>
|
||||
#include <modules/globebrowsing/other/distanceswitch.h>
|
||||
#include <modules/globebrowsing/globes/globemesh.h>
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/rendering/chunklodglobe.h>
|
||||
#include <modules/globebrowsing/globes/chunklodglobe.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/basicgrid.h>
|
||||
#include <modules/globebrowsing/meshes/basicgrid.h>
|
||||
|
||||
// open space includes
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
@@ -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)
|
||||
@@ -39,9 +39,9 @@
|
||||
|
||||
|
||||
|
||||
#include <modules/globebrowsing/datastructures/chunknode.h>
|
||||
#include <modules/globebrowsing/rendering/patchrenderer.h>
|
||||
#include <modules/globebrowsing/rendering/twmstileprovider.h>
|
||||
#include <modules/globebrowsing/globes/chunknode.h>
|
||||
#include <modules/globebrowsing/other/patchrenderer.h>
|
||||
#include <modules/globebrowsing/other/twmstileprovider.h>
|
||||
|
||||
namespace ghoul {
|
||||
namespace opengl {
|
||||
@@ -90,8 +90,8 @@ namespace openspace {
|
||||
std::unique_ptr<LatLonPatchRenderer> _patchRenderer;
|
||||
|
||||
|
||||
static const LatLonPatch LEFT_HEMISPHERE;
|
||||
static const LatLonPatch RIGHT_HEMISPHERE;
|
||||
static const GeodeticPatch LEFT_HEMISPHERE;
|
||||
static const GeodeticPatch RIGHT_HEMISPHERE;
|
||||
|
||||
properties::IntProperty _rotation;
|
||||
|
||||
@@ -22,13 +22,14 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/globes/chunknode.h>
|
||||
|
||||
#include <ghoul/misc/assert.h>
|
||||
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
|
||||
#include <modules/globebrowsing/datastructures/chunknode.h>
|
||||
#include <modules/globebrowsing/rendering/chunklodglobe.h>
|
||||
#include <modules/globebrowsing/globes/chunklodglobe.h>
|
||||
|
||||
|
||||
|
||||
@@ -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<ChunkNode>(new ChunkNode(_owner, nwBounds, this));
|
||||
@@ -30,8 +30,8 @@
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
|
||||
#include <modules/globebrowsing/datastructures/latlon.h>
|
||||
#include <modules/globebrowsing/rendering/patchrenderer.h>
|
||||
#include <modules/globebrowsing/geodetics/geodetic2.h>
|
||||
#include <modules/globebrowsing/other/patchrenderer.h>
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
@@ -23,12 +23,9 @@
|
||||
****************************************************************************************/
|
||||
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#include <modules/globebrowsing/globes/clipmapglobe.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/clipmapglobe.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/clipmapgrid.h>
|
||||
#include <modules/globebrowsing/meshes/clipmapgrid.h>
|
||||
|
||||
// open space includes
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
@@ -39,6 +36,9 @@
|
||||
// ghoul includes
|
||||
#include <ghoul/misc/assert.h>
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/trianglesoup.h>
|
||||
#include <modules/globebrowsing/rendering/grid.h>
|
||||
#include <modules/globebrowsing/rendering/distanceswitch.h>
|
||||
#include <modules/globebrowsing/rendering/patchrenderer.h>
|
||||
#include <modules/globebrowsing/rendering/clipmappyramid.h>
|
||||
#include <modules/globebrowsing/meshes/trianglesoup.h>
|
||||
#include <modules/globebrowsing/meshes/grid.h>
|
||||
#include <modules/globebrowsing/other/distanceswitch.h>
|
||||
#include <modules/globebrowsing/other/patchrenderer.h>
|
||||
#include <modules/globebrowsing/globes/clipmappyramid.h>
|
||||
|
||||
namespace ghoul {
|
||||
namespace opengl {
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
|
||||
#include <modules/globebrowsing/rendering/clipmappyramid.h>
|
||||
#include <modules/globebrowsing/globes/clipmappyramid.h>
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#define __CLIPMAPPYRAMID_H__
|
||||
|
||||
// open space includes
|
||||
#include <modules/globebrowsing/datastructures/latlon.h>
|
||||
#include <modules/globebrowsing/geodetics/geodetic2.h>
|
||||
|
||||
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
|
||||
@@ -22,7 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/rendering/globemesh.h>
|
||||
#include <modules/globebrowsing/globes/globemesh.h>
|
||||
|
||||
// open space includes
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
@@ -31,9 +31,9 @@
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/trianglesoup.h>
|
||||
#include <modules/globebrowsing/rendering/basicgrid.h>
|
||||
#include <modules/globebrowsing/rendering/distanceswitch.h>
|
||||
#include <modules/globebrowsing/meshes/trianglesoup.h>
|
||||
#include <modules/globebrowsing/meshes/basicgrid.h>
|
||||
#include <modules/globebrowsing/other/distanceswitch.h>
|
||||
|
||||
namespace ghoul {
|
||||
namespace opengl {
|
||||
@@ -22,11 +22,11 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/rendering/renderableglobe.h>
|
||||
#include <modules/globebrowsing/globes/renderableglobe.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/globemesh.h>
|
||||
#include <modules/globebrowsing/rendering/clipmapglobe.h>
|
||||
#include <modules/globebrowsing/rendering/chunklodglobe.h>
|
||||
#include <modules/globebrowsing/globes/globemesh.h>
|
||||
#include <modules/globebrowsing/globes/clipmapglobe.h>
|
||||
#include <modules/globebrowsing/globes/chunklodglobe.h>
|
||||
|
||||
// open space includes
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
@@ -33,9 +33,9 @@
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/trianglesoup.h>
|
||||
#include <modules/globebrowsing/rendering/distanceswitch.h>
|
||||
#include <modules/globebrowsing/rendering/globemesh.h>
|
||||
#include <modules/globebrowsing/meshes/trianglesoup.h>
|
||||
#include <modules/globebrowsing/other/distanceswitch.h>
|
||||
#include <modules/globebrowsing/globes/globemesh.h>
|
||||
|
||||
|
||||
namespace ghoul {
|
||||
@@ -22,7 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/rendering/basicgrid.h>
|
||||
#include <modules/globebrowsing/meshes/basicgrid.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "BasicGrid";
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <modules/globebrowsing/rendering/grid.h>
|
||||
#include <modules/globebrowsing/meshes/grid.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/rendering/clipmapgrid.h>
|
||||
#include <modules/globebrowsing/meshes/clipmapgrid.h>
|
||||
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#ifndef __CLIPMAPGEOMETRY_H__
|
||||
#define __CLIPMAPGEOMETRY_H__
|
||||
|
||||
#include <modules/globebrowsing/rendering/grid.h>
|
||||
#include <modules/globebrowsing/meshes/grid.h>
|
||||
|
||||
#include <vector>
|
||||
#include <glm/glm.hpp>
|
||||
@@ -22,7 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/rendering/grid.h>
|
||||
#include <modules/globebrowsing/meshes/grid.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "Grid";
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <modules/globebrowsing/rendering/trianglesoup.h>
|
||||
#include <modules/globebrowsing/meshes/trianglesoup.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/rendering/trianglesoup.h>
|
||||
#include <modules/globebrowsing/meshes/trianglesoup.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "TriangleSoup";
|
||||
@@ -23,7 +23,7 @@
|
||||
****************************************************************************************/
|
||||
|
||||
// open space includes
|
||||
#include <modules/globebrowsing/rendering/distanceswitch.h>
|
||||
#include <modules/globebrowsing/other/distanceswitch.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "DistanceSwitch";
|
||||
@@ -23,7 +23,7 @@
|
||||
****************************************************************************************/
|
||||
|
||||
|
||||
#include <modules/globebrowsing/rendering/frustrumculler.h>
|
||||
#include <modules/globebrowsing/other/frustrumculler.h>
|
||||
|
||||
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
|
||||
|
||||
@@ -32,8 +32,7 @@
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <modules/globebrowsing/datastructures/latlon.h>
|
||||
|
||||
#include <modules/globebrowsing/geodetics/geodetic2.h>
|
||||
|
||||
|
||||
namespace openspace {
|
||||
@@ -65,7 +64,7 @@ namespace openspace {
|
||||
*/
|
||||
bool isVisible(
|
||||
const RenderData& data,
|
||||
const LatLonPatch& patch,
|
||||
const GeodeticPatch& patch,
|
||||
double radius);
|
||||
|
||||
private:
|
||||
@@ -23,7 +23,7 @@
|
||||
****************************************************************************************/
|
||||
|
||||
|
||||
#include <modules/globebrowsing/rendering/gdaldataconverter.h>
|
||||
#include <modules/globebrowsing/other/gdaldataconverter.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "GdalDataConverter";
|
||||
@@ -65,6 +65,6 @@ namespace openspace {
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
#include <modules/globebrowsing/datastructures/lrucache.inl>
|
||||
#include <modules/globebrowsing/other/lrucache.inl>
|
||||
|
||||
#endif // __LRU_CACHE_H__
|
||||
@@ -22,9 +22,9 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/rendering/patchrenderer.h>
|
||||
#include <modules/globebrowsing/other/patchrenderer.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/clipmapgrid.h>
|
||||
#include <modules/globebrowsing/meshes/clipmapgrid.h>
|
||||
|
||||
// open space includes
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
@@ -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<ghoul::opengl::Texture> tile00 = _tileSet.getTile(tileIndex);
|
||||
glm::mat3 uvTransform = _tileSet.getUvTransformationPatchToTile(newPatch, tileIndex);
|
||||
|
||||
@@ -31,11 +31,11 @@
|
||||
// open space includes
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <modules/globebrowsing/datastructures/latlon.h>
|
||||
#include <modules/globebrowsing/rendering/grid.h>
|
||||
#include <modules/globebrowsing/rendering/clipmapgrid.h>
|
||||
#include <modules/globebrowsing/rendering/frustrumculler.h>
|
||||
#include <modules/globebrowsing/rendering/texturetileset.h>
|
||||
#include <modules/globebrowsing/geodetics/geodetic2.h>
|
||||
#include <modules/globebrowsing/meshes/grid.h>
|
||||
#include <modules/globebrowsing/meshes/clipmapgrid.h>
|
||||
#include <modules/globebrowsing/other/frustrumculler.h>
|
||||
#include <modules/globebrowsing/other/texturetileset.h>
|
||||
|
||||
namespace ghoul {
|
||||
namespace opengl {
|
||||
@@ -75,12 +75,12 @@ namespace openspace {
|
||||
LatLonPatchRenderer(shared_ptr<Grid> 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<ClipMapGrid> grid);
|
||||
|
||||
void renderPatch(
|
||||
const LatLon& patchSize,
|
||||
const Geodetic2& patchSize,
|
||||
const RenderData& data,
|
||||
double radius);
|
||||
private:
|
||||
@@ -22,9 +22,9 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/rendering/texturetileset.h>
|
||||
#include <modules/globebrowsing/other/texturetileset.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/gdaldataconverter.h>
|
||||
#include <modules/globebrowsing/other/gdaldataconverter.h>
|
||||
|
||||
#include <ghoul/opengl/texturemanager.h>
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
@@ -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<Texture> TextureTileSet::getTile(LatLonPatch patch) {
|
||||
std::shared_ptr<Texture> 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() -
|
||||
@@ -28,11 +28,9 @@
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
#include <modules/globebrowsing/datastructures/latlon.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/twmstileprovider.h>
|
||||
|
||||
#include <modules/globebrowsing/geodetics/geodetic2.h>
|
||||
|
||||
#include <modules/globebrowsing/other/twmstileprovider.h>
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -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<Texture> getTile(LatLonPatch patch);
|
||||
std::shared_ptr<Texture> 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<Texture> _testTexture;
|
||||
@@ -23,7 +23,7 @@
|
||||
****************************************************************************************/
|
||||
|
||||
|
||||
#include <modules/globebrowsing/rendering/twmstileprovider.h>
|
||||
#include <modules/globebrowsing/other/twmstileprovider.h>
|
||||
|
||||
#include <openspace/engine/downloadmanager.h>
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#ifndef __TWMS_TILE_PROVIDER_H__
|
||||
#define __TWMS_TILE_PROVIDER_H__
|
||||
|
||||
#include <modules/globebrowsing/other/lrucache.h>
|
||||
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
@@ -32,7 +34,6 @@
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
// TILE INDEX //
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -49,9 +50,6 @@ namespace openspace {
|
||||
};
|
||||
}
|
||||
|
||||
#include <modules/globebrowsing/datastructures/lrucache.h>
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// TWMS TILE PROVIDER //
|
||||
Reference in New Issue
Block a user