pub struct GpuScatteringMedium {
pub terms: SmallVec<[ScatteringTerm; 1]>,
pub falloff_resolution: u32,
pub phase_resolution: u32,
pub density_lut: Texture,
pub density_lut_view: TextureView,
pub scattering_lut: Texture,
pub scattering_lut_view: TextureView,
}Expand description
The GPU representation of a ScatteringMedium.
Fields§
§terms: SmallVec<[ScatteringTerm; 1]>The terms of the scattering medium.
falloff_resolution: u32The resolution at which to sample the falloff distribution of each scattering term.
phase_resolution: u32The resolution at which to sample the phase function of each scattering term.
density_lut: TextureThe density_lut, a 2D falloff_resolution x 2 LUT which contains the
medium’s optical density with respect to the atmosphere’s “falloff parameter”,
a linear value which is 1.0 at the planet’s surface and 0.0 at the edge of
space. The first and second rows correspond to absorption density and
scattering density respectively.
density_lut_view: TextureViewThe default TextureView of the density_lut
scattering_lut: TextureThe scattering_lut, a 2D falloff_resolution x phase_resolution LUT which
contains the medium’s scattering density multiplied by the phase function, with
the U axis corresponding to the falloff parameter and the V axis corresponding
to neg_LdotV * 0.5 + 0.5, where neg_LdotV is the dot product of the light
direction and the incoming view vector.
scattering_lut_view: TextureViewThe default TextureView of the scattering_lut
Trait Implementations§
Source§impl RenderAsset for GpuScatteringMedium
impl RenderAsset for GpuScatteringMedium
Source§type SourceAsset = ScatteringMedium
type SourceAsset = ScatteringMedium
Source§type Param = (Res<'static, RenderDevice>, Res<'static, RenderQueue>)
type Param = (Res<'static, RenderDevice>, Res<'static, RenderQueue>)
RenderAsset::prepare_asset. Read moreSource§fn prepare_asset(
source_asset: <GpuScatteringMedium as RenderAsset>::SourceAsset,
_asset_id: AssetId<<GpuScatteringMedium as RenderAsset>::SourceAsset>,
_: &mut <<GpuScatteringMedium as RenderAsset>::Param as SystemParam>::Item<'_, '_>,
_previous_asset: Option<&GpuScatteringMedium>,
) -> Result<GpuScatteringMedium, PrepareAssetError<<GpuScatteringMedium as RenderAsset>::SourceAsset>>
fn prepare_asset( source_asset: <GpuScatteringMedium as RenderAsset>::SourceAsset, _asset_id: AssetId<<GpuScatteringMedium as RenderAsset>::SourceAsset>, _: &mut <<GpuScatteringMedium as RenderAsset>::Param as SystemParam>::Item<'_, '_>, _previous_asset: Option<&GpuScatteringMedium>, ) -> Result<GpuScatteringMedium, PrepareAssetError<<GpuScatteringMedium as RenderAsset>::SourceAsset>>
Source§fn asset_usage(_source_asset: &Self::SourceAsset) -> RenderAssetUsages
fn asset_usage(_source_asset: &Self::SourceAsset) -> RenderAssetUsages
Source§fn byte_len(source_asset: &Self::SourceAsset) -> Option<usize>
fn byte_len(source_asset: &Self::SourceAsset) -> Option<usize>
RenderAssetBytesPerFrame.Source§fn unload_asset(
_source_asset: AssetId<Self::SourceAsset>,
_param: &mut <Self::Param as SystemParam>::Item<'_, '_>,
)
fn unload_asset( _source_asset: AssetId<Self::SourceAsset>, _param: &mut <Self::Param as SystemParam>::Item<'_, '_>, )
RenderAsset::SourceAsset has been removed. Read moreSource§fn take_gpu_data(
_source: &mut Self::SourceAsset,
_previous_gpu_asset: Option<&Self>,
) -> Result<Self::SourceAsset, AssetExtractionError>
fn take_gpu_data( _source: &mut Self::SourceAsset, _previous_gpu_asset: Option<&Self>, ) -> Result<Self::SourceAsset, AssetExtractionError>
RenderWorld / gpu. Heavy internal data (pixels, vertex attributes)
should be moved into the copy, leaving this asset with only metadata.
An error may be returned to indicate that the asset has already been extracted, and should not
have been modified on the CPU side (as it cannot be transferred to GPU again).
The previous GPU asset is also provided, which can be used to check if the modification is valid.Auto Trait Implementations§
impl Freeze for GpuScatteringMedium
impl !RefUnwindSafe for GpuScatteringMedium
impl Send for GpuScatteringMedium
impl Sync for GpuScatteringMedium
impl Unpin for GpuScatteringMedium
impl !UnwindSafe for GpuScatteringMedium
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more