瀏覽代碼

GL3 renderer: Add utility functions

To more easily enable client projects to render with their own shaders.
Michael Ragazzon 11 月之前
父節點
當前提交
d02fb09957
共有 2 個文件被更改,包括 15 次插入0 次删除
  1. 10 0
      Backends/RmlUi_Renderer_GL3.cpp
  2. 5 0
      Backends/RmlUi_Renderer_GL3.h

+ 10 - 0
Backends/RmlUi_Renderer_GL3.cpp

@@ -2140,6 +2140,16 @@ const Gfx::FramebufferData& RenderInterface_GL3::RenderLayerStack::EnsureFramebu
 	return fb;
 }
 
+const Rml::Matrix4f& RenderInterface_GL3::GetTransform() const
+{
+	return transform;
+}
+
+void RenderInterface_GL3::ResetProgram()
+{
+	UseProgram(ProgramId::None);
+}
+
 bool RmlGL3::Initialize(Rml::String* out_message)
 {
 #if defined RMLUI_PLATFORM_EMSCRIPTEN

+ 5 - 0
Backends/RmlUi_Renderer_GL3.h

@@ -100,6 +100,11 @@ public:
 	// Can be passed to RenderGeometry() to leave the bound texture and used program unchanged.
 	static constexpr Rml::TextureHandle TexturePostprocess = Rml::TextureHandle(-2);
 
+	// -- Utility functions for clients --
+
+	const Rml::Matrix4f& GetTransform() const;
+	void ResetProgram();
+
 private:
 	void UseProgram(ProgramId program_id);
 	int GetUniformLocation(UniformId uniform_id) const;