Format header to conform to style guide.

Also moves some types to the mjrender.h header.

PiperOrigin-RevId: 929189125
Change-Id: I19e5598210898c0defb663c60d7ecfb9a19bcd38
This commit is contained in:
Haroon Qureshi
2026-06-09 07:42:23 -07:00
committed by Copybara-Service
parent 991c131d59
commit e6e5229126
17 changed files with 549 additions and 521 deletions
+58 -2
View File
@@ -10,7 +10,7 @@ MuJoCo defines a large number of types:
- Enums used in :ref:`mjModel<tyModelEnums>`.
- Enums used in :ref:`mjData<tyDataEnums>`.
- Enums for abstract :ref:`visualization<tyVisEnums>`.
- Enums used by the :ref:`openGL renderer<tyRenderEnums>`.
- Enums used by the :ref:`renderer<tyRenderEnums>`.
- Enums used by the :ref:`mjUI<tyUIEnums>` user interface package.
- Enums used by :ref:`engine plugins<tyPluginEnums>`.
- Enums used for :ref:`procedural model manipulation<tySpecEnums>`.
@@ -31,7 +31,7 @@ MuJoCo defines a large number of types:
- :ref:`Auxiliary struct types<tyAuxStructure>`, also used by the engine.
- Structs for collecting :ref:`simulation statistics<tyStatStructure>`.
- Structs for :ref:`abstract visualization<tyVisStructure>`.
- Structs used by the :ref:`openGL renderer<tyRenderStructure>`.
- Structs used by the :ref:`renderer<tyRenderStructure>`.
- Structs used by the :ref:`UI framework<tyUIStructure>`.
- Structs used for :ref:`procedural model manipulation<tySpecStructure>`.
- Structs used by :ref:`engine plugins<tyPluginStructure>`.
@@ -705,6 +705,51 @@ These are the possible font types.
.. mujoco-include:: mjtFont
.. _mjrPixelFormat:
mjrPixelFormat
~~~~~~~~~~~~~~
There are the possible values:
.. mujoco-include:: mjrPixelFormat
.. _mjrVertexAttributeUsage:
mjrVertexAttributeUsage
~~~~~~~~~~~~~~~~~~~~~~~
There are the possible values:
.. mujoco-include:: mjrVertexAttributeUsage
.. _mjrVertexAttributeType:
mjrVertexAttributeType
~~~~~~~~~~~~~~~~~~~~~~
There are the possible values:
.. mujoco-include:: mjrVertexAttributeType
.. _mjrIndexType:
mjrIndexType
~~~~~~~~~~~~
There are the possible values:
.. mujoco-include:: mjrIndexType
.. _mjrMeshPrimitiveType:
mjrMeshPrimitiveType
~~~~~~~~~~~~~~~~~~~~
There are the possible values:
.. mujoco-include:: mjrMeshPrimitiveType
.. _tyUIEnums:
@@ -1164,6 +1209,17 @@ This structure specifies a rectangle.
.. mujoco-include:: mjrRect
.. _mjrVertexAttribute:
mjrVertexAttribute
~~~~~~~~~~~~~~~~~~
This structure specifies the attributes for a single vertex.
.. mujoco-include:: mjrVertexAttribute
.. _mjrContext:
mjrContext
+36
View File
@@ -1359,6 +1359,36 @@ typedef enum mjtFont_ { // font type, used at each text operation
mjFONT_SHADOW, // normal font with shadow (for higher contrast)
mjFONT_BIG // big font (for user alerts)
} mjtFont;
typedef enum mjrPixelFormat_ { // pixel format for textures
mjPIXEL_FORMAT_UNKNOWN = 0, // unknown/unspecified
mjPIXEL_FORMAT_R8, // 1 channel, 8 bit
mjPIXEL_FORMAT_RGB8, // 3 channels, 8 bits per channel
mjPIXEL_FORMAT_RGBA8, // 4 channels, 8 bits per channel
mjPIXEL_FORMAT_R32F, // 1 channel, 32 bit float
mjPIXEL_FORMAT_DEPTH32F, // 1 channel, 32 bit float, for depth buffers
mjPIXEL_FORMAT_KTX, // ktx compressed data
} mjrPixelFormat;
typedef enum mjrVertexAttributeUsage_ { // usage/purpose of a vertex attribute
mjVERTEX_ATTRIBUTE_USAGE_POSITION = 0, // vertex position
mjVERTEX_ATTRIBUTE_USAGE_NORMAL, // vertex normal
mjVERTEX_ATTRIBUTE_USAGE_TANGENTS, // vertex tangents
mjVERTEX_ATTRIBUTE_USAGE_UV, // vertex texture coordinates
mjVERTEX_ATTRIBUTE_USAGE_COLOR, // vertex color
} mjrVertexAttributeUsage;
typedef enum mjrVertexAttributeType_ { // data format of a vertex attribute
mjVERTEX_ATTRIBUTE_TYPE_FLOAT2 = 0, // 2D 32-bit float vector
mjVERTEX_ATTRIBUTE_TYPE_FLOAT3, // 3D 32-bit float vector
mjVERTEX_ATTRIBUTE_TYPE_FLOAT4, // 4D 32-bit float vector
mjVERTEX_ATTRIBUTE_TYPE_UBYTE4, // 4D unsigned 8-bit byte vector
} mjrVertexAttributeType;
typedef enum mjrIndexType_ { // data type of index buffer data
mjINDEX_TYPE_U16 = 0, // 16-bit unsigned integer
mjINDEX_TYPE_U32, // 32-bit unsigned integer
} mjrIndexType;
typedef enum mjrMeshPrimitiveType_ { // type of mesh primitive
mjMESH_PRIMITIVE_TYPE_TRIANGLES = 0, // triangles
mjMESH_PRIMITIVE_TYPE_LINES, // lines
} mjrMeshPrimitiveType;
struct mjrRect_ { // OpenGL rectangle
int left; // left (usually 0)
int bottom; // bottom (usually 0)
@@ -1366,6 +1396,12 @@ struct mjrRect_ { // OpenGL rectangle
int height; // height (usually buffer height)
};
typedef struct mjrRect_ mjrRect;
struct mjrVertexAttribute_ { // vertex attribute format specification
const void* bytes; // vertex data
int usage; // mjrVertexAttributeUsage; e.g. position, normal, etc.
int type; // mjrVertexAttributeType; e.g. float3, ubyte4, etc.
};
typedef struct mjrVertexAttribute_ mjrVertexAttribute;
struct mjrContext_ { // custom OpenGL context
// parameters copied from mjVisual
float lineWidth; // line width for wireframe rendering