Two performance optimizations for interpolated flex objects:
1. Hoist loop-invariant stride calculations in `mju_cellLookup` out of nested loops.
This reduces multiplications from 16 to 6 (linear) and 54 to 12 (quadratic)
per vertex.
2. Extract and consolidate optimized 3D interpolation logic into a new
reusable utility `mju_evalBasisArray` in `engine_util_misc.c`. This function
uses nested loops and precomputed 1D shape functions to avoid expensive
dynamic `phi` calls and branching, and leverages stack-buffered outputs to
eliminate compiler pointer-aliasing barriers. We propagate this optimization
to both kinematics (`mju_interpolate3D`) and constraint setup
(`engine_core_constraint.c`).
Together these changes yield a ~50% overall speedup in `mj_fwdKinematics` for interpolated flexes with ~10k vertices in the collision meshes and ~10 nodes in the deformation grid.
PiperOrigin-RevId: 922198093
Change-Id: I9c804e65cd532e2f9ac6e9a71d01c30cd64186fa
Update Renderable so that it can switch its own draw states (material
instance, shadow casting, reflection textures, etc.) per render request.
This allows us to use the same Renderable with different effects from
different views within the same frame.
PiperOrigin-RevId: 922102817
Change-Id: I1cf02fddb7a00345a741db1bee88e716517765f4
- C++ Platform UX: Added a "Copy Camera" button to copy XML camera definitions to clipboard.
- C++ Platform UX: Extracted `SetSpeedIndex` and `GetExpectedLabelWidth` into reusable platform helpers.
- C++ Platform UX: Fixed combo box widths and removed auto-hide tab bar flag from dockspace.
- C++ Studio App: Deduplicated label width and speed index logic by adopting platform helpers.
- C++ Studio App: Updated the toolbar layout to use a 2-column table.
- Python Bindings: Added pybind definitions for `set_camera_index`, `set_speed_index`, and `camera_to_string`.
- Python Studio App: Aligned toolbar UI with C++ using a 2-column table and fixed immediate theme switching.
- Python Studio App: Added a Help menu displaying the MuJoCo version and Stats toggle.
- Python Events: Added `-`/`=` shortcuts for simulation speed and `Esc`/`[`/`]` shortcuts for camera selection.
PiperOrigin-RevId: 922097319
Change-Id: Iec74afe37bf5c7a1ebf1cab4141e47fff5fe9274
The MSVC fallback path in safeAddToBufferSize() performed unchecked
arithmetic (type_size*nr*nc) on attacker-controlled values read from
.mjb binary model files. This could cause integer overflow, leading
to an undersized heap allocation followed by a heap buffer overflow
when data is copied into the buffer.
The fix adds manual overflow detection using SIZE_MAX/INTPTR_MAX
comparisons, matching the behavior of the existing __builtin_*_overflow
path used on GCC/Clang.
Also adds a regression test that crafts a binary model buffer with
overflow-inducing size fields and asserts safe rejection.
The normal component of the tactile sensor now reports the maximum penetration depth at each taxel, instead of a derived normal force. The depth is negated so that positive values indicate penetration.
PiperOrigin-RevId: 921980899
Change-Id: Ide4103c0aff465e25a81cfdda650f6a0e2da9e0b
The prefetcher asks mju_getXMLDependencies for the transitive asset
list, fetches every URL with Promise.all, and primes the bytes into the
WASM-side FetchCache. When the compiler runs, every resource it opens
is already in memory. Cold-load on a typical Menagerie model drops from
~9 s to ~2 s.
The function called tinyxml2's LoadFile directly, which only works on
the OS file system. Reading through mju_openResource lets it work
against any registered backend (VFS, HTTP, github:, ...).
Support Ctrl+Option+Left Click Drag (maps to Ctrl+Alt+Left Click Drag in the application) to apply point force perturbations (translation) on the robot in the WebGL live viewer. This matches the Mac experience in the native MuJoCo simulate app and provides a fallback for Mac users where Right Click is difficult to trigger.
PiperOrigin-RevId: 919767954
Change-Id: I4a1d1c05784a8257d13f64f738af5b4841a615b3
This provides visual feedback to the user while loading large models.
PiperOrigin-RevId: 918708877
Change-Id: I77ea475cce6d9718e6cf8b33cb72b3f524a6ee63
* Changed window.cc to not pass `SDL_WINDOW_OPENGL` for headless opengl graphics modes since this requests a [GLX visual](https://tronche.com/gui/x/xlib/window/visual-types.html#Visual) but CRD's virtual X11 display has no GLX visuals causing window creation to fail with "Couldn't find matching GLX visual".
* Changed `TryLoadEgl` so it fails if `eglBindAPI(EGL_OPENGL_API)` does not return true, causing `CreateFilamentPlatform` to fallback to OSMesa on CRD.
PiperOrigin-RevId: 918029935
Change-Id: Id88338811949b1402578de19bc4d31f4ee1783c1
For example, `compile mujoco_menagerie/robotis_op3/scene.xml` now outputs
```
Compile 1 (cold cache):
total: 317.2 ms
assets: 284.8 ms (wall clock)
load: 616.1 ms
hull: 26.4 ms
poly: 137.8 ms
inert: 177.8 ms
bvh: 568.2 ms
octr: 1.6 ms
tex: 25.3 ms
other: 32.4 ms
Compile 2 (warm cache):
total: 79.9 ms
assets: 54.5 ms (wall clock)
load: 888.5 ms
hull: 0.0 ms
poly: 0.0 ms
inert: 0.0 ms
bvh: 0.0 ms
octr: 0.0 ms
tex: 21.4 ms
other: 25.3 ms
```
PiperOrigin-RevId: 917850214
Change-Id: Iaec86230bec0faf2e47820e20cbff61de5b2621e
Renames MjrFilamentRenderer to CompatContext and makes it an
internal detail of the compatibility layer. This allows us to
remove all legacy functions from the mjrf namespace, making
them available only in the compatibility layer.
Update studio to use non-legacy mjrf APIs. This requires it to
use some of the compat helper classes. These will be refactored
in the future to make them reusable components.
PiperOrigin-RevId: 917730783
Change-Id: Ic8f68e6e75059f7d394ea3266a346cbd6c1fcaed
Warp is not a true stretch mode but a parasitic shear mode so it should be scaled like bending (~thickness^3) rather than stretching (~thickness). The thickness parameter can therefore be used to set the stretch to warp stiffness ratio of the strain constraints.
PiperOrigin-RevId: 916900311
Change-Id: I52e54210fbb2a6d309abc1f084934830adce3423