Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.blamite
The core library for the Blamite Game Engine.
ogre_hlms_debug.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../../debug_ui.h"
4 
5 #include <limits.h>
6 #include <OGRE/OgreSceneManager.h>
7 #include <OGRE/OgreRoot.h>
8 #include <OGRE/OgreHlms.h>
9 #include <OGRE/OgreHlmsManager.h>
10 #include <Strings/components/utils/list/list.h>
11 
14 
15 namespace Blam::DebugUI::Windows
16 {
21  {
22  private:
23  std::vector<std::string> ignored_datablocks = std::vector<std::string>();
24 
25  void DrawHlmsGroup(std::string name, Ogre::Hlms* hlms)
26  {
27  if (ImGui::CollapsingHeader(name.c_str()))
28  {
29  Ogre::Hlms::HlmsDatablockMap datablocks = hlms->getDatablockMap();
30  Ogre::Hlms::HlmsDatablockMap::iterator it;
31 
32  ImGui::Indent(10.0f);
33 
34  if (hlms)
35  {
36  if (ImGui::Button("ignore all current datablocks"))
37  {
38  for (it = datablocks.begin(); it != datablocks.end(); it++)
39  {
40  Ogre::Hlms::DatablockEntry entry = it->second;
41  ignored_datablocks.push_back(entry.name);
42  }
43  }
44 
45  std::string total_datablocks = "total datablocks: " + std::to_string(hlms->getDatablockMap().size());
46  ImGui::Text(total_datablocks.c_str());
47 
48  for (it = datablocks.begin(); it != datablocks.end(); it++)
49  {
50  Ogre::Hlms::DatablockEntry entry = it->second;
51 
52  if (BlamStrings::Utils::List::Contains(ignored_datablocks, entry.name))
53  {
54  continue;
55  }
56 
57  if (ImGui::CollapsingHeader(entry.name.c_str()))
58  {
59  std::string name = "name: " + entry.name;
60  std::string visible_to_manager = "visible to manager: " + std::to_string(entry.visibleToManager);
61 
62  ImGui::Text(name.c_str());
63  ImGui::Text(visible_to_manager.c_str());
64  }
65  }
66  }
67  else
68  {
69  ImGui::Text("hlms was nullptr");
70  }
71 
72  ImGui::Unindent(10.0f);
73  }
74  }
75 
76  public:
77  void Draw()
78  {
79  if (show)
80  {
81  if (ImGui::Begin("Ogre HLMS Debug", &show))
82  {
84 
86  {
87  if (ignored_datablocks.size() > 0)
88  {
89  std::string total_datablocks = "ignored datablocks: " + std::to_string(ignored_datablocks.size());
90  ImGui::Text(total_datablocks.c_str());
91 
92  if (ImGui::Button("clear ignore list"))
93  {
94  ignored_datablocks.clear();
95  }
96  }
97 
98  DrawHlmsGroup("pbs", ogre_graphics_system->getRoot()->getHlmsManager()->getHlms(Ogre::HlmsTypes::HLMS_PBS));
99  DrawHlmsGroup("unlit", ogre_graphics_system->getRoot()->getHlmsManager()->getHlms(Ogre::HlmsTypes::HLMS_UNLIT));
100  }
101  else
102  {
103  ImGui::Text("ogre graphics system was nullptr");
104  }
105  }
106  ImGui::End();
107  }
108  }
109  };
110 }
BlamRendering::OGRE::GetGraphicsSystem
BLAM Demo::GraphicsSystem * GetGraphicsSystem()
Definition: ogre.cpp:343
Blam::DebugUI::Windows::OgreHlmsDebug::Draw
void Draw()
Draws the contents of the group.
Definition: ogre_hlms_debug.hpp:77
ImGui::End
IMGUI_API void End()
Definition: imgui.cpp:6016
ogre_graphics_system
Demo::GraphicsSystem * ogre_graphics_system
Definition: ogre.cpp:51
imgui_stdlib.h
rendering.h
ImGui::Begin
IMGUI_API bool Begin(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
Definition: imgui.cpp:5397
ImGui::CollapsingHeader
IMGUI_API bool CollapsingHeader(const char *label, ImGuiTreeNodeFlags flags=0)
Definition: imgui_widgets.cpp:5422
ImGui::Unindent
IMGUI_API void Unindent(float indent_w=0.0f)
Definition: imgui.cpp:7178
ImGui::Text
IMGUI_API void Text(const char *fmt,...) IM_FMTARGS(1)
Definition: imgui_widgets.cpp:238
Blam::DebugUI::ImGUIDrawingGroup::show
bool show
Controls whether or not the group should be shown. May not be used in all groups.
Definition: debug_ui.h:362
Blam::DebugUI::Windows::OgreHlmsDebug
Class for the Ogre HLMS Debug utility.
Definition: ogre_hlms_debug.hpp:20
Blam::DebugUI::ImGUIDrawingGroup
Class representing an ImGUI drawing group/draw list item.
Definition: debug_ui.h:359
it
ARPHIC PUBLIC LICENSE Ltd Yung Chi Taiwan All rights reserved except as specified below Everyone is permitted to copy and distribute verbatim copies of this license but changing it is forbidden Preamble The licenses for most software are designed to take away your freedom to share and change it By the ARPHIC PUBLIC LICENSE specifically permits and encourages you to use this provided that you give the recipients all the rights that we gave you and make sure they can get the modifications of this software Legal Terms Font means the TrueType fonts AR PL Mingti2L AR PL KaitiM AR PL KaitiM and the derivatives of those fonts created through any modification including modifying reordering converting changing font or adding deleting some characters in from glyph table PL means Public License Copyright Holder means whoever is named in the copyright or copyrights for the Font You means the or person redistributing or modifying the Font Freely Available means that you have the freedom to copy or modify the Font as well as redistribute copies of the Font under the same conditions you not price If you you can charge for this service Copying &Distribution You may copy and distribute verbatim copies of this Font in any without provided that you retain this license including modifying reordering converting changing font or adding deleting some characters in from glyph and copy and distribute such modifications under the terms of Section provided that the following conditions are such as by offering access to copy the modifications from a designated or distributing the modifications on a medium customarily used for software interchange c If the modified fonts normally reads commands interactively when you must cause it
Definition: ARPHICPL.TXT:36
Demo::GraphicsSystem
Definition: GraphicsSystem.h:26
Blam::DebugUI::Windows
Legacy namespace to contain data for the legacy ImGUI console.
Definition: ui.h:26
ImGui::Indent
IMGUI_API void Indent(float indent_w=0.0f)
Definition: imgui.cpp:7170
Demo::GraphicsSystem::getRoot
Ogre::Root * getRoot(void) const
Definition: GraphicsSystem.h:144
ImGui::Button
IMGUI_API bool Button(const char *label, const ImVec2 &size=ImVec2(0, 0))
Definition: imgui_widgets.cpp:644
name
ARPHIC PUBLIC LICENSE Ltd Yung Chi Taiwan All rights reserved except as specified below Everyone is permitted to copy and distribute verbatim copies of this license but changing it is forbidden Preamble The licenses for most software are designed to take away your freedom to share and change it By the ARPHIC PUBLIC LICENSE specifically permits and encourages you to use this provided that you give the recipients all the rights that we gave you and make sure they can get the modifications of this software Legal Terms Font means the TrueType fonts AR PL Mingti2L AR PL KaitiM AR PL KaitiM and the derivatives of those fonts created through any modification including modifying reordering converting changing font name
Definition: ARPHICPL.TXT:16