diff --git a/doc/includes/references.h b/doc/includes/references.h index 9f8d6a9c..f454c394 100644 --- a/doc/includes/references.h +++ b/doc/includes/references.h @@ -2861,6 +2861,7 @@ struct mjvGeom_ { // abstract geom }; typedef struct mjvGeom_ mjvGeom; struct mjvLight_ { // OpenGL light + int id; // light id, -1 for headlight float pos[3]; // position rel. to body frame float dir[3]; // direction rel. to body frame int type; // type (mjtLightType) diff --git a/include/mujoco/mjvisualize.h b/include/mujoco/mjvisualize.h index d7c04523..07c67bac 100644 --- a/include/mujoco/mjvisualize.h +++ b/include/mujoco/mjvisualize.h @@ -259,6 +259,7 @@ typedef struct mjvGeom_ mjvGeom; //---------------------------------- mjvLight ------------------------------------------------------ struct mjvLight_ { // OpenGL light + int id; // light id, -1 for headlight float pos[3]; // position rel. to body frame float dir[3]; // direction rel. to body frame int type; // type (mjtLightType) diff --git a/python/mujoco/introspect/structs.py b/python/mujoco/introspect/structs.py index 96f7cca8..e3c035d2 100644 --- a/python/mujoco/introspect/structs.py +++ b/python/mujoco/introspect/structs.py @@ -6697,6 +6697,11 @@ STRUCTS: Mapping[str, StructDecl] = dict([ name='mjvLight', declname='struct mjvLight_', fields=( + StructFieldDecl( + name='id', + type=ValueType(name='int'), + doc='light id, -1 for headlight', + ), StructFieldDecl( name='pos', type=ArrayType( diff --git a/python/mujoco/structs.cc b/python/mujoco/structs.cc index 0c0e5958..918a6e7c 100644 --- a/python/mujoco/structs.cc +++ b/python/mujoco/structs.cc @@ -1076,6 +1076,7 @@ This is useful for example when the MJB is not available as a file on disk.)")); [](MjvLightWrapper& c, decltype(raw::MjvLight::var) rhs) { \ c.get()->var = rhs; \ }) + X(id); X(cutoff); X(exponent); X(headlight); diff --git a/src/engine/engine_vis_visualize.c b/src/engine/engine_vis_visualize.c index 212ea14f..22b7cfdb 100644 --- a/src/engine/engine_vis_visualize.c +++ b/src/engine/engine_vis_visualize.c @@ -2310,6 +2310,7 @@ void mjv_makeLights(const mjModel* m, const mjData* d, mjvScene* scn) { // set default properties memset(thislight, 0, sizeof(mjvLight)); + thislight->id = -1; thislight->headlight = 1; thislight->texid = -1; thislight->type = mjLIGHT_DIRECTIONAL; @@ -2341,6 +2342,7 @@ void mjv_makeLights(const mjModel* m, const mjData* d, mjvScene* scn) { // copy properties memset(thislight, 0, sizeof(mjvLight)); + thislight->id = i; thislight->type = m->light_type[i]; thislight->texid = m->light_texid[i]; thislight->castshadow = m->light_castshadow[i]; diff --git a/unity/Runtime/Bindings/MjBindings.cs b/unity/Runtime/Bindings/MjBindings.cs index 3d1bc090..df41db08 100644 --- a/unity/Runtime/Bindings/MjBindings.cs +++ b/unity/Runtime/Bindings/MjBindings.cs @@ -6110,6 +6110,7 @@ public unsafe struct mjvGeom_ { [StructLayout(LayoutKind.Sequential)] public unsafe struct mjvLight_ { + public int id; public fixed float pos[3]; public fixed float dir[3]; public int type;