From 388ed457b8c3235f19199b735883e689f413f233 Mon Sep 17 00:00:00 2001 From: Nithin Pranesh Date: Thu, 9 Sep 2021 07:02:00 -0400 Subject: [PATCH] let geometric error of infinity signal unconditional refinement --- .../include/Cesium3DTilesSelection/Tile.h | 13 ++++++------- Cesium3DTilesSelection/src/Tile.cpp | 5 +---- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Cesium3DTilesSelection/include/Cesium3DTilesSelection/Tile.h b/Cesium3DTilesSelection/include/Cesium3DTilesSelection/Tile.h index 957d94f1c..56f7cded6 100644 --- a/Cesium3DTilesSelection/include/Cesium3DTilesSelection/Tile.h +++ b/Cesium3DTilesSelection/include/Cesium3DTilesSelection/Tile.h @@ -12,8 +12,10 @@ #include "CesiumGeospatial/Projection.h" #include "CesiumUtility/DoublyLinkedList.h" #include +#include #include #include +#include #include #include #include @@ -305,18 +307,16 @@ class CESIUM3DTILESSELECTION_API Tile final { * @return Whether to uncoditionally refine this tile. */ bool getUnconditionallyRefine() const noexcept { - return this->_unconditionallyRefine; + return glm::isinf(this->_geometricError); } /** - * @brief Sets whether this tile should be unconditionally refined. + * @brief Marks that this tile should be unconditionally refined. * * This function is not supposed to be called by clients. - * - * @param value Whether this tile should be unconditionaly refined. */ - void setUnconditionallyRefine(bool value) noexcept { - this->_unconditionallyRefine = value; + void setUnconditionallyRefine() noexcept { + this->_geometricError = std::numeric_limits::infinity(); } /** @@ -603,7 +603,6 @@ class CESIUM3DTILESSELECTION_API Tile final { BoundingVolume _boundingVolume; std::optional _viewerRequestVolume; double _geometricError; - bool _unconditionallyRefine; TileRefine _refine; glm::dmat4x4 _transform; diff --git a/Cesium3DTilesSelection/src/Tile.cpp b/Cesium3DTilesSelection/src/Tile.cpp index ffa335f6b..adf97102f 100644 --- a/Cesium3DTilesSelection/src/Tile.cpp +++ b/Cesium3DTilesSelection/src/Tile.cpp @@ -30,7 +30,6 @@ Tile::Tile() noexcept _boundingVolume(OrientedBoundingBox(glm::dvec3(), glm::dmat4())), _viewerRequestVolume(), _geometricError(0.0), - _unconditionallyRefine(false), _refine(TileRefine::Replace), _transform(1.0), _id(""s), @@ -50,7 +49,6 @@ Tile::Tile(Tile&& rhs) noexcept _boundingVolume(rhs._boundingVolume), _viewerRequestVolume(rhs._viewerRequestVolume), _geometricError(rhs._geometricError), - _unconditionallyRefine(rhs._unconditionallyRefine), _refine(rhs._refine), _transform(rhs._transform), _id(std::move(rhs._id)), @@ -70,7 +68,6 @@ Tile& Tile::operator=(Tile&& rhs) noexcept { this->_boundingVolume = rhs._boundingVolume; this->_viewerRequestVolume = rhs._viewerRequestVolume; this->_geometricError = rhs._geometricError; - this->_unconditionallyRefine = rhs._unconditionallyRefine; this->_refine = rhs._refine; this->_transform = rhs._transform; this->_id = std::move(rhs._id); @@ -637,7 +634,7 @@ void Tile::update( // In the latter case, we'll happily render nothing in the space of this // tile, which is sometimes useful. if (!this->_pContent->model) { - this->setUnconditionallyRefine(true); + this->setUnconditionallyRefine(); } // A new and improved bounding volume.