cvkg-render-gpu 0.3.4

Cyber Viking Kvasir Graph (CVKG) - High-fidelity agentic UI framework
Documentation
//! Global Illumination (GI) and Baked Lightmaps / Irradiance Volumes pass structures.
//! Provides precomputed indirect diffuse and specular lighting inputs to PBR shaders.

use crate::kvasir::nodes::PassId;
use crate::kvasir::{ExecutionContext, KvasirNode, ResourceId};

/// Irradiance Volume configuration representing a grid of light probes.
#[derive(Debug, Clone)]
pub struct IrradianceVolume {
    /// Dimension bounds (min corner in world space).
    pub origin: glam::Vec3,
    /// Probe step distance/spacing.
    pub spacing: glam::Vec3,
    /// Probe count in x, y, and z.
    pub dimensions: [u32; 3],
}

/// Environment probe for local specular reflections.
#[derive(Debug, Clone)]
pub struct EnvironmentProbe {
    /// Center of the probe capture region.
    pub center: glam::Vec3,
    /// Influence bounds for box/sphere projection.
    pub bounds_half_size: glam::Vec3,
}

/// GI contribution pass node.
pub struct GlobalIlluminationNode {
    /// Irradiance Volume configuration parameters.
    pub volume: IrradianceVolume,
    /// Local specular environment probes active in the scene.
    pub environment_probes: Vec<EnvironmentProbe>,
    /// Global baked lightmap texture (if present).
    pub lightmap: Option<ResourceId>,
}

impl KvasirNode for GlobalIlluminationNode {
    fn label(&self) -> &'static str {
        "GlobalIlluminationPass"
    }

    fn inputs(&self) -> &[ResourceId] {
        &[]
    }

    fn outputs(&self) -> &[ResourceId] {
        &[]
    }

    fn pass_id(&self) -> PassId {
        PassId::Opaque3d
    }

    fn execute(&self, _ctx: &mut ExecutionContext) {
        tracing::debug!(
            "GlobalIlluminationNode::execute - Sampling baked GI inputs: grid dimensions: {:?}, active probes: {}",
            self.volume.dimensions,
            self.environment_probes.len()
        );
        // Prepares light volume uniforms or samples precomputed GI.
    }
}