(self, physics, renderer_instance, touchpad)
Initialize the viewer.

    Args:
      physics: Physics instance.
      renderer_instance: A renderer.Base instance.
      touchpad: A boolean, use input dedicated to touchpad.
Initialize the viewer.
Initialize the viewer .
def initialize(self, physics, renderer_instance, touchpad):
    """Initialize the viewer.

    Args:
      physics: Physics instance.
      renderer_instance: A renderer.Base instance.
      touchpad: A boolean, use input dedicated to touchpad.
    """
    self._camera = renderer.SceneCamera(
        physics.model, physics.data, self._render_settings,
        settings=self._camera_settings, zoom_factor=self._zoom_factor)

    self._manipulator = ManipulationController(
        self._viewport, self._camera, self._mouse)

    self._free_camera = FreeCameraController(
        self._viewport, self._camera, self._mouse, self._manipulator)

    self._camera_select = CameraSelector(
        physics.model, self._camera, self._free_camera)

    self._renderer = renderer_instance

    self._input_map.clear_bindings()

    if touchpad:
      self._input_map.bind(
          self._manipulator.set_move_vertical_mode,
          _MOVE_OBJECT_VERTICAL_TOUCHPAD)
      self._input_map.bind(
          self._manipulator.set_move_horizontal_mode,
          _MOVE_OBJECT_HORIZONTAL_TOUCHPAD)
      self._input_map.bind(
          self._manipulator.set_rotate_mode, _ROTATE_OBJECT_TOUCHPAD)
      self._input_map.bind(
          self._free_camera.set_pan_vertical_mode,
          _PAN_CAMERA_VERTICAL_TOUCHPAD)
      self._input_map.bind(
          self._free_camera.set_pan_horizontal_mode,
          _PAN_CAMERA_HORIZONTAL_TOUCHPAD)
    else:
      self._input_map.bind(
          self._manipulator.set_move_vertical_mode, _MOVE_OBJECT_VERTICAL_MOUSE)
      self._input_map.bind(
          self._manipulator.set_move_horizontal_mode,
          _MOVE_OBJECT_HORIZONTAL_MOUSE)
      self._input_map.bind(
          self._manipulator.set_rotate_mode, _ROTATE_OBJECT_MOUSE)
      self._input_map.bind(
          self._free_camera.set_pan_vertical_mode, _PAN_CAMERA_VERTICAL_MOUSE)
      self._input_map.bind(
          self._free_camera.set_pan_horizontal_mode,
          _PAN_CAMERA_HORIZONTAL_MOUSE)

    self._input_map.bind(self._print_camera_transform, _PRINT_CAMERA)
    self._input_map.bind(
        self._render_settings.select_prev_rendering_mode, _PREV_RENDERING_MODE)
    self._input_map.bind(
        self._render_settings.select_next_rendering_mode, _NEXT_RENDERING_MODE)
    self._input_map.bind(
        self._render_settings.select_prev_labeling_mode, _PREV_LABELING_MODE)
    self._input_map.bind(
        self._render_settings.select_next_labeling_mode, _NEXT_LABELING_MODE)
    self._input_map.bind(
        self._render_settings.select_prev_labeling_mode, _PREV_LABELING_MODE)
    self._input_map.bind(
        self._render_settings.toggle_stereo_buffering, _DOUBLE_BUFFERING)
    self._input_map.bind(
        self._render_settings.toggle_visualization_flag, _VISUALIZATION_FLAGS)
    self._input_map.bind(
        self._render_settings.toggle_site_group, _SITE_GROUPS)
    self._input_map.bind(
        self._render_settings.toggle_geom_group, _GEOM_GROUPS)
    self._input_map.bind(
        self._render_settings.toggle_rendering_flag, _RENDERING_FLAGS)

    self._input_map.bind(self._camera.zoom_to_scene, _ZOOM_TO_SCENE)
    self._input_map.bind(self._camera_select.select_next, _NEXT_CAMERA)
    self._input_map.bind(self._camera_select.select_previous, _PREVIOUS_CAMERA)
    self._input_map.bind_z_axis(self._free_camera.zoom)
    self._input_map.bind_plane(self._free_camera.on_move)
    self._input_map.bind(self._free_camera.set_rotate_mode, _ROTATE_CAMERA)
    self._input_map.bind(self._free_camera.center, _CENTER_CAMERA)
    self._input_map.bind(self._free_camera.track, _TRACK_OBJECT)
    self._input_map.bind(self._free_camera.free_look, _FREE_LOOK)
    self._input_map.bind(self._manipulator.select, _SELECT_OBJECT)
    self._input_map.bind_plane(self._manipulator.on_move)
