Add flag to mjrContext to support legacy depth mapping by default

This commit is contained in:
Levi Burner
2023-09-26 13:34:00 -04:00
parent d32eb6bd12
commit 2e52bf807b
8 changed files with 40 additions and 0 deletions
+1
View File
@@ -215,6 +215,7 @@ PYBIND11_MODULE(_render, pymodule) {
X(windowDoublebuffer);
X(currentBuffer);
X(readPixelFormat);
X(readDepthMapping);
#undef X
#define X(var) \
+2
View File
@@ -86,6 +86,7 @@ the clause:
_render.mjr_setBuffer(
_enums.mjtFramebuffer.mjFB_OFFSCREEN.value, self._mjr_context
)
self._mjr_context.readDepthMapping = _enums.mjtDepthMapping.mjDM_ONETOZERO
# Default render flags.
self._depth_rendering = False
@@ -196,6 +197,7 @@ the clause:
out_64 = D / (out_64 + C)
# Cast result back to float32 for backwards compatibility
# This has a small accuracy cost
out[:] = out_64.astype(np.float32)
# Reset scene flags.