Class GraphicsModule
java.lang.Object
gaiasky.script.v2.impl.APIModule
gaiasky.script.v2.impl.GraphicsModule
- All Implemented Interfaces:
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 modeseffect_[...]()— activate or deactivate post-processing effectsset_[...]()— set properties or settingsset_image_[...]()— set image levels
-
Field Summary
Fields inherited from class APIModule
api, em, logger, me, nameModifier and TypeFieldDescriptionprotected final APIv2Reference to API object.protected final EventManagerReference to event manager.protected final Logger.Logprotected final APIModuleReference to self.protected final StringModule name. -
Constructor Summary
ConstructorsConstructorDescriptionGraphicsModule(EventManager em, APIv2 api, String name) Create a new module with the given attributes. -
Method Summary
Modifier and TypeMethodDescriptionvoideffect_bloom(float value) Set the strength value for the bloom effect.voideffect_bloom(int level) voideffect_chromatic_aberration(float value) Set the amount of chromatic aberration.voideffect_lens_flare(boolean state) Enable or disables the lens flare effect.voideffect_lens_flare(double value) Set the strength of the lens flare effect, in [0,1].voideffect_motion_blur(boolean active) Enable or disable the camera motion blur effect.voideffect_motion_blur(double value) Enable or disable the camera motion blur effect.voideffect_star_glow(boolean state) Enable or disable stars' light glowing and spilling over closer objects.longGet the current frame number.floatGet the current point size value in pixels.floatGet the base star opacity.floatGet the star brightness value.voidmode_cubemap(boolean state, String projection) Enable and disable the cubemap mode.voidmode_orthosphere(boolean state) Enable or disable the orthosphere view mode.voidmode_panorama(boolean state) Enable or disable the panorama mode.voidmode_planetarium(boolean state) Enable or disable the planetarium mode.voidmode_reprojection(String mode) Set the re-projection mode.voidmode_stereoscopic(boolean state) Enable or disable the stereoscopic mode.voidset_ambient_light(float value) Set the ambient light to a certain value.voidset_ambient_light(int value) voidset_back_buffer_scale(float scale) Set the scaling factor for the back-buffer.voidset_cubemap_projection(String projection) Set the cubemap projection to use.voidset_cubemap_resolution(int resolution) 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.voidset_exposure_tone_mapping(double level) Set the exposure level.voidset_exposure_tone_mapping(long level) voidset_gamma_correction(double level) Set the gamma correction level.voidset_gamma_correction(long level) voidset_glow_texture_index(int index) Set the texture index for the light glow effect, in [1, 6].voidset_hdr_tone_mapping(String type) Set the high dynamic range tone mapping algorithm type.voidset_image_brightness(double level) Set the brightness level of the render system.voidset_image_brightness(long level) voidset_image_contrast(double level) Set the contrast level of the render system.voidset_image_contrast(long level) voidset_image_hue(double level) Set the hue level of the render system.voidset_image_hue(long level) voidset_image_saturation(double level) Set the saturation level of the render system.voidset_image_saturation(long level) voidset_index_of_refraction(float ior) Set index of refraction of celestial sphere in orthosphere view mode.voidset_limit_fps(double fps) Limit the frame rate of Gaia Sky to the given value, in frames per second.voidset_limit_fps(int fps) Limit the frame rate of Gaia Sky to the given value, in frames per second.voidset_orbit_solid_angle_threshold(float deg) Set the solid angle below which orbits fade and disappear.voidset_point_size(float size) Set the base point size.voidset_point_size(long size) voidset_smooth_lod_transitions(boolean value) Set the value of smooth lod transitions, allowing or disallowing octant fade-ins of as they come into view.voidset_star_base_opacity(float opacity) Set the base star opacity.voidset_star_base_opacity(long opacity) voidset_star_brightness(float value) Set the star brightness value.voidset_star_brightness(int brightness) voidset_star_brightness_power(float value) Set the star brightness power profile value in [1.1, 0.9].voidset_star_glow_factor(float value) Set the star glow factor level value.voidset_star_set_billboard(boolean flag) Enable or disable the rendering of close stars as billboards.voidset_star_set_metadata_size(int n) Set the number of nearest stars to be processed for each star set.voidset_star_texture_index(int index) Set the texture index for star groups, in [1, 6].voidset_stereo_profile(int index) Change the stereoscopic profile.
-
Constructor Details
-
GraphicsModule
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:GraphicsAPISet the brightness level of the render system.- Specified by:
set_image_brightnessin interfaceGraphicsAPI- 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:GraphicsAPISet the contrast level of the render system.- Specified by:
set_image_contrastin interfaceGraphicsAPI- 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:GraphicsAPISet the hue level of the render system.- Specified by:
set_image_huein interfaceGraphicsAPI- 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:GraphicsAPISet the saturation level of the render system.- Specified by:
set_image_saturationin interfaceGraphicsAPI- 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:GraphicsAPISet the gamma correction level.- Specified by:
set_gamma_correctionin interfaceGraphicsAPI- 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
Description copied from interface:GraphicsAPISet 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_mappingin interfaceGraphicsAPI- 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:GraphicsAPISet the exposure level.- Specified by:
set_exposure_tone_mappingin interfaceGraphicsAPI- 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
Description copied from interface:GraphicsAPIEnable and disable the cubemap mode.- Specified by:
mode_cubemapin interfaceGraphicsAPI- 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:GraphicsAPIEnable or disable the panorama mode.- Specified by:
mode_panoramain interfaceGraphicsAPI- Parameters:
state- The boolean state. True to activate, false to deactivate.
-
mode_reprojection
Description copied from interface:GraphicsAPISet 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_reprojectionin interfaceGraphicsAPI- 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:GraphicsAPISet the scaling factor for the back-buffer.- Specified by:
set_back_buffer_scalein interfaceGraphicsAPI- Parameters:
scale- The back-buffer scaling factor.
-
set_index_of_refraction
public void set_index_of_refraction(float ior) Description copied from interface:GraphicsAPISet index of refraction of celestial sphere in orthosphere view mode.- Specified by:
set_index_of_refractionin interfaceGraphicsAPI- Parameters:
ior- The index of refraction.
-
mode_planetarium
public void mode_planetarium(boolean state) Description copied from interface:GraphicsAPIEnable or disable the planetarium mode.- Specified by:
mode_planetariumin interfaceGraphicsAPI- 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:GraphicsAPISet 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_resolutionin interfaceGraphicsAPI- Parameters:
resolution- The resolution of each of the sides of the cubemap for the 360 mode.
-
set_cubemap_projection
Description copied from interface:GraphicsAPISet 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.
CubmeapProjectionEffectfor possible values.- Specified by:
set_cubemap_projectionin interfaceGraphicsAPI- 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:GraphicsAPIEnable or disable the orthosphere view mode.- Specified by:
mode_orthospherein interfaceGraphicsAPI- Parameters:
state- The state, true to activate and false to deactivate.
-
mode_stereoscopic
public void mode_stereoscopic(boolean state) Description copied from interface:GraphicsAPIEnable or disable the stereoscopic mode.- Specified by:
mode_stereoscopicin interfaceGraphicsAPI- 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:GraphicsAPIChange the stereoscopic profile.- Specified by:
set_stereo_profilein interfaceGraphicsAPI- 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:GraphicsAPIGet the current frame number. Useful for timing actions in scripts.- Specified by:
get_current_frame_numberin interfaceGraphicsAPI- Returns:
- The current frame number.
-
effect_lens_flare
public void effect_lens_flare(boolean state) Description copied from interface:GraphicsAPIEnable or disables the lens flare effect.- Specified by:
effect_lens_flarein interfaceGraphicsAPI- Parameters:
state- Activate (true) or deactivate (false).
-
effect_lens_flare
public void effect_lens_flare(double value) Description copied from interface:GraphicsAPISet the strength of the lens flare effect, in [0,1].Set to 0 to disable the effect.
- Specified by:
effect_lens_flarein interfaceGraphicsAPI- 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:GraphicsAPIEnable or disable the camera motion blur effect.- Specified by:
effect_motion_blurin interfaceGraphicsAPI- Parameters:
active- Activate (true) or deactivate (false).
-
effect_motion_blur
public void effect_motion_blur(double value) Description copied from interface:GraphicsAPIEnable or disable the camera motion blur effect.- Specified by:
effect_motion_blurin interfaceGraphicsAPI- 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:GraphicsAPIEnable or disable stars' light glowing and spilling over closer objects.- Specified by:
effect_star_glowin interfaceGraphicsAPI- Parameters:
state- Enable (true) or disable (false).
-
effect_bloom
public void effect_bloom(float value) Description copied from interface:GraphicsAPISet the strength value for the bloom effect.- Specified by:
effect_bloomin interfaceGraphicsAPI- 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:GraphicsAPISet the amount of chromatic aberration. Set to 0 to disable the effect.- Specified by:
effect_chromatic_aberrationin interfaceGraphicsAPI- 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:GraphicsAPISet the value of smooth lod transitions, allowing or disallowing octant fade-ins of as they come into view.- Specified by:
set_smooth_lod_transitionsin interfaceGraphicsAPI- Parameters:
value- Activate (true) or deactivate (false).
-
set_ambient_light
public void set_ambient_light(float value) Description copied from interface:GraphicsAPISet the ambient light to a certain value.- Specified by:
set_ambient_lightin interfaceGraphicsAPI- 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:GraphicsAPISet 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_powerin interfaceGraphicsAPI- Parameters:
value- The power value in [0, 100].
-
set_star_glow_factor
public void set_star_glow_factor(float value) Description copied from interface:GraphicsAPISet the star glow factor level value. This controls the amount of glow light when the camera is close to stars. Must be betweenConstants.MIN_STAR_GLOW_FACTORandConstants.MAX_STAR_GLOW_FACTOR.Default is 0.06.
- Specified by:
set_star_glow_factorin interfaceGraphicsAPI- Parameters:
value- The new glow factor value.
-
get_star_brightness
public float get_star_brightness()Description copied from interface:GraphicsAPIGet the star brightness value.- Specified by:
get_star_brightnessin interfaceGraphicsAPI- Returns:
- The brightness value, between 0 and 100.
-
set_star_brightness
public void set_star_brightness(float value) Description copied from interface:GraphicsAPISet the star brightness value.- Specified by:
set_star_brightnessin interfaceGraphicsAPI- 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:GraphicsAPIGet the current point size value in pixels.- Specified by:
get_point_sizein interfaceGraphicsAPI- Returns:
- The size value, in pixels.
-
set_point_size
public void set_point_size(float size) Description copied from interface:GraphicsAPISet the base point size.- Specified by:
set_point_sizein interfaceGraphicsAPI- Parameters:
size- The size value, betweenConstants.MIN_STAR_POINT_SIZEandConstants.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:GraphicsAPIGet the base star opacity.- Specified by:
get_star_base_opacityin interfaceGraphicsAPI- Returns:
- The base opacity value.
-
set_star_base_opacity
public void set_star_base_opacity(float opacity) Description copied from interface:GraphicsAPISet the base star opacity.- Specified by:
set_star_base_opacityin interfaceGraphicsAPI- Parameters:
opacity- The base opacity value, betweenConstants.MIN_STAR_MIN_OPACITYandConstants.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:GraphicsAPISet the texture index for star groups, in [1, 6].- horizontal spike
- god rays
- horizontal and vertical spikes
- simple radial profile
- diagonal spikes
- detailed glow
- Specified by:
set_star_texture_indexin interfaceGraphicsAPI- Parameters:
index- The new star texture index.
-
set_glow_texture_index
public void set_glow_texture_index(int index) Description copied from interface:GraphicsAPISet the texture index for the light glow effect, in [1, 6].- horizontal spike
- god rays
- horizontal and vertical spikes
- simple radial profile
- diagonal spikes
- detailed glow
- Specified by:
set_glow_texture_indexin interfaceGraphicsAPI- 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:GraphicsAPISet 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_sizein interfaceGraphicsAPI- Parameters:
n- The new number of nearest stars.
-
set_star_set_billboard
public void set_star_set_billboard(boolean flag) Description copied from interface:GraphicsAPIEnable or disable the rendering of close stars as billboards.- Specified by:
set_star_set_billboardin interfaceGraphicsAPI- Parameters:
flag- The state flag.
-
set_orbit_solid_angle_threshold
public void set_orbit_solid_angle_threshold(float deg) Description copied from interface:GraphicsAPISet the solid angle below which orbits fade and disappear.- Specified by:
set_orbit_solid_angle_thresholdin interfaceGraphicsAPI- Parameters:
deg- The threshold angle in degrees.
-
set_limit_fps
public void set_limit_fps(double fps) Description copied from interface:GraphicsAPILimit the frame rate of Gaia Sky to the given value, in frames per second.- Specified by:
set_limit_fpsin interfaceGraphicsAPI- 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:GraphicsAPILimit the frame rate of Gaia Sky to the given value, in frames per second.- Specified by:
set_limit_fpsin interfaceGraphicsAPI- Parameters:
fps- The new maximum frame rate as an integer number. Set zero or negative to unlimited.
-