17
17
use core:: { num:: NonZero , ops:: Deref } ;
18
18
19
19
use bevy_app:: { App , Plugin } ;
20
- use bevy_asset:: { AssetId , Handle } ;
20
+ use bevy_asset:: AssetId ;
21
21
use bevy_derive:: { Deref , DerefMut } ;
22
22
use bevy_ecs:: {
23
- component:: Component ,
24
23
entity:: { Entity , EntityHashMap } ,
25
- prelude:: ReflectComponent ,
26
24
query:: With ,
27
25
resource:: Resource ,
28
26
schedule:: IntoScheduleConfigs as _,
@@ -31,10 +29,9 @@ use bevy_ecs::{
31
29
use bevy_image:: Image ;
32
30
use bevy_math:: Mat4 ;
33
31
use bevy_platform:: collections:: HashMap ;
34
- use bevy_reflect:: Reflect ;
35
32
pub use bevy_render:: primitives:: CubemapLayout ;
36
33
use bevy_render:: {
37
- extract_component:: { ExtractComponent , ExtractComponentPlugin } ,
34
+ extract_component:: ExtractComponentPlugin ,
38
35
load_shader_library,
39
36
render_asset:: RenderAssets ,
40
37
render_resource:: {
@@ -44,15 +41,14 @@ use bevy_render::{
44
41
renderer:: { RenderAdapter , RenderDevice , RenderQueue } ,
45
42
sync_world:: RenderEntity ,
46
43
texture:: { FallbackImage , GpuImage } ,
47
- view:: { self , ViewVisibility , Visibility , VisibilityClass } ,
44
+ view:: ViewVisibility ,
48
45
Extract , ExtractSchedule , Render , RenderApp , RenderSystems ,
49
46
} ;
50
- use bevy_transform:: { components:: GlobalTransform , prelude :: Transform } ;
47
+ use bevy_transform:: components:: GlobalTransform ;
51
48
use bytemuck:: { Pod , Zeroable } ;
52
49
53
- use crate :: {
54
- binding_arrays_are_usable, prepare_lights, GlobalClusterableObjectMeta , LightVisibilityClass ,
55
- } ;
50
+ pub use crate :: ClusteredDecal ;
51
+ use crate :: { binding_arrays_are_usable, prepare_lights, GlobalClusterableObjectMeta } ;
56
52
pub use crate :: { DirectionalLightTexture , PointLightTexture , SpotLightTexture } ;
57
53
58
54
/// The maximum number of decals that can be present in a view.
@@ -68,34 +64,6 @@ pub(crate) const MAX_VIEW_DECALS: usize = 8;
68
64
/// can still be added to a scene, but they won't project any decals.
69
65
pub struct ClusteredDecalPlugin ;
70
66
71
- /// An object that projects a decal onto surfaces within its bounds.
72
- ///
73
- /// Conceptually, a clustered decal is a 1×1×1 cube centered on its origin. It
74
- /// projects the given [`Self::image`] onto surfaces in the -Z direction (thus
75
- /// you may find [`Transform::looking_at`] useful).
76
- ///
77
- /// Clustered decals are the highest-quality types of decals that Bevy supports,
78
- /// but they require bindless textures. This means that they presently can't be
79
- /// used on WebGL 2, WebGPU, macOS, or iOS. Bevy's clustered decals can be used
80
- /// with forward or deferred rendering and don't require a prepass.
81
- #[ derive( Component , Debug , Clone , Reflect , ExtractComponent ) ]
82
- #[ reflect( Component , Debug , Clone ) ]
83
- #[ require( Transform , Visibility , VisibilityClass ) ]
84
- #[ component( on_add = view:: add_visibility_class:: <LightVisibilityClass >) ]
85
- pub struct ClusteredDecal {
86
- /// The image that the clustered decal projects.
87
- ///
88
- /// This must be a 2D image. If it has an alpha channel, it'll be alpha
89
- /// blended with the underlying surface and/or other decals. All decal
90
- /// images in the scene must use the same sampler.
91
- pub image : Handle < Image > ,
92
-
93
- /// An application-specific tag you can use for any purpose you want.
94
- ///
95
- /// See the `clustered_decals` example for an example of use.
96
- pub tag : u32 ,
97
- }
98
-
99
67
/// Stores information about all the clustered decals in the scene.
100
68
#[ derive( Resource , Default ) ]
101
69
pub struct RenderClusteredDecals {
0 commit comments