(self, context, viewport)
Renders the overlay on screen.

    Args:
      context: MjrContext instance.
      viewport: MJRRECT instance.
Renders the overlay on screen.
Renders the overlay on screen .
def render(self, context, viewport):
    """Renders the overlay on screen.

    Args:
      context: MjrContext instance.
      viewport: MJRRECT instance.
    """
    width_adjustment = viewport.width % 4
    rect_shape = (viewport.width - width_adjustment, viewport.height)

    if self._depth_buffer is None or self._depth_buffer.shape != rect_shape:
      self._depth_buffer = np.empty(
          (viewport.width, viewport.height), np.float32)

    mjlib.mjr_readPixels(
        None, self._depth_buffer, viewport.mujoco_rect, context.ptr)

    # Subsample by 4, convert to RGB, and cast to unsigned bytes.
    depth_rgb = np.repeat(self._depth_buffer[::4, ::4, None] * 255, 3,
                          -1).astype(np.ubyte)

    pos = types.MJRRECT(
        int(3 * viewport.width / 4) + width_adjustment, 0,
        int(viewport.width / 4), int(viewport.height / 4))
    mjlib.mjr_drawPixels(depth_rgb, None, pos, context.ptr)
def render ( self , context , viewport ) : width_adjustment = viewport . width % 4 rect_shape = ( viewport . width - width_adjustment , viewport . height ) if self . _depth_buffer is None or self . _depth_buffer . shape != rect_shape : self . _depth_buffer = np . empty ( ( viewport . width , viewport . height ) , np . float32 ) mjlib . mjr_readPixels ( None , self . _depth_buffer , viewport . mujoco_rect , context . ptr ) # Subsample by 4, convert to RGB, and cast to unsigned bytes. depth_rgb = np . repeat ( self . _depth_buffer [ : : 4 , : : 4 , None ] * 255 , 3 , - 1 ) . astype ( np . ubyte ) pos = types . MJRRECT ( int ( 3 * viewport . width / 4 ) + width_adjustment , 0 , int ( viewport . width / 4 ) , int ( viewport . height / 4 ) ) mjlib . mjr_drawPixels ( depth_rgb , None , pos , context . ptr )