Fixups to comments and flags for reversed Z rendering

This commit is contained in:
Levi Burner
2023-09-29 11:34:14 -04:00
parent 2e52bf807b
commit 56403b4dce
9 changed files with 26 additions and 28 deletions
+2 -2
View File
@@ -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->readDepthMapping == mjDM_ZEROTOONE) {
if (con->readDepthMap == mjDEPTHMAP_01) {
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->readDepthMapping == mjDM_ZEROTOONE) {
if (con->readDepthMap == mjDEPTHMAP_01) {
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
}