#[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
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.render_method: RenderMethodOverall rendering technique to use.
May be ignored if the method requested is not supported in the current environment.
fog: FogOptionWhether 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: ToneMappingOperatorMethod 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: LightingOptionStyle in which to draw the lighting of Spaces.
This does not affect the computation of lighting.
transparency: TransparencyOptionMethod/fidelity to use for transparency.
show_ui: boolWhether 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: AntialiasingOptionWhether to apply antialiasing techniques.
debug_info_text: boolDraw text overlay showing debug information.
debug_info_text_contents: ShowStatusWhat information should be displayed in debug_info_text.
debug_behaviors: boolDraw boxes around Behaviors attached to parts of Spaces.
This may also eventually include further in-world diagnostic information.
debug_chunk_boxes: boolDraw boxes around chunk borders and some debug info.
debug_collision_boxes: boolDraw collision boxes for some objects.
debug_light_rays_at_cursor: boolDraw the light rays that contribute to the selected block.
debug_pixel_cost: boolVisualize 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: boolCauses [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
impl GraphicsOptions
Sourcepub const UNALTERED_COLORS: GraphicsOptions
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.
Self::bloom_intensity=0Self::fog= [FogOption::None]Self::lighting_display= [LightingOption::None]Self::tone_mapping=ToneMappingOperator::Clamp
Future versions may set other options as necessary to maintain the intended property.
Sourcepub fn repair(self) -> GraphicsOptions
pub fn repair(self) -> GraphicsOptions
Constrain fields to valid/practical values.
Trait Implementations§
Source§impl Clone for GraphicsOptions
impl Clone for GraphicsOptions
Source§fn clone(&self) -> GraphicsOptions
fn clone(&self) -> GraphicsOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphicsOptions
impl Debug for GraphicsOptions
Source§impl Default for GraphicsOptions
impl Default for GraphicsOptions
Source§fn default() -> GraphicsOptions
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.
impl Eq for GraphicsOptions
Source§impl PartialEq for GraphicsOptions
impl PartialEq for GraphicsOptions
impl StructuralPartialEq for GraphicsOptions
Auto Trait Implementations§
impl Freeze for GraphicsOptions
impl RefUnwindSafe for GraphicsOptions
impl Send for GraphicsOptions
impl Sync for GraphicsOptions
impl Unpin for GraphicsOptions
impl UnsafeUnpin for GraphicsOptions
impl UnwindSafe for GraphicsOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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