Cogs.Core
OGC3DTilesSubtree.h
1#include "OGC3DTiles.h"
2
3#include <Context.h>
4
5#include <Resources/DataFetcherManager.h>
6
7#include <Foundation/Geometry/BoundingBox.hpp>
8#include <Foundation/Geometry/Glm.hpp>
9
10#include <vector>
11#include <string>
12#include <functional>
13
14namespace Cogs::Core {
15 namespace OGC3DTilesSubtree {
16 //
17 // See https://github.com/CesiumGS/3d-tiles/blob/main/specification/schema/README.md for
18 // documentation on the JSON schemas
19 //
20
21 struct Availability {
22 bool allIsAvailable = false; // True: All items avalilable. False: Some items available (use the bitstream).
23 uint32_t bitstreamIdx = 0; // Which bitstream bufferView/section to use
24 uint32_t availableCount = 0; // Number of binary elementes in bitstream
25 };
26
28 uint8_t bitstreamIdx = 0;
29 uint32_t startIdx = 0;
30 uint32_t length = 0;
31 };
32
33 struct Subtree {
34 OGC3DTiles::Coord globalCoord;
35
36 uint8_t levelsPerSubtree = 0;
37
38 Availability tileAvailability;
39 Availability childSubtreeAvailability;
40 std::vector<Availability> contentAvailability;
41
42 std::vector<BitstreamSection> bitstreamSections;
43 std::vector<std::vector<uint8_t>> bitstreams;
44 int pendingRequests = 0; // Number of pending external bin-file requests
45 };
46
47 typedef std::function<void(Subtree* subtree)> FetchSubtreeCallback;
48 Cogs::Core::DataFetcherManager::FetchId fetchSubtree(Cogs::Core::Context* context, const std::string& URL, uint32_t uniqueComponentId, FetchSubtreeCallback callback);
49
50 std::vector<OGC3DTiles::Coord> getChildren(const Subtree* subtree, const OGC3DTiles::Coord& parent);
51 std::vector<OGC3DTiles::Coord> getAllChildren(const Subtree* subtree, const OGC3DTiles::Coord& parent);
52
53 std::vector<OGC3DTiles::Coord> getLeafNodesSubtreeCoords(const Subtree* subtree, const OGC3DTiles::Coord& leafNodeCoord);
54
55 OGC3DTiles::Coord globalToLocal(const Subtree* subtree, const OGC3DTiles::Coord& globalCoord);
56 OGC3DTiles::Coord getSubtreesRootCoord(int levelsPerSubtrees, const OGC3DTiles::Coord& coord);
57
58 bool hasContent(const Subtree* subtree, const OGC3DTiles::Coord& coord);
59 bool isLeafNodeInSubtree(const Subtree* subtree, const OGC3DTiles::Coord& coord);
60 };
61};
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....