Convert light directional boolean into a type enum.

PiperOrigin-RevId: 761983728
Change-Id: Id5bf93c103e5358d9c5cd9f1176532a978e0b3a8
This commit is contained in:
Google DeepMind
2025-05-22 08:50:23 -07:00
committed by Copybara-Service
parent 373b4c0437
commit 74cc904edc
21 changed files with 130 additions and 49 deletions
+9 -1
View File
@@ -129,6 +129,14 @@ typedef enum mjtCamLight_ { // tracking mode for camera and light
} mjtCamLight;
typedef enum mjtLightType_ { // type of light
mjLIGHT_SPOT = 0, // spot
mjLIGHT_DIRECTIONAL, // directional
mjLIGHT_POINT, // point
mjLIGHT_IMAGE, // image-based
} mjtLightType;
typedef enum mjtTexture_ { // type of texture
mjTEXTURE_2D = 0, // 2d texture, suitable for planes and hfields
mjTEXTURE_CUBE, // cube texture, suitable for all other geom types
@@ -849,7 +857,7 @@ struct mjModel_ {
int* light_mode; // light tracking mode (mjtCamLight) (nlight x 1)
int* light_bodyid; // id of light's body (nlight x 1)
int* light_targetbodyid; // id of targeted body; -1: none (nlight x 1)
mjtByte* light_directional; // directional light (nlight x 1)
int* light_type; // spot, directional, etc. (mjtLightType) (nlight x 1)
mjtByte* light_castshadow; // does light cast shadows (nlight x 1)
float* light_bulbradius; // light radius for soft shadows (nlight x 1)
float* light_intensity; // intensity, in candela (nlight x 1)
+1 -1
View File
@@ -394,7 +394,7 @@ typedef struct mjsLight_ { // light specification
// intrinsics
mjtByte active; // is light active
mjtByte directional; // is light directional or spot
mjtLightType type; // type of light
mjtByte castshadow; // does light cast shadows
float bulbradius; // bulb radius, for soft shadows
float intensity; // intensity, in candelas
+1 -1
View File
@@ -261,6 +261,7 @@ typedef struct mjvGeom_ mjvGeom;
struct mjvLight_ { // OpenGL light
float pos[3]; // position rel. to body frame
float dir[3]; // direction rel. to body frame
int type; // type (mjtLightType)
float attenuation[3]; // OpenGL attenuation (quadratic model)
float cutoff; // OpenGL cutoff
float exponent; // OpenGL exponent
@@ -268,7 +269,6 @@ struct mjvLight_ { // OpenGL light
float diffuse[3]; // diffuse rgb (alpha=1)
float specular[3]; // specular rgb (alpha=1)
mjtByte headlight; // headlight
mjtByte directional; // directional light
mjtByte castshadow; // does light cast shadows
float bulbradius; // bulb radius for soft shadows
float intensity; // intensity, in candelas
+1 -1
View File
@@ -299,7 +299,7 @@
X ( int, light_mode, nlight, 1 ) \
X ( int, light_bodyid, nlight, 1 ) \
X ( int, light_targetbodyid, nlight, 1 ) \
X ( mjtByte, light_directional, nlight, 1 ) \
X ( int, light_type, nlight, 1 ) \
X ( mjtByte, light_castshadow, nlight, 1 ) \
X ( float, light_bulbradius, nlight, 1 ) \
X ( float, light_intensity, nlight, 1 ) \