5#include "Resources/AssetManager.h"
6#include "Resources/Model.h"
7#include "Resources/Texture.h"
9#include "Systems/Core/AssetSystem.h"
10#include "Systems/Core/AssetInstanceData.h"
12#include "InspectorGuiRenderer.h"
13#include "InspectorGuiHelper.h"
15#include "Foundation/StringViewFormat.h"
16#include "Foundation/Platform/IO.h"
24 std::string byteString(
size_t bytes)
26 if (bytes < 16 * 1024) {
27 return std::to_string(bytes) +
" B";
30 if (bytes < 16 * 1024) {
31 return std::to_string(bytes) +
" KiB";
34 if (bytes < 16 * 1024) {
35 return std::to_string(bytes) +
" MiB";
38 return std::to_string(bytes) +
" GiB";
46 static std::deque<std::vector<std::string>> assetsInQueueHistory;
47 static std::vector<float> assetsInQueueGraph;
48 static size_t assetsInQueueTotal = 0;
49 static float assetsInQueueGraphHeight = 10.f;
50 static int assetsInQueueGraphScale = 50;
51 static std::deque<std::vector<std::string>> assetsProcessingHistory;
52 static std::vector<float> assetsProcessingGraph;
53 static size_t assetsProcessingTotal = 0;
54 static float assetsProcessingGraphHeight = 10.f;
55 static int assetsProcessingGraphScale = 50;
57 void showEntityDefinition(SceneDefinition & scene,
const SceneEntityDefinition & definition)
59 ImGui::PushID(&definition);
61 std::string entityName(scene.properties.getString(definition.nameIndex));
62 if (entityName.empty()) entityName =
"Anonymous";
64 if (ImGui::TreeNode(entityName.c_str())) {
65 ImGui::Text(
"Type: '%.*s'", StringViewFormat(definition.getTypeName()));
67 if (definition.numProperties) {
68 if (ImGui::TreeNode(
"Properties")) {
69 for (uint32_t i = definition.firstProperty; i < definition.firstProperty + definition.numProperties; ++i) {
70 PropertyInfo& prop = scene.properties.getPropertyByIndex(i);
71 std::string_view name = scene.properties.getKey(prop);
74 case PropertyType::Bool:
75 ImGui::Text(
"%.*s: %s", StringViewFormat(name), prop.boolValue ?
"true" :
"false");
77 case PropertyType::Integer:
78 ImGui::Text(
"%.*s: %d", StringViewFormat(name), prop.intValue);
80 case PropertyType::Int2:
81 ImGui::Text(
"%.*s: %d %d", StringViewFormat(name), prop.int2Value[0], prop.int2Value[1]);
83 case PropertyType::UnsignedInteger:
84 ImGui::Text(
"%.*s: 0x%08x", StringViewFormat(name), prop.uintValue);
86 case PropertyType::UInt2:
87 ImGui::Text(
"%.*s: %u %u", StringViewFormat(name), prop.uint2Value[0], prop.uint2Value[1]);
89 case PropertyType::Float:
90 ImGui::Text(
"%.*s: %f", StringViewFormat(name), prop.floatValue);
92 case PropertyType::Float2:
93 ImGui::Text(
"%.*s: %f %f", StringViewFormat(name), prop.float2Value[0], prop.float2Value[1]);
95 case PropertyType::Double:
96 ImGui::Text(
"%.*s: %f", StringViewFormat(name), prop.doubleValue);
98 case PropertyType::StringRef:
99 case PropertyType::String: {
100 std::string_view value = scene.properties.getString(prop);
101 ImGui::Text(
"%.*s: %.*s", StringViewFormat(name), StringViewFormat(value));
104 case PropertyType::FloatArray: {
105 const std::span<float> value = scene.properties.getFloatArray(i);
106 if (value.size() == 6U) {
107 ImGui::Text(
"%.*s: float[%.2f, %.2f, %.2f, %.2f, %.2f, %.2f]", StringViewFormat(name), value[0], value[1], value[2], value[3], value[4], value[5]);
110 ImGui::Text(
"%.*s: float[%zu]", StringViewFormat(name), value.size());
114 case PropertyType::IntArray: {
115 const std::span<const int32_t> value = scene.properties.getIntArray(i);
116 ImGui::Text(
"%.*s: int[%zu]", StringViewFormat(name), value.size());
119 case PropertyType::UIntArray: {
120 std::span<const uint32_t> value = scene.properties.getUIntArray(i);
121 ImGui::Text(
"%.*s: uint[%zu]", StringViewFormat(name), value.size());
124 case PropertyType::DoubleArray: {
125 const std::span<const double> value = scene.properties.getDoubleArray(i);
126 ImGui::Text(
"%.*s: double[%zu]", StringViewFormat(name), value.size());
130 ImGui::Text(
"%.*s: ???", StringViewFormat(name));
138 if (definition.numChildren > 0) {
139 if (ImGui::TreeNode(
"Children")) {
140 uint32_t children = definition.numChildren;
141 uint32_t index = definition.firstChild;
142 while (index < scene.entities.size() && children > 0) {
143 const auto & child = scene.entities[index];
145 if (child.parentIndex == definition.index) {
146 showEntityDefinition(scene, child);
163 void assetInspector(Context* context)
165 auto assets = context->assetManager->getAllocatedResources();
167 for (
auto& resource : assets) {
168 auto asset = (Asset*)resource;
170 ImGui::PushID(asset);
171 std::string_view name = asset->getName();
172 if (name.empty()) name =
"#anonymous";
173 if (ImGui::TreeNode(name.data())) {
174 if (ImGui::Button(
"Reload")) {
175 AssetHandle handle(asset);
176 context->assetManager->reloadAsset(handle);
179 ImGui::Text(
"Name: %.*s", StringViewFormat(name));
181 if (ImGui::TreeNode(
"Scene")) {
182 const SceneDefinition& scene = asset->definition.scene;
184 if (ImGui::TreeNode(
"Property",
"Properties %zu (%s/%s allocated)",
185 scene.properties.getHeaders().size(),
186 byteString(scene.properties.currentByteSize()).c_str(),
187 byteString(scene.properties.allocatedByteSize()).c_str()))
189 std::span<const PropertyInfo> headers = scene.properties.getHeaders();
191 size_t boolCount = 0;
193 size_t int2Count = 0;
194 size_t uintCount = 0;
195 size_t uint2Count = 0;
196 size_t floatCount = 0;
197 size_t float2Count = 0;
198 size_t doubleCount = 0;
199 size_t stringRefCount = 0;
200 size_t stringCount = 0;
201 size_t stringSizes = 0;
202 size_t floatArrayCount = 0;
203 size_t floatArraySizes = 0;
204 size_t intArrayCount = 0;
205 size_t intArraySizes = 0;
206 size_t uintArrayCount = 0;
207 size_t uintArraySizes = 0;
208 size_t doubleArrayCount = 0;
209 size_t doubleArraySizes = 0;
210 for (
const PropertyInfo& info : headers) {
212 case PropertyType::Bool: boolCount++;
break;
213 case PropertyType::Integer: intCount++;
break;
214 case PropertyType::UnsignedInteger: uintCount++;
break;
215 case PropertyType::Float: floatCount++;
break;
216 case PropertyType::Float2: float2Count++;
break;
217 case PropertyType::Double: doubleCount++;
break;
218 case PropertyType::StringRef: stringRefCount++;
break;
219 case PropertyType::String: stringCount++; stringSizes += info.data.size;
break;
220 case PropertyType::FloatArray: floatArrayCount++; floatArraySizes += info.data.size;
break;
221 case PropertyType::IntArray: intArrayCount++; intArraySizes += info.data.size;
break;
222 case PropertyType::UIntArray: uintArrayCount++; uintArraySizes += info.data.size;
break;
223 case PropertyType::DoubleArray: doubleArrayCount++; doubleArraySizes += info.data.size;
break;
229 ImGui::BeginTable(
"sizes", 3, ImGuiTableFlags_SizingFixedFit);
230 ImGui::TableSetupColumn(
"Type", 0);
231 ImGui::TableSetupColumn(
"Count", ImGuiTableColumnFlags_WidthStretch);
232 ImGui::TableSetupColumn(
"ByteSize", ImGuiTableColumnFlags_WidthStretch);
233 ImGui::TableHeadersRow();
236 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"bool");
237 ImGui::TableNextColumn(); ImGui::Text(
"%zu", boolCount);
238 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(boolCount *
sizeof(PropertyInfo)).c_str());
241 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"Int");
242 ImGui::TableNextColumn(); ImGui::Text(
"%zu", intCount);
243 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(intCount *
sizeof(PropertyInfo)).c_str());
246 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"Int2");
247 ImGui::TableNextColumn(); ImGui::Text(
"%zu", int2Count);
248 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(int2Count *
sizeof(PropertyInfo)).c_str());
251 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"Uint");
252 ImGui::TableNextColumn(); ImGui::Text(
"%zu", uintCount);
253 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(uintCount *
sizeof(PropertyInfo)).c_str());
256 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"UInt2");
257 ImGui::TableNextColumn(); ImGui::Text(
"%zu", uint2Count);
258 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(uint2Count *
sizeof(PropertyInfo)).c_str());
261 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"Float");
262 ImGui::TableNextColumn(); ImGui::Text(
"%zu", floatCount);
263 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(floatCount *
sizeof(PropertyInfo)).c_str());
266 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"Float2");
267 ImGui::TableNextColumn(); ImGui::Text(
"%zu", float2Count);
268 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(float2Count *
sizeof(PropertyInfo)).c_str());
271 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"Double");
272 ImGui::TableNextColumn(); ImGui::Text(
"%zu", doubleCount);
273 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(doubleCount *
sizeof(PropertyInfo)).c_str());
275 if (floatArrayCount) {
276 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"Float array");
277 ImGui::TableNextColumn(); ImGui::Text(
"%zu", floatArrayCount);
278 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(floatArrayCount *
sizeof(PropertyInfo) + floatArraySizes).c_str());
281 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"Int array");
282 ImGui::TableNextColumn(); ImGui::Text(
"%zu", intArrayCount);
283 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(intCount *
sizeof(PropertyInfo) + intArraySizes).c_str());
285 if (uintArrayCount) {
286 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"UInt array");
287 ImGui::TableNextColumn(); ImGui::Text(
"%zu", uintArrayCount);
288 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(uintArrayCount *
sizeof(PropertyInfo) + uintArraySizes).c_str());
290 if (doubleArrayCount) {
291 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"Double array");
292 ImGui::TableNextColumn(); ImGui::Text(
"%zu", doubleArrayCount);
293 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(doubleArrayCount *
sizeof(PropertyInfo) + doubleArraySizes).c_str());
295 if (stringRefCount) {
296 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"String ref");
297 ImGui::TableNextColumn(); ImGui::Text(
"%zu", stringRefCount);
298 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(stringRefCount *
sizeof(PropertyInfo)).c_str());
301 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"String");
302 ImGui::TableNextColumn(); ImGui::Text(
"%zu", stringCount);
303 ImGui::TableNextColumn(); ImGui::TextUnformatted(byteString(stringCount *
sizeof(PropertyInfo) + stringSizes).c_str());
309 ImGui::BeginTable(
"contents", 4, ImGuiTableFlags_SizingFixedFit);
310 ImGui::TableSetupColumn(
"Index", 0);
311 ImGui::TableSetupColumn(
"Key", 0);
312 ImGui::TableSetupColumn(
"Type", 0);
313 ImGui::TableSetupColumn(
"Value", ImGuiTableColumnFlags_WidthStretch);
314 ImGui::TableHeadersRow();
316 for (
size_t i = 0, n = headers.size(); i < n; i++) {
317 const PropertyInfo& info = headers[i];
318 ImGui::TableNextColumn(); ImGui::Text(
"%zu", i);
319 ImGui::TableNextColumn(); ImGui::TextUnformatted(Strings::getC(info.key));
321 case PropertyType::Bool:
322 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"bool");
323 ImGui::TableNextColumn(); ImGui::TextUnformatted(info.boolValue ?
"true" :
"false");
325 case PropertyType::Integer:
326 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"int");
327 ImGui::TableNextColumn(); ImGui::Text(
"%d", info.intValue);
329 case PropertyType::UnsignedInteger:
330 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"uint");
331 ImGui::TableNextColumn(); ImGui::Text(
"0x%08x", info.uintValue);
333 case PropertyType::Float:
334 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"float");
335 ImGui::TableNextColumn(); ImGui::Text(
"%.2f", info.floatValue);
337 case PropertyType::Double:
338 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"double");
339 ImGui::TableNextColumn(); ImGui::Text(
"%.2f", info.doubleValue);
341 case PropertyType::Float2:
342 case PropertyType::FloatArray: {
343 const std::span<const float> value = scene.properties.getFloatArray(uint32_t(i));
344 ImGui::TableNextColumn(); ImGui::Text(
"float[%zu]", value.size());
345 ImGui::TableNextColumn();
346 switch (value.size()) {
347 case 0: ImGui::TextUnformatted(
"{ }");
break;
348 case 1: ImGui::Text(
"{ %.2f }", value[0]);
break;
349 case 2: ImGui::Text(
"{ %.2f, %.2f }", value[0], value[1]);
break;
350 case 3: ImGui::Text(
"{ %.2f, %.2f, %.2f }", value[0], value[1], value[2]);
break;
351 case 6: ImGui::Text(
"{ %.2f, %.2f, %.2f, %.2f, %.2f, %.2f }", value[0], value[1], value[2], value[3], value[4], value[5]);
break;
352 default:ImGui::Text(
"{ %.2f, %.2f, %.2f, ... }", value[0], value[1], value[2]);
break;
356 case PropertyType::Int2:
357 case PropertyType::IntArray: {
358 const std::span<const int32_t> value = scene.properties.getIntArray(uint32_t(i));
359 ImGui::TableNextColumn(); ImGui::Text(
"int[%zu]", value.size());
360 ImGui::TableNextColumn();
361 switch (value.size()) {
362 case 0: ImGui::TextUnformatted(
"{ }");
break;
363 case 1: ImGui::Text(
"{ %d }", value[0]);
break;
364 case 2: ImGui::Text(
"{ %d, %d }", value[0], value[1]);
break;
365 case 3: ImGui::Text(
"{ %d, %d, %d }", value[0], value[1], value[2]);
break;
366 default:ImGui::Text(
"{ %d, %d, %d, ... }", value[0], value[1], value[2]);
break;
370 case PropertyType::UInt2:
371 case PropertyType::UIntArray: {
372 const std::span<const uint32_t> value = scene.properties.getUIntArray(uint32_t(i));
373 ImGui::TableNextColumn(); ImGui::Text(
"uint[%zu]", value.size());
374 ImGui::TableNextColumn();
375 switch (value.size()) {
376 case 0: ImGui::TextUnformatted(
"{ }");
break;
377 case 1: ImGui::Text(
"{ %u }", value[0]);
break;
378 case 2: ImGui::Text(
"{ %u, %u }", value[0], value[1]);
break;
379 case 3: ImGui::Text(
"{ %u, %u, %u }", value[0], value[1], value[2]);
break;
380 default:ImGui::Text(
"{ %u, %u, %u, ... }", value[0], value[1], value[2]);
break;
384 case PropertyType::DoubleArray: {
385 const std::span<const double> value = scene.properties.getDoubleArray(uint32_t(i));
386 ImGui::TableNextColumn(); ImGui::Text(
"double[%zu]", value.size());
387 ImGui::TableNextColumn();
388 switch (value.size()) {
389 case 0: ImGui::TextUnformatted(
"{ }");
break;
390 case 1: ImGui::Text(
"{ %.2f }", value[0]);
break;
391 case 2: ImGui::Text(
"{ %.2f, %.2f }", value[0], value[1]);
break;
392 case 3: ImGui::Text(
"{ %.2f, %.2f, %.2f }", value[0], value[1], value[2]);
break;
393 default:ImGui::Text(
"{ %.2f, %.2f, %.2f, ... }", value[0], value[1], value[2]);
break;
397 case PropertyType::StringRef: {
398 std::string_view value = scene.properties.getString(info);
399 ImGui::TableNextColumn(); ImGui::Text(
"string ref[%zu]", value.size());
400 ImGui::TableNextColumn(); ImGui::Text(
"%.*s", StringViewFormat(value));
403 case PropertyType::String: {
404 std::string_view value = scene.properties.getString(info);
405 ImGui::TableNextColumn(); ImGui::Text(
"string[%zu]", value.size());
406 ImGui::TableNextColumn(); ImGui::Text(
"%.*s", StringViewFormat(value));
410 ImGui::TableNextColumn(); ImGui::TextUnformatted(
"???");
411 ImGui::TableNextRow();
422 for (
auto& d : asset->definition.scene.entities) {
423 if (d.parentIndex == SceneEntityDefinition::NoIndex || d.isParentedByName()) {
424 showEntityDefinition(asset->definition.scene, d);
431 if (ImGui::TreeNode(
"Models")) {
432 for (
auto& m : asset->models) {
433 ImGui::PushID(m.resolve());
434 showModel(context, m.resolve(), std::string(m->getName()));
441 if (ImGui::TreeNode(
"Textures")) {
442 for (
auto& t : asset->textures) {
443 ImGui::PushID(t.resolve());
444 showTexture(context,
dynamic_cast<Cogs::Core::Renderer*
>(context->renderer), t.resolve(),
false);
459 void assetInstanceInspector(Context * context)
461 for (
auto & assetComponent : context->assetSystem->pool) {
462 ImGui::PushID(&assetComponent);
464 const auto & data = context->assetSystem->getData<AssetData>(&assetComponent);
466 std::string name = data.asset ? IO::stem(data.asset->getName()) :
"Asset: N/A";
468 if (ImGui::TreeNode(name.c_str())) {
469 auto stats = context->assetSystem->getStats(&assetComponent);
471 ImGui::Columns(4,
"Stats");
475 ImGui::Text(
"Current");
478 ImGui::Text(
"Projected");
481 ImGui::Text(
"Limit");
486#if ENABLE_COST_TRACKING
489 ImGui::Text(
"Memory");
492 ImGui::Text(
"%" PRIx64
"u", stats->current.memory);
495 ImGui::Text(
"%" PRIx64
"u", stats->projected.memory);
498 ImGui::Text(
"%" PRIx64
"u", stats->max.memory);
503 ImGui::Text(
"Draw calls");
506 ImGui::Text(
"%u", stats->current.drawCalls);
509 ImGui::Text(
"%u", stats->projected.drawCalls);
512 ImGui::Text(
"%u", stats->max.drawCalls);
517 ImGui::Text(
"Primitives");
520 ImGui::Text(
"%u", stats->current.primitiveCount);
523 ImGui::Text(
"%u", stats->projected.primitiveCount);
526 ImGui::Text(
"%u", stats->max.primitiveCount);
533 ImGui::Text(
"Entities spawned: %d", stats->frame.spawnedEntities);
534 ImGui::Text(
"Entities destroyed: %d", stats->frame.destroyedEntities);
535 ImGui::Text(
"Entities alive: %d", stats->numEntities);
537#if ENABLE_COST_TRACKING
538 ImGui::Text(
"Tolerance scale: %f", stats->toleranceScale);
540 ImGui::Text(
"Requests: %u", stats->numRequests);
544 ImGui::Text(
"Frustum cull in: %d", stats->frustumCullIn);
545 ImGui::Text(
"Frustum cull out: %d", stats->frustumCullOut);
546 ImGui::Text(
"BBox cull out: %d", stats->bboxCullOut);
559void Cogs::Core::assetInspector(Context * context,
bool * show)
562 ImGui::SetNextWindowSize(ImVec2(600, 1000), ImGuiCond_FirstUseEver);
564 ImGui::Begin(
"Assets", show, 0);
566 if (ImGui::CollapsingHeader(
"Assets")) {
567 assetInspector(context);
569 if (ImGui::CollapsingHeader(
"Assets instances")) {
570 assetInstanceInspector(context);
576void Cogs::Core::assetQueueInspector(Context* context,
bool* show)
579 ImGui::SetNextWindowSize(ImVec2(600, 600), ImGuiCond_FirstUseEver);
580 ImGui::Begin(
"Asset Queue", show, 0);
582 auto pendingAssets = context->assetSystem->getPendingRequests();
583 auto inFlightAssets = context->assetSystem->getInFlightRequests();
584 auto buttonSize = ImVec2(70, 30);
586 if (!pendingAssets.empty()) {
587 assetsInQueueGraph.push_back(
static_cast<float>(pendingAssets.size()));
589 std::vector<std::string> assetsInQueuePaths;
590 assetsInQueuePaths.reserve(pendingAssets.size());
592 for (
auto& resource : pendingAssets) {
593 assetsInQueuePaths.emplace_back(resource->path);
595 assetsInQueueHistory.push_back(assetsInQueuePaths);
597 assetsInQueueTotal = pendingAssets.size();
599 if (!inFlightAssets.empty()) {
600 assetsProcessingGraph.push_back(
static_cast<float>(inFlightAssets.size()));
601 std::vector<std::string> assetsProcessingPaths;
602 assetsProcessingPaths.reserve(inFlightAssets.size());
604 for (
auto& resource : inFlightAssets) {
605 assetsProcessingPaths.emplace_back(resource->path);
607 assetsProcessingHistory.emplace_back(std::move(assetsProcessingPaths));
609 assetsProcessingTotal = inFlightAssets.size();
612 while (assetsInQueueGraph.size() >
static_cast<size_t>(assetsInQueueGraphScale)) {
613 assetsInQueueGraph.erase(assetsInQueueGraph.begin());
614 assetsInQueueHistory.erase(assetsInQueueHistory.begin());
617 while (assetsProcessingGraph.size() >
static_cast<size_t>(assetsProcessingGraphScale)) {
618 assetsProcessingGraph.erase(assetsProcessingGraph.begin());
619 assetsProcessingHistory.erase(assetsProcessingHistory.begin());
622 assetsInQueueGraphHeight = std::max(assetsInQueueGraphHeight,
static_cast<float>(pendingAssets.size()));
623 assetsProcessingGraphHeight = std::max(assetsProcessingGraphHeight,
static_cast<float>(inFlightAssets.size()));
624 ImGui::PlotHistogram(
"", assetsInQueueGraph.data(),
static_cast<int>(assetsInQueueGraph.size()), 0,
nullptr, 0, assetsInQueueGraphHeight, ImVec2((ImGui::GetWindowContentRegionMax().x - ImGui::GetWindowContentRegionMin().x) / 2, 150.f));
626 ImGui::PlotHistogram(
"", assetsProcessingGraph.data(),
static_cast<int>(assetsProcessingGraph.size()), 0,
nullptr, 0, assetsProcessingGraphHeight, ImVec2((ImGui::GetWindowContentRegionMax().x - ImGui::GetWindowContentRegionMin().x) / 2 - 8.f, 150.f));
628 ImGui::Text(
"Pending requests: %zu", assetsInQueueTotal);
630 ImGui::SetCursorPosX((ImGui::GetWindowContentRegionMax().x - ImGui::GetWindowContentRegionMin().x) / 2 + 15.f);
631 ImGui::Text(
"In flight requests: %zu", assetsProcessingTotal);
633 ImGui::PushItemWidth((ImGui::GetWindowContentRegionMax().x - ImGui::GetWindowContentRegionMin().x) / 2 - 80.f);
634 ImGui::SliderInt(
"Pending scale", &assetsInQueueGraphScale, 10, 150);
635 ImGui::PopItemWidth();
637 ImGui::PushItemWidth((ImGui::GetWindowContentRegionMax().x - ImGui::GetWindowContentRegionMin().x) / 2 - 90.f);
638 ImGui::SetCursorPosX((ImGui::GetWindowContentRegionMax().x - ImGui::GetWindowContentRegionMin().x) / 2 + 15.f);
639 ImGui::SliderInt(
"In flight scale", &assetsProcessingGraphScale, 10, 300);
640 ImGui::PopItemWidth();
642 if (ImGui::Button(
"Reset all", buttonSize)) {
643 assetsProcessingGraph.clear();
644 assetsProcessingHistory.clear();
645 assetsProcessingTotal = 0;
646 assetsInQueueGraph.clear();
647 assetsInQueueHistory.clear();
648 assetsInQueueTotal = 0;
653 for (
size_t i = 0; i < std::max(assetsInQueueHistory.size(), assetsProcessingHistory.size()); i++) {
656 header += std::to_string(i);
657 if (i < assetsInQueueHistory.size()) {
658 header +=
" Pending: ";
659 header += std::to_string(assetsInQueueHistory[i].size());
661 if (i < assetsProcessingHistory.size()) {
662 header +=
" In Flight: ";
663 header += std::to_string(assetsProcessingHistory[i].size());
665 if (ImGui::CollapsingHeader(header.c_str())) {
666 ImGui::Text(
"----------------Pending Requests----------------");
667 if (i < assetsInQueueHistory.size()) {
668 for (
const std::string& assetName : assetsInQueueHistory[i]) {
669 ImGui::TextWrapped(
"%s", assetName.c_str());
672 ImGui::Text(
"----------------In Flight Requests-----------------");
673 if (i < assetsProcessingHistory.size()) {
674 for (
const std::string& assetName : assetsProcessingHistory[i]) {
675 ImGui::TextWrapped(
"%s", assetName.c_str());
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....