|
Cogs.Core
|
Classes | |
| struct | LoadedModel |
| struct | Node |
| struct | TileCandidate |
Public Member Functions | |
| OGC3DTilesSystem (Cogs::Memory::Allocator *allocator, Cogs::ComponentIndex capacity) | |
| void | initialize (Context *context) override |
| Initialize the system. | |
| void | update (Context *context) override |
| Provided for custom update logic in derived systems. | |
| ComponentHandle | createComponent () override |
| void | destroyComponent (ComponentHandle component) override |
Public Member Functions inherited from Cogs::Core::ComponentSystemWithDataPool< OGC3DTilesComponent, OGC3DTilesDataHolder > | |
| ComponentSystemWithDataPool (Memory::Allocator *allocator, SizeType size=1024) | |
| OGC3DTilesDataHolder & | getData (const OGC3DTilesComponent *component) |
| const OGC3DTilesDataHolder & | getData (const OGC3DTilesComponent *component) const |
Public Member Functions inherited from Cogs::Core::ComponentSystemWithDataPools< ComponentType, DataTypes > | |
| ComponentSystemWithDataPools (Memory::Allocator *allocator, SizeType size=1024, MemBlockType componentMemType=MemBlockType::Component, MemBlockType dataMemType=MemBlockType::ComponentData) | |
| ComponentHandle | createComponent () override |
| void | destroyComponent (ComponentHandle component) override |
| template<typename T > | |
| T & | getData (const ComponentType *component) |
| Get the data stored for the given component from the data pool storing objects of the specified template type. | |
| template<typename T > | |
| const T & | getData (const ComponentType *component) const |
| Get the const data stored for the given component from the data pool storing objects of the specified template type. | |
Public Member Functions inherited from Cogs::Core::ComponentSystem< ComponentType > | |
| ComponentSystem (Memory::Allocator *allocator, SizeType size=16384, MemBlockType componentMemType=MemBlockType::Component) | |
| void | instrumentedPreUpdate () override |
| Provided for tagged engine instrumentation. | |
| void | instrumentedUpdate () override |
| Provided for tagged engine instrumentation. | |
| void | instrumentedPostUpdate () override |
| Provided for tagged engine instrumentation. | |
| ComponentHandle | createComponent () override |
| Create a new component instance. | |
| void | destroyComponent (ComponentHandle component) override |
| Destroy the component held by the given handle. | |
| SizeType | getComponentIndex (const Component *component) const |
| Get the index of the given component in the component pool. | |
| size_t | size () |
| Returns the number of active components. | |
| void | clearCarryFlags () |
| Clear carry flags of all active components. | |
| void | resetFlags () |
| Reset the flags of all active components. | |
| void | prepareUpdate (Context *) override |
| void | postUpdate (Context *) override |
| ComponentHandle | getHandle (const ComponentType *component) |
| Get a handle to the given Component instance. | |
| virtual void | addEntitiesWithComponent (std::vector< EntityId > &entities, Reflection::TypeId componentTypeId) override |
| Return all entities with a given. | |
Public Member Functions inherited from Cogs::Core::ComponentSystemBase | |
| virtual | ~ComponentSystemBase () |
| Provided for destruction via pointer to base. | |
| ComponentSystemBase (Reflection::TypeId componentType) | |
| Constructs a ComponentSystemBase to manage components of the given componentType. | |
| virtual void | initialize (Context *context) |
| Initialize the system. | |
| void | preUpdate () |
| Run the pre-update method of the system. | |
| void | update () |
| Updates the system state to that of the current frame. | |
| void | postUpdate () |
| Perform post update logic in the system. | |
| virtual void | preUpdate (Context *) |
| Provided for custom pre update logic in derived systems. | |
| virtual void | prepareUpdate (Context *) |
| Provided for custom update preparation logic in derived systems. | |
| virtual void | update (Context *) |
| Provided for custom update logic in derived systems. | |
| virtual void | postUpdate (Context *) |
| Provided for custom post update logic in derived systems. | |
| virtual void | instrumentedPreUpdate () |
| Provided for tagged engine instrumentation. | |
| virtual void | instrumentedUpdate () |
| Provided for tagged engine instrumentation. | |
| virtual void | instrumentedPostUpdate () |
| Provided for tagged engine instrumentation. | |
| virtual void | addEntitiesWithComponent (std::vector< EntityId > &, Reflection::TypeId) |
| Return all entities with a given. | |
| virtual void | cleanup (Context *) |
| Provided for custom cleanup logic in derived systems. | |
| virtual ComponentHandle | createComponent () |
| Create a new component instance. | |
| virtual void | destroyComponent (ComponentHandle) |
| Destroy the component held by the given handle. | |
| Reflection::TypeId | getComponentType () const |
| Get the reflected type of the components managed by this system. | |
Static Public Member Functions | |
| static bool | componentIsStale (Context *context, uint32_t id) |
Static Public Member Functions inherited from Cogs::Core::ComponentSystem< ComponentType > | |
| static Reflection::TypeId | getTypeId () |
| Get the type id of the component type used by the system. | |
Private Types | |
| using | base_type = Cogs::Core::ComponentSystem< OGC3DTilesComponent > |
Private Member Functions | |
| void | initializeTileset (OGC3DTilesComponent *component, OGC3DTilesData *componentState) |
| void | traverseTileset (const OGC3DTilesComponent *component, OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, float gracePeriodBeforeTileRemoval) |
| uint64_t | fetchAndInitializeTileset (const uint64_t tilesetGUID, const std::string &tilesetURL, OGC3DTilesComponent *component, uint32_t uniqueComponentId) |
| Cogs::Core::DataFetcherManager::FetchId | fetchAndInitializeAsset (OGC3DTilesComponent *component, uint32_t uniqueComponentId) |
| Node | buildExplicitTree (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, const OGC3DTilesTileset::Tile *tile, const std::string &tileIdStr, const glm::mat4 ¤tTransform, const glm::mat4 &globalTransform, std::unordered_set< const OGC3DTilesTileset::Tileset * > &visitedTilesets) const |
| Node | buildImplicitTree (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, const OGC3DTiles::Coord &coord, const glm::mat4 &globalTransform) const |
| void | collectTileCandidates (OGC3DTilesData *componentState, const Node *node, std::unordered_map< uint64_t, TileCandidate > &target) const |
| void | calculateTileVisibilities (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, const Node *node) const |
| bool | allChildrenAreReady (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, const Node *node) const |
| bool | tileHasReadyContent (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, uint64_t tileId) const |
| bool | tileHasModelRequests (const OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, uint64_t tileId) const |
| bool | tileHasSubTilesetRequests (const OGC3DTilesData *componentState, uint64_t tileId) const |
| void | setTileVisibility (const OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, uint64_t tileId, bool onoff) const |
| void | setVisibilityForAllTiles (const OGC3DTilesData *componentState, bool onoff) const |
| bool | modelIsReady (const ModelHandle &modelhandle) const |
| size_t | pruneTileCache (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, float gracePeriodBeforeTileRemoval) const |
| void | removeTileFromScene (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, uint64_t tileId) const |
| void | requestSubTileset (OGC3DTilesData *componentState, const std::string &fullURL, uint64_t tileId, const OGC3DTilesTileset::Tileset *parentTileset) const |
| void | requestSubtree (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, const OGC3DTiles::Coord &coord) const |
| bool | requestModel (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, const TileCandidate &tile, const std::string URL) const |
| void | loadMissingModels (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, const std::unordered_map< uint64_t, TileCandidate > &toBeLoaded) const |
| void | addModelToScene (const std::string &uniqueName, TileCandidate tile, ModelHandle handle, const OGC3DTilesData *componentState) const |
| void | addBBoxIndicatorToScene (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, uint64_t tileId, Cogs::Geometry::DBoundingBox box) const |
| void | removeBBoxIndicatorFromScene (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, uint64_t tileId) const |
| void | cancelStaleModelRequests (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, const Node &node) const |
| void | processModelRequests (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, uint32_t frameNumber) const |
| void | processSubtreeRequests (const OGC3DTilesComponent *component, OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset) |
| void | processSubTilesetRequests (const OGC3DTilesComponent *component, OGC3DTilesData *componentState) |
| bool | hasPendingRequests (const OGC3DTilesData *componentState) const |
| void | cleanupPendingSubtreeRequests (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset) const |
| bool | isInsideFrustum (const Cogs::Geometry::DBoundingBox &box) const |
| glm::dvec3 | getCurrentCameraPosition () const |
| OGC3DTilesSubtree::Subtree * | getSubtreeForTileCoord (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, const OGC3DTiles::Coord &coord) const |
| std::vector< OGC3DTiles::Coord > | getTileCoordChildren (OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, const OGC3DTiles::Coord &parent) const |
| std::string | addOptionalURLParameters (const OGC3DTilesData *componentState, const std::string &url) const |
| bool | extractAndStoreOptionalSessionKeys (OGC3DTilesData *componentState, const std::string &url) const |
| void | applyMaterialToAllModels (const OGC3DTilesData *componentState, MaterialInstanceHandle materialHandle) |
| void | applyMaterialToModel (const OGC3DTilesSystem::LoadedModel &model, MaterialInstanceHandle materialHandle) |
Static Private Member Functions | |
| static uint64_t | makeCacheKey (const OGC3DTiles::Coord &coord) |
| static std::string | buildSubtreeURL (const OGC3DTilesData *componentState, const OGC3DTilesTileset::Tileset *tileset, const OGC3DTiles::Coord &coord) |
| static bool | modelIsEmpty (const ModelHandle handle) |
| static void | printDebugStats (const OGC3DTilesData *componentState) |
| static std::string | compileURL (const std::string &baseURL, const std::string &tilesetPath, const std::string &modelPath) |
Private Attributes | |
| OGC3DTilesBounds * | bounds = nullptr |
| std::string | accessToken = "" |
| double | timestampOfLastCameraMovement = 0.0 |
| glm::mat4 | lastCameraViewProjection = glm::mat4(-1) |
| std::vector< MaterialInstanceHandle > | debugTileTreeDepthColorMaterials |
Additional Inherited Members | |
Public Types inherited from Cogs::Core::ComponentSystem< ComponentType > | |
| typedef ComponentType | component_type |
Public Attributes inherited from Cogs::Core::ComponentSystem< ComponentType > | |
| ComponentPool< ComponentType > | pool |
| Pool of components managed by the system. | |
Public Attributes inherited from Cogs::Core::ComponentSystemBase | |
| Reflection::TypeId | componentType |
| The type of components managed by this instance. | |
| Context * | context = nullptr |
| Pointer to the Context instance the system lives in. | |
Definition at line 38 of file OGC3DTilesSystem.h.
|
private |
Definition at line 40 of file OGC3DTilesSystem.h.
| OGC3DTilesSystem::OGC3DTilesSystem | ( | Cogs::Memory::Allocator * | allocator, |
| Cogs::ComponentIndex | capacity | ||
| ) |
Definition at line 99 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 1554 of file OGC3DTilesSystem.cpp.
|
private |
Will return a circa size (in bytes) of the model.
Definition at line 1526 of file OGC3DTilesSystem.cpp.
References Cogs::Core::EntityStore::addChild(), Cogs::Core::ComponentSystemBase::context, Cogs::Core::EntityStore::createEntity(), Cogs::Core::EntityStore::findEntity(), Cogs::ComponentModel::Component::getComponent(), Cogs::Core::ModelComponent::inheritMaterial, Cogs::Core::ModelComponent::materialInstance, Cogs::Core::ModelComponent::model, Cogs::ComponentModel::Component::setChanged(), Cogs::Core::Context::store, Cogs::Core::TransformComponent::transform, and Cogs::Core::TransformComponent::transformFlags.
|
private |
Definition at line 552 of file OGC3DTilesSystem.cpp.
|
private |
Check if all children are ready. We might have to dig several layers down. Returns TRUE if all children are ready.
Definition at line 1224 of file OGC3DTilesSystem.cpp.
References allChildrenAreReady(), and tileHasReadyContent().
Referenced by allChildrenAreReady(), and calculateTileVisibilities().
|
private |
Definition at line 200 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 212 of file OGC3DTilesSystem.cpp.
|
private |
Walk the tileset and collect all tiles which are within the view-frustrum. The distance of a tile to the camera will determine which detail level we'll use. Tiles close to the camera will be collected deeper from the tree than tiles far away (ie. at a higher resolution level).
Definition at line 1415 of file OGC3DTilesSystem.cpp.
References buildExplicitTree(), and Cogs::hash().
Referenced by buildExplicitTree().
|
private |
Walk the tree (quad- or oct-tree) and collect all tiles which are within the view-frustrum. The distance of a tile to the camera will determine which detail level we'll use. Tiles close to the camera will be collected deeper from the tree than tiles far away (ie. at a higher resolution level).
Definition at line 1310 of file OGC3DTilesSystem.cpp.
References buildImplicitTree(), and getSubtreeForTileCoord().
Referenced by buildImplicitTree().
|
staticprivate |
Definition at line 1123 of file OGC3DTilesSystem.cpp.
|
private |
This method will traverse the tree top down and hide tiles depending on the state of the tile's loaded data. This method assumes that all tiles are visible by default when in "waitForTileSiblings"-mode.
Definition at line 1272 of file OGC3DTilesSystem.cpp.
References allChildrenAreReady(), calculateTileVisibilities(), and tileHasReadyContent().
Referenced by calculateTileVisibilities().
|
private |
Definition at line 349 of file OGC3DTilesSystem.cpp.
|
private |
Some subtrees have external binary files which are loaded async. This method will go through all registered/active subtree-requests and remove those who no longer have any pending requests for external files.
Definition at line 391 of file OGC3DTilesSystem.cpp.
References Cogs::hash(), and makeCacheKey().
|
private |
This method will traverse the node-tree and register all tile candidates in "target".
Definition at line 1250 of file OGC3DTilesSystem.cpp.
References collectTileCandidates().
Referenced by collectTileCandidates().
|
staticprivate |
Definition at line 174 of file OGC3DTilesSystem.cpp.
|
static |
Used for detecting if a component is valid or has been destroyed. The 'uniqueComponentId' value is autogenerated when the component is created and stored in its data-bundle.
Definition at line 158 of file OGC3DTilesSystem.cpp.
References Cogs::Core::ComponentSystemBase::context, and Cogs::Core::ComponentSystem< ComponentType >::pool.
|
overridevirtual |
Overridden to update data pool contents in lockstep with the component pool. Any subclass overriding this method should call base class first.
Reimplemented from Cogs::Core::ComponentSystemWithDataPools< ComponentType, DataTypes >.
Definition at line 1646 of file OGC3DTilesSystem.cpp.
References Cogs::Core::Context::bounds, Cogs::Core::ComponentSystemBase::context, Cogs::Core::ComponentSystemBase::createComponent(), Cogs::Core::ComponentSystem< ComponentType >::pool, and Cogs::ComponentModel::ComponentHandle::resolve().
|
overridevirtual |
Overridden to update data pool contents in lockstep with the component pool. Any subclass overriding this method should also call base class.
Reimplemented from Cogs::Core::ComponentSystemWithDataPools< ComponentType, DataTypes >.
Definition at line 1665 of file OGC3DTilesSystem.cpp.
References Cogs::Core::OGC3DTilesComponent::baseURL, Cogs::Core::Context::bounds, Cogs::Core::ComponentSystemBase::context, Cogs::Core::ComponentSystemBase::destroyComponent(), Cogs::Core::EntityStore::destroyEntity(), Cogs::Core::EntityStore::getEntity(), Cogs::ComponentModel::ComponentHandle::resolve(), and Cogs::Core::Context::store.
|
private |
Extract optional "session=" value from URL. Returns TRUE if a value was found.
Definition at line 507 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 610 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 670 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 1728 of file OGC3DTilesSystem.cpp.
|
private |
This method will first check the cache then load from URL if needed.
NOTE: This method will schedule loading of any missing subtrees, but this is an async process. It is therefore be possible that NULL is returned (for a while). Be patient.
Definition at line 1823 of file OGC3DTilesSystem.cpp.
References makeCacheKey(), and requestSubtree().
Referenced by buildImplicitTree().
|
private |
Definition at line 1768 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 408 of file OGC3DTilesSystem.cpp.
|
overridevirtual |
Initialize the system.
Initialization is performed after all systems are created and a renderer initialized, but before the first time anything is rendered.
| context | Pointer to the context the system lives in. |
Reimplemented from Cogs::Core::ComponentSystemBase.
Definition at line 107 of file OGC3DTilesSystem.cpp.
References Cogs::Core::ComponentSystemBase::context, Cogs::Core::ComponentSystemBase::initialize(), Cogs::Core::MaterialInstance::material, Cogs::Core::MaterialInstance::setVec4Property(), and Cogs::Core::Context::variables.
|
private |
Definition at line 580 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 1734 of file OGC3DTilesSystem.cpp.
|
private |
This method will go through all "tilesInView" and add requests for those tiles which are not already in the cache. Those who are will have their timestamp updated to prevent removal when cleanup is executed.
Definition at line 1039 of file OGC3DTilesSystem.cpp.
References Cogs::Core::ComponentSystemBase::context, requestModel(), Cogs::Core::Context::time, Cogs::StringView::to_string(), and Cogs::Core::Context::variables.
|
staticprivate |
Created a hash integer out of the coord's X, Y and Z + level. The Z will be omitted for Quad-trees.
NOTE: Coord-values are limited to 16bit range which should be more than enough.
Definition at line 1143 of file OGC3DTilesSystem.cpp.
References Cogs::hash().
Referenced by cleanupPendingSubtreeRequests(), getSubtreeForTileCoord(), and requestSubtree().
|
staticprivate |
Definition at line 1755 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 861 of file OGC3DTilesSystem.cpp.
|
staticprivate |
Definition at line 182 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 926 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 1849 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 1915 of file OGC3DTilesSystem.cpp.
|
private |
If the component's "enableCaching==TRUE" then pruning will be performed if the QualityService's 3DTiles variables are below certain values.
All tiles in the tileCache which have a timestamp older than "this->gracePeriodBeforeTileRemoval" will be deleted. (Along with the debug BBox – if the bbox feature is switched on)
Returns the number of tiles removed/released.
Definition at line 742 of file OGC3DTilesSystem.cpp.
References Cogs::Core::ComponentSystemBase::context, Cogs::Core::Context::engine, Cogs::ComponentModel::Component::getComponent(), Cogs::Core::EntityStore::getEntity(), Cogs::Core::Context::qualityService, Cogs::ComponentModel::Component::setChanged(), Cogs::Core::Context::store, Cogs::Core::Context::time, and Cogs::Core::SceneComponent::visible.
|
private |
Definition at line 1626 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 898 of file OGC3DTilesSystem.cpp.
|
private |
Schedule loading of a model
Returns TRUE if a model was scheduled or already requested.
Definition at line 1002 of file OGC3DTilesSystem.cpp.
References Cogs::Core::ComponentSystemBase::context, and Cogs::Core::None.
Referenced by loadMissingModels().
|
private |
Definition at line 1508 of file OGC3DTilesSystem.cpp.
|
private |
Return a subtree from cache. If it does not exist a request will be added for the subtree. Requests are processed by the "processSubtreeRequests()" method each "update()". Only relevant for IMPLICIT trees.
Definition at line 1982 of file OGC3DTilesSystem.cpp.
References makeCacheKey().
Referenced by getSubtreeForTileCoord().
|
private |
Definition at line 829 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 818 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 1192 of file OGC3DTilesSystem.cpp.
|
private |
Check if tile's content is both loaded and uploaded to the GPU.
Definition at line 1159 of file OGC3DTilesSystem.cpp.
Referenced by allChildrenAreReady(), and calculateTileVisibilities().
|
private |
Definition at line 1209 of file OGC3DTilesSystem.cpp.
|
private |
Definition at line 431 of file OGC3DTilesSystem.cpp.
|
overridevirtual |
Provided for custom update logic in derived systems.
Reimplemented from Cogs::Core::ComponentSystemBase.
Definition at line 224 of file OGC3DTilesSystem.cpp.
References Cogs::Core::ComponentSystemBase::context, Cogs::Core::EntityStore::destroyEntity(), Cogs::Core::Context::engine, Cogs::Core::ComponentSystem< ComponentType >::pool, Cogs::Core::EntityStore::removeChild(), Cogs::Core::Context::store, Cogs::Core::Context::time, and Cogs::Core::Context::variables.
|
private |
Definition at line 153 of file OGC3DTilesSystem.h.
|
private |
Definition at line 152 of file OGC3DTilesSystem.h.
|
private |
Definition at line 158 of file OGC3DTilesSystem.h.
|
private |
Definition at line 156 of file OGC3DTilesSystem.h.
|
private |
Definition at line 155 of file OGC3DTilesSystem.h.