More fixups to mjtDepthMap names
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
+2
-2
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
),
|
||||
),
|
||||
)),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user