Trait bevy::pbr::LightProbeComponent

pub trait LightProbeComponent: Sized + Send + Sync + Component {
    type AssetId: Send + Sync + Clone + Eq + Hash;
    type ViewLightProbeInfo: Send + Sync + Default;

    // Required methods
    fn id(&self, image_assets: &RenderAssets<GpuImage>) -> Option<Self::AssetId>;
    fn intensity(&self) -> f32;
    fn create_render_view_light_probes(
        view_component: Option<&Self>,
        image_assets: &RenderAssets<GpuImage>,
    ) -> RenderViewLightProbes<Self>;
}
Expand description

A trait implemented by all components that represent light probes.

Currently, the two light probe types are EnvironmentMapLight and IrradianceVolume, for reflection probes and irradiance volumes respectively.

Most light probe systems are written to be generic over the type of light probe. This allows much of the code to be shared and enables easy addition of more light probe types (e.g. real-time reflection planes) in the future.

Required Associated Types§

type AssetId: Send + Sync + Clone + Eq + Hash

Holds AssetIds of the texture or textures that this light probe references.

This can just be AssetId if the light probe only references one texture. If it references multiple textures, it will be a structure containing those asset IDs.

type ViewLightProbeInfo: Send + Sync + Default

If the light probe can be attached to the view itself (as opposed to a cuboid region within the scene), this contains the information that will be passed to the GPU in order to render it. Otherwise, this will be ().

Currently, only reflection probes (i.e. EnvironmentMapLight) can be attached directly to views.

Required Methods§

fn id(&self, image_assets: &RenderAssets<GpuImage>) -> Option<Self::AssetId>

Returns the asset ID or asset IDs of the texture or textures referenced by this light probe.

fn intensity(&self) -> f32

Returns the intensity of this light probe.

This is a scaling factor that will be multiplied by the value or values sampled from the texture.

fn create_render_view_light_probes( view_component: Option<&Self>, image_assets: &RenderAssets<GpuImage>, ) -> RenderViewLightProbes<Self>

Creates an instance of RenderViewLightProbes containing all the information needed to render this light probe.

This is called for every light probe in view every frame.

Object Safety§

This trait is not object safe.

Implementors§