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
+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