2#include "Resources/Resources.h"
3#include "Resources/DataFetcherManager.h"
8 struct Image360Component;
11namespace Cogs::Core::Image360
13 typedef int16_t SlotIx;
21 typedef int16_t EncodedSlotIx;
54 uint32_t cacheMaxCount = 0;
55 uint32_t treeMaxSize = 0;
56 uint32_t maxConcurrent = 0;
71 std::unique_ptr<Memory::MemoryBuffer> buffer;
72 DataFetcherManager::FetchId fetchId = DataFetcherManager::NoFetchId;
75 uint8_t channelIx = 0;
80 std::vector<LoadItem> itemsLoading;
81 std::vector<LoadItem> itemsUploading;
83 bool canLoadAnyItems(
const Config& config)
const;
85 void issueChannelFetch(
Context* context,
90 const uint8_t channelIx,
91 const uint8_t revision,
92 const size_t cacheLevel,
93 const size_t cacheLevelIndex);
95 void processLoadItems(
Context* context,
99 const uint32_t currentFrame);
119 State state = State::None;
122 uint32_t lastTouched = 0;
123 uint8_t revision = 0;
126 std::vector<SlotIx> map;
128 std::vector<Item> items;
132 void init(
const Config& config);
134 SlotIx isQuadInCache(
Context* context,
138 const uint32_t currentFrame,
139 const size_t cacheLevel,
140 const size_t cacheLevelIndex);
142 void updateLeastRecentlyUsedList(
const uint32_t currentFrame);
155 glm::mat3 worldFromLocal;
156 glm::mat3 localFromWorld;
163 uint32_t sampler = 0;
167 std::vector<std::unique_ptr<Memory::MemoryBuffer>> tilesData;
170 uint32_t sampler = 0;
173 uint32_t baseSize = 0;
176 uint32_t currentTreeSize = 0;
177 uint32_t noDataDepth = 0;
178 bool discardNoDepth =
true;
190 size_t cacheLevelIndex = 0;
191 size_t encodedTreeIndex = 0;
195 std::vector<Image360::EncodedSlotIx> data;
203 const uint32_t currentFrame,
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
@ Resident
The resource is loaded onto the GPU.
size_t maxItemCount
Number of tiles in cache.
size_t lruPointer
Points to one past the least recently and recycable item, decrements and zero means nothing to recycl...
std::vector< SlotIx > lru
Slots sorted s.t. the least recently used items is at end.
@ SRGB8_JPEG
8-bit colors in SRGB color space stored as JPEG (.jpg).
@ U16_ZST
16-bit unsigned values stored as little endian raw values that are subsequently zstd compressed.
@ SRGBA8_PNG
8-bit colors in SRGB color space and a alpha channel (zero is transparent) stored as PNG (....
@ SRGB8_PNG
8-bit colors in SRGB color space stored as PNG (.png).
@ U16
16-bit unsigned values stored as little endian raw values.
uint32_t noDataDepth
Depth value that corresponds to noData.
uint32_t instanceId
Component instance id.
uint32_t baseSize
Base image size of a cached tile. From json.
uint8_t valueChannel
Data channel to be used as value data. From component.
uint32_t treeDepth
Depth of tile hierarchy. From json.
uint8_t depthChannel
Data channel that contains depth data. From json.
std::vector< Channel > channels
Data channels to use. From json.
bool discardNoDepth
Discard pixels with no depth data.
bool hasDepth
If data has depth and component wants depth.
float extent
Size in model space units, used for bounds queries.
std::vector< Quad > quadsNext
Scratch buffers kept here to avoid excessive reallocations.
std::vector< LoadItem > itemsLoadingNext
Scratch buffer.
uint32_t gpuAllocatedCacheItemCount
Number of tiles allocated in current GPU cache texture.
uint32_t gpuActiveCacheItemCount
Number of tiles in current GPU cache that contain data.
static const ResourceHandle_t NoHandle
Handle representing a default (or none if default not present) resource.
Abstract base class storing data read from a file.