Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.blamite
The core library for the Blamite Game Engine.
ogre_scene_editor.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 
10 
11 namespace Blam::DebugUI::Windows
12 {
17  {
18  private:
19  void ShowSceneNodeControls(Ogre::Node* node, int iterator_index)
20  {
21  if (!node)
22  {
23  return;
24  }
25 
26  std::string entry_name = node->getName() + "##" + node->getName() + std::to_string(iterator_index);
27 
28  if (ImGui::CollapsingHeader(entry_name.c_str()))
29  {
30  Ogre::Vector3 position = node->getPosition();
31  Ogre::Quaternion orientation = node->getOrientation();
32  Ogre::Vector3 scale = node->getScale();
33 
34  std::string position_name = "position##" + node->getName() + std::to_string(iterator_index);
35  std::string orientation_name = "orientation##" + node->getName() + std::to_string(iterator_index);
36  std::string scale_name = "scale##" + node->getName() + std::to_string(iterator_index);
37 
38  if (ImGui::DragFloat3(position_name.c_str(), (float*)&position))
39  {
40  node->setPosition(position);
41  }
42 
43  if (ImGui::DragFloat4(orientation_name.c_str(), (float*)&orientation))
44  {
45  node->setOrientation(orientation);
46  }
47 
48  if (ImGui::DragFloat3(scale_name.c_str(), (float*)&scale))
49  {
50  node->setScale(scale);
51  }
52 
53  if (node->numChildren() > 0)
54  {
55  std::string child_count_message = "children: " + std::to_string(node->numChildren());
56  ImGui::Text(child_count_message.c_str());
57 
58  Ogre::Node::NodeVecIterator it = node->getChildIterator();
59  ImGui::Indent(20.0f);
60  int index = 0;
61  while (it.current() != it.end())
62  {
63  Ogre::Node* node = it.getNext();
64  ShowSceneNodeControls(node, index);
65  index++;
66  }
67  ImGui::Unindent(20.0f);
68  }
69  }
70  }
71 
72  public:
73  void Draw()
74  {
75  if (show)
76  {
77  if (ImGui::Begin("Ogre Scene Editor", &show))
78  {
80 
82  {
83  Ogre::SceneNode* root = ogre_graphics_system->getSceneManager()->getRootSceneNode();
84  Ogre::SceneNode* root_2d = BlamRendering::OGRE::Get2DSceneManager()->getRootSceneNode();
85 
86  if (ImGui::CollapsingHeader("world"))
87  {
88  ShowSceneNodeControls(root, 0);
89  }
90 
91  if (ImGui::CollapsingHeader("2d ortho"))
92  {
93  ShowSceneNodeControls(root_2d, 0);
94  }
95  }
96  else
97  {
98  ImGui::Text("ogre graphics system was nullptr");
99  }
100  }
101  ImGui::End();
102  }
103  }
104  };
105 }
Blam::DebugUI::Windows::OgreSceneEditor::Draw
void Draw()
Draws the contents of the group.
Definition: ogre_scene_editor.hpp:73
BlamRendering::OGRE::GetGraphicsSystem
BLAM Demo::GraphicsSystem * GetGraphicsSystem()
Definition: ogre.cpp:343
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
Demo::GraphicsSystem::getSceneManager
Ogre::SceneManager * getSceneManager(void) const
Definition: GraphicsSystem.h:146
BlamRendering::OGRE::Get2DSceneManager
BLAM Ogre::SceneManager * Get2DSceneManager()
Definition: ogre.cpp:395
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::ImGUIDrawingGroup
Class representing an ImGUI drawing group/draw list item.
Definition: debug_ui.h:359
ImGui::DragFloat3
IMGUI_API bool DragFloat3(const char *label, float v[3], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", float power=1.0f)
Definition: imgui_widgets.cpp:2174
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
ImGui::DragFloat4
IMGUI_API bool DragFloat4(const char *label, float v[4], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", float power=1.0f)
Definition: imgui_widgets.cpp:2179
Blam::DebugUI::Windows
Legacy namespace to contain data for the legacy ImGUI console.
Definition: ui.h:26
Blam::DebugUI::Windows::OgreSceneEditor
Class for the Ogre Scene Editor utility.
Definition: ogre_scene_editor.hpp:16
ImGui::Indent
IMGUI_API void Indent(float indent_w=0.0f)
Definition: imgui.cpp:7170