Modernize struct and enum style in MuJoCo headers.

PiperOrigin-RevId: 936485706
Change-Id: I31864acc4bd44573127d3d04c6b1a23f9d9c4cbc
This commit is contained in:
Kyle Bayes
2026-06-23 00:47:13 -07:00
committed by Copybara-Service
parent afccd36dd4
commit 0fd7bea973
12 changed files with 463 additions and 548 deletions
+16 -24
View File
@@ -164,7 +164,7 @@ typedef enum mjtStereo_ { // type of stereo rendering
//---------------------------------- mjvPerturb ----------------------------------------------------
struct mjvPerturb_ { // object selection and perturbation
typedef struct mjvPerturb_ { // object selection and perturbation
int select; // selected body id; non-positive: none
int flexselect; // selected flex id; negative: none
int skinselect; // selected skin id; negative: none
@@ -176,13 +176,12 @@ struct mjvPerturb_ { // object selection and perturbation
mjtNum localpos[3]; // selection point in object coordinates
mjtNum localmass; // spatial inertia at selection point
mjtNum scale; // relative mouse motion-to-space scaling (set by initPerturb)
};
typedef struct mjvPerturb_ mjvPerturb;
} mjvPerturb;
//---------------------------------- mjvCamera -----------------------------------------------------
struct mjvCamera_ { // abstract camera
typedef struct mjvCamera_ { // abstract camera
// type and ids
int type; // camera type (mjtCamera)
int fixedcamid; // fixed camera id
@@ -196,13 +195,12 @@ struct mjvCamera_ { // abstract camera
// orthographic / perspective
int orthographic; // 0: perspective; 1: orthographic
};
typedef struct mjvCamera_ mjvCamera;
} mjvCamera;
//---------------------------------- mjvGLCamera ---------------------------------------------------
struct mjvGLCamera_ { // OpenGL camera
typedef struct mjvGLCamera_ { // OpenGL camera
// camera frame
float pos[3]; // position
float forward[3]; // forward direction
@@ -218,13 +216,12 @@ struct mjvGLCamera_ { // OpenGL camera
// orthographic / perspective
int orthographic; // 0: perspective; 1: orthographic
};
typedef struct mjvGLCamera_ mjvGLCamera;
} mjvGLCamera;
//---------------------------------- mjvGeom -------------------------------------------------------
struct mjvGeom_ { // abstract geom
typedef struct mjvGeom_ { // abstract geom
// type info
int type; // geom type (mjtGeom)
int dataid; // mesh, hfield or plane id; -1: none; mesh: 2*id or 2*id+1 (hull)
@@ -253,13 +250,12 @@ struct mjvGeom_ { // abstract geom
float camdist; // distance to camera (used by sorter)
float modelrbound; // geom rbound from model, 0 if not model geom
mjtByte transparent; // treat geom as transparent
};
typedef struct mjvGeom_ mjvGeom;
} mjvGeom;
//---------------------------------- mjvLight ------------------------------------------------------
struct mjvLight_ { // OpenGL light
typedef 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
@@ -276,13 +272,12 @@ struct mjvLight_ { // OpenGL light
float bulbradius; // bulb radius for soft shadows
float intensity; // intensity, in candelas
float range; // range of effectiveness
};
typedef struct mjvLight_ mjvLight;
} mjvLight;
//---------------------------------- mjvOption -----------------------------------------------------
struct mjvOption_ { // abstract visualization options
typedef struct mjvOption_ { // abstract visualization options
int label; // what objects to label (mjtLabel)
int frame; // which frame to show (mjtFrame)
mjtByte geomgroup[mjNGROUP]; // geom visualization by group
@@ -295,13 +290,12 @@ struct mjvOption_ { // abstract visualization options
mjtByte flags[mjNVISFLAG]; // visualization flags (indexed by mjtVisFlag)
int bvh_depth; // depth of the bounding volume hierarchy to be visualized
int flex_layer; // element layer to be visualized for 3D flex
};
typedef struct mjvOption_ mjvOption;
} mjvOption;
//---------------------------------- mjvScene ------------------------------------------------------
struct mjvScene_ { // abstract scene passed to OpenGL renderer
typedef struct mjvScene_ { // abstract scene passed to OpenGL renderer
// abstract geoms
int maxgeom; // size of allocated geom buffer
int ngeom; // number of geoms currently in buffer
@@ -358,13 +352,12 @@ struct mjvScene_ { // abstract scene passed to OpenGL renderer
// geom buffer status
int status; // 0: ok, 1: geoms exhausted, warning issued
};
typedef struct mjvScene_ mjvScene;
} mjvScene;
//---------------------------------- mjvFigure -----------------------------------------------------
struct mjvFigure_ { // abstract 2D figure passed to OpenGL renderer
typedef struct mjvFigure_ { // abstract 2D figure passed to OpenGL renderer
// enable flags
int flg_legend; // show legend
int flg_ticklabel[2]; // show grid tick labels (x,y)
@@ -409,7 +402,6 @@ struct mjvFigure_ { // abstract 2D figure passed to OpenGL rendere
int yaxispixel[2]; // range of y-axis in pixels
float xaxisdata[2]; // range of x-axis in data units
float yaxisdata[2]; // range of y-axis in data units
};
typedef struct mjvFigure_ mjvFigure;
} mjvFigure;
#endif // MUJOCO_MJVISUALIZE_H_