Skip to main content

GraphicsConfig

Struct GraphicsConfig 

Source
pub struct GraphicsConfig {
    pub max_frames: Option<u64>,
    pub frames_in_flight: u32,
    pub vsync: bool,
    pub fps_cap: u32,
    pub clear_color: [f32; 4],
    pub shadow_map_size: u32,
    pub shadow_update: ShadowUpdate,
    pub shadow_distance: u32,
    pub shadow_cascades: u32,
    pub anisotropy: u32,
}
Expand description

Rendering settings for the world: frame pacing, shadows, and clear colour. One per world. The GPU backend is chosen by the engine for the platform and is not user-configurable.

{
  "name": "gfx",
  "type": "GraphicsConfig",
  "args": { "clear_color": [0.1, 0.1, 0.15, 1.0], "frames_in_flight": 2 }
}

Fields§

§max_frames: Option<u64>

Cap the render loop at this many frames, then exit. Unset runs until the window is closed.

§frames_in_flight: u32

Preferred number of frames in flight (1-3). Higher can smooth pacing at the cost of input latency.

§vsync: bool

Cap the frame rate to the display refresh (vsync). Defaults to false: the render loop runs uncapped (DirectX presents with tearing allowed, Vulkan uses a mailbox present mode), which is what a benchmark wants. Set to true to lock presentation to the monitor refresh, eliminating tearing and the wasted frames that never reach the screen.

§fps_cap: u32

Cap the frame rate to this many frames per second. 0 (default) leaves the loop uncapped. The cap is a CPU-side frame pacer, so it composes with vsync: the more restrictive of the two wins. Useful for limiting heat, fan noise, and power draw, or matching a fixed refresh.

§clear_color: [f32; 4]

Background clear colour [r, g, b, a] in linear 0..1 space.

§shadow_map_size: u32

Shadow map resolution in texels (e.g. 2048). Set to 0 to disable shadows.

§shadow_update: ShadowUpdate

How often shadow cascades are re-rendered. hybrid (default) amortizes the far cascades across frames; every_frame refreshes them all every frame.

§shadow_distance: u32

How far from the camera shadows are cast, in world units (e.g. 80). The cascades cover from the near plane out to this distance; a larger value shadows more of the scene but spreads the same shadow-map resolution over more area (softer, blockier shadows). Capped at the camera far plane.

§shadow_cascades: u32

Number of shadow cascades, 1 to 4 (4 is the default and the maximum). More cascades keep distant shadows sharper by splitting the view range into finer slices, at the cost of an extra shadow-map render per cascade; fewer is cheaper but blockier far from the camera. The slice count covers the same shadow_distance regardless.

§anisotropy: u32

Maximum anisotropic-filtering degree for the scene texture sampler (albedo + normal maps), e.g. 8. Higher keeps textures viewed at a grazing angle (floors, walls receding into the distance) sharp instead of blurring along the minor axis, at a small sampling cost. 1 disables anisotropy (plain trilinear). Clamped to the GPU’s supported range (1..16) at init.

Trait Implementations§

Source§

impl Clone for GraphicsConfig

Source§

fn clone(&self) -> GraphicsConfig

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 Component for GraphicsConfig

Source§

const NAME: &'static str = "GraphicsConfig"

The registry name a world authors this component under.
Source§

fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>

Reconstruct this component from a blob record, whose bytes are the serialized runtime component (cook already ran the asset -> component translation). The default rejects: runtime-only components are never stored in a blob, so only loadable types provide an implementation.
Source§

fn inject_locator(&mut self, _locator: PayloadLocator)

Called after construction to inject the payload locator from the blob def. Only meaningful for components with a compiled payload. The default implementation does nothing (correct for most components).
Source§

fn inject_name(&mut self, _id: AssetId)

Called after construction to inject the asset’s identity from the blob def. Only meaningful for components that look themselves up by id at runtime. The default implementation does nothing.
Source§

impl ComponentSlot for GraphicsConfig

Source§

const DISCRIMINANT: u8

The component type’s stable id, used as its ComponentId.
Source§

fn slot(s: &ComponentStorage) -> &Column<Self>

Borrow this type’s column out of the storage.
Source§

fn slot_mut(s: &mut ComponentStorage) -> &mut Column<Self>

Mutably borrow this type’s column out of the storage.
Source§

impl Debug for GraphicsConfig

Source§

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

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

impl Default for GraphicsConfig

Source§

fn default() -> GraphicsConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for GraphicsConfig

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<GraphicsConfig, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<GraphicsConfig> for ComponentAsset

Source§

fn from(c: GraphicsConfig) -> Self

Converts to this type from the input type.
Source§

impl RuntimeComponent for GraphicsConfig

Source§

impl Serialize for GraphicsConfig

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> 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<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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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, <T as TryFrom<U>>::Error>

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more