pub struct RayTraceSettings {
pub samples_per_axis: u32,
pub max_bounces: u32,
}Expand description
Ray-tracing quality settings shared by the CPU reference renderer and both GPU shader backends.
The values are packed into the GPU frame header so the CPU path and the shaders sample and bounce identically.
Fields§
§samples_per_axis: u32Supersampling grid resolution per axis. 1 traces one ray per
pixel; 4 traces sixteen and averages them. Valid range 1..=4.
max_bounces: u32Maximum number of secondary bounces after the primary hit. 0
still shades the primary hit. Valid range 0..=16.
Implementations§
Source§impl RayTraceSettings
Implements the constructors and validation for RayTraceSettings.
impl RayTraceSettings
Implements the constructors and validation for RayTraceSettings.
Sourcepub fn new_default() -> RayTraceSettings
pub fn new_default() -> RayTraceSettings
Returns the default settings: one ray per pixel and the
[RAYTRACE_DEFAULT_MAX_BOUNCES_LIMIT] bounce limit.
§Returns
RayTraceSettings- The default settings.
Sourcepub fn with_quality(samples_per_axis: u32, max_bounces: u32) -> RayTraceSettings
pub fn with_quality(samples_per_axis: u32, max_bounces: u32) -> RayTraceSettings
Returns a settings block with an explicit sampling grid and bounce limit.
The arguments are not validated here; call
RayTraceSettings::validate before packing or rendering.
§Arguments
u32- The supersampling grid resolution per axis.u32- The maximum number of secondary bounces.
§Returns
RayTraceSettings- The new settings.
Sourcepub fn rays_per_pixel(&self) -> u32
pub fn rays_per_pixel(&self) -> u32
Returns the total number of rays traced per pixel, which is
samples_per_axis squared.
§Returns
u32- The per-pixel ray count.
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Checks that both fields are inside the range the CPU renderer and both shaders support.
samples_per_axis must be within
1..=[RAYTRACE_SAMPLES_PER_AXIS_MAX] and max_bounces within
0..=[RAYTRACE_MAX_BOUNCES_MAX]. Anything else is rejected rather
than clamped, so a caller never silently gets a different image than
it asked for.
§Returns
Result<(), String>-Ok(())when both fields are in range, otherwise a message naming the offending field.