mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-24 04:59:24 -06:00
Fixed bug introduced in commit f484005... due to enum Chunk::Status was implicitely casted to bool. Changed enum to class
This commit is contained in:
@@ -102,8 +102,9 @@ namespace openspace {
|
||||
_isVisible &= HorizonCuller::isVisible(myRenderData, _surfacePatch, ellipsoid, maxHeight);
|
||||
}
|
||||
|
||||
if(!_isVisible && owner()->mergeInvisible)
|
||||
return WANT_MERGE;
|
||||
if (!_isVisible && owner()->mergeInvisible) {
|
||||
return Status::WANT_MERGE;
|
||||
}
|
||||
|
||||
|
||||
Vec3 cameraPosition = myRenderData.camera.position().dvec3();
|
||||
@@ -125,9 +126,9 @@ namespace openspace {
|
||||
// clamp level
|
||||
desiredLevel = glm::clamp(desiredLevel, _owner->minSplitDepth, _owner->maxSplitDepth);
|
||||
|
||||
if (desiredLevel < _index.level) return WANT_MERGE;
|
||||
else if (_index.level < desiredLevel) return WANT_SPLIT;
|
||||
else return DO_NOTHING;
|
||||
if (desiredLevel < _index.level) return Status::WANT_MERGE;
|
||||
else if (_index.level < desiredLevel) return Status::WANT_SPLIT;
|
||||
else return Status::DO_NOTHING;
|
||||
}
|
||||
|
||||
void Chunk::render(const RenderData& data) const {
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace openspace {
|
||||
class Chunk {
|
||||
public:
|
||||
|
||||
enum Status{
|
||||
enum class Status{
|
||||
DO_NOTHING,
|
||||
WANT_MERGE,
|
||||
WANT_SPLIT,
|
||||
|
||||
@@ -74,13 +74,12 @@ bool ChunkNode::updateChunkTree(const RenderData& data) {
|
||||
|
||||
if (isLeaf()) {
|
||||
Chunk::Status status = _chunk.update(data);
|
||||
if (status == Chunk::WANT_SPLIT) {
|
||||
if (status == Chunk::Status::WANT_SPLIT) {
|
||||
split();
|
||||
}
|
||||
return status == Chunk::WANT_MERGE;
|
||||
return status == Chunk::Status::WANT_MERGE;
|
||||
}
|
||||
else {
|
||||
|
||||
char requestedMergeMask = 0;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (_children[i]->updateChunkTree(data)) {
|
||||
@@ -88,14 +87,13 @@ bool ChunkNode::updateChunkTree(const RenderData& data) {
|
||||
}
|
||||
}
|
||||
|
||||
// check if all children requested merge
|
||||
if (requestedMergeMask == 0xf && _chunk.update(data)) {
|
||||
merge();
|
||||
bool allChildrenWantsMerge = requestedMergeMask == 0xf;
|
||||
bool thisChunkWantsSplit = _chunk.update(data) == Chunk::Status::WANT_SPLIT;
|
||||
|
||||
// re-run updateChunkTree on this, now that this is a leaf node
|
||||
// OBS, this may currently cause a split() again ...
|
||||
return updateChunkTree(data);
|
||||
if (allChildrenWantsMerge && !thisChunkWantsSplit) {
|
||||
merge();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user