Skip to main content

GraphicsOptions

Struct GraphicsOptions 

Source
#[non_exhaustive]
pub struct GraphicsOptions {
Show 20 fields pub render_method: RenderMethod, pub fog: FogOption, pub fov_y: PositiveSign<f64>, pub tone_mapping: ToneMappingOperator, pub maximum_intensity: PositiveSign<f32>, pub exposure: ExposureOption, pub bloom_intensity: ZeroOne<f32>, pub view_distance: PositiveSign<f64>, pub lighting_display: LightingOption, pub transparency: TransparencyOption, pub show_ui: bool, pub antialiasing: AntialiasingOption, pub debug_info_text: bool, pub debug_info_text_contents: ShowStatus, pub debug_behaviors: bool, pub debug_chunk_boxes: bool, pub debug_collision_boxes: bool, pub debug_light_rays_at_cursor: bool, pub debug_pixel_cost: bool, pub debug_reduce_view_frustum: bool,
}
Expand description

Options for controlling rendering (not affecting gameplay except informationally).

Some options may be ignored by some renderers, such as when they request a particular implementation approach or debug visualization. Renderers should make an effort to report such failings, such as via the all_is_cubes_render::Flaws type.

§Serialization stability warning

This type implements [serde::Serialize] and [serde::Deserialize], but serialization support is still experimental (as is the game data model in general). We do not guarantee that future versions of all-is-cubes will be able to deserialize data which is serialized by this version.

Additionally, the serialization schema is designed with serde_json in mind. It is not guaranteed that using a different data format crate, which may use a different subset of the information exposed via [serde::Serialize], will produce stable results.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§render_method: RenderMethod

Overall rendering technique to use.

May be ignored if the method requested is not supported in the current environment.

§fog: FogOption

Whether and how to draw fog obscuring the view distance limit.

TODO: Implement fog in raytracer.

§fov_y: PositiveSign<f64>

Field of view, in degrees from top to bottom edge of the viewport.

Values ≥ 180° are ignored.

§tone_mapping: ToneMappingOperator

Method to use to remap colors to fit within the displayable range.

In order for tone mapping to take effect, maximum_intensity must be set to an appropriate finite value.

§maximum_intensity: PositiveSign<f32>

Maximum value to allow in the output image’s color channels.

  • If the output format/device supports HDR (high dynamic range; color channel values greater than 1.0), this should be set to the maximum representable (or desired) value.
  • If the output format is HDR and no specific limit is known or desired, use ∞. Note that this disables tone mapping.
  • If the output format is not HDR (SDR), use 1.0.
  • If no information is available, use ∞.

The chosen tone_mapping will use this information to map to the available range.

The default value is ∞.

§exposure: ExposureOption

“Camera exposure” value: a scaling factor from scene luminance to displayed luminance. Note that the exact interpretation of this depends on the chosen tone_mapping.

§bloom_intensity: ZeroOne<f32>

Proportion of bloom (blurred image) to mix into the original image. 0.0 is no bloom and 1.0 is no original image.

§view_distance: PositiveSign<f64>

Distance, in unit cubes, from the camera to the farthest visible point. TODO: Implement view distance limit (and fog) in raytracer. TODO: make deserialization not break on infinity

§lighting_display: LightingOption

Style in which to draw the lighting of Spaces. This does not affect the computation of lighting.

§transparency: TransparencyOption

Method/fidelity to use for transparency.

§show_ui: bool

Whether to show the HUD or other UI elements.

This does not affect UI state or clickability; it purely controls display. It is intended for the purpose of asking a renderer to produce an image of the scene without any UI.

The cursor is not currently considered part of the UI. This may be revisited later. The “info text” is controlled separately by debug_info_text.

§antialiasing: AntialiasingOption

Whether to apply antialiasing techniques.

§debug_info_text: bool

Draw text overlay showing debug information.

§debug_info_text_contents: ShowStatus

What information should be displayed in debug_info_text.

§debug_behaviors: bool

Draw boxes around Behaviors attached to parts of Spaces. This may also eventually include further in-world diagnostic information.

§debug_chunk_boxes: bool

Draw boxes around chunk borders and some debug info.

§debug_collision_boxes: bool

Draw collision boxes for some objects.

§debug_light_rays_at_cursor: bool

Draw the light rays that contribute to the selected block.

§debug_pixel_cost: bool

Visualize the cost of rendering each pixel, rather than the color of the scene.

Note that the current implementations of this in All is Cubes’ standard renderers do not measure actual execution cost, but quantities correlated with it. The color channels are used as follows:

  • In the raytracer,
    • Red-yellow: number of steps taken
    • Blue: original scene luminance
  • In the GPU mesh renderer:
    • Red: number of opaque fragment shader executions
    • Green: number of transparent fragment shader executions
    • Blue: number of triangles rasterized, including ones discarded by depth test
§debug_reduce_view_frustum: bool

Causes [Camera] to compute a falsified view frustum which is 1/2 the width and height it should be.

This may be used to visualize the effect of frustum culling that is performed via [Camera::aab_in_view()].

Implementations§

Source§

impl GraphicsOptions

Source

pub const UNALTERED_COLORS: GraphicsOptions

A set of graphics options which differs from GraphicsOptions::default() in that it disables all operations which change colors away from their obvious values; that is, the Rgba colors you get from a rendering will be identical (except for quantization error and background colors) to the Rgba colors in the depicted Atoms.

Future versions may set other options as necessary to maintain the intended property.

Source

pub fn repair(self) -> GraphicsOptions

Constrain fields to valid/practical values.

Trait Implementations§

Source§

impl Clone for GraphicsOptions

Source§

fn clone(&self) -> GraphicsOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GraphicsOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for GraphicsOptions

Source§

fn default() -> GraphicsOptions

Default graphics options broadly have “everything reasonable” turned on (they may disable things that are not well-implemented yet).

TODO: Explain exactly what the default is.

Source§

impl Eq for GraphicsOptions

Source§

impl PartialEq for GraphicsOptions

Source§

fn eq(&self, other: &GraphicsOptions) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GraphicsOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ConditionalSend for T
where T: Send,

Source§

impl<T> DynEq for T
where T: Any + Eq,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Casts the type to dyn Any.
Source§

fn dyn_eq(&self, other: &(dyn DynEq + 'static)) -> bool

This method tests for self and other values to be equal. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromWorld for T
where T: Default,

Source§

fn from_world(_world: &mut World) -> T

Creates Self using default().

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.