Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.blamite
The core library for the Blamite Game Engine.
ogre2_imgui_manager.h
Go to the documentation of this file.
1 #pragma once
2 
4 #include <OGRE/OgrePrerequisites.h>
5 
6 #include <OGRE/OgreRenderQueueListener.h>
7 #include <OGRE/OgreSingleton.h>
8 #include <OGRE/OgreTextureGpu.h>
9 #include <OGRE/OgreResourceGroupManager.h>
10 #include <OGRE/OgreRenderable.h>
11 #include <OGRE/OgreRenderOperation.h>
12 
13 namespace OgreBites
14 {
15  struct InputListener;
16 }
17 
18 namespace Ogre
19 {
20  class SceneManager;
21 
22  class ImguiManager : public RenderQueueListener, public Singleton<ImguiManager>
23  {
24  public:
25  static void createSingleton();
26 
27  ImguiManager();
28  ~ImguiManager();
29 
32  ImFont* addFont(const String& name, const String& group OGRE_RESOURCE_GROUP_INIT);
33 
34  virtual void init(Ogre::SceneManager* mgr);
35 
36  virtual void newFrame(float deltaTime, const Ogre::Rect& windowRect);
37 
38  //inherited from RenderQueueListener
39  virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation, bool& repeatThisInvocation);
40 
41  OgreBites::InputListener* getInputListener();
42 
43  static ImguiManager& getSingleton(void);
44  static ImguiManager* getSingletonPtr(void);
45 
46  protected:
47 
48  class ImGUIRenderable : public Renderable
49  {
50  protected:
51  void initImGUIRenderable(void);
52 
53  public:
56 
57  void updateVertexData(const ImVector<ImDrawVert>& vtxBuf, const ImVector<ImDrawIdx>& idxBuf);
58  Real getSquaredViewDepth(const Camera* cam) const { (void)cam; return 0; }
59 
60  virtual const MaterialPtr& getMaterial(void) const { return mMaterial; }
61  virtual void getWorldTransforms(Matrix4* xform) const { *xform = mXform; }
62  virtual void getRenderOperation(RenderOperation& op) { op = mRenderOp; }
63  virtual const LightList& getLights(void) const;
64 
65  MaterialPtr mMaterial;
66  Matrix4 mXform;
67  RenderOperation mRenderOp;
68 
69  };
70 
71  void createFontTexture();
72  void createMaterial();
73 
74  SceneManager* mSceneMgr;
75 
77  TexturePtr mFontTex;
78 
80 
81  typedef std::vector<ImWchar> CodePointRange;
82  std::vector<CodePointRange> mCodePointRanges;
83  };
84 }
ImFontAtlas::AddFontDefault
IMGUI_API ImFont * AddFontDefault(const ImFontConfig *font_cfg=NULL)
Definition: imgui_draw.cpp:1648
ImGuiIO::KeyAlt
bool KeyAlt
Definition: imgui.h:1415
ImDrawList::VtxBuffer
ImVector< ImDrawVert > VtxBuffer
Definition: imgui.h:1886
ImGuiIO::KeySuper
bool KeySuper
Definition: imgui.h:1416
Ogre::ImguiManager::ImguiManager
ImguiManager()
Definition: ogre2_imgui_manager.cpp:193
ImGui::DestroyContext
IMGUI_API void DestroyContext(ImGuiContext *ctx=NULL)
Definition: imgui.cpp:3290
ImVec4::x
float x
Definition: imgui.h:194
ImGuiIO::MouseDown
bool MouseDown[5]
Definition: imgui.h:1410
Ogre::ImguiManager::mCodePointRanges
std::vector< CodePointRange > mCodePointRanges
Definition: ogre2_imgui_manager.h:82
BlamOgreRenderSystemType::DirectX11
@ DirectX11
render_system_type
BlamOgreRenderSystemType render_system_type
Definition: imgui_impl_ogre2.cpp:18
ImGuiKey_Home
@ ImGuiKey_Home
Definition: imgui.h:944
font
io.Fonts->AddFontFromMemoryCompressedTTF(compressed_data, compressed_data_size, size_pixels,...) font
Definition: README.txt:86
width
int width
Definition: bgfx.cpp:19
ImGuiKey_PageDown
@ ImGuiKey_PageDown
Definition: imgui.h:943
Ogre::ImguiManager::getInputListener
OgreBites::InputListener * getInputListener()
Definition: ogre2_imgui_manager.cpp:214
ImVec4::z
float z
Definition: imgui.h:194
Ogre::ImguiManager::addFont
ImFont * addFont(const String &name, const String &group OGRE_RESOURCE_GROUP_INIT)
add font from ogre .fontdef file must be called before init()
Definition: ogre2_imgui_manager.cpp:348
ImGuiIO::AddInputCharacter
IMGUI_API void AddInputCharacter(unsigned int c)
Definition: imgui.cpp:1259
Ogre::ImguiManager::ImGUIRenderable::getSquaredViewDepth
Real getSquaredViewDepth(const Camera *cam) const
Definition: ogre2_imgui_manager.h:58
Ogre::ImguiManager::createFontTexture
void createFontTexture()
Definition: ogre2_imgui_manager.cpp:386
ImFontAtlas::AddFontFromMemoryTTF
IMGUI_API ImFont * AddFontFromMemoryTTF(void *font_data, int font_size, float size_pixels, const ImFontConfig *font_cfg=NULL, const ImWchar *glyph_ranges=NULL)
Definition: imgui_draw.cpp:1691
Ogre::ImguiManager::ImGUIRenderable::mXform
Matrix4 mXform
Definition: ogre2_imgui_manager.h:66
ImGuiIO::MousePos
ImVec2 MousePos
Definition: imgui.h:1409
ImFontConfig::Name
char Name[40]
Definition: imgui.h:2023
imgui.h
Ogre::ImguiManager::ImGUIRenderable::ImGUIRenderable
ImGUIRenderable()
Definition: ogre2_imgui_manager.cpp:426
Ogre::ImguiManager::ImGUIRenderable::getMaterial
virtual const MaterialPtr & getMaterial(void) const
Definition: ogre2_imgui_manager.h:60
ImFontConfig
Definition: imgui.h:2002
Ogre::ImguiManager::ImGUIRenderable::mMaterial
MaterialPtr mMaterial
Definition: ogre2_imgui_manager.h:65
ImDrawData::CmdListsCount
int CmdListsCount
Definition: imgui.h:1983
ImGuiIO::WantCaptureMouse
bool WantCaptureMouse
Definition: imgui.h:1429
SDLK_UP
@ SDLK_UP
Definition: SdlEmulationLayer.h:485
ImDrawList::CmdBuffer
ImVector< ImDrawCmd > CmdBuffer
Definition: imgui.h:1884
ImDrawList
Definition: imgui.h:1881
ImGuiIO
Definition: imgui.h:1338
ImFontAtlas::GetTexDataAsRGBA32
IMGUI_API void GetTexDataAsRGBA32(unsigned char **out_pixels, int *out_width, int *out_height, int *out_bytes_per_pixel=NULL)
Definition: imgui_draw.cpp:1576
OgreBites
Definition: ogre2_imgui_manager.h:13
ImGuiKey_UpArrow
@ ImGuiKey_UpArrow
Definition: imgui.h:940
ImVec2::x
float x
Definition: imgui.h:181
ImGuiIO::KeysDown
bool KeysDown[512]
Definition: imgui.h:1417
ImDrawCmd::ClipRect
ImVec4 ClipRect
Definition: imgui.h:1794
Ogre::ImguiManager
Definition: ogre2_imgui_manager.h:22
Ogre::ImguiManager::~ImguiManager
~ImguiManager()
Definition: ogre2_imgui_manager.cpp:198
ImVec2
Definition: imgui.h:179
NULL
Add a fourth parameter to bake specific font ranges NULL
Definition: README.txt:57
ImFont
Definition: imgui.h:2180
ImVector::empty
bool empty() const
Definition: imgui.h:1244
Blam::Globals::String
@ String
Represents a std::string.
Definition: globals.h:48
ImGuiIO::Fonts
ImFontAtlas * Fonts
Definition: imgui.h:1359
ImGuiKey_V
@ ImGuiKey_V
Definition: imgui.h:955
ImGuiIO::KeyCtrl
bool KeyCtrl
Definition: imgui.h:1413
ImGui::Render
IMGUI_API void Render()
Definition: imgui.cpp:4248
Ogre::ImguiManager::ImGUIRenderable::getRenderOperation
virtual void getRenderOperation(RenderOperation &op)
Definition: ogre2_imgui_manager.h:62
ImGuiKey_LeftArrow
@ ImGuiKey_LeftArrow
Definition: imgui.h:938
ImGuiIO::KeyShift
bool KeyShift
Definition: imgui.h:1414
ImFontAtlas::Fonts
ImVector< ImFont * > Fonts
Definition: imgui.h:2167
ImDrawData::CmdLists
ImDrawList ** CmdLists
Definition: imgui.h:1982
Ogre::ImguiManager::ImGUIRenderable
Definition: ogre2_imgui_manager.h:48
SDLK_PAGEUP
@ SDLK_PAGEUP
Definition: SdlEmulationLayer.h:478
SDLK_RIGHT
@ SDLK_RIGHT
Definition: SdlEmulationLayer.h:482
ImGui::GetIO
IMGUI_API ImGuiIO & GetIO()
Definition: imgui.cpp:3300
SDLK_LSHIFT
@ SDLK_LSHIFT
Definition: SdlEmulationLayer.h:608
Ogre::ImguiManager::mSceneMgr
SceneManager * mSceneMgr
Definition: ogre2_imgui_manager.h:74
ImGuiIO::WantCaptureKeyboard
bool WantCaptureKeyboard
Definition: imgui.h:1430
Ogre::ImguiManager::ImGUIRenderable::getWorldTransforms
virtual void getWorldTransforms(Matrix4 *xform) const
Definition: ogre2_imgui_manager.h:61
Ogre::ImguiManager::init
virtual void init(Ogre::SceneManager *mgr)
Definition: ogre2_imgui_manager.cpp:204
ImDrawList::IdxBuffer
ImVector< ImDrawIdx > IdxBuffer
Definition: imgui.h:1885
Ogre::ImguiManager::createSingleton
static void createSingleton()
Definition: ogre2_imgui_manager.cpp:175
ImGuiKey_End
@ ImGuiKey_End
Definition: imgui.h:945
ImDrawCmd
Definition: imgui.h:1791
Ogre::ImguiManager::ImGUIRenderable::updateVertexData
void updateVertexData(const ImVector< ImDrawVert > &vtxBuf, const ImVector< ImDrawIdx > &idxBuf)
Definition: ogre2_imgui_manager.cpp:470
ImDrawCmd::TextureId
ImTextureID TextureId
Definition: imgui.h:1795
Ogre::ImguiManager::newFrame
virtual void newFrame(float deltaTime, const Ogre::Rect &windowRect)
Definition: ogre2_imgui_manager.cpp:408
ImGuiKey_Enter
@ ImGuiKey_Enter
Definition: imgui.h:950
Ogre::ImguiManager::renderQueueEnded
virtual void renderQueueEnded(uint8 queueGroupId, const String &invocation, bool &repeatThisInvocation)
Definition: ogre2_imgui_manager.cpp:226
SDLK_LEFT
@ SDLK_LEFT
Definition: SdlEmulationLayer.h:483
imgui_impl_ogre2.h
ImGuiKey_Backspace
@ ImGuiKey_Backspace
Definition: imgui.h:948
ImGuiKey_C
@ ImGuiKey_C
Definition: imgui.h:954
ImVector::size_in_bytes
int size_in_bytes() const
Definition: imgui.h:1246
ImGuiKey_RightArrow
@ ImGuiKey_RightArrow
Definition: imgui.h:939
ImVector< ImDrawVert >
ImVector::size
int size() const
Definition: imgui.h:1245
SDLK_DOWN
@ SDLK_DOWN
Definition: SdlEmulationLayer.h:484
ImWchar
unsigned short ImWchar
Definition: imgui.h:131
ImGuiKey_A
@ ImGuiKey_A
Definition: imgui.h:953
ImGui::GetDrawData
IMGUI_API ImDrawData * GetDrawData()
Definition: imgui.cpp:3313
ImDrawData
Definition: imgui.h:1979
ImGuiIO::DeltaTime
float DeltaTime
Definition: imgui.h:1347
ImGuiKey_Z
@ ImGuiKey_Z
Definition: imgui.h:958
height
int height
Definition: bgfx.cpp:20
ImVec4::w
float w
Definition: imgui.h:194
Ogre::ImguiManager::createMaterial
void createMaterial()
Definition: ogre2_imgui_manager.cpp:326
Ogre::ImguiManager::ImGUIRenderable::~ImGUIRenderable
~ImGUIRenderable()
Definition: ogre2_imgui_manager.cpp:464
ImVec2::y
float y
Definition: imgui.h:181
ImGuiKey_Space
@ ImGuiKey_Space
Definition: imgui.h:949
ImGui::CreateContext
IMGUI_API ImGuiContext * CreateContext(ImFontAtlas *shared_font_atlas=NULL)
Definition: imgui.cpp:3281
Ogre::ImguiManager::CodePointRange
std::vector< ImWchar > CodePointRange
Definition: ogre2_imgui_manager.h:81
ImGuiKey_PageUp
@ ImGuiKey_PageUp
Definition: imgui.h:942
ImGuiKey_Delete
@ ImGuiKey_Delete
Definition: imgui.h:947
ImGuiKey_X
@ ImGuiKey_X
Definition: imgui.h:956
ImGuiKey_DownArrow
@ ImGuiKey_DownArrow
Definition: imgui.h:941
Ogre::ImguiManager::ImGUIRenderable::getLights
virtual const LightList & getLights(void) const
Definition: ogre2_imgui_manager.cpp:492
Ogre::ImguiManager::mFrameEnded
bool mFrameEnded
Definition: ogre2_imgui_manager.h:79
Ogre
Definition: ogre2_imgui_manager.h:18
ImVec4::y
float y
Definition: imgui.h:194
ImFontAtlas::GetGlyphRangesDefault
const IMGUI_API ImWchar * GetGlyphRangesDefault()
Definition: imgui_draw.cpp:2225
Ogre::ImguiManager::ImGUIRenderable::initImGUIRenderable
void initImGUIRenderable(void)
Definition: ogre2_imgui_manager.cpp:435
ImGui::NewFrame
IMGUI_API void NewFrame()
Definition: imgui.cpp:3689
ImGuiIO::KeyMap
int KeyMap[ImGuiKey_COUNT]
Definition: imgui.h:1354
Ogre::ImguiManager::getSingleton
static ImguiManager & getSingleton(void)
Definition: ogre2_imgui_manager.cpp:187
Ogre::ImguiManager::getSingletonPtr
static ImguiManager * getSingletonPtr(void)
Definition: ogre2_imgui_manager.cpp:182
ImVector::Size
int Size
Definition: imgui.h:1229
uint16_t
unsigned short uint16_t
Definition: stdint.h:16
ImGuiKey_Y
@ ImGuiKey_Y
Definition: imgui.h:957
Ogre::ImguiManager::mRenderable
ImGUIRenderable mRenderable
Definition: ogre2_imgui_manager.h:76
ogre2_imgui_manager.h
ImDrawVert
Definition: imgui.h:1813
ImDrawCmd::ElemCount
unsigned int ElemCount
Definition: imgui.h:1793
Ogre::ImguiManager::ImGUIRenderable::mRenderOp
RenderOperation mRenderOp
Definition: ogre2_imgui_manager.h:67
ImGuiIO::MouseWheel
float MouseWheel
Definition: imgui.h:1411
ImVector::Data
T * Data
Definition: imgui.h:1231
ImGuiKey_Tab
@ ImGuiKey_Tab
Definition: imgui.h:937
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
ImGuiKey_Escape
@ ImGuiKey_Escape
Definition: imgui.h:951
ImGuiIO::DisplaySize
ImVec2 DisplaySize
Definition: imgui.h:1346
Ogre::ImguiManager::mFontTex
TexturePtr mFontTex
Definition: ogre2_imgui_manager.h:77
SDLK_PAGEDOWN
@ SDLK_PAGEDOWN
Definition: SdlEmulationLayer.h:481