Skip to main content

carla/rpc/
map_layer.rs

1/// Map layer flags for toggling visual elements in the simulation.
2///
3/// Map layers allow selective loading/unloading of visual elements to optimize
4/// performance or focus on specific aspects of the environment. Layers can be
5/// combined using bitwise OR operations.
6#[cfg_attr(
7    carla_version_0916,
8    doc = " See [carla.MapLayer](https://carla.readthedocs.io/en/0.9.16/python_api/#carla.MapLayer) in the Python API."
9)]
10#[cfg_attr(
11    carla_version_0915,
12    doc = " See [carla.MapLayer](https://carla.readthedocs.io/en/0.9.15/python_api/#carla.MapLayer) in the Python API."
13)]
14#[cfg_attr(
15    carla_version_0914,
16    doc = " See [carla.MapLayer](https://carla.readthedocs.io/en/0.9.14/python_api/#carla.MapLayer) in the Python API."
17)]
18///
19/// # Examples
20///
21/// ```no_run
22/// use carla::{client::Client, rpc::MapLayer};
23///
24/// let client = Client::default();
25/// let world = client.world();
26///
27/// // Load only buildings and ground for performance
28/// world.load_map_layer(MapLayer::Buildings as u16 | MapLayer::Ground as u16);
29///
30/// // Unload foliage for better visibility
31/// world.unload_map_layer(MapLayer::Foliage as u16);
32/// ```
33#[derive(Debug, Clone, PartialEq, Eq, Hash)]
34#[repr(u16)]
35pub enum MapLayer {
36    /// No layers (empty mask).
37    None = 0,
38    /// Building structures.
39    Buildings = 0x1,
40    /// Road decals and markings.
41    Decals = 0x1 << 1,
42    /// Trees, grass, and vegetation.
43    Foliage = 0x1 << 2,
44    /// Ground surface.
45    Ground = 0x1 << 3,
46    /// Static parked vehicles in the environment.
47    ParkedVehicles = 0x1 << 4,
48    /// Particle effects (smoke, dust, etc.).
49    Particles = 0x1 << 5,
50    /// Props and street furniture.
51    Props = 0x1 << 6,
52    /// Street lights and lamp posts.
53    StreetLights = 0x1 << 7,
54    /// Walls and barriers.
55    Walls = 0x1 << 8,
56    /// All layers enabled (full visual fidelity).
57    All = 0xFFFF,
58}