Skip to content

Commit

Permalink
let geometric error of infinity signal unconditional refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
nithinp7 committed Sep 9, 2021
1 parent b5f8784 commit 388ed45
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
13 changes: 6 additions & 7 deletions Cesium3DTilesSelection/include/Cesium3DTilesSelection/Tile.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
#include "CesiumGeospatial/Projection.h"
#include "CesiumUtility/DoublyLinkedList.h"
#include <atomic>
#include <glm/common.hpp>
#include <glm/mat4x4.hpp>
#include <gsl/span>
#include <limits>
#include <memory>
#include <optional>
#include <string>
Expand Down Expand Up @@ -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<double>::infinity();
}

/**
Expand Down Expand Up @@ -603,7 +603,6 @@ class CESIUM3DTILESSELECTION_API Tile final {
BoundingVolume _boundingVolume;
std::optional<BoundingVolume> _viewerRequestVolume;
double _geometricError;
bool _unconditionallyRefine;
TileRefine _refine;
glm::dmat4x4 _transform;

Expand Down
5 changes: 1 addition & 4 deletions Cesium3DTilesSelection/src/Tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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)),
Expand All @@ -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);
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 388ed45

Please sign in to comment.