More fixups to mjtDepthMap names

This commit is contained in:
Levi Burner
2023-09-29 18:24:54 -04:00
parent 56403b4dce
commit 9e51f20ce2
7 changed files with 12 additions and 12 deletions
+3 -3
View File
@@ -40,8 +40,8 @@ typedef enum mjtFramebuffer_ { // OpenGL framebuffer option
} mjtFramebuffer; } mjtFramebuffer;
typedef enum mjtDepthMap_ { // depth mapping for `mjr_readPixels` typedef enum mjtDepthMap_ { // depth mapping for `mjr_readPixels`
mjDEPTHMAP_01 = 0, // standard depth map; 0: znear, 1: zfar mjDEPTH_ZERONEAR = 0, // standard depth map; 0: znear, 1: zfar
mjDEPTHMAP_10 = 1 // reversed depth map; 1: znear, 0: zfar mjDEPTH_ZEROFAR = 1 // reversed depth map; 1: znear, 0: zfar
} mjtDepthMap; } mjtDepthMap;
typedef enum mjtFontScale_ { // font scale, used at context creation 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 int readPixelFormat; // default color pixel format for mjr_readPixels
// depth output format // 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; typedef struct mjrContext_ mjrContext;
+2 -2
View File
@@ -626,8 +626,8 @@ ENUMS: Mapping[str, EnumDecl] = dict([
name='mjtDepthMap', name='mjtDepthMap',
declname='enum mjtDepthMap_', declname='enum mjtDepthMap_',
values=dict([ values=dict([
('mjDEPTHMAP_01', 0), ('mjDEPTH_ZERONEAR', 0),
('mjDEPTHMAP_10', 1), ('mjDEPTH_ZEROFAR', 1),
]), ]),
)), )),
('mjtFontScale', ('mjtFontScale',
+1 -1
View File
@@ -7129,7 +7129,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
StructFieldDecl( StructFieldDecl(
name='readDepthMap', name='readDepthMap',
type=ValueType(name='int'), type=ValueType(name='int'),
doc='depth mapping: mjDEPTHMAP_01 or mjDEPTHMAP_10', doc='depth mapping: mjDEPTH_ZERONEAR or mjDEPTH_ZEROFAR',
), ),
), ),
)), )),
+1 -1
View File
@@ -86,7 +86,7 @@ the clause:
_render.mjr_setBuffer( _render.mjr_setBuffer(
_enums.mjtFramebuffer.mjFB_OFFSCREEN.value, self._mjr_context _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. # Default render flags.
self._depth_rendering = False self._depth_rendering = False
+1 -1
View File
@@ -1614,7 +1614,7 @@ void mjr_makeContext_offSize(const mjModel* m, mjrContext* con, int fontscale,
con->readPixelFormat = GL_RGB; con->readPixelFormat = GL_RGB;
// set default depth mapping for mjr_readPixels // set default depth mapping for mjr_readPixels
con->readDepthMap = mjDEPTHMAP_01; con->readDepthMap = mjDEPTH_ZERONEAR;
} }
+2 -2
View File
@@ -115,7 +115,7 @@ void mjr_readPixels(unsigned char* rgb, float* depth,
if (depth) { if (depth) {
glReadPixels(viewport.left, viewport.bottom, viewport.width, viewport.height, glReadPixels(viewport.left, viewport.bottom, viewport.width, viewport.height,
GL_DEPTH_COMPONENT, GL_FLOAT, depth); GL_DEPTH_COMPONENT, GL_FLOAT, depth);
if (con->readDepthMap == mjDEPTHMAP_01) { if (con->readDepthMap == mjDEPTH_ZERONEAR) {
int N_pixels = viewport.width * viewport.height; 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 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, glReadPixels(viewport.left, viewport.bottom, viewport.width, viewport.height,
GL_DEPTH_COMPONENT, GL_FLOAT, depth); GL_DEPTH_COMPONENT, GL_FLOAT, depth);
if (con->readDepthMap == mjDEPTHMAP_01) { if (con->readDepthMap == mjDEPTH_ZERONEAR) {
int N_pixels = viewport.width * viewport.height; 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 for (int i = 0; i < N_pixels; i++) depth[i] = 1.0 - depth[i]; // Reverse the reversed Z buffer
} }
+2 -2
View File
@@ -390,8 +390,8 @@ public enum mjtFramebuffer : int{
mjFB_OFFSCREEN = 1, mjFB_OFFSCREEN = 1,
} }
public enum mjtDepthMap : int{ public enum mjtDepthMap : int{
mjDEPTHMAP_01 = 0, mjDEPTH_ZERONEAR = 0,
mjDEPTHMAP_10 = 1, mjDEPTH_ZEROFAR = 1,
} }
public enum mjtFontScale : int{ public enum mjtFontScale : int{
mjFONTSCALE_50 = 50, mjFONTSCALE_50 = 50,