First-pass of a plugin system for GUI elements.

Refactor filament's debug drawing to be one such plugin.

PiperOrigin-RevId: 859002002
Change-Id: Ibe9000dec19fce648eef6d57170ce435b9a8c6ff
This commit is contained in:
Haroon Qureshi
2026-01-21 02:46:40 -08:00
committed by Copybara-Service
parent bf05bb1885
commit e2180ff744
10 changed files with 176 additions and 29 deletions
+12
View File
@@ -20,6 +20,7 @@
#if defined(USE_FILAMENT_OPENGL) || defined(USE_FILAMENT_VULKAN)
#include "experimental/filament/render_context_filament.h"
#include "experimental/platform/plugin.h"
#elif defined(USE_CLASSIC_OPENGL)
#include <imgui.h>
#include <backends/imgui_impl_opengl3.h>
@@ -136,3 +137,14 @@ int Renderer::UploadImage(int texture_id, const std::byte* pixels, int width,
double Renderer::GetFps() { return fps_; }
} // namespace mujoco::platform
#if !defined(USE_CLASSIC_OPENGL)
mjPLUGIN_LIB_INIT {
mujoco::platform::GuiPlugin plugin;
plugin.name = "Filament";
plugin.update = [](mujoco::platform::GuiPlugin* self) {
mjr_updateGui(nullptr);
};
mujoco::platform::RegisterGuiPlugin(&plugin);
}
#endif