Rigs of Rods 2026.01
Soft-body Physics Simulation
Loading...
Searching...
No Matches
OgreImGuiOverlay.h
Go to the documentation of this file.
1// This file is part of the OGRE project.
2// It is subject to the license terms in the LICENSE file found in the top-level directory
3// of this distribution and at https://www.ogre3d.org/licensing.
4
5#pragma once
6
7#include <OgreOverlay.h>
8
9#include <imgui.h>
10
11namespace Ogre
12{
13class ImGuiOverlay : public Overlay
14{
15public:
18
21 ImFont* addFont(const String& name, const String& group OGRE_RESOURCE_GROUP_INIT, float size_scale = 1.f);
22
24 void rebuildFontTexture();
25
26 static void NewFrame(const FrameEvent& evt);
27
28 void _findVisibleObjects(Camera* cam, RenderQueue* queue, Viewport* vp);
29
30 void initialise(); // RIGSOFRODS: Private and non-virtual in OGRE... how does it even work?
31
32private:
33
34 typedef std::vector<ImWchar> CodePointRange;
35 std::vector<CodePointRange> mCodePointRanges;
36
37 class ImGUIRenderable : public Ogre::Renderable
38 {
39 public:
42
43 void initialise();
44
45 void updateVertexData(const ImVector<ImDrawVert>& vtxBuf, const ImVector<ImDrawIdx>& idxBuf);
46
47 bool preRender(SceneManager* sm, RenderSystem* rsys);
48
49 virtual void getWorldTransforms(Matrix4* xform) const { *xform = mXform; }
50 virtual void getRenderOperation(RenderOperation& op) { op = mRenderOp; }
51
52 const LightList& getLights(void) const;
53
54 void createMaterial();
55 void createFontTexture();
56
57 const MaterialPtr& getMaterial() const { return mMaterial; }
58
59 Real getSquaredViewDepth(const Camera*) const { return 0; }
60
61 void _update();
62
64
65 Matrix4 mXform;
66 RenderOperation mRenderOp;
67 TexturePtr mFontTex;
68 MaterialPtr mMaterial;
69 };
70
72};
73} // namespace Ogre
74
Real getSquaredViewDepth(const Camera *) const
const LightList & getLights(void) const
virtual void getWorldTransforms(Matrix4 *xform) const
void updateVertexData(const ImVector< ImDrawVert > &vtxBuf, const ImVector< ImDrawIdx > &idxBuf)
const MaterialPtr & getMaterial() const
bool preRender(SceneManager *sm, RenderSystem *rsys)
virtual void getRenderOperation(RenderOperation &op)
ImGUIRenderable mRenderable
void rebuildFontTexture()
RIGSOFRODS: re-create the font texture after fonts were changed (i.e. io.Fonts->Clear() + addFont())
void _findVisibleObjects(Camera *cam, RenderQueue *queue, Viewport *vp)
static void NewFrame(const FrameEvent &evt)
std::vector< CodePointRange > mCodePointRanges
ImFont * addFont(const String &name, const String &group OGRE_RESOURCE_GROUP_INIT, float size_scale=1.f)
add font from ogre .fontdef file must be called before first show() or followed by rebuildFontTexture...
std::vector< ImWchar > CodePointRange