Allow user-defined visualization geoms to be added to the passive viewer.

Fixes #1023, #1082

PiperOrigin-RevId: 572303635
Change-Id: Ia8399f816f311b38a7b137f5bd4f359f77a1da1c
This commit is contained in:
Saran Tunyasuvunakool
2023-10-10 10:51:29 -07:00
committed by Copybara-Service
parent 1bd6c94e6d
commit 2e15574b58
13 changed files with 112 additions and 56 deletions
+5 -3
View File
@@ -51,8 +51,7 @@ class Simulate {
// create object and initialize the simulate ui
Simulate(
std::unique_ptr<PlatformUIAdapter> platform_ui_adapter,
mjvScene* scn, mjvCamera* cam,
mjvOption* opt, mjvPerturb* pert, bool is_passive);
mjvCamera* cam, mjvOption* opt, mjvPerturb* pert, bool is_passive);
// Synchronize mjModel and mjData state with UI inputs, and update
// visualization.
@@ -233,7 +232,7 @@ class Simulate {
int camera = 0;
// abstract visualization
mjvScene& scn;
mjvScene scn;
mjvCamera& cam;
mjvOption& opt;
mjvPerturb& pert;
@@ -243,6 +242,9 @@ class Simulate {
mjvFigure figsize = {};
mjvFigure figsensor = {};
// additional user-defined visualization geoms (used in passive mode)
mjvScene* user_scn = nullptr;
// OpenGL rendering and UI
int refresh_rate = 60;
int window_pos[2] = {0};