mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-04 18:11:01 -05:00
Solve merge conflict and removed rendering of borders.
This commit is contained in:
@@ -46,6 +46,7 @@ set(HEADER_FILES
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/patchrenderer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/culling.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/aabb.h
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/other/distanceswitch.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/other/texturetileset.h
|
||||
@@ -81,6 +82,7 @@ set(SOURCE_FILES
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/patchrenderer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/culling.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/aabb.cpp
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/other/distanceswitch.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/other/texturetileset.cpp
|
||||
|
||||
@@ -33,36 +33,16 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
Ellipsoid::Ellipsoid()
|
||||
: Ellipsoid(1,1,1)
|
||||
{
|
||||
Ellipsoid::Ellipsoid() : Ellipsoid(1,1,1) {
|
||||
|
||||
}
|
||||
|
||||
Ellipsoid::Ellipsoid(Vec3 radii)
|
||||
: _radii(radii)
|
||||
, _cachedValues({
|
||||
Vec3( // _radiiSquared
|
||||
(_radii.x * _radii.x),
|
||||
(_radii.y * _radii.y),
|
||||
(_radii.z * _radii.z)),
|
||||
Vec3( // _oneOverRadiiSquared
|
||||
1.0 / (_radii.x * _radii.x),
|
||||
1.0 / (_radii.y * _radii.y),
|
||||
1.0 / (_radii.z * _radii.z)),
|
||||
Vec3( // _radiiToTheFourth
|
||||
_radii.x * _radii.x * _radii.x * _radii.x,
|
||||
_radii.y * _radii.y * _radii.y * _radii.y,
|
||||
_radii.z * _radii.z * _radii.z * _radii.z),
|
||||
glm::min(_radii.x, glm::min(_radii.y, _radii.z))})
|
||||
{
|
||||
|
||||
Ellipsoid::Ellipsoid(Vec3 radii) : _radii(radii) {
|
||||
updateInternalCache();
|
||||
}
|
||||
|
||||
Ellipsoid::Ellipsoid(Scalar x, Scalar y, Scalar z)
|
||||
: Ellipsoid(Vec3(x, y, z))
|
||||
{
|
||||
|
||||
Ellipsoid::Ellipsoid(Scalar x, Scalar y, Scalar z) : _radii(x, y, z) {
|
||||
updateInternalCache();
|
||||
}
|
||||
|
||||
Ellipsoid::~Ellipsoid()
|
||||
@@ -70,16 +50,32 @@ namespace openspace {
|
||||
|
||||
}
|
||||
|
||||
Vec3 Ellipsoid::scaleToGeocentricSurface(const Vec3& p) const
|
||||
void Ellipsoid::updateInternalCache() {
|
||||
_cached._radiiSquared = Vec3(
|
||||
(_radii.x * _radii.x),
|
||||
(_radii.y * _radii.y),
|
||||
(_radii.z * _radii.z));
|
||||
|
||||
_cached._oneOverRadiiSquared = Vec3(1) / _cached._radiiSquared;
|
||||
_cached._radiiToTheFourth = _cached._radiiSquared * _cached._radiiSquared;
|
||||
|
||||
_cached._minimumRadius = glm::min(_radii.x, glm::min(_radii.y, _radii.z));
|
||||
_cached._maximumRadius = glm::max(_radii.x, glm::max(_radii.y, _radii.z));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Vec3 Ellipsoid::geocentricSurfaceProjection(const Vec3& p) const
|
||||
{
|
||||
Scalar beta = 1.0 / sqrt(dot(p * p, _cachedValues._oneOverRadiiSquared));
|
||||
Scalar beta = 1.0 / sqrt(dot(p * p, _cached._oneOverRadiiSquared));
|
||||
return beta * p;
|
||||
}
|
||||
|
||||
Vec3 Ellipsoid::scaleToGeodeticSurface(const Vec3& p) const
|
||||
Vec3 Ellipsoid::geodeticSurfaceProjection(const Vec3& p) const
|
||||
{
|
||||
Scalar beta = 1.0 / sqrt(dot(p * p, _cachedValues._oneOverRadiiSquared));
|
||||
Scalar n = glm::length(beta * p * _cachedValues._oneOverRadiiSquared);
|
||||
Scalar beta = 1.0 / sqrt(dot(p * p, _cached._oneOverRadiiSquared));
|
||||
Scalar n = glm::length(beta * p * _cached._oneOverRadiiSquared);
|
||||
Scalar alpha = (1.0 - beta) * (glm::length(p) / n);
|
||||
|
||||
Vec3 p2 = p * p;
|
||||
@@ -92,21 +88,21 @@ namespace openspace {
|
||||
do {
|
||||
alpha -= (s / dSdA);
|
||||
|
||||
d = Vec3(1.0) + alpha * _cachedValues._oneOverRadiiSquared;
|
||||
d = Vec3(1.0) + alpha * _cached._oneOverRadiiSquared;
|
||||
d2 = d * d;
|
||||
d3 = d * d2;
|
||||
|
||||
s = glm::dot(p2 / (_cachedValues._radiiSquared * d2), Vec3(1.0)) - 1.0;
|
||||
s = glm::dot(p2 / (_cached._radiiSquared * d2), Vec3(1.0)) - 1.0;
|
||||
|
||||
dSdA = -2.0 * glm::dot(p2 / (_cachedValues._radiiToTheFourth * d3), Vec3(1.0));
|
||||
dSdA = -2.0 * glm::dot(p2 / (_cached._radiiToTheFourth * d3), Vec3(1.0));
|
||||
}
|
||||
while (abs(s) > epsilon);
|
||||
return p / d;
|
||||
}
|
||||
|
||||
Vec3 Ellipsoid::geodeticSurfaceNormal(const Vec3& p) const
|
||||
Vec3 Ellipsoid::geodeticSurfaceNormalForGeocentricallyProjectedPoint(const Vec3& p) const
|
||||
{
|
||||
Vec3 normal = p * _cachedValues._oneOverRadiiSquared;
|
||||
Vec3 normal = p * _cached._oneOverRadiiSquared;
|
||||
return glm::normalize(normal);
|
||||
}
|
||||
|
||||
@@ -122,42 +118,47 @@ namespace openspace {
|
||||
|
||||
Vec3 Ellipsoid::radiiSquared() const
|
||||
{
|
||||
return _cachedValues._radiiSquared;
|
||||
return _cached._radiiSquared;
|
||||
}
|
||||
|
||||
Vec3 Ellipsoid::oneOverRadiiSquared() const
|
||||
{
|
||||
return _cachedValues._oneOverRadiiSquared;
|
||||
return _cached._oneOverRadiiSquared;
|
||||
}
|
||||
|
||||
Vec3 Ellipsoid::radiiToTheFourth() const
|
||||
{
|
||||
return _cachedValues._radiiToTheFourth;
|
||||
return _cached._radiiToTheFourth;
|
||||
}
|
||||
|
||||
Scalar Ellipsoid::minimumRadius() const
|
||||
{
|
||||
return _cachedValues._minimumRadius;
|
||||
return _cached._minimumRadius;
|
||||
}
|
||||
|
||||
Scalar Ellipsoid::maximumRadius() const
|
||||
{
|
||||
return _cached._maximumRadius;
|
||||
}
|
||||
|
||||
Geodetic2 Ellipsoid::cartesianToGeodetic2(const Vec3& p) const
|
||||
{
|
||||
Vec3 normal = geodeticSurfaceNormal(p);
|
||||
Vec3 normal = geodeticSurfaceNormalForGeocentricallyProjectedPoint(p);
|
||||
return Geodetic2(
|
||||
asin(normal.z / length(normal)), // Latitude
|
||||
atan2(normal.y, normal.x)); // Longitude
|
||||
}
|
||||
|
||||
Vec3 Ellipsoid::geodetic2ToCartesian(const Geodetic2& geodetic2) const
|
||||
Vec3 Ellipsoid::cartesianSurfacePosition(const Geodetic2& geodetic2) const
|
||||
{
|
||||
// Position on surface : height = 0
|
||||
return geodetic3ToCartesian(Geodetic3({ geodetic2, 0 }));
|
||||
return cartesianPosition(Geodetic3({ geodetic2, 0 }));
|
||||
}
|
||||
|
||||
Vec3 Ellipsoid::geodetic3ToCartesian(const Geodetic3& geodetic3) const
|
||||
Vec3 Ellipsoid::cartesianPosition(const Geodetic3& geodetic3) const
|
||||
{
|
||||
Vec3 normal = geodeticSurfaceNormal(geodetic3.geodetic2);
|
||||
Vec3 k = _cachedValues._radiiSquared * normal;
|
||||
Vec3 k = _cached._radiiSquared * normal;
|
||||
Scalar gamma = sqrt(dot(k, normal));
|
||||
Vec3 rSurface = k / gamma;
|
||||
return rSurface + geodetic3.height * normal;
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
\param p is a point in the cartesian coordinate system to be placed on the surface
|
||||
of the Ellipsoid
|
||||
*/
|
||||
Vec3 scaleToGeocentricSurface(const Vec3& p) const;
|
||||
Vec3 geocentricSurfaceProjection(const Vec3& p) const;
|
||||
|
||||
|
||||
/**
|
||||
@@ -71,31 +71,34 @@ public:
|
||||
\param p is a point in the cartesian coordinate system to be placed on the surface
|
||||
of the Ellipsoid
|
||||
*/
|
||||
Vec3 scaleToGeodeticSurface(const Vec3& p) const;
|
||||
Vec3 geodeticSurfaceProjection(const Vec3& p) const;
|
||||
|
||||
Vec3 geodeticSurfaceNormal(const Vec3& p) const;
|
||||
Vec3 geodeticSurfaceNormalForGeocentricallyProjectedPoint(const Vec3& p) const;
|
||||
Vec3 geodeticSurfaceNormal(Geodetic2 geodetic2) const;
|
||||
|
||||
Vec3 radiiSquared() const;
|
||||
Vec3 oneOverRadiiSquared() const;
|
||||
Vec3 radiiToTheFourth() const;
|
||||
|
||||
Scalar minimumRadius() const;
|
||||
Scalar maximumRadius() const;
|
||||
|
||||
Geodetic2 cartesianToGeodetic2(const Vec3& p) const;
|
||||
Vec3 geodetic2ToCartesian(const Geodetic2& geodetic2) const;
|
||||
Vec3 geodetic3ToCartesian(const Geodetic3& geodetic3) const;
|
||||
Vec3 cartesianSurfacePosition(const Geodetic2& geodetic2) const;
|
||||
Vec3 cartesianPosition(const Geodetic3& geodetic3) const;
|
||||
|
||||
private:
|
||||
struct EllipsoidCache
|
||||
{
|
||||
struct EllipsoidCache {
|
||||
Vec3 _radiiSquared;
|
||||
Vec3 _oneOverRadiiSquared;
|
||||
Vec3 _radiiToTheFourth;
|
||||
Scalar _minimumRadius;
|
||||
};
|
||||
Scalar _maximumRadius;
|
||||
} _cached;
|
||||
|
||||
void updateInternalCache();
|
||||
|
||||
Vec3 _radii;
|
||||
EllipsoidCache _cachedValues;
|
||||
};
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace openspace {
|
||||
// A PART OF AN ELLIPSOID AND NOT A SPHERE!MUST CHECK IF THIS FUNCTION IS STILL
|
||||
// VALID.
|
||||
const Geodetic2& cornerNearEquator = _center.lat > 0 ? southWestCorner() : northWestCorner();
|
||||
return glm::length(ellipsoid.geodetic2ToCartesian(_center) - ellipsoid.geodetic2ToCartesian(cornerNearEquator));
|
||||
return glm::length(ellipsoid.cartesianSurfacePosition(_center) - ellipsoid.cartesianSurfacePosition(cornerNearEquator));
|
||||
}
|
||||
/*
|
||||
Scalar GeodeticPatch::unitArea() const {
|
||||
@@ -172,6 +172,15 @@ namespace openspace {
|
||||
return Geodetic2(2 * _halfSize.lat, 2 * _halfSize.lon);
|
||||
}
|
||||
|
||||
Geodetic2 GeodeticPatch::getCorner(Quad q) const {
|
||||
switch (q) {
|
||||
case NORTH_WEST: return northWestCorner();
|
||||
case NORTH_EAST: return northEastCorner();
|
||||
case SOUTH_WEST: return southWestCorner();
|
||||
case SOUTH_EAST: return southEastCorner();
|
||||
}
|
||||
}
|
||||
|
||||
Geodetic2 GeodeticPatch::northWestCorner() const{
|
||||
return Geodetic2(_center.lat + _halfSize.lat, _center.lon - _halfSize.lon);
|
||||
}
|
||||
|
||||
@@ -125,6 +125,7 @@ public:
|
||||
*/
|
||||
// Scalar unitArea() const;
|
||||
|
||||
Geodetic2 getCorner(Quad q) const;
|
||||
|
||||
Geodetic2 northWestCorner() const;
|
||||
Geodetic2 northEastCorner() const;
|
||||
|
||||
@@ -38,11 +38,11 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
Chunk::Chunk(ChunkedLodGlobe* owner, const ChunkIndex& chunkIndex)
|
||||
Chunk::Chunk(ChunkedLodGlobe* owner, const ChunkIndex& chunkIndex, bool initVisible)
|
||||
: _owner(owner)
|
||||
, _surfacePatch(chunkIndex)
|
||||
, _index(chunkIndex)
|
||||
, _isVisible(true)
|
||||
, _isVisible(initVisible)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -91,34 +91,33 @@ namespace openspace {
|
||||
|
||||
|
||||
|
||||
// Do horizon culling
|
||||
const int maxHeight = 8700; // should be read from gdal dataset or mod file
|
||||
_isVisible = HorizonCuller::isVisible(myRenderData, _surfacePatch, ellipsoid, maxHeight);
|
||||
if (!_isVisible) {
|
||||
return WANT_MERGE;
|
||||
}
|
||||
|
||||
|
||||
// Do frustum culling
|
||||
_isVisible = FrustumCuller::isVisible(myRenderData, _surfacePatch, ellipsoid);
|
||||
if (!_isVisible) {
|
||||
return WANT_MERGE;
|
||||
|
||||
if (_owner->doFrustumCulling) {
|
||||
_isVisible &= FrustumCuller::isVisible(myRenderData, _surfacePatch, ellipsoid, maxHeight);
|
||||
}
|
||||
|
||||
if (_owner->doHorizonCulling) {
|
||||
_isVisible &= HorizonCuller::isVisible(myRenderData, _surfacePatch, ellipsoid, maxHeight);
|
||||
}
|
||||
|
||||
if (!_isVisible) return WANT_MERGE;
|
||||
|
||||
|
||||
Vec3 cameraPosition = myRenderData.camera.position().dvec3();
|
||||
Geodetic2 pointOnPatch = _surfacePatch.closestPoint(
|
||||
ellipsoid.cartesianToGeodetic2(cameraPosition));
|
||||
Vec3 globePosition = myRenderData.position.dvec3();
|
||||
Vec3 patchPosition = globePosition + ellipsoid.geodetic2ToCartesian(pointOnPatch);
|
||||
|
||||
Vec3 patchPosition = globePosition + ellipsoid.cartesianSurfacePosition(pointOnPatch);
|
||||
Vec3 cameraToChunk = patchPosition - cameraPosition;
|
||||
Scalar minimumGlobeRadius = ellipsoid.minimumRadius();
|
||||
|
||||
|
||||
// Calculate desired level based on distance
|
||||
Scalar distance = glm::length(cameraToChunk);
|
||||
_owner->minDistToCamera = fmin(_owner->minDistToCamera, distance);
|
||||
|
||||
Scalar scaleFactor = 10 * minimumGlobeRadius;
|
||||
Scalar scaleFactor = _owner->lodScaleFactor * ellipsoid.minimumRadius();;
|
||||
Scalar projectedScaleFactor = scaleFactor / distance;
|
||||
int desiredLevel = floor(log2(projectedScaleFactor));
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace openspace {
|
||||
WANT_SPLIT,
|
||||
};
|
||||
|
||||
Chunk(ChunkedLodGlobe* owner, const ChunkIndex& chunkIndex);
|
||||
Chunk(ChunkedLodGlobe* owner, const ChunkIndex& chunkIndex, bool initVisible = true);
|
||||
|
||||
/// Updates chunk internally and returns a desired level
|
||||
Status update(const RenderData& data);
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace openspace {
|
||||
|
||||
void ChunkedLodGlobe::render(const RenderData& data){
|
||||
minDistToCamera = INFINITY;
|
||||
ChunkNode::renderedPatches = 0;
|
||||
ChunkNode::renderedPatches = 0;
|
||||
|
||||
_leftRoot->render(data);
|
||||
_rightRoot->render(data);
|
||||
|
||||
@@ -85,6 +85,13 @@ namespace openspace {
|
||||
}
|
||||
|
||||
|
||||
bool doHorizonCulling = true;
|
||||
bool doFrustumCulling = true;
|
||||
int numPosZthres;
|
||||
float lodScaleFactor;
|
||||
bool initChunkVisible;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Covers all negative longitudes
|
||||
|
||||
@@ -96,10 +96,11 @@ bool ChunkNode::internalUpdateChunkTree(const RenderData& data) {
|
||||
}
|
||||
|
||||
// check if all children requested merge
|
||||
if (requestedMergeMask == 0xf) {
|
||||
if (requestedMergeMask == 0xf && _chunk.update(data)) {
|
||||
merge();
|
||||
|
||||
// re-run this method on this, now that this is a leaf node
|
||||
// re-run internalUpdateChunkTree on this, now that this is a leaf node
|
||||
// OBS, this may currently cause a split() again ...
|
||||
return internalUpdateChunkTree(data);
|
||||
}
|
||||
return false;
|
||||
@@ -111,8 +112,7 @@ void ChunkNode::internalRender(const RenderData& data) {
|
||||
if (isLeaf()) {
|
||||
if (_chunk.isVisible()) {
|
||||
ChunkRenderer& patchRenderer = _chunk.owner()->getPatchRenderer();
|
||||
patchRenderer.renderChunk(_chunk, _chunk.owner()->ellipsoid(), data);
|
||||
//patchRenderer.renderPatch(_chunk.surfacePatch, data, _chunk.owner->ellipsoid(), _chunk.index);
|
||||
patchRenderer.renderChunk(_chunk, data);
|
||||
ChunkNode::renderedPatches++;
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ void ChunkNode::internalRender(const RenderData& data) {
|
||||
void ChunkNode::split(int depth) {
|
||||
if (depth > 0 && isLeaf()) {
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
Chunk chunk(_chunk.owner(), _chunk.index().child((Quad)i));
|
||||
Chunk chunk(_chunk.owner(), _chunk.index().child((Quad)i), _chunk.owner()->initChunkVisible);
|
||||
_children[i] = std::unique_ptr<ChunkNode>(new ChunkNode(chunk, this));
|
||||
}
|
||||
}
|
||||
@@ -145,6 +145,8 @@ void ChunkNode::merge() {
|
||||
}
|
||||
_children[i] = nullptr;
|
||||
}
|
||||
|
||||
ghoul_assert(isLeaf(), "ChunkNode must be leaf after merge");
|
||||
}
|
||||
|
||||
const ChunkNode& ChunkNode::getChild(Quad quad) const {
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace openspace {
|
||||
{
|
||||
Scalar minimumRadius = _ellipsoid.minimumRadius();
|
||||
Vec3 cameraPosition = data.camera.position().dvec3();
|
||||
Vec3 cameraPositionOnSurface = _ellipsoid.scaleToGeodeticSurface(cameraPosition);
|
||||
Vec3 cameraPositionOnSurface = _ellipsoid.geodeticSurfaceProjection(cameraPosition);
|
||||
Scalar h = glm::length(cameraPosition - cameraPositionOnSurface);
|
||||
Scalar cosAngleToHorizon = minimumRadius / (minimumRadius + h);
|
||||
Scalar angleToHorizon = glm::acos(cosAngleToHorizon);
|
||||
|
||||
@@ -46,19 +46,33 @@ namespace {
|
||||
const std::string keyHeightMaps = "HeightMaps";
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace openspace {
|
||||
|
||||
|
||||
RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
: _tileProviderManager(std::shared_ptr<TileProviderManager>(new TileProviderManager))
|
||||
, _saveOrThrowCamera(properties::BoolProperty("saveOrThrowCamera", "saveOrThrowCamera"))
|
||||
, doFrustumCulling(properties::BoolProperty("doFrustumCulling", "doFrustumCulling"))
|
||||
, doHorizonCulling(properties::BoolProperty("doHorizonCulling", "doHorizonCulling"))
|
||||
, numPosZthres(properties::IntProperty("numPosZthres", "numPosZthres", 0, 0, 9))
|
||||
, lodScaleFactor(properties::FloatProperty("lodScaleFactor", "lodScaleFactor", 10.0f, 0.0f, 100.0f))
|
||||
, initChunkVisible(properties::BoolProperty("initChunkVisible", "initChunkVisible", true))
|
||||
|
||||
{
|
||||
|
||||
setName("RenderableGlobe");
|
||||
addProperty(_saveOrThrowCamera);
|
||||
|
||||
|
||||
|
||||
addProperty(_saveOrThrowCamera);
|
||||
addProperty(doFrustumCulling);
|
||||
addProperty(doHorizonCulling);
|
||||
addProperty(numPosZthres);
|
||||
addProperty(lodScaleFactor);
|
||||
addProperty(initChunkVisible);
|
||||
|
||||
doFrustumCulling.setValue(true);
|
||||
doHorizonCulling.setValue(true);
|
||||
|
||||
// Read the radii in to its own dictionary
|
||||
Vec3 radii;
|
||||
@@ -142,6 +156,11 @@ namespace openspace {
|
||||
_chunkedLodGlobe->setSaveCamera(nullptr);
|
||||
}
|
||||
}
|
||||
_chunkedLodGlobe->doFrustumCulling = doFrustumCulling.value();
|
||||
_chunkedLodGlobe->doHorizonCulling = doHorizonCulling.value();
|
||||
_chunkedLodGlobe->numPosZthres = numPosZthres.value();
|
||||
_chunkedLodGlobe->lodScaleFactor= lodScaleFactor.value();
|
||||
_chunkedLodGlobe->initChunkVisible = initChunkVisible.value();
|
||||
_distanceSwitch.render(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/properties/optionproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
#include <modules/globebrowsing/meshes/trianglesoup.h>
|
||||
@@ -62,7 +63,11 @@ public:
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
|
||||
properties::BoolProperty doFrustumCulling;
|
||||
properties::BoolProperty doHorizonCulling;
|
||||
properties::IntProperty numPosZthres;
|
||||
properties::FloatProperty lodScaleFactor;
|
||||
properties::BoolProperty initChunkVisible;
|
||||
private:
|
||||
|
||||
double _time;
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
|
||||
#include <modules/globebrowsing/rendering/aabb.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "AABB";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
|
||||
AABB2::AABB2() : min(1e35), max(-1e35) { }
|
||||
AABB2::AABB2(const vec2& min, const vec2& max) : min(min), max(max) { }
|
||||
|
||||
void AABB2::expand(const vec2& p) {
|
||||
min.x = glm::min(min.x, p.x);
|
||||
min.y = glm::min(min.y, p.y);
|
||||
max.x = glm::max(max.x, p.x);
|
||||
max.y = glm::max(max.y, p.y);
|
||||
}
|
||||
|
||||
vec2 AABB2::center() const {
|
||||
return 0.5f * (min + max);
|
||||
}
|
||||
|
||||
vec2 AABB2::size() const {
|
||||
return max - min;
|
||||
}
|
||||
|
||||
bool AABB2::intersects(const vec2& p) const {
|
||||
return (min.x < p.x) && (p.x < max.x)
|
||||
&& (min.y < p.y) && (p.y < max.y);
|
||||
}
|
||||
|
||||
bool AABB2::intersects(const AABB2& o) const {
|
||||
return (min.x < o.max.x) && (o.min.x < max.x)
|
||||
&& (min.y < o.max.y) && (o.min.y < max.y);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
AABB3::AABB3() : min(1e35), max(-1e35) { }
|
||||
AABB3::AABB3(const vec3& min, const vec3& max) : min(min), max(max) { }
|
||||
|
||||
void AABB3::expand(const vec3 p) {
|
||||
min.x = glm::min(min.x, p.x);
|
||||
min.y = glm::min(min.y, p.y);
|
||||
min.z = glm::min(min.z, p.z);
|
||||
max.x = glm::max(max.x, p.x);
|
||||
max.y = glm::max(max.y, p.y);
|
||||
max.z = glm::max(max.z, p.z);
|
||||
}
|
||||
|
||||
vec3 AABB3::center() const {
|
||||
return 0.5f * (min + max);
|
||||
}
|
||||
|
||||
vec3 AABB3::size() const {
|
||||
return max - min;
|
||||
}
|
||||
|
||||
bool AABB3::intersects(const vec3& p) const {
|
||||
return (min.x < p.x) && (p.x < max.x)
|
||||
&& (min.y < p.y) && (p.y < max.y)
|
||||
&& (min.z < p.z) && (p.z < max.z);
|
||||
}
|
||||
|
||||
bool AABB3::intersects(const AABB3& o) const {
|
||||
return (min.x < o.max.x) && (o.min.x < max.x)
|
||||
&& (min.y < o.max.y) && (o.min.y < max.y)
|
||||
&& (min.z < o.max.z) && (o.min.z < max.z);
|
||||
}
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
@@ -0,0 +1,71 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __AABB_H__
|
||||
#define __AABB_H__
|
||||
|
||||
#include <memory>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
// open space includes
|
||||
|
||||
|
||||
|
||||
namespace openspace {
|
||||
|
||||
using namespace glm;
|
||||
|
||||
|
||||
struct AABB2 {
|
||||
AABB2();
|
||||
AABB2(const vec2& min, const vec2& max);
|
||||
|
||||
void expand(const vec2& p);
|
||||
vec2 center() const;
|
||||
vec2 size() const;
|
||||
bool intersects(const vec2& p) const;
|
||||
bool intersects(const AABB2& o) const;
|
||||
|
||||
vec2 min;
|
||||
vec2 max;
|
||||
};
|
||||
|
||||
|
||||
struct AABB3 {
|
||||
AABB3();
|
||||
AABB3(const vec3& min, const vec3& max);
|
||||
|
||||
void expand(const vec3 p);
|
||||
vec3 center() const;
|
||||
vec3 size() const;
|
||||
bool intersects(const vec3& p) const;
|
||||
bool intersects(const AABB3& o) const;
|
||||
|
||||
vec3 min;
|
||||
vec3 max;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __AABB_H__
|
||||
@@ -24,9 +24,12 @@
|
||||
|
||||
|
||||
#include <modules/globebrowsing/rendering/culling.h>
|
||||
#include <modules/globebrowsing/rendering/aabb.h>
|
||||
|
||||
#include <modules/globebrowsing/geodetics/ellipsoid.h>
|
||||
|
||||
#include <modules/globebrowsing/meshes/trianglesoup.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "FrustrumCuller";
|
||||
}
|
||||
@@ -59,10 +62,10 @@ namespace openspace {
|
||||
return testPoint(pointScreenSpace, vec2(0));
|
||||
}
|
||||
|
||||
bool FrustumCuller::isVisible(
|
||||
const RenderData& data,
|
||||
const GeodeticPatch& patch,
|
||||
const Ellipsoid& ellipsoid) {
|
||||
|
||||
bool FrustumCuller::isVisible(const RenderData& data, const GeodeticPatch& patch,
|
||||
const Ellipsoid& ellipsoid)
|
||||
{
|
||||
// An axis aligned bounding box based on the patch's minimum boudning sphere is
|
||||
// used for testnig
|
||||
|
||||
@@ -78,7 +81,7 @@ namespace openspace {
|
||||
|
||||
// Calculate the patch's center point in screen space
|
||||
vec4 patchCenterModelSpace =
|
||||
vec4(ellipsoid.geodetic2ToCartesian(patch.center()), 1);
|
||||
vec4(ellipsoid.cartesianSurfacePosition(patch.center()), 1);
|
||||
vec4 patchCenterClippingSpace =
|
||||
modelViewProjectionTransform * patchCenterModelSpace;
|
||||
vec2 pointScreenSpace =
|
||||
@@ -93,17 +96,88 @@ namespace openspace {
|
||||
(1.0f / patchCenterClippingSpace.w) * marginClippingSpace.xy();
|
||||
|
||||
// Test the bounding box by testing the center point and the corresponding margin
|
||||
return testPoint(pointScreenSpace, marginScreenSpace);
|
||||
PointLocation res = testPoint(pointScreenSpace, marginScreenSpace);
|
||||
return res == PointLocation::Inside;
|
||||
}
|
||||
|
||||
bool FrustumCuller::testPoint(const glm::vec2& pointScreenSpace,
|
||||
bool FrustumCuller::isVisible(const RenderData& data, const GeodeticPatch& patch,
|
||||
const Ellipsoid& ellipsoid, const Scalar maxHeight)
|
||||
{
|
||||
// Calculate the MVP matrix
|
||||
mat4 modelTransform = translate(mat4(1), data.position.vec3());
|
||||
mat4 viewTransform = data.camera.combinedViewMatrix();
|
||||
mat4 modelViewProjectionTransform = data.camera.projectionMatrix()
|
||||
* viewTransform * modelTransform;
|
||||
|
||||
|
||||
|
||||
double centerRadius = ellipsoid.maximumRadius();
|
||||
//double centerRadius = glm::length(ellipsoid.cartesianSurfacePosition(patch.center()));
|
||||
double maxCenterRadius = centerRadius + maxHeight;
|
||||
|
||||
double maximumPatchSide = max(patch.halfSize().lat, patch.halfSize().lon);
|
||||
double maxHeightOffset = maxCenterRadius / cos(maximumPatchSide) - centerRadius;
|
||||
double minHeightOffset = 0; // for now
|
||||
|
||||
|
||||
/*
|
||||
Geodetic3 centerGeodetic = { patch.center(), 0};
|
||||
vec4 centerModelSpace = vec4(ellipsoid.cartesianPosition(centerGeodetic), 1);
|
||||
vec4 centerClippingSpace = modelViewProjectionTransform * centerModelSpace;
|
||||
vec3 centerScreenSpace = (1.0f / glm::abs(centerClippingSpace.w)) * centerClippingSpace.xyz();
|
||||
AABB3 viewFrustum(vec3(-1, -1, 0), vec3(1, 1, 1e35));
|
||||
return viewFrustum.intersects(centerScreenSpace);
|
||||
*/
|
||||
|
||||
// Create a bounding box that fits the patch corners
|
||||
|
||||
AABB3 bounds; // in screen space
|
||||
int numPositiveZ = 0;
|
||||
for (size_t i = 0; i < 8; i++) {
|
||||
Quad q = (Quad) (i%4);
|
||||
double offset = i < 4 ? minHeightOffset : maxHeightOffset;
|
||||
Geodetic3 cornerGeodetic = { patch.getCorner(q), offset };
|
||||
vec4 cornerModelSpace = vec4(ellipsoid.cartesianPosition(cornerGeodetic), 1);
|
||||
vec4 cornerClippingSpace = modelViewProjectionTransform * cornerModelSpace;
|
||||
vec3 cornerScreenSpace = (1.0f / glm::abs(cornerClippingSpace.w)) * cornerClippingSpace.xyz();
|
||||
bounds.expand(cornerScreenSpace);
|
||||
}
|
||||
|
||||
AABB3 viewFrustum(vec3(-1, -1, 0), vec3(1, 1, 1e35));
|
||||
return bounds.intersects(viewFrustum);
|
||||
|
||||
/*
|
||||
vec2 center = bounds.center();
|
||||
vec2 margin = 0.5f * bounds.size();
|
||||
return testPoint(center, margin) == PointLocation::Inside;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
PointLocation FrustumCuller::testPoint(const glm::vec2& pointScreenSpace,
|
||||
const glm::vec2& marginScreenSpace)
|
||||
{
|
||||
const vec2& p = pointScreenSpace;
|
||||
|
||||
vec2 cullBounds = vec2(1) + marginScreenSpace;
|
||||
return ((-cullBounds.x < p.x && p.x < cullBounds.x) &&
|
||||
(-cullBounds.y < p.y && p.y < cullBounds.y));
|
||||
int x = p.x <= -cullBounds.x ? 0 : p.x < cullBounds.x ? 1 : 2;
|
||||
int y = p.y <= -cullBounds.y ? 0 : p.y < cullBounds.y ? 1 : 2;
|
||||
PointLocation res = (PointLocation) (3 * y + x);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool FrustumCuller::testPoint(const glm::vec3& pointScreenSpace,
|
||||
const glm::vec3& marginScreenSpace)
|
||||
{
|
||||
|
||||
const vec3& p = pointScreenSpace;
|
||||
|
||||
vec3 cullBounds = vec3(1) + marginScreenSpace;
|
||||
int x = p.x <= -cullBounds.x ? 0 : p.x < cullBounds.x ? 1 : 2;
|
||||
int y = p.y <= -cullBounds.y ? 0 : p.y < cullBounds.y ? 1 : 2;
|
||||
int z = p.z <= -cullBounds.z ? 0 : p.z < cullBounds.z ? 1 : 2;
|
||||
return x == 1 && y == 1 && z == 1;
|
||||
}
|
||||
|
||||
glm::vec2 FrustumCuller::transformToScreenSpace(const vec3& point,
|
||||
@@ -167,7 +241,7 @@ namespace openspace {
|
||||
return HorizonCuller::isVisible(
|
||||
cameraPosition,
|
||||
globePosition,
|
||||
ellipsoid.geodetic2ToCartesian(closestPatchPoint),
|
||||
ellipsoid.cartesianSurfacePosition(closestPatchPoint),
|
||||
height,
|
||||
minimumGlobeRadius);
|
||||
}
|
||||
|
||||
@@ -42,21 +42,17 @@ namespace openspace {
|
||||
|
||||
|
||||
|
||||
enum PointLocation {
|
||||
AboveLeft = 0, Above, AboveRight, // 0, 1, 2
|
||||
Left, Inside, Right, // 3, 4, 5
|
||||
BelowLeft, Below, BelowRight // 6, 7, 8
|
||||
};
|
||||
|
||||
|
||||
class FrustumCuller {
|
||||
public:
|
||||
|
||||
enum PointTestResult : int {
|
||||
Inside = 0,
|
||||
Above,
|
||||
AboveRight,
|
||||
Right,
|
||||
BelowRight,
|
||||
Below,
|
||||
BelowLeft,
|
||||
Left,
|
||||
AboveLeft
|
||||
};
|
||||
|
||||
|
||||
|
||||
FrustumCuller();
|
||||
@@ -72,6 +68,7 @@ namespace openspace {
|
||||
const RenderData& data,
|
||||
const vec3& point);
|
||||
|
||||
|
||||
/**
|
||||
Returns false if the patch element is guaranteed to be outside the view
|
||||
frustrum, and true is the patch element MAY be inside the view frustrum.
|
||||
@@ -81,16 +78,26 @@ namespace openspace {
|
||||
const GeodeticPatch& patch,
|
||||
const Ellipsoid& ellipsoid);
|
||||
|
||||
|
||||
static bool isVisible(
|
||||
const RenderData& data,
|
||||
const GeodeticPatch& patch,
|
||||
const Ellipsoid& ellipsoid,
|
||||
const Scalar maxHeight);
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
Returns true if the point in screen space is inside the view frustrum.
|
||||
The optional screen space margin vector is used to resize area defining
|
||||
what is considered to be inside the view frustrum.
|
||||
*/
|
||||
static bool testPoint(
|
||||
static PointLocation testPoint(
|
||||
const glm::vec2& pointScreenSpace,
|
||||
const glm::vec2& marginScreenSpace);
|
||||
const glm::vec2& marginScreenSpace = vec2(0));
|
||||
|
||||
static bool testPoint(
|
||||
const glm::vec3& pointScreenSpace,
|
||||
const glm::vec3& marginScreenSpace = vec3(0));
|
||||
|
||||
|
||||
static glm::vec2 transformToScreenSpace(
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
|
||||
#include <modules/globebrowsing/rendering/patchrenderer.h>
|
||||
#include <modules/globebrowsing/globes/chunkedlodglobe.h>
|
||||
#include <modules/globebrowsing/meshes/clipmapgrid.h>
|
||||
|
||||
// open space includes
|
||||
@@ -38,6 +39,7 @@
|
||||
|
||||
// STL includes
|
||||
#include <sstream>
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
@@ -119,25 +121,16 @@ namespace openspace {
|
||||
|
||||
}
|
||||
|
||||
void ChunkRenderer::renderChunk(
|
||||
const Chunk& chunk,
|
||||
const Ellipsoid& ellipsoid,
|
||||
const RenderData& data)
|
||||
{
|
||||
void ChunkRenderer::renderChunk(const Chunk& chunk, const RenderData& data) {
|
||||
if (chunk.index().level < 9) {
|
||||
renderChunkGlobally(chunk, ellipsoid, data);
|
||||
renderChunkGlobally(chunk, data);
|
||||
}
|
||||
else {
|
||||
renderChunkLocally(chunk, ellipsoid, data);
|
||||
renderChunkLocally(chunk, data);
|
||||
}
|
||||
}
|
||||
|
||||
void ChunkRenderer::renderChunkGlobally(
|
||||
const Chunk& chunk,
|
||||
const Ellipsoid& ellipsoid,
|
||||
const RenderData& data)
|
||||
{
|
||||
|
||||
void ChunkRenderer::renderChunkGlobally(const Chunk& chunk, const RenderData& data){
|
||||
using namespace glm;
|
||||
|
||||
// All providers of tiles
|
||||
@@ -242,6 +235,7 @@ namespace openspace {
|
||||
mat4 viewTransform = data.camera.combinedViewMatrix();
|
||||
mat4 modelViewProjectionTransform = data.camera.projectionMatrix()
|
||||
* viewTransform * modelTransform;
|
||||
const Ellipsoid& ellipsoid = chunk.owner()->ellipsoid();
|
||||
|
||||
// Upload the uniform variables
|
||||
programObject->setUniform("modelViewProjectionTransform", modelViewProjectionTransform);
|
||||
@@ -310,6 +304,7 @@ namespace openspace {
|
||||
|
||||
Geodetic2 swCorner = chunk.surfacePatch().southWestCorner();
|
||||
auto patchSize = chunk.surfacePatch().size();
|
||||
const Ellipsoid& ellipsoid = chunk.owner()->ellipsoid();
|
||||
_programObjectGlobalRendering->setUniform("modelViewProjectionTransform", modelViewProjectionTransform);
|
||||
_programObjectGlobalRendering->setUniform("minLatLon", vec2(swCorner.toLonLatVec2()));
|
||||
_programObjectGlobalRendering->setUniform("lonLatScalingFactor", vec2(patchSize.toLonLatVec2()));
|
||||
@@ -327,13 +322,8 @@ namespace openspace {
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void ChunkRenderer::renderChunkLocally(
|
||||
const Chunk& chunk,
|
||||
const Ellipsoid& ellipsoid,
|
||||
const RenderData& data)
|
||||
void ChunkRenderer::renderChunkLocally(const Chunk& chunk, const RenderData& data)
|
||||
{
|
||||
|
||||
using namespace glm;
|
||||
|
||||
// All providers of tiles
|
||||
@@ -447,11 +437,13 @@ namespace openspace {
|
||||
Geodetic2 nw = chunk.surfacePatch().northWestCorner();
|
||||
Geodetic2 ne = chunk.surfacePatch().northEastCorner();
|
||||
|
||||
const Ellipsoid& ellipsoid = chunk.owner()->ellipsoid();
|
||||
|
||||
// Get model space positions of the four control points
|
||||
Vec3 patchSwModelSpace = ellipsoid.geodetic2ToCartesian(sw);
|
||||
Vec3 patchSeModelSpace = ellipsoid.geodetic2ToCartesian(se);
|
||||
Vec3 patchNwModelSpace = ellipsoid.geodetic2ToCartesian(nw);
|
||||
Vec3 patchNeModelSpace = ellipsoid.geodetic2ToCartesian(ne);
|
||||
Vec3 patchSwModelSpace = ellipsoid.cartesianSurfacePosition(sw);
|
||||
Vec3 patchSeModelSpace = ellipsoid.cartesianSurfacePosition(se);
|
||||
Vec3 patchNwModelSpace = ellipsoid.cartesianSurfacePosition(nw);
|
||||
Vec3 patchNeModelSpace = ellipsoid.cartesianSurfacePosition(ne);
|
||||
|
||||
// Transform all control points to camera space
|
||||
Vec3 patchSwCameraSpace = Vec3(dmat4(modelViewTransform) * glm::dvec4(patchSwModelSpace, 1));
|
||||
@@ -544,11 +536,13 @@ namespace openspace {
|
||||
Geodetic2 nw = chunk.surfacePatch().northWestCorner();
|
||||
Geodetic2 ne = chunk.surfacePatch().northEastCorner();
|
||||
|
||||
const Ellipsoid& ellipsoid = chunk.owner()->ellipsoid();
|
||||
|
||||
// Get model space positions of the four control points
|
||||
Vec3 patchSwModelSpace = ellipsoid.geodetic2ToCartesian(sw);
|
||||
Vec3 patchSeModelSpace = ellipsoid.geodetic2ToCartesian(se);
|
||||
Vec3 patchNwModelSpace = ellipsoid.geodetic2ToCartesian(nw);
|
||||
Vec3 patchNeModelSpace = ellipsoid.geodetic2ToCartesian(ne);
|
||||
Vec3 patchSwModelSpace = ellipsoid.cartesianSurfacePosition(sw);
|
||||
Vec3 patchSeModelSpace = ellipsoid.cartesianSurfacePosition(se);
|
||||
Vec3 patchNwModelSpace = ellipsoid.cartesianSurfacePosition(nw);
|
||||
Vec3 patchNeModelSpace = ellipsoid.cartesianSurfacePosition(ne);
|
||||
|
||||
// Transform all control points to camera space
|
||||
Vec3 patchSwCameraSpace = Vec3(dmat4(modelViewTransform) * glm::dvec4(patchSwModelSpace, 1));
|
||||
@@ -843,10 +837,10 @@ namespace openspace {
|
||||
ivec2 contraction = ivec2(intSnapCoord.y % 2, intSnapCoord.x % 2);
|
||||
|
||||
// Get global positions of the four control points
|
||||
Vec3 patchSw = ellipsoid.geodetic2ToCartesian(newPatch.southWestCorner());
|
||||
Vec3 patchSe = ellipsoid.geodetic2ToCartesian(newPatch.southEastCorner());
|
||||
Vec3 patchNw = ellipsoid.geodetic2ToCartesian(newPatch.northWestCorner());
|
||||
Vec3 patchNe = ellipsoid.geodetic2ToCartesian(newPatch.northEastCorner());
|
||||
Vec3 patchSw = ellipsoid.cartesianSurfacePosition(newPatch.southWestCorner());
|
||||
Vec3 patchSe = ellipsoid.cartesianSurfacePosition(newPatch.southEastCorner());
|
||||
Vec3 patchNw = ellipsoid.cartesianSurfacePosition(newPatch.northWestCorner());
|
||||
Vec3 patchNe = ellipsoid.cartesianSurfacePosition(newPatch.northEastCorner());
|
||||
|
||||
// Transform all control points to camera space
|
||||
patchSw = Vec3(dmat4(modelViewTransform) * glm::dvec4(patchSw, 1));
|
||||
|
||||
@@ -79,20 +79,13 @@ namespace openspace {
|
||||
ChunkRenderer(shared_ptr<Grid> grid,
|
||||
shared_ptr<TileProviderManager> tileProviderManager);
|
||||
|
||||
void ChunkRenderer::renderChunk(
|
||||
const Chunk& chunk,
|
||||
const Ellipsoid& ellipsoid,
|
||||
const RenderData& data);
|
||||
void ChunkRenderer::renderChunk(const Chunk& chunk, const RenderData& data);
|
||||
|
||||
private:
|
||||
void ChunkRenderer::renderChunkGlobally(
|
||||
const Chunk& chunk,
|
||||
const Ellipsoid& ellipsoid,
|
||||
const RenderData& data);
|
||||
const Chunk& chunk, const RenderData& data);
|
||||
void ChunkRenderer::renderChunkLocally(
|
||||
const Chunk& chunk,
|
||||
const Ellipsoid& ellipsoid,
|
||||
const RenderData& data);
|
||||
|
||||
const Chunk& chunk, const RenderData& data);
|
||||
shared_ptr<Grid> _grid;
|
||||
unique_ptr<LayeredTextureShaderProvider> _globalRenderingShaderProvider;
|
||||
unique_ptr<LayeredTextureShaderProvider> _localRenderingShaderProvider;
|
||||
|
||||
Reference in New Issue
Block a user