Refactor FilamentContext to prepare for upcoming changes.

Separate out the parts of the FilamentContext initialization that
depends on the mjModel into a separate Init function.

PiperOrigin-RevId: 890373341
Change-Id: I06b524668cd60dad804d437958f4f6606c46200b
This commit is contained in:
Haroon Qureshi
2026-03-27 04:25:34 -07:00
committed by Copybara-Service
parent d597b23e5e
commit 1c2100e27c
5 changed files with 31 additions and 24 deletions
@@ -49,7 +49,8 @@ void mjrf_makeFilamentContext(const mjModel* m, mjrContext* con,
if (g_filament_context != nullptr) {
mju_error("Context already exists!");
}
g_filament_context = new mujoco::FilamentContext(config, m);
g_filament_context = new mujoco::FilamentContext(config);
g_filament_context->Init(m);
}
void mjrf_defaultContext(mjrContext* con) {
@@ -60,6 +61,8 @@ void mjrf_makeContext(const mjModel* m, mjrContext* con, int fontscale) {
mjr_freeContext(con);
mjrFilamentConfig cfg;
mjrf_defaultFilamentConfig(&cfg);
cfg.width = m->vis.global.offwidth;
cfg.height = m->vis.global.offheight;
mjrf_makeFilamentContext(m, con, &cfg);
}