Trait bevy_pbr::LightProbeComponent
source · pub trait LightProbeComponent: Send + Sync + Component + Sized {
type AssetId: Send + Sync + Clone + Eq + Hash;
type ViewLightProbeInfo: Send + Sync + Default;
// Required methods
fn id(&self, image_assets: &RenderAssets<Image>) -> Option<Self::AssetId>;
fn intensity(&self) -> f32;
fn create_render_view_light_probes(
view_component: Option<&Self>,
image_assets: &RenderAssets<Image>
) -> 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§
sourcetype ViewLightProbeInfo: Send + Sync + Default
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§
sourcefn id(&self, image_assets: &RenderAssets<Image>) -> Option<Self::AssetId>
fn id(&self, image_assets: &RenderAssets<Image>) -> Option<Self::AssetId>
Returns the asset ID or asset IDs of the texture or textures referenced by this light probe.
sourcefn intensity(&self) -> f32
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.
sourcefn create_render_view_light_probes(
view_component: Option<&Self>,
image_assets: &RenderAssets<Image>
) -> RenderViewLightProbes<Self>
fn create_render_view_light_probes( view_component: Option<&Self>, image_assets: &RenderAssets<Image> ) -> 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.