Fix a few issues with the passive viewer.

1. Create an arena for the mjData instance used by the passive viewer visualization.

When using the passive viewer, stuff gets copied from the real mjData into a minimal struct.
That struct didn't have a stack, and now visualization for Flex does stack allocs.

2. Add missing a missing field in scene state for flex visualization.

3. Fix a memory leak where mjvScene wasn't released on exit in the passive viewer.

4. Add some locks in places where the render thread and Simulate::Sync collide.

This fixes #1280.

PiperOrigin-RevId: 591891676
Change-Id: I592f286cab9719c8d9af84e42f9756ea1f9f1971
This commit is contained in:
Nimrod Gileadi
2023-12-18 07:32:20 -08:00
committed by Copybara-Service
parent 8ecb16abfa
commit 7cb7c87f70
9 changed files with 61 additions and 9 deletions
+3
View File
@@ -6095,6 +6095,7 @@ public unsafe struct model {
public int nnames;
public int npaths;
public int nsensordata;
public int narena;
public mjOption_ opt;
public mjVisual_ vis;
public mjStatistic_ stat;
@@ -6287,6 +6288,7 @@ public unsafe struct data {
public int* wrap_obj;
public double* ten_length;
public double* wrap_xpos;
public double* bvh_aabb_dyn;
public byte* bvh_active;
public int* island_dofadr;
public int* island_dofind;
@@ -6296,6 +6298,7 @@ public unsafe struct data {
public double* flexvert_xpos;
public mjContact_* contact;
public double* efc_force;
public void* arena;
}
[StructLayout(LayoutKind.Sequential)]