Cogs.Core
ModelInspector.cpp
1#include "Inspectors.h"
2#include "Context.h"
3#include "InspectorGuiHelper.h"
4
5#include "Resources/ModelManager.h"
6#include "Resources/MaterialInstance.h"
7#include "Resources/Texture.h"
8
9#include "Rendering/Common.h"
10
11#include "Foundation/Reflection/TypeDatabase.h"
12
13#include "imgui.h"
14
15using namespace Cogs::Reflection;
16using namespace Cogs::Core;
17
18void Cogs::Core::modelInspector(Context * context, bool * show)
19{
20 if (*show) {
21 ImGui::SetNextWindowSize(ImVec2(600, 800), ImGuiCond_Once);
22
23 guiBegin("Models", show);
24
25 auto models = context->modelManager->getAllocatedResources();
26
27 int id = 0;
28 for (auto & m : models) {
29 auto model = static_cast<Model *>(m);
30 std::string header;
31 if (model->getName()) {
32 header.append(model->getName());
33 }
34 else if (model->getSource()) {
35 header.append(model->getSource());
36 }
37 else {
38 header.append("Model ");
39 header.append(std::to_string(id++));
40 }
41 header.append(" [");
42 header.append(std::to_string(model->referenceCount()));
43 header.append(" refs]");
44 showModel(context, model, header);
45 }
46
47 guiEnd();
48 }
49}
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....
Contains reflection support.
Definition: Component.h:11
Model resources define a template for a set of connected entities, with resources such as meshes,...
Definition: Model.h:56