diff --git a/include/mujoco/mjrender.h b/include/mujoco/mjrender.h index f2980690..efd82bcd 100644 --- a/include/mujoco/mjrender.h +++ b/include/mujoco/mjrender.h @@ -40,8 +40,8 @@ typedef enum mjtFramebuffer_ { // OpenGL framebuffer option } mjtFramebuffer; typedef enum mjtDepthMap_ { // depth mapping for `mjr_readPixels` - mjDEPTHMAP_01 = 0, // standard depth map; 0: znear, 1: zfar - mjDEPTHMAP_10 = 1 // reversed depth map; 1: znear, 0: zfar + 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 @@ -157,7 +157,7 @@ struct mjrContext_ { // custom OpenGL context int readPixelFormat; // default color pixel format for mjr_readPixels // depth output format - int readDepthMap; // depth mapping: mjDEPTHMAP_01 or mjDEPTHMAP_10 + int readDepthMap; // depth mapping: mjDEPTH_ZERONEAR or mjDEPTH_ZEROFAR }; typedef struct mjrContext_ mjrContext; diff --git a/introspect/enums.py b/introspect/enums.py index 90671ea1..04b772d1 100644 --- a/introspect/enums.py +++ b/introspect/enums.py @@ -626,8 +626,8 @@ ENUMS: Mapping[str, EnumDecl] = dict([ name='mjtDepthMap', declname='enum mjtDepthMap_', values=dict([ - ('mjDEPTHMAP_01', 0), - ('mjDEPTHMAP_10', 1), + ('mjDEPTH_ZERONEAR', 0), + ('mjDEPTH_ZEROFAR', 1), ]), )), ('mjtFontScale', diff --git a/introspect/structs.py b/introspect/structs.py index c318bead..aed98c9e 100644 --- a/introspect/structs.py +++ b/introspect/structs.py @@ -7129,7 +7129,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([ StructFieldDecl( name='readDepthMap', type=ValueType(name='int'), - doc='depth mapping: mjDEPTHMAP_01 or mjDEPTHMAP_10', + doc='depth mapping: mjDEPTH_ZERONEAR or mjDEPTH_ZEROFAR', ), ), )), diff --git a/python/mujoco/renderer.py b/python/mujoco/renderer.py index 1b1d2cd0..b07940d3 100644 --- a/python/mujoco/renderer.py +++ b/python/mujoco/renderer.py @@ -86,7 +86,7 @@ the clause: _render.mjr_setBuffer( _enums.mjtFramebuffer.mjFB_OFFSCREEN.value, self._mjr_context ) - self._mjr_context.readDepthMap = _enums.mjtDepthMap.mjDEPTHMAP_10 + self._mjr_context.readDepthMap = _enums.mjtDepthMap.mjDEPTH_ZEROFAR # Default render flags. self._depth_rendering = False diff --git a/src/render/render_context.c b/src/render/render_context.c index ab7aac9d..99daf299 100644 --- a/src/render/render_context.c +++ b/src/render/render_context.c @@ -1614,7 +1614,7 @@ void mjr_makeContext_offSize(const mjModel* m, mjrContext* con, int fontscale, con->readPixelFormat = GL_RGB; // set default depth mapping for mjr_readPixels - con->readDepthMap = mjDEPTHMAP_01; + con->readDepthMap = mjDEPTH_ZERONEAR; } diff --git a/src/render/render_gl2.c b/src/render/render_gl2.c index 2d54c99e..5ba11d34 100644 --- a/src/render/render_gl2.c +++ b/src/render/render_gl2.c @@ -115,7 +115,7 @@ void mjr_readPixels(unsigned char* rgb, float* depth, if (depth) { glReadPixels(viewport.left, viewport.bottom, viewport.width, viewport.height, GL_DEPTH_COMPONENT, GL_FLOAT, depth); - if (con->readDepthMap == mjDEPTHMAP_01) { + if (con->readDepthMap == mjDEPTH_ZERONEAR) { int N_pixels = viewport.width * viewport.height; for (int i = 0; i < N_pixels; i++) depth[i] = 1.0 - depth[i]; // Reverse the reversed Z buffer } @@ -164,7 +164,7 @@ void mjr_readPixels(unsigned char* rgb, float* depth, glReadPixels(viewport.left, viewport.bottom, viewport.width, viewport.height, GL_DEPTH_COMPONENT, GL_FLOAT, depth); - if (con->readDepthMap == mjDEPTHMAP_01) { + if (con->readDepthMap == mjDEPTH_ZERONEAR) { int N_pixels = viewport.width * viewport.height; for (int i = 0; i < N_pixels; i++) depth[i] = 1.0 - depth[i]; // Reverse the reversed Z buffer } diff --git a/unity/Runtime/Bindings/MjBindings.cs b/unity/Runtime/Bindings/MjBindings.cs index 7e3268e7..f4dc2680 100644 --- a/unity/Runtime/Bindings/MjBindings.cs +++ b/unity/Runtime/Bindings/MjBindings.cs @@ -390,8 +390,8 @@ public enum mjtFramebuffer : int{ mjFB_OFFSCREEN = 1, } public enum mjtDepthMap : int{ - mjDEPTHMAP_01 = 0, - mjDEPTHMAP_10 = 1, + mjDEPTH_ZERONEAR = 0, + mjDEPTH_ZEROFAR = 1, } public enum mjtFontScale : int{ mjFONTSCALE_50 = 50,