Class GraphicsModule

java.lang.Object
gaiasky.script.v2.impl.APIModule
gaiasky.script.v2.impl.GraphicsModule
All Implemented Interfaces:
GraphicsAPI

public class GraphicsModule extends APIModule implements GraphicsAPI
The graphics module contains methods and calls that modify and query the graphics and rendering system.

The methods in this API are organized like this:

  • mode_[...]() — activate or deactivate camera modes
  • effect_[...]() — activate or deactivate post-processing effects
  • set_[...]() — set properties or settings
    • set_image_[...]() — set image levels
  • Constructor Details

    • GraphicsModule

      public GraphicsModule(EventManager em, APIv2 api, String name)
      Create a new module with the given attributes.
      Parameters:
      api - Reference to the API class.
      name - Name of the module.
  • Method Details

    • set_image_brightness

      public void set_image_brightness(double level)
      Description copied from interface: GraphicsAPI
      Set the brightness level of the render system.
      Specified by:
      set_image_brightness in interface GraphicsAPI
      Parameters:
      level - The brightness level as a double precision floating point number in [-1,1]. The neutral value is 0.0.
    • set_image_brightness

      public void set_image_brightness(long level)
    • set_image_contrast

      public void set_image_contrast(double level)
      Description copied from interface: GraphicsAPI
      Set the contrast level of the render system.
      Specified by:
      set_image_contrast in interface GraphicsAPI
      Parameters:
      level - The contrast level as a double precision floating point number in [0,2]. The neutral value is 1.0.
    • set_image_contrast

      public void set_image_contrast(long level)
    • set_image_hue

      public void set_image_hue(double level)
      Description copied from interface: GraphicsAPI
      Set the hue level of the render system.
      Specified by:
      set_image_hue in interface GraphicsAPI
      Parameters:
      level - The hue level as a double precision floating point number in [0,2]. The neutral value is 1.0.
    • set_image_hue

      public void set_image_hue(long level)
    • set_image_saturation

      public void set_image_saturation(double level)
      Description copied from interface: GraphicsAPI
      Set the saturation level of the render system.
      Specified by:
      set_image_saturation in interface GraphicsAPI
      Parameters:
      level - The saturation level as a double precision floating point number in [0,2]. The neutral value is 1.0.
    • set_image_saturation

      public void set_image_saturation(long level)
    • set_gamma_correction

      public void set_gamma_correction(double level)
      Description copied from interface: GraphicsAPI
      Set the gamma correction level.
      Specified by:
      set_gamma_correction in interface GraphicsAPI
      Parameters:
      level - The gamma correction level in [0,3] as a floating point number. The neutral value is 1.2.
    • set_gamma_correction

      public void set_gamma_correction(long level)
    • set_hdr_tone_mapping

      public void set_hdr_tone_mapping(String type)
      Description copied from interface: GraphicsAPI
      Set the high dynamic range tone mapping algorithm type. The types can be:
      • "auto" - performs an automatic HDR tone mapping based on the current luminosity of the scene
      • "exposure" - performs an exposure-based HDR tone mapping. The exposure value must be set with GraphicsAPI.set_exposure_tone_mapping(double)
      • "aces" - performs the ACES tone mapping
      • "uncharted" - performs the tone mapping implemented in Uncharted
      • "filmic" - performs a filmic tone mapping
      • "none" - no HDR tone mapping
      Specified by:
      set_hdr_tone_mapping in interface GraphicsAPI
      Parameters:
      type - The HDR tone mapping type. One of ["auto"|"exposure"|"aces"|"uncharted"|"filmic"|"none"].
    • set_exposure_tone_mapping

      public void set_exposure_tone_mapping(double level)
      Description copied from interface: GraphicsAPI
      Set the exposure level.
      Specified by:
      set_exposure_tone_mapping in interface GraphicsAPI
      Parameters:
      level - The exposure level in [0,n]. Set to 0 to disable exposure tone mapping.
    • set_exposure_tone_mapping

      public void set_exposure_tone_mapping(long level)
    • mode_cubemap

      public void mode_cubemap(boolean state, String projection)
      Description copied from interface: GraphicsAPI
      Enable and disable the cubemap mode.
      Specified by:
      mode_cubemap in interface GraphicsAPI
      Parameters:
      state - The boolean state. True to activate, false to deactivate.
      projection - The projection to use as a string. Accepted values are ["equirectangular"|"cylindrical"|"hammer"|"orthographic"|"orthosphere"|"orthosphere_crossye"|"azimuthal_equidistant"].
    • mode_panorama

      public void mode_panorama(boolean state)
      Description copied from interface: GraphicsAPI
      Enable or disable the panorama mode.
      Specified by:
      mode_panorama in interface GraphicsAPI
      Parameters:
      state - The boolean state. True to activate, false to deactivate.
    • mode_reprojection

      public void mode_reprojection(String mode)
      Description copied from interface: GraphicsAPI
      Set the re-projection mode. Possible modes are:
      • "disabled"
      • "default"
      • "accurate"
      • "stereographic_screen"
      • "stereographic_long"
      • "stereographic_short"
      • "stereographic_180"
      • "lambert_screen"
      • "lambert_long"
      • "lambert_short"
      • "lambert_180"
      • "orthographic_screen"
      • "orthographic_long"
      • "orthographic_short"
      • "orthographic_180"
      Specified by:
      mode_reprojection in interface GraphicsAPI
      Parameters:
      mode - The re-projection mode, as a string.
    • set_back_buffer_scale

      public void set_back_buffer_scale(float scale)
      Description copied from interface: GraphicsAPI
      Set the scaling factor for the back-buffer.
      Specified by:
      set_back_buffer_scale in interface GraphicsAPI
      Parameters:
      scale - The back-buffer scaling factor.
    • set_index_of_refraction

      public void set_index_of_refraction(float ior)
      Description copied from interface: GraphicsAPI
      Set index of refraction of celestial sphere in orthosphere view mode.
      Specified by:
      set_index_of_refraction in interface GraphicsAPI
      Parameters:
      ior - The index of refraction.
    • mode_planetarium

      public void mode_planetarium(boolean state)
      Description copied from interface: GraphicsAPI
      Enable or disable the planetarium mode.
      Specified by:
      mode_planetarium in interface GraphicsAPI
      Parameters:
      state - The boolean state. True to activate, false to deactivate.
    • set_cubemap_resolution

      public void set_cubemap_resolution(int resolution)
      Description copied from interface: GraphicsAPI
      Set the resolution (width and height are the same) of each side of the frame buffers used to capture each of the 6 directions that go into the cubemap to construct the equirectangular image for the 360 mode. This should roughly be 1/3 of the output resolution at which the 360 mode are to be captured (or screen resolution).
      Specified by:
      set_cubemap_resolution in interface GraphicsAPI
      Parameters:
      resolution - The resolution of each of the sides of the cubemap for the 360 mode.
    • set_cubemap_projection

      public void set_cubemap_projection(String projection)
      Description copied from interface: GraphicsAPI
      Set the cubemap projection to use.

      Accepted values are:

      • "equirectangular" - spherical projection.
      • "cylindrical" - cylindrical projection.
      • "hammer" - Hammer projection.
      • "orthographic" - orthographic projection, with the two hemispheres side-by-side.
      • "orthosphere" - orthographic projection, with the two hemispheres overlaid. That gives an outside view of the camera's celestial sphere.
      • "orthosphere_crosseye" - same as orthosphere, but duplicated to produce a stereoscopic cross-eye image (side by side).
      • "azimuthal_equidistant" - azimuthal equidistant projection, used in Planetarium mode.
      See CubmeapProjectionEffect for possible values.
      Specified by:
      set_cubemap_projection in interface GraphicsAPI
      Parameters:
      projection - The projection, in ["equirectangular"|"cylindrical"|"hammer"|"orthographic"|"orthosphere"|"orthosphere_crossye"|"azimuthal_equidistant"].
    • mode_orthosphere

      public void mode_orthosphere(boolean state)
      Description copied from interface: GraphicsAPI
      Enable or disable the orthosphere view mode.
      Specified by:
      mode_orthosphere in interface GraphicsAPI
      Parameters:
      state - The state, true to activate and false to deactivate.
    • mode_stereoscopic

      public void mode_stereoscopic(boolean state)
      Description copied from interface: GraphicsAPI
      Enable or disable the stereoscopic mode.
      Specified by:
      mode_stereoscopic in interface GraphicsAPI
      Parameters:
      state - The boolean state. True to activate, false to deactivate.
    • set_stereo_profile

      public void set_stereo_profile(int index)
      Description copied from interface: GraphicsAPI
      Change the stereoscopic profile.
      Specified by:
      set_stereo_profile in interface GraphicsAPI
      Parameters:
      index - The index of the new profile:
      • 0 - VR_HEADSET
      • 1 - HD_3DTV
      • 2 - CROSSEYE
      • 3 - PARALLEL_VIEW
      • 4 - ANAGLYPHIC (red-cyan)
    • get_current_frame_number

      public long get_current_frame_number()
      Description copied from interface: GraphicsAPI
      Get the current frame number. Useful for timing actions in scripts.
      Specified by:
      get_current_frame_number in interface GraphicsAPI
      Returns:
      The current frame number.
    • effect_lens_flare

      public void effect_lens_flare(boolean state)
      Description copied from interface: GraphicsAPI
      Enable or disables the lens flare effect.
      Specified by:
      effect_lens_flare in interface GraphicsAPI
      Parameters:
      state - Activate (true) or deactivate (false).
    • effect_lens_flare

      public void effect_lens_flare(double value)
      Description copied from interface: GraphicsAPI
      Set the strength of the lens flare effect, in [0,1].

      Set to 0 to disable the effect.

      Specified by:
      effect_lens_flare in interface GraphicsAPI
      Parameters:
      value - The strength or intensity of the lens flare, in [0,1].
    • effect_motion_blur

      public void effect_motion_blur(boolean active)
      Description copied from interface: GraphicsAPI
      Enable or disable the camera motion blur effect.
      Specified by:
      effect_motion_blur in interface GraphicsAPI
      Parameters:
      active - Activate (true) or deactivate (false).
    • effect_motion_blur

      public void effect_motion_blur(double value)
      Description copied from interface: GraphicsAPI
      Enable or disable the camera motion blur effect.
      Specified by:
      effect_motion_blur in interface GraphicsAPI
      Parameters:
      value - The strength of camera the motion blur effect, in [Constants.MOTIONBLUR_MIN, Constants.MOTIONBLUR_MAX].
    • effect_star_glow

      public void effect_star_glow(boolean state)
      Description copied from interface: GraphicsAPI
      Enable or disable stars' light glowing and spilling over closer objects.
      Specified by:
      effect_star_glow in interface GraphicsAPI
      Parameters:
      state - Enable (true) or disable (false).
    • effect_bloom

      public void effect_bloom(float value)
      Description copied from interface: GraphicsAPI
      Set the strength value for the bloom effect.
      Specified by:
      effect_bloom in interface GraphicsAPI
      Parameters:
      value - Bloom strength between 0 and 100. Set to 0 to deactivate the bloom.
    • effect_chromatic_aberration

      public void effect_chromatic_aberration(float value)
      Description copied from interface: GraphicsAPI
      Set the amount of chromatic aberration. Set to 0 to disable the effect.
      Specified by:
      effect_chromatic_aberration in interface GraphicsAPI
      Parameters:
      value - Chromatic aberration amount in [0,0.05].
    • effect_bloom

      public void effect_bloom(int level)
    • set_smooth_lod_transitions

      public void set_smooth_lod_transitions(boolean value)
      Description copied from interface: GraphicsAPI
      Set the value of smooth lod transitions, allowing or disallowing octant fade-ins of as they come into view.
      Specified by:
      set_smooth_lod_transitions in interface GraphicsAPI
      Parameters:
      value - Activate (true) or deactivate (false).
    • set_ambient_light

      public void set_ambient_light(float value)
      Description copied from interface: GraphicsAPI
      Set the ambient light to a certain value.
      Specified by:
      set_ambient_light in interface GraphicsAPI
      Parameters:
      value - The value of the ambient light in [0,1].
    • set_ambient_light

      public void set_ambient_light(int value)
    • set_star_brightness_power

      public void set_star_brightness_power(float value)
      Description copied from interface: GraphicsAPI
      Set the star brightness power profile value in [1.1, 0.9]. Default value is 1. The power is applied to the star solid angle (from camera), before clamping, as sa = pow(sa, r).
      Specified by:
      set_star_brightness_power in interface GraphicsAPI
      Parameters:
      value - The power value in [0, 100].
    • set_star_glow_factor

      public void set_star_glow_factor(float value)
      Description copied from interface: GraphicsAPI
      Set the star glow factor level value. This controls the amount of glow light when the camera is close to stars. Must be between Constants.MIN_STAR_GLOW_FACTOR and Constants.MAX_STAR_GLOW_FACTOR.

      Default is 0.06.

      Specified by:
      set_star_glow_factor in interface GraphicsAPI
      Parameters:
      value - The new glow factor value.
    • get_star_brightness

      public float get_star_brightness()
      Description copied from interface: GraphicsAPI
      Get the star brightness value.
      Specified by:
      get_star_brightness in interface GraphicsAPI
      Returns:
      The brightness value, between 0 and 100.
    • set_star_brightness

      public void set_star_brightness(float value)
      Description copied from interface: GraphicsAPI
      Set the star brightness value.
      Specified by:
      set_star_brightness in interface GraphicsAPI
      Parameters:
      value - The brightness value, between 0 and 100.
    • set_star_brightness

      public void set_star_brightness(int brightness)
    • get_point_size

      public float get_point_size()
      Description copied from interface: GraphicsAPI
      Get the current point size value in pixels.
      Specified by:
      get_point_size in interface GraphicsAPI
      Returns:
      The size value, in pixels.
    • set_point_size

      public void set_point_size(float size)
      Description copied from interface: GraphicsAPI
      Set the base point size.
      Specified by:
      set_point_size in interface GraphicsAPI
      Parameters:
      size - The size value, between Constants.MIN_STAR_POINT_SIZE and Constants.MAX_STAR_POINT_SIZE.
    • set_point_size

      public void set_point_size(long size)
    • get_star_base_opacity

      public float get_star_base_opacity()
      Description copied from interface: GraphicsAPI
      Get the base star opacity.
      Specified by:
      get_star_base_opacity in interface GraphicsAPI
      Returns:
      The base opacity value.
    • set_star_base_opacity

      public void set_star_base_opacity(float opacity)
      Description copied from interface: GraphicsAPI
      Set the base star opacity.
      Specified by:
      set_star_base_opacity in interface GraphicsAPI
      Parameters:
      opacity - The base opacity value, between Constants.MIN_STAR_MIN_OPACITY and Constants.MAX_STAR_MIN_OPACITY.
    • set_star_base_opacity

      public void set_star_base_opacity(long opacity)
    • set_star_texture_index

      public void set_star_texture_index(int index)
      Description copied from interface: GraphicsAPI
      Set the texture index for star groups, in [1, 6].

      1. horizontal spike
      2. god rays
      3. horizontal and vertical spikes
      4. simple radial profile
      5. diagonal spikes
      6. detailed glow
      Specified by:
      set_star_texture_index in interface GraphicsAPI
      Parameters:
      index - The new star texture index.
    • set_glow_texture_index

      public void set_glow_texture_index(int index)
      Description copied from interface: GraphicsAPI
      Set the texture index for the light glow effect, in [1, 6].

      1. horizontal spike
      2. god rays
      3. horizontal and vertical spikes
      4. simple radial profile
      5. diagonal spikes
      6. detailed glow
      Specified by:
      set_glow_texture_index in interface GraphicsAPI
      Parameters:
      index - The new glow effect texture index.
    • set_star_set_metadata_size

      public void set_star_set_metadata_size(int n)
      Description copied from interface: GraphicsAPI
      Set the number of nearest stars to be processed for each star set. Use this method with caution, it is mainly intended for internal purposes.
      Specified by:
      set_star_set_metadata_size in interface GraphicsAPI
      Parameters:
      n - The new number of nearest stars.
    • set_star_set_billboard

      public void set_star_set_billboard(boolean flag)
      Description copied from interface: GraphicsAPI
      Enable or disable the rendering of close stars as billboards.
      Specified by:
      set_star_set_billboard in interface GraphicsAPI
      Parameters:
      flag - The state flag.
    • set_orbit_solid_angle_threshold

      public void set_orbit_solid_angle_threshold(float deg)
      Description copied from interface: GraphicsAPI
      Set the solid angle below which orbits fade and disappear.
      Specified by:
      set_orbit_solid_angle_threshold in interface GraphicsAPI
      Parameters:
      deg - The threshold angle in degrees.
    • set_limit_fps

      public void set_limit_fps(double fps)
      Description copied from interface: GraphicsAPI
      Limit the frame rate of Gaia Sky to the given value, in frames per second.
      Specified by:
      set_limit_fps in interface GraphicsAPI
      Parameters:
      fps - The new maximum frame rate as a double-precision floating point number. Set zero or negative to unlimited.
    • set_limit_fps

      public void set_limit_fps(int fps)
      Description copied from interface: GraphicsAPI
      Limit the frame rate of Gaia Sky to the given value, in frames per second.
      Specified by:
      set_limit_fps in interface GraphicsAPI
      Parameters:
      fps - The new maximum frame rate as an integer number. Set zero or negative to unlimited.