Files
phy/bevy_pbr/trait.LightProbeComponent.html
Orion Kindel 0ce894e6b0 doc
2025-03-18 10:30:23 -05:00

45 lines
18 KiB
HTML

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="A trait implemented by all components that represent light probes."><title>LightProbeComponent in bevy_pbr - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="bevy_pbr" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-893ab5e7.css"></noscript><link rel="icon" href="https://bevyengine.org/assets/icon.png"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button><a class="logo-container" href="../bevy_pbr/index.html"><img src="https://bevyengine.org/assets/icon.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../bevy_pbr/index.html"><img src="https://bevyengine.org/assets/icon.png" alt="logo"></a><h2><a href="../bevy_pbr/index.html">bevy_<wbr>pbr</a><span class="version">0.15.1</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Light<wbr>Probe<wbr>Component</a></h2><h3><a href="#required-associated-types">Required Associated Types</a></h3><ul class="block"><li><a href="#associatedtype.AssetId" title="AssetId">AssetId</a></li><li><a href="#associatedtype.ViewLightProbeInfo" title="ViewLightProbeInfo">ViewLightProbeInfo</a></li></ul><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.create_render_view_light_probes" title="create_render_view_light_probes">create_render_view_light_probes</a></li><li><a href="#tymethod.id" title="id">id</a></li><li><a href="#tymethod.intensity" title="intensity">intensity</a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate bevy_<wbr>pbr</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="index.html">bevy_pbr</a></span><h1>Trait <span class="trait">LightProbeComponent</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../src/bevy_pbr/light_probe/mod.rs.html#254-290">Source</a> </span></div><pre class="rust item-decl"><code>pub trait LightProbeComponent:
<a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a>
+ <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a>
+ <a class="trait" href="../bevy_ecs/component/trait.Component.html" title="trait bevy_ecs::component::Component">Component</a>
+ <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a> {
type <a href="#associatedtype.AssetId" class="associatedtype">AssetId</a>: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a>;
type <a href="#associatedtype.ViewLightProbeInfo" class="associatedtype">ViewLightProbeInfo</a>: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a>;
// Required methods
fn <a href="#tymethod.id" class="fn">id</a>(&amp;self, image_assets: &amp;<a class="struct" href="../bevy_render/render_asset/struct.RenderAssets.html" title="struct bevy_render::render_asset::RenderAssets">RenderAssets</a>&lt;<a class="struct" href="../bevy_render/texture/gpu_image/struct.GpuImage.html" title="struct bevy_render::texture::gpu_image::GpuImage">GpuImage</a>&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="trait.LightProbeComponent.html#associatedtype.AssetId" title="type bevy_pbr::LightProbeComponent::AssetId">AssetId</a>&gt;;
<span class="item-spacer"></span> fn <a href="#tymethod.intensity" class="fn">intensity</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a>;
<span class="item-spacer"></span> fn <a href="#tymethod.create_render_view_light_probes" class="fn">create_render_view_light_probes</a>(
view_component: <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self&gt;,
image_assets: &amp;<a class="struct" href="../bevy_render/render_asset/struct.RenderAssets.html" title="struct bevy_render::render_asset::RenderAssets">RenderAssets</a>&lt;<a class="struct" href="../bevy_render/texture/gpu_image/struct.GpuImage.html" title="struct bevy_render::texture::gpu_image::GpuImage">GpuImage</a>&gt;,
) -&gt; <a class="struct" href="struct.RenderViewLightProbes.html" title="struct bevy_pbr::RenderViewLightProbes">RenderViewLightProbes</a>&lt;Self&gt;;
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>A trait implemented by all components that represent light probes.</p>
<p>Currently, the two light probe types are <a href="environment_map/struct.EnvironmentMapLight.html" title="struct bevy_pbr::environment_map::EnvironmentMapLight"><code>EnvironmentMapLight</code></a> and
<a href="irradiance_volume/struct.IrradianceVolume.html" title="struct bevy_pbr::irradiance_volume::IrradianceVolume"><code>IrradianceVolume</code></a>, for reflection probes and irradiance volumes
respectively.</p>
<p>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.</p>
</div></details><h2 id="required-associated-types" class="section-header">Required Associated Types<a href="#required-associated-types" class="anchor">§</a></h2><div class="methods"><details class="toggle" open><summary><section id="associatedtype.AssetId" class="method"><a class="src rightside" href="../src/bevy_pbr/light_probe/mod.rs.html#261">Source</a><h4 class="code-header">type <a href="#associatedtype.AssetId" class="associatedtype">AssetId</a>: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/cmp/trait.Eq.html" title="trait core::cmp::Eq">Eq</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/hash/trait.Hash.html" title="trait core::hash::Hash">Hash</a></h4></section></summary><div class="docblock"><p>Holds <a href="../bevy_asset/id/enum.AssetId.html" title="enum bevy_asset::id::AssetId"><code>AssetId</code></a>s of the texture or textures that this light probe
references.</p>
<p>This can just be <a href="../bevy_asset/id/enum.AssetId.html" title="enum bevy_asset::id::AssetId"><code>AssetId</code></a> if the light probe only references one
texture. If it references multiple textures, it will be a structure
containing those asset IDs.</p>
</div></details><details class="toggle" open><summary><section id="associatedtype.ViewLightProbeInfo" class="method"><a class="src rightside" href="../src/bevy_pbr/light_probe/mod.rs.html#270">Source</a><h4 class="code-header">type <a href="#associatedtype.ViewLightProbeInfo" class="associatedtype">ViewLightProbeInfo</a>: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> + <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/default/trait.Default.html" title="trait core::default::Default">Default</a></h4></section></summary><div class="docblock"><p>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
<code>()</code>.</p>
<p>Currently, only reflection probes (i.e. <a href="environment_map/struct.EnvironmentMapLight.html" title="struct bevy_pbr::environment_map::EnvironmentMapLight"><code>EnvironmentMapLight</code></a>) can be
attached directly to views.</p>
</div></details></div><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.id" class="method"><a class="src rightside" href="../src/bevy_pbr/light_probe/mod.rs.html#274">Source</a><h4 class="code-header">fn <a href="#tymethod.id" class="fn">id</a>(&amp;self, image_assets: &amp;<a class="struct" href="../bevy_render/render_asset/struct.RenderAssets.html" title="struct bevy_render::render_asset::RenderAssets">RenderAssets</a>&lt;<a class="struct" href="../bevy_render/texture/gpu_image/struct.GpuImage.html" title="struct bevy_render::texture::gpu_image::GpuImage">GpuImage</a>&gt;) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;Self::<a class="associatedtype" href="trait.LightProbeComponent.html#associatedtype.AssetId" title="type bevy_pbr::LightProbeComponent::AssetId">AssetId</a>&gt;</h4></section></summary><div class="docblock"><p>Returns the asset ID or asset IDs of the texture or textures referenced
by this light probe.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.intensity" class="method"><a class="src rightside" href="../src/bevy_pbr/light_probe/mod.rs.html#280">Source</a><h4 class="code-header">fn <a href="#tymethod.intensity" class="fn">intensity</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.f32.html">f32</a></h4></section></summary><div class="docblock"><p>Returns the intensity of this light probe.</p>
<p>This is a scaling factor that will be multiplied by the value or values
sampled from the texture.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="tymethod.create_render_view_light_probes" class="method"><a class="src rightside" href="../src/bevy_pbr/light_probe/mod.rs.html#286-289">Source</a><h4 class="code-header">fn <a href="#tymethod.create_render_view_light_probes" class="fn">create_render_view_light_probes</a>(
view_component: <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;&amp;Self&gt;,
image_assets: &amp;<a class="struct" href="../bevy_render/render_asset/struct.RenderAssets.html" title="struct bevy_render::render_asset::RenderAssets">RenderAssets</a>&lt;<a class="struct" href="../bevy_render/texture/gpu_image/struct.GpuImage.html" title="struct bevy_render::texture::gpu_image::GpuImage">GpuImage</a>&gt;,
) -&gt; <a class="struct" href="struct.RenderViewLightProbes.html" title="struct bevy_pbr::RenderViewLightProbes">RenderViewLightProbes</a>&lt;Self&gt;</h4></section></summary><div class="docblock"><p>Creates an instance of <a href="struct.RenderViewLightProbes.html" title="struct bevy_pbr::RenderViewLightProbes"><code>RenderViewLightProbes</code></a> containing all the
information needed to render this light probe.</p>
<p>This is called for every light probe in view every frame.</p>
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.84.0/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><details class="toggle implementors-toggle"><summary><section id="impl-LightProbeComponent-for-EnvironmentMapLight" class="impl"><a class="src rightside" href="../src/bevy_pbr/light_probe/environment_map.rs.html#305-363">Source</a><a href="#impl-LightProbeComponent-for-EnvironmentMapLight" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.LightProbeComponent.html" title="trait bevy_pbr::LightProbeComponent">LightProbeComponent</a> for <a class="struct" href="environment_map/struct.EnvironmentMapLight.html" title="struct bevy_pbr::environment_map::EnvironmentMapLight">EnvironmentMapLight</a></h3></section></summary><div class="impl-items"><section id="associatedtype.AssetId-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/bevy_pbr/light_probe/environment_map.rs.html#306">Source</a><a href="#associatedtype.AssetId-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.AssetId" class="associatedtype">AssetId</a> = <a class="struct" href="environment_map/struct.EnvironmentMapIds.html" title="struct bevy_pbr::environment_map::EnvironmentMapIds">EnvironmentMapIds</a></h4></section><section id="associatedtype.ViewLightProbeInfo-1" class="associatedtype trait-impl"><a class="src rightside" href="../src/bevy_pbr/light_probe/environment_map.rs.html#310">Source</a><a href="#associatedtype.ViewLightProbeInfo-1" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.ViewLightProbeInfo" class="associatedtype">ViewLightProbeInfo</a> = <a class="struct" href="environment_map/struct.EnvironmentMapViewLightProbeInfo.html" title="struct bevy_pbr::environment_map::EnvironmentMapViewLightProbeInfo">EnvironmentMapViewLightProbeInfo</a></h4></section></div></details><details class="toggle implementors-toggle"><summary><section id="impl-LightProbeComponent-for-IrradianceVolume" class="impl"><a class="src rightside" href="../src/bevy_pbr/light_probe/irradiance_volume.rs.html#320-345">Source</a><a href="#impl-LightProbeComponent-for-IrradianceVolume" class="anchor">§</a><h3 class="code-header">impl <a class="trait" href="trait.LightProbeComponent.html" title="trait bevy_pbr::LightProbeComponent">LightProbeComponent</a> for <a class="struct" href="irradiance_volume/struct.IrradianceVolume.html" title="struct bevy_pbr::irradiance_volume::IrradianceVolume">IrradianceVolume</a></h3></section></summary><div class="impl-items"><section id="associatedtype.AssetId-2" class="associatedtype trait-impl"><a class="src rightside" href="../src/bevy_pbr/light_probe/irradiance_volume.rs.html#321">Source</a><a href="#associatedtype.AssetId-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.AssetId" class="associatedtype">AssetId</a> = <a class="enum" href="../bevy_asset/id/enum.AssetId.html" title="enum bevy_asset::id::AssetId">AssetId</a>&lt;<a class="struct" href="../bevy_image/image/struct.Image.html" title="struct bevy_image::image::Image">Image</a>&gt;</h4></section><section id="associatedtype.ViewLightProbeInfo-2" class="associatedtype trait-impl"><a class="src rightside" href="../src/bevy_pbr/light_probe/irradiance_volume.rs.html#325">Source</a><a href="#associatedtype.ViewLightProbeInfo-2" class="anchor">§</a><h4 class="code-header">type <a href="#associatedtype.ViewLightProbeInfo" class="associatedtype">ViewLightProbeInfo</a> = <a class="primitive" href="https://doc.rust-lang.org/1.84.0/std/primitive.unit.html">()</a></h4></section></div></details></div><script src="../trait.impl/bevy_pbr/light_probe/trait.LightProbeComponent.js" async></script></section></div></main></body></html>