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:
committed by
Copybara-Service
parent
991c131d59
commit
e6e5229126
@@ -15,7 +15,8 @@
|
||||
#ifndef MUJOCO_MJRENDER_H_
|
||||
#define MUJOCO_MJRENDER_H_
|
||||
|
||||
#include <mujoco/mjmodel.h>
|
||||
#include <mujoco/mjtype.h>
|
||||
#include <mujoco/mjvisualize.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
@@ -44,11 +45,13 @@ typedef enum mjtFramebuffer_ { // OpenGL framebuffer option
|
||||
mjFB_OFFSCREEN // offscreen buffer
|
||||
} mjtFramebuffer;
|
||||
|
||||
|
||||
typedef enum mjtDepthMap_ { // depth mapping for `mjr_readPixels`
|
||||
mjDEPTH_ZERONEAR = 0, // standard depth map; 0: znear, 1: zfar
|
||||
mjDEPTH_ZEROFAR = 1 // reversed depth map; 1: znear, 0: zfar
|
||||
} mjtDepthMap;
|
||||
|
||||
|
||||
typedef enum mjtFontScale_ { // font scale, used at context creation
|
||||
mjFONTSCALE_50 = 50, // 50% scale, suitable for low-res rendering
|
||||
mjFONTSCALE_100 = 100, // normal scale, suitable in the absence of DPI scaling
|
||||
@@ -66,6 +69,46 @@ typedef enum mjtFont_ { // font type, used at each text operation
|
||||
} 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)
|
||||
@@ -75,6 +118,21 @@ struct mjrRect_ { // OpenGL rectangle
|
||||
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;
|
||||
|
||||
|
||||
// alias non-rendering types into mjr namespace
|
||||
typedef mjtTexture mjrSamplerType;
|
||||
typedef mjtColorSpace mjrColorSpace;
|
||||
typedef mjtLightType mjrLightType;
|
||||
typedef mjvGLCamera mjrCamera;
|
||||
|
||||
|
||||
//---------------------------------- mjrContext ----------------------------------------------------
|
||||
|
||||
struct mjrContext_ { // custom OpenGL context
|
||||
|
||||
Reference in New Issue
Block a user