Add option to mjspec for creating a texture directly from a buffer.

PiperOrigin-RevId: 662186527
Change-Id: I469c876681d52964ac971c0bb2ec3517224d3a3d
This commit is contained in:
Alessio Quaglino
2024-08-12 12:26:39 -07:00
committed by Copybara-Service
parent 20cae556ee
commit 851bb6eef4
16 changed files with 267 additions and 95 deletions
+9
View File
@@ -4417,6 +4417,15 @@ Safely cast an element as mjsMaterial, or return NULL if the element is not an m
Attribute setters
^^^^^^^^^^^^^^^^^
.. _mjs_setBuffer:
mjs_setBuffer
~~~~~~~~~~~~~
.. mujoco-include:: mjs_setBuffer
Copy buffer.
.. _mjs_setString:
mjs_setString
+8 -1
View File
@@ -5,6 +5,13 @@ Changelog
Upcoming version (not yet released)
-----------------------------------
General
^^^^^^^
1. Add :ref:`mjSpec` option for creating a texture from a buffer.
Upcoming version (not yet released)
-----------------------------------
General
^^^^^^^
- :ref:`shellinertia <body-geom-shellinertia>` is now supported by all geom types.
@@ -22,7 +29,7 @@ Version 3.2.1 (Aug 5, 2024)
General
^^^^^^^
1. Renamed ``mjModel.tex_rbg`` to ``mjModel.tex_data``.
1. Renamed ``mjModel.tex_rgb`` to ``mjModel.tex_data``.
2. Added a new :ref:`autoreset<option-flag-autoreset>` flag to disable automatic reset when NaNs or infinities are
detected.
3. Added sub-elements to the MJCF :ref:`material<asset-material>` element, to allow specification of multiple textures
+4
View File
@@ -2026,6 +2026,9 @@ typedef struct mjsTexture_ { // texture specification
// method 3: separate files
mjStringVec* cubefiles; // different file for each side of the cube
// method 4: from buffer read by user
mjBuffer* data; // texture data
// flip options
mjtByte hflip; // horizontal flip
mjtByte vflip; // vertical flip
@@ -3584,6 +3587,7 @@ mjsHField* mjs_asHField(mjsElement* element);
mjsSkin* mjs_asSkin(mjsElement* element);
mjsTexture* mjs_asTexture(mjsElement* element);
mjsMaterial* mjs_asMaterial(mjsElement* element);
void mjs_setBuffer(mjBuffer* dest, const void* array, int size);
void mjs_setString(mjString* dest, const char* text);
void mjs_setStringVec(mjStringVec* dest, const char* text);
mjtByte mjs_setInStringVec(mjStringVec* dest, int i, const char* text);