1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Decal system for projecting textures onto surfaces.
//!
//! Decals are projected textures that conform to underlying geometry, useful for
//! bullet holes, blood splatter, graffiti, dirt patches, and other surface details.
//!
//! - [`Decal`]: Component defining decal appearance and projection settings
//!
//! # Basic Decal
//!
//! ```ignore
//! let entity = world.spawn_entities(
//! DECAL | LOCAL_TRANSFORM | GLOBAL_TRANSFORM | LOCAL_TRANSFORM_DIRTY,
//! 1
//! )[0];
//!
//! world.core.set_decal(entity, Decal::new("textures/bullet_hole.png")
//! .with_size(0.2, 0.2)
//! .with_depth(0.5));
//!
//! world.core.set_local_transform(entity, LocalTransform {
//! translation: hit_position,
//! rotation: hit_rotation, // Align with surface normal
//! ..Default::default()
//! });
//! ```
//!
//! # Emissive Decals (Neon Signs, Glowing Markings)
//!
//! ```ignore
//! let decal = Decal::new("textures/neon_sign.png")
//! .with_size(2.0, 1.0)
//! .with_emissive("textures/neon_sign_emissive.png", 5.0);
//! ```
//!
//! # Colored Decals
//!
//! ```ignore
//! let blood_decal = Decal::new("textures/splatter.png")
//! .with_size(0.5, 0.5)
//! .with_color([0.8, 0.1, 0.1, 1.0]); // Red tint
//! ```
//!
//! # Distance Fade
//!
//! Fade decals out at distance to avoid visual noise:
//!
//! ```ignore
//! let decal = Decal::new("textures/graffiti.png")
//! .with_size(3.0, 2.0)
//! .with_fade(30.0, 50.0); // Start fading at 30m, fully faded at 50m
//! ```
//!
//! # Decal Properties
//!
//! | Property | Description |
//! |----------|-------------|
//! | `size` | Width and height in world units |
//! | `depth` | Projection depth (how far into surfaces) |
//! | `normal_threshold` | Surface angle cutoff (0-1, lower = stricter) |
//! | `fade_start` | Distance to start fading (meters) |
//! | `fade_end` | Distance to fully fade (meters) |
//! | `emissive_strength` | Bloom intensity for emissive decals |
//!
//! [`Decal`]: components::Decal
pub mod components;
pub use components::*;