Skip to main content

polyscope_core/
ground_plane.rs

1//! Ground plane configuration for polyscope.
2
3use serde::{Deserialize, Serialize};
4
5/// Ground plane rendering mode.
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
7pub enum GroundPlaneMode {
8    /// No ground plane.
9    None,
10    /// Tiled ground plane with subtle grid lines.
11    #[default]
12    Tile,
13    /// Shadow only (no visible ground plane, just shadows).
14    ShadowOnly,
15    /// Tiled ground plane with reflections.
16    TileReflection,
17}
18
19/// Ground plane configuration.
20#[derive(Debug, Clone, Serialize, Deserialize)]
21pub struct GroundPlaneConfig {
22    /// Rendering mode.
23    pub mode: GroundPlaneMode,
24    /// Height of the ground plane (Y coordinate), used when `height_is_relative` is false.
25    pub height: f32,
26    /// Whether height is relative to scene bounds (auto-placed below scene).
27    pub height_is_relative: bool,
28    /// Shadow blur iterations (0-5).
29    pub shadow_blur_iters: u32,
30    /// Shadow darkness (0.0 = no shadow, 1.0 = full black).
31    pub shadow_darkness: f32,
32    /// Reflection intensity (0.0 = none, 1.0 = full mirror).
33    pub reflection_intensity: f32,
34}
35
36impl Default for GroundPlaneConfig {
37    fn default() -> Self {
38        Self {
39            mode: GroundPlaneMode::Tile,
40            height: 0.0,
41            height_is_relative: true,
42            shadow_blur_iters: 2,
43            shadow_darkness: 0.4,
44            reflection_intensity: 0.25,
45        }
46    }
47}