use bevy_reflect::{std_traits::ReflectDefault, Reflect};12/// The [parallax mapping] method to use to compute depth based on the3/// material's [`depth_map`].4///5/// Parallax Mapping uses a depth map texture to give the illusion of depth6/// variation on a mesh surface that is geometrically flat.7///8/// See the `parallax_mapping.wgsl` shader code for implementation details9/// and explanation of the methods used.10///11/// [`depth_map`]: crate::StandardMaterial::depth_map12/// [parallax mapping]: https://en.wikipedia.org/wiki/Parallax_mapping13#[derive(Debug, Copy, Clone, PartialEq, Eq, Default, Reflect)]14#[reflect(Default, Clone, PartialEq)]15pub enum ParallaxMappingMethod {16/// A simple linear interpolation, using a single texture sample.17///18/// This method is named "Parallax Occlusion Mapping".19///20/// Unlike [`ParallaxMappingMethod::Relief`], only requires a single lookup,21/// but may skip small details and result in writhing material artifacts.22#[default]23Occlusion,24/// Discovers the best depth value based on binary search.25///26/// Each iteration incurs a texture sample.27/// The result has fewer visual artifacts than [`ParallaxMappingMethod::Occlusion`].28///29/// This method is named "Relief Mapping".30Relief {31/// How many additional steps to use at most to find the depth value.32max_steps: u32,33},34}3536impl ParallaxMappingMethod {37/// [`ParallaxMappingMethod::Relief`] with a 5 steps, a reasonable default.38pub const DEFAULT_RELIEF_MAPPING: Self = ParallaxMappingMethod::Relief { max_steps: 5 };3940pub(crate) fn max_steps(&self) -> u32 {41match self {42ParallaxMappingMethod::Occlusion => 0,43ParallaxMappingMethod::Relief { max_steps } => *max_steps,44}45}46}474849