def initialize ( self , physics , renderer_instance , touchpad ) : self . _camera = renderer . SceneCamera ( physics . model , physics . data , self . _render_settings , settings = self . _camera_settings , zoom_factor = self . _zoom_factor ) self . _manipulator = ManipulationController ( self . _viewport , self . _camera , self . _mouse ) self . _free_camera = FreeCameraController ( self . _viewport , self . _camera , self . _mouse , self . _manipulator ) self . _camera_select = CameraSelector ( physics . model , self . _camera , self . _free_camera ) self . _renderer = renderer_instance self . _input_map . clear_bindings ( ) if touchpad : self . _input_map . bind ( self . _manipulator . set_move_vertical_mode , _MOVE_OBJECT_VERTICAL_TOUCHPAD ) self . _input_map . bind ( self . _manipulator . set_move_horizontal_mode , _MOVE_OBJECT_HORIZONTAL_TOUCHPAD ) self . _input_map . bind ( self . _manipulator . set_rotate_mode , _ROTATE_OBJECT_TOUCHPAD ) self . _input_map . bind ( self . _free_camera . set_pan_vertical_mode , _PAN_CAMERA_VERTICAL_TOUCHPAD ) self . _input_map . bind ( self . _free_camera . set_pan_horizontal_mode , _PAN_CAMERA_HORIZONTAL_TOUCHPAD ) else : self . _input_map . bind ( self . _manipulator . set_move_vertical_mode , _MOVE_OBJECT_VERTICAL_MOUSE ) self . _input_map . bind ( self . _manipulator . set_move_horizontal_mode , _MOVE_OBJECT_HORIZONTAL_MOUSE ) self . _input_map . bind ( self . _manipulator . set_rotate_mode , _ROTATE_OBJECT_MOUSE ) self . _input_map . bind ( self . _free_camera . set_pan_vertical_mode , _PAN_CAMERA_VERTICAL_MOUSE ) self . _input_map . bind ( self . _free_camera . set_pan_horizontal_mode , _PAN_CAMERA_HORIZONTAL_MOUSE ) self . _input_map . bind ( self . _print_camera_transform , _PRINT_CAMERA ) self . _input_map . bind ( self . _render_settings . select_prev_rendering_mode , _PREV_RENDERING_MODE ) self . _input_map . bind ( self . _render_settings . select_next_rendering_mode , _NEXT_RENDERING_MODE ) self . _input_map . bind ( self . _render_settings . select_prev_labeling_mode , _PREV_LABELING_MODE ) self . _input_map . bind ( self . _render_settings . select_next_labeling_mode , _NEXT_LABELING_MODE ) self . _input_map . bind ( self . _render_settings . select_prev_labeling_mode , _PREV_LABELING_MODE ) self . _input_map . bind ( self . _render_settings . toggle_stereo_buffering , _DOUBLE_BUFFERING ) self . _input_map . bind ( self . _render_settings . toggle_visualization_flag , _VISUALIZATION_FLAGS ) self . _input_map . bind ( self . _render_settings . toggle_site_group , _SITE_GROUPS ) self . _input_map . bind ( self . _render_settings . toggle_geom_group , _GEOM_GROUPS ) self . _input_map . bind ( self . _render_settings . toggle_rendering_flag , _RENDERING_FLAGS ) self . _input_map . bind ( self . _camera . zoom_to_scene , _ZOOM_TO_SCENE ) self . _input_map . bind ( self . _camera_select . select_next , _NEXT_CAMERA ) self . _input_map . bind ( self . _camera_select . select_previous , _PREVIOUS_CAMERA ) self . _input_map . bind_z_axis ( self . _free_camera . zoom ) self . _input_map . bind_plane ( self . _free_camera . on_move ) self . _input_map . bind ( self . _free_camera . set_rotate_mode , _ROTATE_CAMERA ) self . _input_map . bind ( self . _free_camera . center , _CENTER_CAMERA ) self . _input_map . bind ( self . _free_camera . track , _TRACK_OBJECT ) self . _input_map . bind ( self . _free_camera . free_look , _FREE_LOOK ) self . _input_map . bind ( self . _manipulator . select , _SELECT_OBJECT ) self . _input_map . bind_plane ( self . _manipulator . on_move )