-
Notifications
You must be signed in to change notification settings - Fork 264
Extract Tile selection algorithms from Tileset into free functions
#1342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
calebbuffa
wants to merge
31
commits into
CesiumGS:main
Choose a base branch
from
calebbuffa:ownership
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
1b8fc8f
call .get() to fix test
calebbuffa 5eece01
create MainThreadOnly and TileObserver
calebbuffa 89bc16d
create TileHiearchy and TileOverlaySystem
calebbuffa c282c89
create TileUnloadQueue
calebbuffa 8b64f4b
make tile state update a function callback
calebbuffa fa17459
create TileSelection
calebbuffa aafcd22
tile selection delegates to free functions
calebbuffa f4c06d9
update content calls to use .get()
calebbuffa 836f709
create free selectTiles test
calebbuffa 32abaaa
remov unused makeCloseViewstate function to fix -Wunused-function ci …
calebbuffa acb9a7d
document undocumented public members
calebbuffa 9abf209
satisfy clang-tidy includes
calebbuffa cb0aac9
Update comment TileOverlaySystem.h
calebbuffa 1a576f8
move selectTiles to top
calebbuffa 051f3ae
revert unnecessary changes based on feedback
calebbuffa 47205f4
Merge branch 'ownership' of https://github.com/calebbuffa/cesium-nati…
calebbuffa d51f930
remove [main-thread-only] comment
calebbuffa 1a9ddf5
revert _overlayCollection rename
calebbuffa 792878b
fix comments
calebbuffa e33a898
update markIneligble call
calebbuffa 9eaca5c
pass ViewUpdateResult instead of recreating in selectTiles
calebbuffa d7a8b89
format
calebbuffa 7d1de8e
fix const cast
calebbuffa 3e6c4eb
fix orphaned comment
calebbuffa 488eb2d
fix remaining issues
calebbuffa abded91
Merge branch 'main' of https://github.com/CesiumGS/cesium-native into…
calebbuffa 37018d3
Merge branch 'main' of https://github.com/CesiumGS/cesium-native into…
calebbuffa 4112199
remove TraversalContext
calebbuffa 44aec15
add this->_queue
calebbuffa 2c8f6bf
fix docs/comments
calebbuffa 7d9efb3
remove unused parameters
calebbuffa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
Cesium3DTilesSelection/include/Cesium3DTilesSelection/TileUnloadQueue.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #pragma once | ||
|
|
||
| #include <Cesium3DTilesSelection/Tile.h> | ||
|
|
||
| namespace Cesium3DTilesSelection { | ||
|
|
||
| /** | ||
| * @brief LRU list of tiles eligible for content eviction. | ||
| * | ||
| * Head is least-recently-used, tail is most-recently-used. | ||
| * | ||
| * @private | ||
| */ | ||
| class TileUnloadQueue { | ||
| public: | ||
| TileUnloadQueue() noexcept = default; | ||
| ~TileUnloadQueue() noexcept = default; | ||
|
|
||
| TileUnloadQueue(const TileUnloadQueue&) = delete; | ||
| TileUnloadQueue& operator=(const TileUnloadQueue&) = delete; | ||
| TileUnloadQueue(TileUnloadQueue&&) noexcept = default; | ||
| TileUnloadQueue& operator=(TileUnloadQueue&&) noexcept = default; | ||
|
|
||
| /** | ||
| * @brief Adds `tile` to the tail (most-recently-used end). No-op if already | ||
| * tracked. | ||
| */ | ||
| void markEligible(Tile& tile) noexcept { | ||
| if (!this->_queue.contains(tile)) { | ||
| this->_queue.insertAtTail(tile); | ||
| } | ||
| } | ||
|
|
||
| /** @brief Removes `tile` from the queue. No-op if not present. */ | ||
| void markIneligible(Tile& tile) noexcept { this->_queue.remove(tile); } | ||
|
|
||
| /** @brief Returns true if `tile` is currently in the queue. */ | ||
| bool contains(const Tile& tile) const noexcept { | ||
| return this->_queue.contains(tile); | ||
| } | ||
|
|
||
| /** @brief Returns the least-recently-used tile, or nullptr. */ | ||
| Tile* head() noexcept { return this->_queue.head(); } | ||
|
|
||
| /** @brief Returns the tile following `tile` in LRU order. */ | ||
| Tile* next(Tile& tile) noexcept { return this->_queue.next(tile); } | ||
|
|
||
| private: | ||
| Tile::UnusedLinkedList _queue; | ||
| }; | ||
|
|
||
| } // namespace Cesium3DTilesSelection | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
Cesium3DTilesSelection/include/Cesium3DTilesSelection/TilesetSelection.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #pragma once | ||
|
|
||
| #include <Cesium3DTilesSelection/Library.h> | ||
| #include <Cesium3DTilesSelection/ViewUpdateResult.h> | ||
|
|
||
| #include <vector> | ||
|
|
||
| namespace Cesium3DTilesSelection { | ||
|
|
||
| class Tile; | ||
| class TilesetFrameState; | ||
| class TilesetExternals; | ||
| struct TilesetOptions; | ||
| class TileOcclusionRendererProxy; | ||
|
|
||
| /** | ||
| * @brief Per-frame inputs for the tile selection algorithm. | ||
| */ | ||
| struct TileSelectionContext { | ||
| /** @brief The tileset configuration options. */ | ||
| const TilesetOptions& options; | ||
| /** @brief External interfaces (asset accessor, task processor, etc.). */ | ||
| const TilesetExternals& externals; | ||
| /** @brief Scratch buffer reused across frames to avoid allocating them on the | ||
| * heap during selection. */ | ||
| std::vector<double>& scratchDistances; | ||
| /** @brief Scratch buffer reused across frames to avoid allocating them on the | ||
| * heap during selection. Holds the occlusion proxies of the children of a | ||
| * tile. */ | ||
| std::vector<const TileOcclusionRendererProxy*>& scratchOcclusionProxies; | ||
| }; | ||
|
|
||
| /** | ||
| * @brief Runs the tile selection / LOD traversal algorithm. | ||
| * | ||
| * Populates `result` with the tiles to render this frame. The view group in | ||
| * `frameState` also receives load queue updates. | ||
| * | ||
| * @param context Configuration, external dependencies, and scratch buffers. | ||
| * @param frameState Per-frame view parameters and the view group to update. | ||
| * @param rootTile Root of the tile hierarchy to traverse. | ||
| * @param result Filled with the selected tiles and statistics for this frame. | ||
|
calebbuffa marked this conversation as resolved.
|
||
| * | ||
| * @private | ||
| */ | ||
|
calebbuffa marked this conversation as resolved.
|
||
| CESIUM3DTILESSELECTION_API void selectTiles( | ||
| const TileSelectionContext& context, | ||
| const TilesetFrameState& frameState, | ||
| Tile& rootTile, | ||
| ViewUpdateResult& result); | ||
|
calebbuffa marked this conversation as resolved.
|
||
|
|
||
| } // namespace Cesium3DTilesSelection | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.