This repository has been archived by the owner on Sep 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
/
ImguiManager.h
84 lines (60 loc) · 2.36 KB
/
ImguiManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#pragma once
#include <imgui.h>
#include <OgrePrerequisites.h>
#include <OgreRenderQueueListener.h>
#include <OgreSingleton.h>
#include <OgreTexture.h>
#include <OgreResourceGroupManager.h>
#include <OgreRenderable.h>
#include <OgreRenderOperation.h>
namespace OgreBites
{
struct InputListener;
}
namespace Ogre
{
class SceneManager;
class ImguiManager : public RenderQueueListener, public Singleton<ImguiManager>
{
public:
static void createSingleton();
ImguiManager();
~ImguiManager();
/// add font from ogre .fontdef file
/// must be called before init()
ImFont* addFont(const String& name, const String& group OGRE_RESOURCE_GROUP_INIT);
virtual void init(Ogre::SceneManager* mgr);
virtual void newFrame(float deltaTime,const Ogre::Rect & windowRect);
//inherited from RenderQueueListener
virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation,bool& repeatThisInvocation);
OgreBites::InputListener* getInputListener();
static ImguiManager& getSingleton(void);
static ImguiManager* getSingletonPtr(void);
protected:
class ImGUIRenderable : public Renderable
{
protected:
void initImGUIRenderable(void);
public:
ImGUIRenderable();
~ImGUIRenderable();
void updateVertexData(const ImVector<ImDrawVert>& vtxBuf, const ImVector<ImDrawIdx>& idxBuf);
Real getSquaredViewDepth(const Camera* cam) const { (void)cam; return 0; }
virtual const MaterialPtr& getMaterial(void) const { return mMaterial; }
virtual void getWorldTransforms( Matrix4* xform ) const { *xform = mXform; }
virtual void getRenderOperation( RenderOperation& op ) { op = mRenderOp; }
virtual const LightList& getLights(void) const;
MaterialPtr mMaterial;
Matrix4 mXform;
RenderOperation mRenderOp;
};
void createFontTexture();
void createMaterial();
SceneManager* mSceneMgr;
ImGUIRenderable mRenderable;
TexturePtr mFontTex;
bool mFrameEnded;
typedef std::vector<ImWchar> CodePointRange;
std::vector<CodePointRange> mCodePointRanges;
};
}